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: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- version: unstable
mutter_pkg: libmutter-14-dev
- version: development-target
mutter_pkg: libmutter-17-dev
mutter_pkg: libmutter-18-dev
container:
image: ghcr.io/elementary/docker:${{ matrix.version }}

Expand All @@ -31,7 +31,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y gettext gsettings-desktop-schemas-dev libatk-bridge2.0-dev libclutter-1.0-dev libgee-0.8-dev libglib2.0-dev libgnome-desktop-4-dev libgnome-bg-4-dev libgranite-dev libgtk-3-dev ${{ matrix.mutter_pkg }} libsqlite3-dev meson systemd-dev valac valadoc
apt install -y gettext gsettings-desktop-schemas-dev libatk-bridge2.0-dev libclutter-1.0-dev libgee-0.8-dev libglib2.0-dev libgnome-desktop-4-dev libgnome-bg-4-dev libgranite-dev libgtk-3-dev ${{ matrix.mutter_pkg }} libsoup-3.0-dev libsqlite3-dev meson systemd-dev valac valadoc
- name: Build
env:
DESTDIR: out
Expand Down
4 changes: 0 additions & 4 deletions lib/BackgroundBlurEffect.vala
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
box_scale_factor = stage_view.get_scale ();
last_box_scale_factor = box_scale_factor;

#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
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ if mutter49_dep.found()
vala_flags = ['--define', 'HAS_MUTTER43', '--define', 'HAS_MUTTER44', '--define', 'HAS_MUTTER45', '--define', 'HAS_MUTTER46', '--define', 'HAS_MUTTER47', '--define', 'HAS_MUTTER48', '--define', 'HAS_MUTTER49']
endif

mutter50_dep = dependency('libmutter-18', version: ['>= 50', '< 51'], required: false)
if mutter50_dep.found()
libmutter_dep = dependency('libmutter-18', version: '>= 50')
mutter_dep = [
libmutter_dep,
dependency('mutter-mtk-18'), dependency('mutter-cogl-18'),
dependency('mutter-clutter-18')
]
vala_flags = ['--define', 'HAS_MUTTER43', '--define', 'HAS_MUTTER44', '--define', 'HAS_MUTTER45', '--define', 'HAS_MUTTER46', '--define', 'HAS_MUTTER47', '--define', 'HAS_MUTTER48', '--define', 'HAS_MUTTER49', '--define', 'HAS_MUTTER50']
endif

if mutter_dep.length() == 0
error ('No supported mutter library found!')
endif
Expand Down
16 changes: 15 additions & 1 deletion plugins/pip/PopupWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
}

