@@ -47,9 +47,7 @@ namespace Gala {
4747 /**
4848 * {@inheritDoc }
4949 */
50- public Gala . ActivatableComponent workspace_view { get ; protected set ; }
51-
52- public ScreenShield ? screen_shield { get ; private set ; }
50+ public Gala . ActivatableComponent workspace_view { get ; protected set ; }
5351
5452 public PointerLocator pointer_locator { get ; private set ; }
5553
@@ -153,9 +151,6 @@ namespace Gala {
153151 private void show_stage () {
154152 unowned Meta . Display display = get_display ();
155153
156- screen_shield = new ScreenShield (this );
157- screensaver = new ScreenSaverManager (screen_shield);
158-
159154 DBus . init (this );
160155 DBusAccelerator . init (display);
161156 MediaFeedback . init ();
@@ -239,8 +234,51 @@ namespace Gala {
239234 stage. remove_child (feedback_group);
240235 ui_group. add_child (feedback_group);
241236
237+ // initialize plugins and add default components if no plugin overrides them
238+ unowned var plugin_manager = PluginManager . get_default ();
239+ plugin_manager. initialize (this );
240+ plugin_manager. regions_changed. connect (update_input_area);
241+
242+ if (plugin_manager. workspace_view_provider == null
243+ || (workspace_view = (plugin_manager. get_plugin (plugin_manager. workspace_view_provider) as ActivatableComponent )) == null ) {
244+ workspace_view = new MultitaskingView (this );
245+ ui_group. add_child ((Clutter . Actor ) workspace_view);
246+ }
247+
248+ if (plugin_manager. window_switcher_provider == null ) {
249+ window_switcher = new WindowSwitcher (this , gesture_tracker);
250+ ui_group. add_child (window_switcher);
251+
252+ Meta . KeyBinding . set_custom_handler (" switch-applications" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
253+ Meta . KeyBinding . set_custom_handler (" switch-applications-backward" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
254+ Meta . KeyBinding . set_custom_handler (" switch-windows" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
255+ Meta . KeyBinding . set_custom_handler (" switch-windows-backward" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
256+ Meta . KeyBinding . set_custom_handler (" switch-group" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
257+ Meta . KeyBinding . set_custom_handler (" switch-group-backward" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
258+ }
259+
260+ if (plugin_manager. window_overview_provider == null
261+ || (window_overview = (plugin_manager. get_plugin (plugin_manager. window_overview_provider) as ActivatableComponent )) == null ) {
262+ window_overview = new WindowOverview (this );
263+ ui_group. add_child ((Clutter . Actor ) window_overview);
264+ }
265+
266+ // Add the remaining components that should be on top
267+ notification_group = new Clutter .Actor ();
268+ ui_group. add_child (notification_group);
269+
270+ pointer_locator = new PointerLocator (display);
271+ ui_group. add_child (pointer_locator);
272+ ui_group. add_child (new DwellClickTimer (display));
273+
274+ var screen_shield = new ScreenShield (this );
275+ screensaver = new ScreenSaverManager (screen_shield);
276+ ui_group. add_child (screen_shield);
277+
242278 FilterManager . init (this );
243279
280+ zoom = new Zoom (this );
281+
244282 /* keybindings*/
245283 var keybinding_settings = new GLib .Settings (" io.elementary.desktop.wm.keybindings" );
246284
@@ -261,6 +299,14 @@ namespace Gala {
261299 display. add_keybinding (" window-screenshot-clip" , keybinding_settings, Meta . KeyBindingFlags . IGNORE_AUTOREPEAT , (Meta . KeyHandlerFunc ) handle_screenshot);
262300 display. add_keybinding (" area-screenshot-clip" , keybinding_settings, Meta . KeyBindingFlags . IGNORE_AUTOREPEAT , (Meta . KeyHandlerFunc ) handle_screenshot);
263301
302+ display. add_keybinding (" expose-all-windows" , keybinding_settings, Meta . KeyBindingFlags . IGNORE_AUTOREPEAT , () = > {
303+ if (window_overview. is_opened ()) {
304+ window_overview. close ();
305+ } else {
306+ window_overview. open ();
307+ }
308+ });
309+
264310 display. overlay_key. connect (() = > {
265311 launch_action (" overlay-action" );
266312 });
@@ -269,6 +315,14 @@ namespace Gala {
269315 launch_action (" toggle-recording-action" );
270316 });
271317
318+ Meta . KeyBinding . set_custom_handler (" show-desktop" , () = > {
319+ if (workspace_view. is_opened ()) {
320+ workspace_view. close ();
321+ } else {
322+ workspace_view. open ();
323+ }
324+ });
325+
272326 Meta . KeyBinding . set_custom_handler (" switch-to-workspace-up" , () = > {});
273327 Meta . KeyBinding . set_custom_handler (" switch-to-workspace-down" , () = > {});
274328 Meta . KeyBinding . set_custom_handler (" switch-to-workspace-left" , (Meta . KeyHandlerFunc ) handle_switch_to_workspace);
@@ -284,89 +338,20 @@ namespace Gala {
284338 }
285339
286340 unowned var monitor_manager = display. get_context (). get_backend (). get_monitor_manager ();
287- monitor_manager. monitors_changed. connect (on_monitors_changed );
341+ monitor_manager. monitors_changed. connect (update_ui_group_size );
288342
289343 hot_corner_manager = new HotCornerManager (this , behavior_settings, new_behavior_settings);
290344 hot_corner_manager. on_configured. connect (update_input_area);
291345 hot_corner_manager. configure ();
292346
293- zoom = new Zoom (this );
294-
295- // Most things inside this "later" depend on GTK. We get segfaults if we try to do GTK stuff before the window manager
296- // is initialized, so we hold this stuff off until we're ready to draw
297- laters. add (Meta . LaterType . BEFORE_REDRAW , () = > {
298- unowned string xdg_session_type = Environment . get_variable (" XDG_SESSION_TYPE" );
299- if (xdg_session_type == " x11" ) {
300- string [] args = {};
301- unowned string [] _args = args;
302- Gtk . init (ref _args);
303- }
304-
305- // initialize plugins and add default components if no plugin overrides them
306- unowned var plugin_manager = PluginManager . get_default ();
307- plugin_manager. initialize (this );
308- plugin_manager. regions_changed. connect (update_input_area);
309-
310- if (plugin_manager. workspace_view_provider == null
311- || (workspace_view = (plugin_manager. get_plugin (plugin_manager. workspace_view_provider) as ActivatableComponent )) == null ) {
312- workspace_view = new MultitaskingView (this );
313- ui_group. add_child ((Clutter . Actor ) workspace_view);
314- }
315-
316- Meta . KeyBinding . set_custom_handler (" show-desktop" , () = > {
317- if (workspace_view. is_opened ())
318- workspace_view. close ();
319- else
320- workspace_view. open ();
321- });
322-
323- if (plugin_manager. window_switcher_provider == null ) {
324- window_switcher = new WindowSwitcher (this , gesture_tracker);
325- ui_group. add_child (window_switcher);
326-
327- Meta . KeyBinding . set_custom_handler (" switch-applications" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
328- Meta . KeyBinding . set_custom_handler (" switch-applications-backward" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
329- Meta . KeyBinding . set_custom_handler (" switch-windows" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
330- Meta . KeyBinding . set_custom_handler (" switch-windows-backward" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
331- Meta . KeyBinding . set_custom_handler (" switch-group" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
332- Meta . KeyBinding . set_custom_handler (" switch-group-backward" , (Meta . KeyHandlerFunc ) window_switcher. handle_switch_windows);
333- }
334-
335- if (plugin_manager. window_overview_provider == null
336- || (window_overview = (plugin_manager. get_plugin (plugin_manager. window_overview_provider) as ActivatableComponent )) == null ) {
337- window_overview = new WindowOverview (this );
338- ui_group. add_child ((Clutter . Actor ) window_overview);
339- }
340-
341- notification_group = new Clutter .Actor ();
342- ui_group. add_child (notification_group);
343-
344- pointer_locator = new PointerLocator (display);
345- ui_group. add_child (pointer_locator);
346- ui_group. add_child (new DwellClickTimer (display));
347-
348- ui_group. add_child (screen_shield);
349-
350- display. add_keybinding (" expose-all-windows" , keybinding_settings, Meta . KeyBindingFlags . IGNORE_AUTOREPEAT , () = > {
351- if (window_overview. is_opened ()) {
352- window_overview. close ();
353- } else {
354- window_overview. open ();
355- }
356- });
357-
358- plugin_manager. load_waiting_plugins ();
359-
360- return false ;
361- });
362-
363347 update_input_area ();
364348
365-
366349 display. window_created. connect ((window) = > window_created (window));
367350
368351 stage. show ();
369352
353+ plugin_manager. load_waiting_plugins ();
354+
370355 Idle . add (() = > {
371356 // let the session manager move to the next phase
372357#if WITH_SYSTEMD
@@ -416,11 +401,6 @@ namespace Gala {
416401 } catch (Error e) { warning (e. message); }
417402 }
418403
419- private void on_monitors_changed () {
420- update_ui_group_size ();
421- screen_shield. expand_to_screen_size ();
422- }
423-
424404 [CCode (instance_pos = -1 )]
425405 private void handle_cycle_workspaces (Meta .Display display , Meta .Window ? window , Clutter .KeyEvent event ,
426406 Meta .KeyBinding binding ) {
@@ -1023,26 +1003,26 @@ namespace Gala {
10231003 current. stick ();
10241004 break ;
10251005 case ActionType . SWITCH_TO_WORKSPACE_PREVIOUS:
1026- switch_to_next_workspace (Meta . MotionDirection . LEFT , Gtk . get_current_event_time () );
1006+ switch_to_next_workspace (Meta . MotionDirection . LEFT , Meta . CURRENT_TIME );
10271007 break ;
10281008 case ActionType . SWITCH_TO_WORKSPACE_NEXT:
1029- switch_to_next_workspace (Meta . MotionDirection . RIGHT , Gtk . get_current_event_time () );
1009+ switch_to_next_workspace (Meta . MotionDirection . RIGHT , Meta . CURRENT_TIME );
10301010 break ;
10311011 case ActionType . MOVE_CURRENT_WORKSPACE_LEFT:
10321012 unowned var workspace_manager = get_display (). get_workspace_manager ();
10331013 unowned var active_workspace = workspace_manager. get_active_workspace ();
10341014 unowned var target_workspace = active_workspace. get_neighbor (Meta . MotionDirection . LEFT );
1035- move_window (current, target_workspace, Gtk . get_current_event_time () );
1015+ move_window (current, target_workspace, Meta . CURRENT_TIME );
10361016 break ;
10371017 case ActionType . MOVE_CURRENT_WORKSPACE_RIGHT:
10381018 unowned var workspace_manager = get_display (). get_workspace_manager ();
10391019 unowned var active_workspace = workspace_manager. get_active_workspace ();
10401020 unowned var target_workspace = active_workspace. get_neighbor (Meta . MotionDirection . RIGHT );
1041- move_window (current, target_workspace, Gtk . get_current_event_time () );
1021+ move_window (current, target_workspace, Meta . CURRENT_TIME );
10421022 break ;
10431023 case ActionType . CLOSE_CURRENT:
10441024 if (current != null && current. can_close ())
1045- current. @delete (Gtk . get_current_event_time () );
1025+ current. @delete (Meta . CURRENT_TIME );
10461026 break ;
10471027 case ActionType . OPEN_LAUNCHER:
10481028 try {
0 commit comments