Skip to content

Commit 513671f

Browse files
committed
WindowManager: Load plugins and create components right away
1 parent f28ac03 commit 513671f

File tree

1 file changed

+59
-68
lines changed

1 file changed

+59
-68
lines changed

src/WindowManager.vala

Lines changed: 59 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,47 @@ namespace Gala {
270270
stage.remove_child (feedback_group);
271271
ui_group.add_child (feedback_group);
272272

273+
// Initialize plugins and add default components if no plugin overrides them
274+
unowned var plugin_manager = PluginManager.get_default ();
275+
plugin_manager.initialize (this);
276+
plugin_manager.regions_changed.connect (update_input_area);
277+
278+
if (plugin_manager.workspace_view_provider == null
279+
|| (workspace_view = (plugin_manager.get_plugin (plugin_manager.workspace_view_provider) as ActivatableComponent)) == null
280+
) {
281+
workspace_view = new MultitaskingView (this);
282+
ui_group.add_child ((Clutter.Actor) workspace_view);
283+
}
284+
285+
if (plugin_manager.window_switcher_provider == null) {
286+
window_switcher = new WindowSwitcher (this, gesture_tracker);
287+
ui_group.add_child (window_switcher);
288+
289+
Meta.KeyBinding.set_custom_handler ("switch-applications", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
290+
Meta.KeyBinding.set_custom_handler ("switch-applications-backward", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
291+
Meta.KeyBinding.set_custom_handler ("switch-windows", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
292+
Meta.KeyBinding.set_custom_handler ("switch-windows-backward", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
293+
Meta.KeyBinding.set_custom_handler ("switch-group", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
294+
Meta.KeyBinding.set_custom_handler ("switch-group-backward", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
295+
}
296+
297+
if (plugin_manager.window_overview_provider == null
298+
|| (window_overview = (plugin_manager.get_plugin (plugin_manager.window_overview_provider) as ActivatableComponent)) == null
299+
) {
300+
window_overview = new WindowOverview (this);
301+
ui_group.add_child ((Clutter.Actor) window_overview);
302+
}
303+
304+
// Add the remaining components that should be on top
305+
notification_group = new Clutter.Actor ();
306+
ui_group.add_child (notification_group);
307+
308+
pointer_locator = new PointerLocator (display);
309+
ui_group.add_child (pointer_locator);
310+
ui_group.add_child (new DwellClickTimer (display));
311+
312+
ui_group.add_child (screen_shield);
313+
273314
FilterManager.init (this);
274315

275316
/*keybindings*/
@@ -293,6 +334,14 @@ namespace Gala {
293334
display.add_keybinding ("window-screenshot-clip", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
294335
display.add_keybinding ("area-screenshot-clip", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
295336

337+
display.add_keybinding ("expose-all-windows", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, () => {
338+
if (window_overview.is_opened ()) {
339+
window_overview.close ();
340+
} else {
341+
window_overview.open ();
342+
}
343+
});
344+
296345
display.overlay_key.connect (() => {
297346
launch_action ("overlay-action");
298347
});
@@ -301,6 +350,14 @@ namespace Gala {
301350
launch_action ("toggle-recording-action");
302351
});
303352

353+
Meta.KeyBinding.set_custom_handler ("show-desktop", () => {
354+
if (workspace_view.is_opened ()) {
355+
workspace_view.close ();
356+
} else {
357+
workspace_view.open ();
358+
}
359+
});
360+
304361
Meta.KeyBinding.set_custom_handler ("switch-to-workspace-up", () => {});
305362
Meta.KeyBinding.set_custom_handler ("switch-to-workspace-down", () => {});
306363
Meta.KeyBinding.set_custom_handler ("switch-to-workspace-left", (Meta.KeyHandlerFunc) handle_switch_to_workspace);
@@ -324,80 +381,14 @@ namespace Gala {
324381

325382
zoom = new Zoom (this);
326383

327-
// Most things inside this "later" depend on GTK. We get segfaults if we try to do GTK stuff before the window manager
328-
// is initialized, so we hold this stuff off until we're ready to draw
329-
laters.add (Meta.LaterType.BEFORE_REDRAW, () => {
330-
if (!Meta.Util.is_wayland_compositor ()) {
331-
string[] args = {};
332-
unowned string[] _args = args;
333-
Gtk.init (ref _args);
334-
}
335-
336-
// initialize plugins and add default components if no plugin overrides them
337-
unowned var plugin_manager = PluginManager.get_default ();
338-
plugin_manager.initialize (this);
339-
plugin_manager.regions_changed.connect (update_input_area);
340-
341-
if (plugin_manager.workspace_view_provider == null
342-
|| (workspace_view = (plugin_manager.get_plugin (plugin_manager.workspace_view_provider) as ActivatableComponent)) == null) {
343-
workspace_view = new MultitaskingView (this);
344-
ui_group.add_child ((Clutter.Actor) workspace_view);
345-
}
346-
347-
Meta.KeyBinding.set_custom_handler ("show-desktop", () => {
348-
if (workspace_view.is_opened ())
349-
workspace_view.close ();
350-
else
351-
workspace_view.open ();
352-
});
353-
354-
if (plugin_manager.window_switcher_provider == null) {
355-
window_switcher = new WindowSwitcher (this, gesture_tracker);
356-
ui_group.add_child (window_switcher);
357-
358-
Meta.KeyBinding.set_custom_handler ("switch-applications", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
359-
Meta.KeyBinding.set_custom_handler ("switch-applications-backward", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
360-
Meta.KeyBinding.set_custom_handler ("switch-windows", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
361-
Meta.KeyBinding.set_custom_handler ("switch-windows-backward", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
362-
Meta.KeyBinding.set_custom_handler ("switch-group", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
363-
Meta.KeyBinding.set_custom_handler ("switch-group-backward", (Meta.KeyHandlerFunc) window_switcher.handle_switch_windows);
364-
}
365-
366-
if (plugin_manager.window_overview_provider == null
367-
|| (window_overview = (plugin_manager.get_plugin (plugin_manager.window_overview_provider) as ActivatableComponent)) == null) {
368-
window_overview = new WindowOverview (this);
369-
ui_group.add_child ((Clutter.Actor) window_overview);
370-
}
371-
372-
notification_group = new Clutter.Actor ();
373-
ui_group.add_child (notification_group);
374-
375-
pointer_locator = new PointerLocator (display);
376-
ui_group.add_child (pointer_locator);
377-
ui_group.add_child (new DwellClickTimer (display));
378-
379-
ui_group.add_child (screen_shield);
380-
381-
display.add_keybinding ("expose-all-windows", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, () => {
382-
if (window_overview.is_opened ()) {
383-
window_overview.close ();
384-
} else {
385-
window_overview.open ();
386-
}
387-
});
388-
389-
plugin_manager.load_waiting_plugins ();
390-
391-
return false;
392-
});
393-
394384
update_input_area ();
395385

396-
397386
display.window_created.connect ((window) => window_created (window));
398387

399388
stage.show ();
400389

390+
plugin_manager.load_waiting_plugins ();
391+
401392
Idle.add (() => {
402393
// let the session manager move to the next phase
403394
#if WITH_SYSTEMD

0 commit comments

Comments
 (0)