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
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ if mutter48_dep.found()
vala_flags = ['--define', 'HAS_MUTTER43', '--define', 'HAS_MUTTER44', '--define', 'HAS_MUTTER45', '--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_MUTTER43', '--define', 'HAS_MUTTER44', '--define', 'HAS_MUTTER45', '--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
4 changes: 3 additions & 1 deletion src/DaemonManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public class Gala.DaemonManager : GLib.Object {
break;

case "MODAL":
#if HAS_MUTTER46
#if HAS_MUTTER49
window.set_type (Meta.WindowType.DOCK);
#elif HAS_MUTTER46
client.wayland_client.make_dock (window);
#endif
window.move_frame (false, 0, 0);
Expand Down
4 changes: 4 additions & 0 deletions src/DesktopIntegration.vala
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ public class Gala.DesktopIntegration : GLib.Object {

wm.get_display ().get_sound_player ().play_from_theme ("bell", _("Window has already focus"), null);

#if HAS_MUTTER49
if (window.is_maximized ()) {
#else
if (window.get_maximized () == BOTH) {
#endif
notifying = false;
return;
}
Expand Down
41 changes: 40 additions & 1 deletion src/KeyboardManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public class Gala.KeyboardManager : Object {
public Meta.Display display { construct; private get; }

private GLib.Settings settings;
#if HAS_MUTTER49
private GLib.Cancellable? cancellable = null;
#endif

public KeyboardManager (Meta.Display display) {
Object (display: display);
Expand Down Expand Up @@ -104,13 +107,49 @@ public class Gala.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
backend.set_keymap (layout, variant, options, settings.get_string ("xkb-model"));
#else
backend.set_keymap (layout, variant, options);
#endif
} else if (key == "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
}
}
}
2 changes: 1 addition & 1 deletion src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public class Gala.HideTracker : Object {
}

focus_overlap = true;
focus_maximized_overlap = VERTICAL in window.get_maximized ();
focus_maximized_overlap = window.maximized_vertically;
}

update_hidden ();
Expand Down
5 changes: 5 additions & 0 deletions src/ShellClients/ManagedClient.vala
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ public class Gala.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 src/ShellClients/NotificationsClient.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public class Gala.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
6 changes: 6 additions & 0 deletions src/ShellClients/ShellClientsManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,18 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
}

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 @@ -144,6 +149,7 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
// 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
8 changes: 8 additions & 0 deletions src/Widgets/SessionLocker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,11 @@ public class Gala.SessionLocker : Clutter.Actor {
#else
unowned var tracker = wm.get_display ().get_cursor_tracker ();
#endif
#if HAS_MUTTER49
tracker.inhibit_cursor_visibility ();
#else
tracker.set_pointer_visible (false);
#endif
visible = true;
grab_key_focus ();
modal_proxy = wm.push_modal (this, true);
Expand Down Expand Up @@ -398,7 +402,11 @@ public class Gala.SessionLocker : Clutter.Actor {
#else
unowned var tracker = wm.get_display ().get_cursor_tracker ();
#endif
#if HAS_MUTTER49
tracker.uninhibit_cursor_visibility ();
#else
tracker.set_pointer_visible (true);
#endif
visible = false;

activation_time = 0;
Expand Down
16 changes: 16 additions & 0 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -767,11 +767,19 @@ namespace Gala {
if (current == null || current.window_type != Meta.WindowType.NORMAL || !current.can_maximize ())
break;

#if HAS_MUTTER49
if (current.is_maximized ()) {
current.unmaximize ();
} else {
current.maximize ();
}
#else
var maximize_flags = current.get_maximized ();
if (Meta.MaximizeFlags.VERTICAL in maximize_flags || Meta.MaximizeFlags.HORIZONTAL in maximize_flags)
current.unmaximize (Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL);
else
current.maximize (Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL);
#endif
break;
case ActionType.HIDE_CURRENT:
if (current != null && current.window_type == Meta.WindowType.NORMAL)
Expand Down Expand Up @@ -887,6 +895,13 @@ namespace Gala {
if (window.can_maximize ())
flags |= WindowFlags.CAN_MAXIMIZE;

#if HAS_MUTTER49
if (window.is_maximized ())
flags |= WindowFlags.IS_MAXIMIZED;

if (window.maximized_vertically && !window.maximized_horizontally)
flags |= WindowFlags.IS_TILED;
#else
var maximize_flags = window.get_maximized ();
if (maximize_flags > 0) {
flags |= WindowFlags.IS_MAXIMIZED;
Expand All @@ -895,6 +910,7 @@ namespace Gala {
flags |= WindowFlags.IS_TILED;
}
}
#endif

if (window.allows_move ())
flags |= WindowFlags.ALLOWS_MOVE;
Expand Down
150 changes: 150 additions & 0 deletions vapi/Clutter-17.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// 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"

Focus skip
KeyFocus skip
Sprite skip

// 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