Skip to content

Commit 5e5c9a5

Browse files
authored
Merge branch 'main' into leolost/panel-window-use-window-positioner
2 parents eff2bc9 + 4850f1b commit 5e5c9a5

File tree

11 files changed

+112
-74
lines changed

11 files changed

+112
-74
lines changed

data/gala.gschema.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</description>
6363
</key>
6464
<key type="s" name="panel-main-menu-action">
65-
<default>''</default>
65+
<default>'io.elementary.wingpanel --toggle-indicator=app-launcher'</default>
6666
<summary>Panel main menu action</summary>
6767
<description>Sets the command to run when the panel-main-menu keybinding is pressed.</description>
6868
</key>
@@ -72,10 +72,15 @@
7272
<description></description>
7373
</key>
7474
<key type="s" name="overlay-action">
75-
<default>''</default>
75+
<default>'io.elementary.wingpanel --toggle-indicator=app-launcher'</default>
7676
<summary></summary>
7777
<description></description>
7878
</key>
79+
<key type="s" name="interactive-screenshot-action">
80+
<default>'flatpak run io.elementary.screenshot'</default>
81+
<summary>Interactive screenshot action</summary>
82+
<description>Sets the command to run when the interactive-screenshot keybinding is pressed.</description>
83+
</key>
7984
<key type="b" name="move-maximized-workspace">
8085
<default>false</default>
8186
<summary>Automatically move maximized windows to a new workspace</summary>
@@ -144,6 +149,10 @@
144149
<default><![CDATA[['Print']]]></default>
145150
<summary>Take a screenshot</summary>
146151
</key>
152+
<key name="interactive-screenshot" type="as">
153+
<default><![CDATA[['<Super>Print']]]></default>
154+
<summary>Launch the interactive screenshot tool</summary>
155+
</key>
147156
<key name="window-screenshot" type="as">
148157
<default><![CDATA[['<Alt>Print']]]></default>
149158
<summary>Take a screenshot of a window</summary>

lib/Utils.vala

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,5 +400,50 @@ namespace Gala {
400400

401401
return texture;
402402
}
403+
404+
private static HashTable<Meta.Window, X.XserverRegion?> regions = new HashTable<Meta.Window, X.XserverRegion?> (null, null);
405+
406+
public static void x11_set_window_pass_through (Meta.Window window) {
407+
unowned var x11_display = window.display.get_x11_display ();
408+
409+
#if HAS_MUTTER46
410+
var x_window = x11_display.lookup_xwindow (window);
411+
#else
412+
var x_window = window.get_xwindow ();
413+
#endif
414+
unowned var xdisplay = x11_display.get_xdisplay ();
415+
416+
regions[window] = X.Fixes.create_region_from_window (xdisplay, x_window, 0);
417+
418+
X.Xrectangle rect = {};
419+
420+
var region = X.Fixes.create_region (xdisplay, {rect});
421+
422+
X.Fixes.set_window_shape_region (xdisplay, x_window, 2, 0, 0, region);
423+
424+
X.Fixes.destroy_region (xdisplay, region);
425+
}
426+
427+
public static void x11_unset_window_pass_through (Meta.Window window) {
428+
unowned var x11_display = window.display.get_x11_display ();
429+
430+
#if HAS_MUTTER46
431+
var x_window = x11_display.lookup_xwindow (window);
432+
#else
433+
var x_window = window.get_xwindow ();
434+
#endif
435+
unowned var xdisplay = x11_display.get_xdisplay ();
436+
437+
var region = regions[window];
438+
439+
if (region == null) {
440+
return;
441+
}
442+
443+
X.Fixes.set_window_shape_region (xdisplay, x_window, 2, 0, 0, region);
444+
445+
regions.remove (window);
446+
X.Fixes.destroy_region (xdisplay, region);
447+
}
403448
}
404449
}

po/en_GB.po

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: beat-box\n"
99
"Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n"
1010
"POT-Creation-Date: 2024-11-23 16:06+0000\n"
11-
"PO-Revision-Date: 2024-09-29 02:16+0000\n"
11+
"PO-Revision-Date: 2024-12-05 01:16+0000\n"
1212
"Last-Translator: David Hewitt <[email protected]>\n"
1313
"Language-Team: English (United Kingdom) <https://l10n.elementary.io/projects/"
1414
"desktop/gala/en_GB/>\n"
@@ -17,7 +17,7 @@ msgstr ""
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919
"Plural-Forms: nplurals=2; plural=n != 1;\n"
20-
"X-Generator: Weblate 5.6.2\n"
20+
"X-Generator: Weblate 5.8.4\n"
2121
"X-Launchpad-Export-Date: 2017-03-14 07:02+0000\n"
2222