private Clutter.Actor on_move_begin () {
#if HAS_MUTTER48
#if HAS_MUTTER50
set_cursor_type (Clutter.CursorType.MOVE);
#elif HAS_MUTTER48
display.set_cursor (Meta.Cursor.MOVE);
#else
display.set_cursor (Meta.Cursor.DND_IN_DRAG);
Expand All @@ -210,7 +212,11 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
private void on_move_end () {
reactive = true;
update_screen_position ();
#if HAS_MUTTER50
set_cursor_type (Clutter.CursorType.DEFAULT);
#else
display.set_cursor (Meta.Cursor.DEFAULT);
#endif
}

private bool on_resize_button_press (Clutter.Event event) {
Expand All @@ -228,7 +234,11 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
grab = resize_button.get_stage ().grab (resize_button);
resize_button.event.connect (on_resize_event);

#if HAS_MUTTER50
set_cursor_type (Clutter.CursorType.SE_RESIZE);
#else
display.set_cursor (Meta.Cursor.SE_RESIZE);
#endif

return Clutter.EVENT_PROPAGATE;
}
Expand Down Expand Up @@ -289,7 +299,11 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {

update_screen_position ();

#if HAS_MUTTER50
set_cursor_type (Clutter.CursorType.DEFAULT);
#else
display.set_cursor (Meta.Cursor.DEFAULT);
#endif
}

private void on_allocation_changed () {
Expand Down
8 changes: 8 additions & 0 deletions plugins/pip/SelectionArea.vala
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,23 @@ public class Gala.Plugins.PIP.SelectionArea : CanvasActor {
}

public void close () {
#if HAS_MUTTER50
set_cursor_type (Clutter.CursorType.DEFAULT);
#else
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
#endif

if (modal_proxy != null) {
wm.pop_modal (modal_proxy);
}
}

public void start_selection () {
#if HAS_MUTTER50
set_cursor_type (Clutter.CursorType.CROSSHAIR);
#else
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
#endif
grab_key_focus ();

modal_proxy = wm.push_modal (this, true);
Expand Down
2 changes: 2 additions & 0 deletions src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Gala {
* set the area where clutter can receive events
**/
public static void set_input_area (Meta.Display display, InputArea area) {
#if !HAS_MUTTER50
if (Meta.Util.is_wayland_compositor ()) {
return;
}
Expand Down Expand Up @@ -83,6 +84,7 @@ namespace Gala {
#else
var xregion = X.Fixes.create_region (x11display.get_xdisplay (), rects);
x11display.set_stage_input_region (xregion);
#endif
#endif
}

Expand Down
13 changes: 13 additions & 0 deletions src/KeyboardManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ public class Gala.KeyboardManager : Object {
}

private bool switch_input_source (bool backward) {
#if !HAS_MUTTER50
#if HAS_MUTTER46
display.get_compositor ().backend.ungrab_keyboard (display.get_current_time ());
#else
display.ungrab_keyboard (display.get_current_time ());
#endif
#endif

var sources = settings.get_value ("sources");
Expand All @@ -71,7 +73,11 @@ public class Gala.KeyboardManager : Object {
private void on_settings_changed (string key) {
unowned var backend = display.get_context ().get_backend ();

#if HAS_MUTTER50
if (key == "sources" || key == "xkb-options" || key == "xkb-model" || key == "current") {
#else
if (key == "sources" || key == "xkb-options" || key == "xkb-model") {
#endif
string[] layouts = {}, variants = {};

var sources = settings.get_value ("sources");
Expand Down Expand Up @@ -113,7 +119,12 @@ public class Gala.KeyboardManager : Object {
cancellable = new GLib.Cancellable ();
}

#if HAS_MUTTER50
var description = new Meta.KeymapDescription.from_rules (settings.get_string ("xkb-model"), layout, variant, options, layouts, layouts);
backend.set_keymap_async.begin (description, settings.get_uint ("current"), cancellable, (obj, res) => {
#else
backend.set_keymap_async.begin (layout, variant, options, settings.get_string ("xkb-model"), cancellable, (obj, res) => {
#endif
try {
((Meta.Backend) obj).set_keymap_async.end (res);
} catch (Error e) {
Expand All @@ -129,6 +140,7 @@ public class Gala.KeyboardManager : Object {
#else
backend.set_keymap (layout, variant, options);
#endif
#if !HAS_MUTTER50
} else if (key == "current") {
#if HAS_MUTTER49
if (cancellable != null) {
Expand All @@ -149,6 +161,7 @@ public class Gala.KeyboardManager : Object {
});
#else
backend.lock_layout_group (settings.get_uint ("current"));
#endif
#endif
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ namespace Gala {

try {
ctx.start ();
#if HAS_MUTTER50
if (true) {
#else
if (ctx.get_compositor_type () == Meta.CompositorType.WAYLAND) {
#endif
Gala.init_pantheon_shell (ctx);
}
} catch (Error e) {
Expand Down
6 changes: 6 additions & 0 deletions src/ScreenshotManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ public class Gala.ScreenshotManager : Object {
image.get_data (),
image.get_stride (),
Cogl.PixelFormat.BGRA_8888_PRE,
#if HAS_MUTTER50
null,
#endif
paint_flags
);
} else {
Expand All @@ -583,6 +586,9 @@ public class Gala.ScreenshotManager : Object {
image.get_data (),
image.get_stride (),
Cogl.PixelFormat.ARGB_8888_PRE,
#if HAS_MUTTER50
null,
#endif
paint_flags
);
}
Expand Down
12 changes: 11 additions & 1 deletion src/Widgets/MultitaskingView/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
close_button.visible = false;
window_title.visible = false;

#if HAS_MUTTER48
#if HAS_MUTTER50
wm.stage.set_cursor_type (Clutter.CursorType.MOVE);
#elif HAS_MUTTER48
wm.get_display ().set_cursor (Meta.Cursor.MOVE);
#else
wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);
Expand Down Expand Up @@ -505,7 +507,11 @@ public class Gala.WindowClone : ActorTarget, RootTarget {

active_shape.show ();

#if HAS_MUTTER50
wm.stage.set_cursor_type (Clutter.CursorType.DEFAULT);
#else
display.set_cursor (Meta.Cursor.DEFAULT);
#endif

bool did_move = false;

Expand Down Expand Up @@ -564,7 +570,11 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
close_button.visible = true;
window_title.visible = true;

#if HAS_MUTTER50
wm.stage.set_cursor_type (Clutter.CursorType.DEFAULT);
#else
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
#endif

if (duration > 0) {
ulong handler = 0;
Expand Down
8 changes: 8 additions & 0 deletions src/Widgets/PixelPicker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public class Gala.PixelPicker : Clutter.Actor {
}

private void close () {
#if HAS_MUTTER50
wm.stage.set_cursor_type (Clutter.CursorType.DEFAULT);
#else
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
#endif
if (modal_proxy != null) {
wm.pop_modal (modal_proxy);
}
Expand All @@ -63,7 +67,11 @@ public class Gala.PixelPicker : Clutter.Actor {
}

public void start_selection () {
#if HAS_MUTTER50
wm.stage.set_cursor_type (Clutter.CursorType.CROSSHAIR);
#else
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
#endif
grab_key_focus ();

modal_proxy = wm.push_modal (this, true);
Expand Down
8 changes: 8 additions & 0 deletions src/Widgets/SelectionArea.vala
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,23 @@ public class Gala.SelectionArea : CanvasActor {
}

public void close () {
#if HAS_MUTTER50
wm.stage.set_cursor_type (Clutter.CursorType.DEFAULT);
#else
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
#endif

if (modal_proxy != null) {
wm.pop_modal (modal_proxy);
}
}

public void start_selection () {
#if HAS_MUTTER50
wm.stage.set_cursor_type (Clutter.CursorType.CROSSHAIR);
#else
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
#endif
grab_key_focus ();

modal_proxy = wm.push_modal (this, true);
Expand Down
Loading