Skip to content

Commit a355282

Browse files
authored
Merge branch 'main' into leneemter/sort-windows
2 parents f589b45 + 776b82c commit a355282

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
lines changed

po/hu.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: noise\n"
99
"Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n"
1010
"POT-Creation-Date: 2025-02-10 20:55+0000\n"
11-
"PO-Revision-Date: 2025-01-16 17:55+0000\n"
11+
"PO-Revision-Date: 2025-02-21 19:16+0000\n"
1212
"Last-Translator: TomiOhl <[email protected]>\n"
1313
"Language-Team: Hungarian <https://l10n.elementary.io/projects/desktop/gala/"
1414
"hu/>\n"
@@ -301,11 +301,11 @@ msgstr "Képernyőkép %s"
301301

302302
#: src/WindowManager.vala:2375
303303
msgid "Screenshot is saved to clipboard"
304-
msgstr ""
304+
msgstr "Képernyőkép mentve a vágólapra"
305305

306306
#: src/WindowManager.vala:2375
307307
msgid "Screenshot saved to screenshots folder"
308-
msgstr ""
308+
msgstr "Képernyőkép mentve a Képernyőképek mappába"
309309

310310
#~ msgid ""
311311
#~ "Set the keyboard layout correctly at startup so that the indicator "

src/DesktopIntegration.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class Gala.DesktopIntegration : GLib.Object {
2121
public signal void windows_changed ();
2222
public signal void active_workspace_changed ();
2323
public signal void workspace_removed (int index);
24-
24+
2525
private unowned WindowManagerGala wm;
2626
private GLib.HashTable<Meta.Window, int64?> time_appeared_on_workspace;
2727

@@ -56,6 +56,8 @@ public class Gala.DesktopIntegration : GLib.Object {
5656
window.unmanaging.connect ((_window) => {
5757
time_appeared_on_workspace.remove (_window);
5858
});
59+
60+
window.workspace_changed.connect (() => windows_changed ());
5961
});
6062
}
6163

src/Gestures/ToucheggBackend.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,19 @@ public class Gala.ToucheggBackend : Object, GestureBackend {
200200
on_gesture_detected (make_gesture (type, direction, fingers, performed_on_device_type), Meta.CURRENT_TIME);
201201
on_begin (delta, elapsed_time);
202202
return false;
203-
});
203+
}, Priority.DEFAULT);
204204
break;
205205
case DBUS_ON_GESTURE_UPDATE:
206206
Idle.add (() => {
207207
on_update (delta, elapsed_time);
208208
return false;
209-
});
209+
}, Priority.DEFAULT);
210210
break;
211211
case DBUS_ON_GESTURE_END:
212212
Idle.add (() => {
213213
on_end (delta, elapsed_time);
214214
return false;
215-
});
215+
}, Priority.DEFAULT);
216216
break;
217217
default:
218218
break;

src/WorkspaceManager.vala

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public class Gala.WorkspaceManager : Object {
120120
// or else things might get broke
121121
DragDropAction.cancel_all_by_id ("multitaskingview-window");
122122

123-
remove_workspace (prev_workspace);
123+
queue_remove_workspace (prev_workspace);
124124
}
125125
}
126126

@@ -178,7 +178,7 @@ public class Gala.WorkspaceManager : Object {
178178
&& Utils.get_n_windows (workspace, true, window) == 0
179179
&& workspace != last_workspace
180180
) {
181-
remove_workspace (workspace);
181+
queue_remove_workspace (workspace);
182182
}
183183

184184
// if window is the second last and empty, make it the last workspace
@@ -187,7 +187,7 @@ public class Gala.WorkspaceManager : Object {
187187
&& Utils.get_n_windows (workspace, true, window) == 0
188188
&& workspace.index () == last_workspace_index - 1
189189
) {
190-
remove_workspace (last_workspace);
190+
queue_remove_workspace (last_workspace);
191191
}
192192
}
193193

@@ -221,12 +221,27 @@ public class Gala.WorkspaceManager : Object {
221221
manager.append_new_workspace (false, display.get_current_time ());
222222
}
223223

224+
private void queue_remove_workspace (Meta.Workspace workspace) {
225+
// workspace has already been removed
226+
if (workspace in workspaces_marked_removed) {
227+
return;
228+
}
229+
230+
workspaces_marked_removed.add (workspace);
231+
232+
// We might be here because of a signal emition from the ws machinery (e.g. workspace.window_removed).
233+
// Often the function emitting the signal doesn't take a ref on the ws so if we remove it right
234+
// away it will be freed. But because the function often accesses it after the singal emition this leads
235+
// to warnings and in some cases a crash.
236+
Idle.add (() => remove_workspace (workspace));
237+
}
238+
224239
/**
225240
* Make sure we switch to a different workspace and remove the given one
226241
*
227242
* @param workspace The workspace to remove
228243
*/
229-
private void remove_workspace (Meta.Workspace workspace) {
244+
private bool remove_workspace (Meta.Workspace workspace) {
230245
unowned Meta.Display display = workspace.get_display ();
231246
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
232247
var time = display.get_current_time ();
@@ -246,17 +261,12 @@ public class Gala.WorkspaceManager : Object {
246261
}
247262
}
248263

249-
// workspace has already been removed
250-
if (workspace in workspaces_marked_removed) {
251-
return;
252-
}
253-
254264
workspace.window_added.disconnect (queue_window_added);
255265
workspace.window_removed.disconnect (window_removed);
256266

257-
workspaces_marked_removed.add (workspace);
258-
259267
manager.remove_workspace (workspace, time);
268+
269+
return Source.REMOVE;
260270
}
261271

262272
/**
@@ -292,7 +302,7 @@ public class Gala.WorkspaceManager : Object {
292302
foreach (var workspace in manager.get_workspaces ()) {
293303
var last_index = manager.get_n_workspaces () - 1;
294304
if (Utils.get_n_windows (workspace) == 0 && workspace.index () != last_index) {
295-
remove_workspace (workspace);
305+
queue_remove_workspace (workspace);
296306
}
297307
}
298308
}

0 commit comments

Comments
 (0)