2323
#: daemon/DBus.vala:82 daemon-gtk3/BackgroundMenu.vala:11
@@ -123,10 +123,8 @@ msgid "Updated translations"
123123
msgstr "Updated translations"
124124

125125
#: data/gala.metainfo.xml.in:35
126-
#, fuzzy
127-
#| msgid "Improve window shadows for legacy apps"
128126
msgid "Improved shadows performance"
129-
msgstr "Improve window shadows for legacy apps"
127+
msgstr "Improved shadows performance"
130128

131129
#: data/gala.metainfo.xml.in:78
132130
msgid "Fix a potential crash when moving windows between workspaces"

po/pl.po

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ msgstr ""
88
"Project-Id-Version: gala\n"
99
"Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n"
1010
"POT-Creation-Date: 2024-11-23 16:06+0000\n"
11-
"PO-Revision-Date: 2024-09-23 10:39+0000\n"
11+
"PO-Revision-Date: 2024-12-03 18:16+0000\n"
1212
"Last-Translator: Marcin Serwin <[email protected]>\n"
13-
"Language-Team: Polish <https://l10n.elementary.io/projects/desktop/gala/pl/"
14-
">\n"
13+
"Language-Team: Polish <https://l10n.elementary.io/projects/desktop/gala/pl/>"
14+
"\n"
1515
"Language: pl\n"
1616
"MIME-Version: 1.0\n"
1717
"Content-Type: text/plain; charset=UTF-8\n"
@@ -124,10 +124,8 @@ msgid "Updated translations"
124124
msgstr "Zaktualizowano tłumaczenia"
125125

126126
#: data/gala.metainfo.xml.in:35
127-
#, fuzzy
128-
#| msgid "Improve window shadows for legacy apps"
129127
msgid "Improved shadows performance"
130-
msgstr "Popraw cienie okien dla przestarzałych aplikacji"
128+
msgstr "Poprawiona wydajność cieni"
131129

132130
#: data/gala.metainfo.xml.in:78
133131
msgid "Fix a potential crash when moving windows between workspaces"

src/ShellClients/DelegateActor.vala

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/ShellClients/HideTracker.vala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,10 @@ public class Gala.HideTracker : Object {
213213
}
214214

