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

Revert "WindowManager: Remove Meta.Later" #1713

Merged
merged 4 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions data/gala.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
</ul>
</description>
<issues>
<issue url="https://github.com/elementary/gala/issues/1331">Dialog dim won't go off on gtk app</issue>
<issue url="https://github.com/elementary/gala/issues/1700">PiP doesn't become visible by changing workspaces</issue>
<issue url="https://github.com/elementary/gala/issues/1712">gala 7.1.0-1 crashes on Arch</issue>
</issues>
</release>

Expand Down
124 changes: 69 additions & 55 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ namespace Gala {
var color = background_settings.get_string ("primary-color");
stage.background_color = Clutter.Color.from_string (color);

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

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

zoom = new Zoom (this);

accent_color_manager = new AccentColorManager ();
// 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);

// 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);
accent_color_manager = new AccentColorManager ();

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);
}
// 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);

Meta.KeyBinding.set_custom_handler ("show-desktop", () => {
if (workspace_view.is_opened ())
workspace_view.close ();
else
workspace_view.open ();
});
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);
}

if (plugin_manager.window_switcher_provider == null) {
winswitcher = new WindowSwitcher (this);
ui_group.add_child (winswitcher);
Meta.KeyBinding.set_custom_handler ("show-desktop", () => {
if (workspace_view.is_opened ())
workspace_view.close ();
else
workspace_view.open ();
});

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);
}
if (plugin_manager.window_switcher_provider == null) {
winswitcher = new WindowSwitcher (this);
ui_group.add_child (winswitcher);

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);
}
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);
}

notification_group = new Clutter.Actor ();
ui_group.add_child (notification_group);
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);
}

pointer_locator = new PointerLocator (this);
ui_group.add_child (pointer_locator);
ui_group.add_child (new DwellClickTimer (this));
notification_group = new Clutter.Actor ();
ui_group.add_child (notification_group);

ui_group.add_child (screen_shield);
pointer_locator = new PointerLocator (this);
ui_group.add_child (pointer_locator);
ui_group.add_child (new DwellClickTimer (this));

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);
}
});
ui_group.add_child (screen_shield);

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 ();

plugin_manager.load_waiting_plugins ();
return false;
});

update_input_area ();

Expand Down