Skip to content

Commit ac21869

Browse files
authored
Merge branch 'main' into lenemter/bg-blur-2
2 parents b6da608 + 5acb014 commit ac21869

File tree

8 files changed

+803
-666
lines changed

8 files changed

+803
-666
lines changed

daemon/DBus.vala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ public class Gala.Daemon.DBus : GLib.Object {
164164
}
165165

166166
private void show_menu (Gtk.Popover menu, int display_width, int display_height, int x, int y) {
167+
if (!DisplayConfig.is_logical_layout ()) {
168+
var scale_factor = window.scale_factor;
169+
170+
display_width /= scale_factor;
171+
display_height /= scale_factor;
172+
x /= scale_factor;
173+
y /= scale_factor;
174+
}
175+
167176
window.default_width = display_width;
168177
window.default_height = display_height;
169178
window.present ();

daemon/DisplayConfig.vala

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright 2024-2025 elementary, Inc. (https://elementary.io)
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
[DBus (name = "org.gnome.Mutter.DisplayConfig")]
7+
public interface Gala.Daemon.DisplayConfig : Object {
8+
private static bool? _is_logical_layout = null;
9+
private static DisplayConfig? proxy = null;
10+
11+
public static bool is_logical_layout () {
12+
if (_is_logical_layout == null) {
13+
init ();
14+
}
15+
16+
return _is_logical_layout;
17+
}
18+
19+
private static void init () {
20+
try {
21+
proxy = Bus.get_proxy_sync (BusType.SESSION, "org.gnome.Mutter.DisplayConfig", "/org/gnome/Mutter/DisplayConfig");
22+
proxy.monitors_changed.connect (update);
23+
} catch (Error e) {
24+
critical (e.message);
25+
_is_logical_layout = true;
26+
return;
27+
}
28+
29+
update ();
30+
}
31+
32+
private static void update () {
33+
uint current_serial;
34+
MutterReadMonitor[] mutter_monitors;
35+
MutterReadLogicalMonitor[] mutter_logical_monitors;
36+
GLib.HashTable<string, GLib.Variant> properties;
37+
try {
38+
proxy.get_current_state (out current_serial, out mutter_monitors, out mutter_logical_monitors, out properties);
39+
} catch (Error e) {
40+
critical (e.message);
41+
_is_logical_layout = true;
42+
return;
43+
}
44+
45+
uint layout_mode = 1; // Absence of "layout-mode" means logical (= 1) according to the documentation.
46+
var layout_mode_variant = properties.lookup ("layout-mode");
47+
if (layout_mode_variant != null) {
48+
layout_mode = layout_mode_variant.get_uint32 ();
49+
}
50+
51+
_is_logical_layout = layout_mode == 1;
52+
}
53+
54+
public signal void monitors_changed ();
55+
public abstract void get_current_state (out uint serial, out MutterReadMonitor[] monitors, out MutterReadLogicalMonitor[] logical_monitors, out GLib.HashTable<string, GLib.Variant> properties) throws Error;
56+
}
57+
58+
public struct MutterReadMonitorInfo {
59+
public string connector;
60+
public string vendor;
61+
public string product;
62+
public string serial;
63+
public uint hash {
64+
get {
65+
return (connector + vendor + product + serial).hash ();
66+
}
67+
}
68+
}
69+
70+
public struct MutterReadMonitorMode {
71+
public string id;
72+
public int width;
73+
public int height;
74+
public double frequency;
75+
public double preferred_scale;
76+
public double[] supported_scales;
77+
public GLib.HashTable<string, GLib.Variant> properties;
78+
}
79+
80+
public struct MutterReadMonitor {
81+
public MutterReadMonitorInfo monitor;
82+
public MutterReadMonitorMode[] modes;
83+
public GLib.HashTable<string, GLib.Variant> properties;
84+
}
85+
86+
public struct MutterReadLogicalMonitor {
87+
public int x;
88+
public int y;
89+
public double scale;
90+
public uint transform;
91+
public bool primary;
92+
public MutterReadMonitorInfo[] monitors;
93+
public GLib.HashTable<string, GLib.Variant> properties;
94+
}

daemon/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
gala_daemon_sources = files(
22
'Main.vala',
3+
'DisplayConfig.vala',
34
'DBus.vala',
45
'MonitorLabel.vala',
56
'Window.vala',

po/zh_TW.po

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n"
1010
"POT-Creation-Date: 2025-03-12 22:19+0000\n"
11-
"PO-Revision-Date: 2024-12-21 09:16+0000\n"
11+
"PO-Revision-Date: 2025-03-17 11:05+0000\n"
1212
"Last-Translator: Kisaragi Hiu <[email protected]>\n"
13-
"Language-Team: Chinese (Traditional Han script) <https://l10n.elementary.io/"
14-
"projects/desktop/gala/zh_Hant/>\n"
13+
"Language-Team: Chinese (Traditional Han script) <https://"
14+
"l10n.elementaryos.org/projects/desktop/gala/zh_Hant/>\n"
1515
"Language: zh_TW\n"
1616
"MIME-Version: 1.0\n"
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919
"Plural-Forms: nplurals=1; plural=0;\n"
20-
"X-Generator: Weblate 5.8.4\n"
20+
"X-Generator: Weblate 5.10.2\n"
2121
"X-Launchpad-Export-Date: 2017-02-21 05:48+0000\n"
2222

2323
#: daemon/DBus.vala:82 daemon-gtk3/BackgroundMenu.vala:11
@@ -256,19 +256,19 @@ msgstr "%s 的畫面快照"
256256
#. / TRANSLATORS: 'Files' is the name of file manager used by elementary OS
257257
#: src/ScreenshotManager.vala:137
258258
msgid "Show in Files"
259-
msgstr ""
259+
msgstr "在《檔案》中顯示"
260260

261261
#: src/ScreenshotManager.vala:143 src/ScreenshotManager.vala:501
262262
msgid "Screenshot taken"
263263
msgstr "已拍攝畫面快照"
264264

265265
#: src/ScreenshotManager.vala:144
266266
msgid "Screenshot is saved to clipboard"
267-
msgstr ""
267+
msgstr "畫面快照已儲存到剪貼簿中"
268268

269269
#: src/ScreenshotManager.vala:144
270270
msgid "Screenshot saved to screenshots folder"
271-
msgstr ""
271+
msgstr "畫面快照已儲存到畫面快照資料夾"
272272

273273
#: src/ScreenshotManager.vala:409
274274
msgid "Screenshots"

src/ShellClients/HideTracker.vala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public class Gala.HideTracker : Object {
302302
int.MAX
303303
);
304304

305-
barrier.trigger.connect (trigger_show);
305+
barrier.trigger.connect (on_barrier_triggered);
306306
}
307307

308308
private void setup_barrier_bottom (Mtk.Rectangle monitor_geom, int offset) {
@@ -319,6 +319,11 @@ public class Gala.HideTracker : Object {
319319
int.MAX
320320
);
321321

322-
barrier.trigger.connect (trigger_show);
322+
barrier.trigger.connect (on_barrier_triggered);
323+
}
324+
325+
private void on_barrier_triggered () {
326+
trigger_show ();
327+
schedule_update ();
323328
}
324329
}

0 commit comments

Comments
 (0)