Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowManager: Remove Meta.Later #1688

Merged
merged 5 commits into from Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
124 changes: 55 additions & 69 deletions src/WindowManager.vala
Expand Up @@ -196,11 +196,7 @@ namespace Gala {
var color = background_settings.get_string ("primary-color");
stage.background_color = Clutter.Color.from_string (color);

unowned var laters = display.get_compositor ().get_laters ();
laters.add (Meta.LaterType.BEFORE_REDRAW, () => {
WorkspaceManager.init (this);
return false;
});
WorkspaceManager.init (this);

/* our layer structure:
* stage
Expand Down Expand Up @@ -291,81 +287,71 @@ namespace Gala {

zoom = new Zoom (this);

// Most things inside this "later" depend on GTK. We get segfaults if we try to do GTK stuff before the window manager
// is initialized, so we hold this stuff off until we're ready to draw
laters.add (Meta.LaterType.BEFORE_REDRAW, () => {
string[] args = {};
unowned string[] _args = args;
Gtk.init (ref _args);

accent_color_manager = new AccentColorManager ();
accent_color_manager = new AccentColorManager ();

// initialize plugins and add default components if no plugin overrides them
var plugin_manager = PluginManager.get_default ();
plugin_manager.initialize (this);
plugin_manager.regions_changed.connect (update_input_area);

if (plugin_manager.workspace_view_provider == null
|| (workspace_view = (plugin_manager.get_plugin (plugin_manager.workspace_view_provider) as ActivatableComponent)) == null) {
workspace_view = new MultitaskingView (this);
ui_group.add_child ((Clutter.Actor) workspace_view);
}

Meta.KeyBinding.set_custom_handler ("show-desktop", () => {
if (workspace_view.is_opened ())
workspace_view.close ();
else
workspace_view.open ();
});
// initialize plugins and add default components if no plugin overrides them
var plugin_manager = PluginManager.get_default ();
plugin_manager.initialize (this);
plugin_manager.regions_changed.connect (update_input_area);

if (plugin_manager.window_switcher_provider == null) {
winswitcher = new WindowSwitcher (this);
ui_group.add_child (winswitcher);
if (plugin_manager.workspace_view_provider == null
|| (workspace_view = (plugin_manager.get_plugin (plugin_manager.workspace_view_provider) as ActivatableComponent)) == null) {
workspace_view = new MultitaskingView (this);
ui_group.add_child ((Clutter.Actor) workspace_view);
}

Meta.KeyBinding.set_custom_handler ("switch-applications", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-applications-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-windows", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-windows-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-group", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-group-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
}
Meta.KeyBinding.set_custom_handler ("show-desktop", () => {
if (workspace_view.is_opened ())
workspace_view.close ();
else
workspace_view.open ();
});

if (plugin_manager.window_overview_provider == null
|| (window_overview = (plugin_manager.get_plugin (plugin_manager.window_overview_provider) as ActivatableComponent)) == null) {
window_overview = new WindowOverview (this);
ui_group.add_child ((Clutter.Actor) window_overview);
}
if (plugin_manager.window_switcher_provider == null) {
winswitcher = new WindowSwitcher (this);
ui_group.add_child (winswitcher);

notification_group = new Clutter.Actor ();
ui_group.add_child (notification_group);
Meta.KeyBinding.set_custom_handler ("switch-applications", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-applications-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-windows", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-windows-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-group", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
Meta.KeyBinding.set_custom_handler ("switch-group-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
}

pointer_locator = new PointerLocator (this);
ui_group.add_child (pointer_locator);
ui_group.add_child (new DwellClickTimer (this));
if (plugin_manager.window_overview_provider == null
|| (window_overview = (plugin_manager.get_plugin (plugin_manager.window_overview_provider) as ActivatableComponent)) == null) {
window_overview = new WindowOverview (this);
ui_group.add_child ((Clutter.Actor) window_overview);
}

ui_group.add_child (screen_shield);
notification_group = new Clutter.Actor ();
ui_group.add_child (notification_group);

display.add_keybinding ("expose-windows", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, () => {
if (window_overview.is_opened ()) {
window_overview.close ();
} else {
window_overview.open ();
}
});
display.add_keybinding ("expose-all-windows", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, () => {
if (window_overview.is_opened ()) {
window_overview.close ();
} else {
var hints = new HashTable<string,Variant> (str_hash, str_equal);
hints.@set ("all-windows", true);
window_overview.open (hints);
}
});
pointer_locator = new PointerLocator (this);
ui_group.add_child (pointer_locator);
ui_group.add_child (new DwellClickTimer (this));

plugin_manager.load_waiting_plugins ();
ui_group.add_child (screen_shield);

return false;
display.add_keybinding ("expose-windows", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, () => {
if (window_overview.is_opened ()) {
window_overview.close ();
} else {
window_overview.open ();
}
});
display.add_keybinding ("expose-all-windows", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, () => {
if (window_overview.is_opened ()) {
window_overview.close ();
} else {
var hints = new HashTable<string,Variant> (str_hash, str_equal);
hints.@set ("all-windows", true);
window_overview.open (hints);
}
});

plugin_manager.load_waiting_plugins ();

update_input_area ();

Expand Down