215215
private void toggle_display (bool should_hide) {
216-
unowned var window_actor = (Meta.WindowActor) panel.window.get_compositor_private ();
217-
218-
// Window actor receives pointer events while hidden on X11: https://github.com/elementary/gala/issues/2083
219216
#if HAS_MUTTER45
220-
hovered = panel.window.has_pointer () && window_actor.visible;
217+
hovered = panel.window.has_pointer ();
221218
#else
222-
hovered = window_has_pointer () && window_actor.visible;
219+
hovered = window_has_pointer ();
223220
#endif
224221

225222
if (should_hide && !hovered && !panel.window.has_focus ()) {

src/ShellClients/PanelClone.vala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public class Gala.PanelClone : Object {
4848
actor = (Meta.WindowActor) panel.window.get_compositor_private ();
4949
// WindowActor position and Window position aren't necessarily the same.
5050
// The clone needs the actor position
51-
panel.delegate_actor.notify["x"].connect (update_clone_position);
52-
panel.delegate_actor.notify["y"].connect (update_clone_position);
51+
actor.notify["x"].connect (update_clone_position);
52+
actor.notify["y"].connect (update_clone_position);
5353
// Actor visibility might be changed by something else e.g. workspace switch
5454
// but we want to keep it in sync with us
5555
actor.notify["visible"].connect (update_visible);
@@ -97,7 +97,7 @@ public class Gala.PanelClone : Object {
9797
switch (panel.anchor) {
9898
case TOP:
9999
case BOTTOM:
100-
return panel.delegate_actor.x;
100+
return actor.x;
101101
default:
102102
return 0;
103103
}
@@ -106,9 +106,9 @@ public class Gala.PanelClone : Object {
106106
private float calculate_clone_y (bool hidden) {
107107
switch (panel.anchor) {
108108
case TOP:
109-
return hidden ? panel.delegate_actor.y - actor.height : panel.delegate_actor.y;
109+
return hidden ? actor.y - actor.height : actor.y;
110110
case BOTTOM:
111-
return hidden ? panel.delegate_actor.y + actor.height : panel.delegate_actor.y;
111+
return hidden ? actor.y + actor.height : actor.y;
112112
default:
113113
return 0;
114114
}
@@ -128,7 +128,7 @@ public class Gala.PanelClone : Object {
128128
panel_hidden = true;
129129

130130
if (!Meta.Util.is_wayland_compositor ()) {
131-
panel.window.move_frame (false, DelegateActor.OUT_OF_BOUNDS, DelegateActor.OUT_OF_BOUNDS);
131+
Utils.x11_set_window_pass_through (panel.window);
132132
}
133133

134134
if (panel.anchor != TOP && panel.anchor != BOTTOM) {
@@ -151,7 +151,7 @@ public class Gala.PanelClone : Object {
151151
}
152152

153153
if (!Meta.Util.is_wayland_compositor ()) {
154-
panel.window.move_frame (false, panel.delegate_actor.actual_x, panel.delegate_actor.actual_y);
154+
Utils.x11_unset_window_pass_through (panel.window);
155155
}
156156

157157
clone.save_easing_state ();

src/ShellClients/PanelWindow.vala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class Gala.PanelWindow : Object {
1515

1616
private WindowPositioner window_positioner;
1717

18-
public DelegateActor delegate_actor;
1918
private PanelClone clone;
2019

2120
private int width = -1;
@@ -34,7 +33,6 @@ public class Gala.PanelWindow : Object {
3433

3534
window.stick ();
3635

37-
delegate_actor = new DelegateActor ((Meta.WindowActor) window.get_compositor_private ());
3836
clone = new PanelClone (wm, this);
3937

4038
var display = wm.get_display ();
@@ -57,8 +55,6 @@ public class Gala.PanelWindow : Object {
5755
public Meta.Rectangle get_custom_window_rect () {
5856
#endif
5957
var window_rect = window.get_frame_rect ();
60-
window_rect.x = delegate_actor.actual_x;
61-
window_rect.y = delegate_actor.actual_y;
6258

6359
if (width > 0) {
6460
window_rect.width = width;

src/WindowManager.vala

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,39 @@ namespace Gala {
148148
display.gl_video_memory_purged.connect (() => {
149149
Meta.Background.refresh_all ();
150150
});
151+
152+
#if WITH_SYSTEMD
153+
if (Meta.Util.is_wayland_compositor ()) {
154+
display.init_xserver.connect ((task) => {
155+
start_x11_services.begin (task);
156+
return true;
157+
});
158+
}
159+
#endif
151160
}
152161

162+
#if WITH_SYSTEMD
163+
private async void start_x11_services (GLib.Task task) {
164+
try {
165+
var session_bus = yield GLib.Bus.@get (GLib.BusType.SESSION);
166+
yield session_bus.call (
167+
"org.freedesktop.systemd1",
168+
"/org/freedesktop/systemd1",
169+
"org.freedesktop.systemd1.Manager",
170+
"StartUnit",
171+
new GLib.Variant ("(ss)", "gnome-session-x11-services-ready.target", "fail"),
172+
new GLib.VariantType ("(o)"),
173+
GLib.DBusCallFlags.NONE,
174+
-1
175+
);
176+
} catch (Error e) {
177+
critical (e.message);
178+
} finally {
179+
task.return_boolean (true);
180+
}
181+
}
182+
#endif
183+
153184
private void show_stage () {
154185
unowned Meta.Display display = get_display ();
155186

@@ -255,6 +286,7 @@ namespace Gala {
255286
display.add_keybinding ("switch-input-source-backward", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_switch_input_source);
256287

257288
display.add_keybinding ("screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
289+
display.add_keybinding ("interactive-screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
258290
display.add_keybinding ("window-screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
259291
display.add_keybinding ("area-screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
260292
display.add_keybinding ("screenshot-clip", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
@@ -295,8 +327,7 @@ namespace Gala {
295327
// Most things inside this "later" depend on GTK. We get segfaults if we try to do GTK stuff before the window manager
296328
// is initialized, so we hold this stuff off until we're ready to draw
297329
laters.add (Meta.LaterType.BEFORE_REDRAW, () => {
298-
unowned string xdg_session_type = Environment.get_variable ("XDG_SESSION_TYPE");
299-
if (xdg_session_type == "x11") {
330+
if (!Meta.Util.is_wayland_compositor ()) {
300331
string[] args = {};
301332
unowned string[] _args = args;
302333
Gtk.init (ref _args);
@@ -518,6 +549,9 @@ namespace Gala {
518549
case "screenshot":
519550
screenshot_screen.begin ();
520551
break;
552+
case "interactive-screenshot":
553+
launch_action ("interactive-screenshot-action");
554+
break;
521555
case "area-screenshot":
522556
screenshot_area.begin ();
523557
break;

src/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ gala_bin_sources = files(
4141
'HotCorners/Barrier.vala',
4242
'HotCorners/HotCorner.vala',
4343
'HotCorners/HotCornerManager.vala',
44-
'ShellClients/DelegateActor.vala',
4544
'ShellClients/HideTracker.vala',
4645
'ShellClients/ManagedClient.vala',
4746
'ShellClients/NotificationsClient.vala',

0 commit comments

Comments
 (0)