Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions compositor/BackgroundBlurEffect.vala
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ public class GreeterCompositor.BackgroundBlurEffect : Clutter.Effect {
Mtk.Rectangle stage_view_layout = {};

box_scale_factor = stage_view.get_scale ();
#if HAS_MUTTER49
stage_view.get_layout (stage_view_layout);
#else
stage_view.get_layout (ref stage_view_layout);
#endif

origin_x -= stage_view_layout.x;
origin_y -= stage_view_layout.y;
Expand Down
49 changes: 45 additions & 4 deletions compositor/KeyboardManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public class GreeterCompositor.KeyboardManager : Object {
private static KeyboardManager? instance;
private static VariantType sources_variant_type;
private static GLib.Settings settings;
#if HAS_MUTTER49
private GLib.Cancellable? cancellable = null;
#endif

public unowned Meta.Display display { construct; private get; }

Expand Down Expand Up @@ -74,6 +77,8 @@ public class GreeterCompositor.KeyboardManager : Object {

[CCode (instance_pos = -1)]
private void set_keyboard_layout (GLib.Settings settings, string key) {
unowned var backend = display.get_context ().get_backend ();

if (key == "sources" || key == "xkb-options") {
string[] layouts = {}, variants = {};

Expand All @@ -100,14 +105,50 @@ public class GreeterCompositor.KeyboardManager : Object {
var variant = string.joinv (",", variants);
var options = string.joinv (",", xkb_options);

#if HAS_MUTTER46
#if HAS_MUTTER49
if (cancellable != null) {
cancellable.cancel ();
cancellable = new GLib.Cancellable ();
}

backend.set_keymap_async.begin (layout, variant, options, settings.get_string ("xkb-model"), cancellable, (obj, res) => {
try {
((Meta.Backend) obj).set_keymap_async.end (res);
} catch (Error e) {
if (e is GLib.IOError.CANCELLED) {
// ignore
} else {
cancellable = null;
}
}
});
#elif HAS_MUTTER46
//TODO: add model support
display.get_context ().get_backend ().set_keymap (layout, variant, options, "");
backend.set_keymap (layout, variant, options, "");
#else
display.get_context ().get_backend ().set_keymap (layout, variant, options);
backend.set_keymap (layout, variant, options);
#endif
} else if (key == "current") {
display.get_context ().get_backend ().lock_layout_group (settings.get_uint ("current"));
#if HAS_MUTTER49
if (cancellable != null) {
cancellable.cancel ();
cancellable = new GLib.Cancellable ();
}

backend.set_keymap_layout_group_async.begin (settings.get_uint ("current"), cancellable, (obj, res) => {
try {
((Meta.Backend) obj).set_keymap_layout_group_async.end (res);
} catch (Error e) {
if (e is GLib.IOError.CANCELLED) {
// ignore
} else {
cancellable = null;
}
}
});
#else
backend.lock_layout_group (settings.get_uint ("current"));
#endif
}
}
}
5 changes: 5 additions & 0 deletions compositor/ShellClients/ManagedClient.vala
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ public class GreeterCompositor.ManagedClient : Object {
private async void start_wayland () {
var subprocess_launcher = new GLib.SubprocessLauncher (INHERIT_FDS);
try {
#if HAS_MUTTER49
wayland_client = new Meta.WaylandClient.subprocess (display.get_context (), subprocess_launcher, args);
subprocess = wayland_client.get_subprocess ();
#else
wayland_client = new Meta.WaylandClient (display.get_context (), subprocess_launcher);
subprocess = wayland_client.spawnv (display, args);
#endif

yield subprocess.wait_async ();

Expand Down
4 changes: 3 additions & 1 deletion compositor/ShellClients/NotificationsClient.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class GreeterCompositor.NotificationsClient : Object {
window.set_data (NOTIFICATION_DATA_KEY, true);
window.make_above ();
window.stick ();
#if HAS_MUTTER46
#if HAS_MUTTER49
window.set_type (Meta.WindowType.DOCK);
#elif HAS_MUTTER46
client.wayland_client.make_dock (window);
#endif
});
Expand Down
12 changes: 12 additions & 0 deletions compositor/ShellClients/ShellClientsManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ public class GreeterCompositor.ShellClientsManager : Object {
}

public void make_dock (Meta.Window window) {
#if HAS_MUTTER49
window.set_type (Meta.WindowType.DOCK);
#else
if (Meta.Util.is_wayland_compositor ()) {
make_dock_wayland (window);
} else {
make_dock_x11 (window);
}
#endif
}

#if !HAS_MUTTER49
private void make_dock_wayland (Meta.Window window) requires (Meta.Util.is_wayland_compositor ()) {
foreach (var client in protocol_clients) {
if (client.wayland_client.owns_window (window)) {
Expand Down Expand Up @@ -88,16 +93,22 @@ public class GreeterCompositor.ShellClientsManager : Object {
// 0 means replace
xdisplay.change_property (x_window, atom, (X.Atom) 4, 32, 0, (uchar[]) dock_atom, 1);
}
#endif


public void make_desktop (Meta.Window window) {
#if HAS_MUTTER49
window.set_type (Meta.WindowType.DESKTOP);
#else
if (Meta.Util.is_wayland_compositor ()) {
make_desktop_wayland (window);
} else {
make_desktop_x11 (window);
}
#endif
}

#if !HAS_MUTTER49
private void make_desktop_wayland (Meta.Window window) requires (Meta.Util.is_wayland_compositor ()) {
foreach (var client in protocol_clients) {
if (client.wayland_client.owns_window (window)) {
Expand Down Expand Up @@ -125,6 +136,7 @@ public class GreeterCompositor.ShellClientsManager : Object {
// 0 means replace
xdisplay.change_property (x_window, atom, (X.Atom) 4, 32, 0, (uchar[]) dock_atom, 1);
}
#endif

public void set_anchor (Meta.Window window, Pantheon.Desktop.Anchor anchor) {
if (window in panel_windows) {
Expand Down
9 changes: 8 additions & 1 deletion compositor/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,15 @@ namespace GreeterCompositor {
var subprocess_launcher = new GLib.SubprocessLauncher (GLib.SubprocessFlags.INHERIT_FDS);
try {
Meta.WaylandClient daemon_client;
Subprocess? subprocess;

#if HAS_MUTTER49
daemon_client = new Meta.WaylandClient.subprocess (display.get_context (), subprocess_launcher, command);
subprocess = daemon_client.get_subprocess ();
#else
daemon_client = new Meta.WaylandClient (display.get_context (), subprocess_launcher);
var subprocess = daemon_client.spawnv (display, command);
subprocess = daemon_client.spawnv (display, command);
#endif

yield subprocess.wait_async ();

Expand Down
5 changes: 4 additions & 1 deletion compositor/WingpanelManager/FocusManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ public class GreeterCompositor.FocusManager : GLib.Object {
}

if (window != null) {
#if HAS_MUTTER46
#if HAS_MUTTER49
Graphene.Point pos_hint = {x, y};
window.begin_grab_op (Meta.GrabOp.MOVING, null, time, pos_hint);
#elif HAS_MUTTER46
Graphene.Point pos_hint = {x, y};
window.begin_grab_op (Meta.GrabOp.MOVING, null, null, time, pos_hint);
#else
Expand Down
11 changes: 11 additions & 0 deletions compositor/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ if mutter48_dep.found()
vala_flags = ['--define', 'HAS_MUTTER46', '--define', 'HAS_MUTTER47', '--define', 'HAS_MUTTER48']
endif

mutter49_dep = dependency('libmutter-17', version: ['>= 49', '< 50'], required: false)
if mutter49_dep.found()
libmutter_dep = dependency('libmutter-17', version: '>= 49')
mutter_dep = [
libmutter_dep,
dependency('mutter-mtk-17'), dependency('mutter-cogl-17'),
dependency('mutter-clutter-17')
]
vala_flags = ['--define', 'HAS_MUTTER46', '--define', 'HAS_MUTTER47', '--define', 'HAS_MUTTER48', '--define', 'HAS_MUTTER49']
endif

if mutter_dep.length() == 0
error ('No supported mutter library found!')
endif
Expand Down
146 changes: 146 additions & 0 deletions vapi/Clutter-17.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// Non mini-object
ActorBox struct
Margin struct
PaintVolume struct
Perspective struct

*.ref unowned
* cheader_filename="clutter/clutter.h"

// Fix the few clutter-pango headers
Text cheader_filename="clutter/clutter-pango.h"
TextBuffer cheader_filename="clutter/clutter-pango.h"
TextNode cheader_filename="clutter/clutter-pango.h"
Actor
.get_pango_context cheader_filename="clutter/clutter-pango.h"
.create_pango_context cheader_filename="clutter/clutter-pango.h"
.create_pango_layout cheader_filename="clutter/clutter-pango.h"


Actor
.apply_transform.matrix ref
.get_abs_allocation_vertices.verts out=false
Event.type#method name="get_type"

// ???
Actor.has_pointer#method name="get_has_pointer"

// Not all backing symbols are deprecated
Actor.pick deprecated=false

// Nullable return values
Actor
.get_parent nullable

// The original CType has been overridden by the annotations
Actor
.allocate.box ctype="const ClutterActorBox *"
.get_stage ctype="ClutterActor *"
Action.handle_event.event ctype="const ClutterEvent *"

// method/virtual-method/signal don't match
Actor
.event#method name="emit_event"
.get_paint_volume#virtual_method name="get_paint_volume_vfunc"
.get_paint_volume#virtual_method.volume out
Text
.activate#method name="try_activate"
.insert_text#signal skip
TextBuffer.get_text#virtual_method name="get_text_with_length"

// Default values
Stage.read_pixels
.width default=-1
.height default=-1
Stage.paint_to_buffer
.data type="uint8[]"
Text
.position_to_coords.line_height default=null

// Skipped by g-i for unknown reasons
LayoutManager
.create_child_meta skip=false

// We can use static strings
PaintNode
.set_static_name skip=false

// Variadic arguments
Backend
.get_cogl_context skip=false
Interval
.new skip=false
.get_interval skip=false
.set_final skip=false
.set_initial skip=false
.set_interval skip=false
LayoutManager
.child_get skip=false
.child_set skip=false

// Skipped upstream for unknown reasons
Interval.register_progress_func skip=false

// struct/class confusion
ActorBox
.new skip
.from_vertices skip
Margin
.new skip

// Upstream
Event
.get_position.position out

FrameListenerIface skip
FrameClock.new skip

// Remove for clutter-2.0
/////////////////////////

StageView.layout skip

Stage
.paint_view.redraw_clip type="Cairo.Region"

// *Event should be compact classes derived from Clutter.Event
Event.type skip=false
AnyEvent struct=false base_type="Clutter.Event"
ButtonEvent struct=false base_type="Clutter.Event"
CrossingEvent struct=false base_type="Clutter.Event"
DeviceEvent struct=false base_type="Clutter.Event"
IMEvent struct=false base_type="Clutter.Event"
KeyEvent struct=false base_type="Clutter.Event"
MotionEvent struct=false base_type="Clutter.Event"
PadButtonEvent struct=false base_type="Clutter.Event"
PadDialEvent struct=false base_type="Clutter.Event"
PadRingEvent struct=false base_type="Clutter.Event"
PadStripEvent struct=false base_type="Clutter.Event"
ProximityEvent struct=false base_type="Clutter.Event"
ScrollEvent struct=false base_type="Clutter.Event"
TouchEvent struct=false base_type="Clutter.Event"
TouchpadHoldEvent struct=false base_type="Clutter.Event"
TouchpadPinchEvent struct=false base_type="Clutter.Event"
TouchpadSwipeEvent struct=false base_type="Clutter.Event"

// Keysyms used to be CLUTTER_X instead of CLUTTER_KEY_X
*#constant skip
CURRENT_TIME skip=false
PRIORITY_REDRAW skip=false

// Clutter devs don't like us creating nested namespaces
value_* name="value_(.+)" parent="Clutter.Value"
threads_* name="threads_(.+)" parent="Clutter.Threads"

// There is no way to know sealed classes before GLib 2.70
ColorState sealed
FrameClock sealed
TextureContent sealed

TextureContent.new_from_texture symbol_type="constructor"

// Possibly keep
KEY_* skip=false name="KEY_(.+)" type="uint" parent="Clutter.Key"
BUTTON_* skip=false name="BUTTON_(.+)" type="uint32" parent="Clutter.Button"
EVENT_STOP skip=false type="bool"
EVENT_PROPAGATE skip=false type="bool"
Loading