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

WindowSwitcher: Fix issues on first use and after minimize #1662

Merged
merged 2 commits into from Apr 27, 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
21 changes: 14 additions & 7 deletions src/Widgets/WindowSwitcher/WindowSwitcher.vala
Expand Up @@ -37,7 +37,9 @@ namespace Gala {
}

_current_icon = value;
_current_icon.selected = true;
if (_current_icon != null) {
_current_icon.selected = true;
}

update_caption_text ();
}
Expand Down Expand Up @@ -211,6 +213,9 @@ namespace Gala {
}

unowned var current_window = display.get_tab_current (Meta.TabList.NORMAL, workspace);
if (current_window == null) {
current_icon = null;
}

container.width = -1;
container.destroy_all_children ();
Expand All @@ -235,6 +240,7 @@ namespace Gala {

unowned var current_window = display.get_tab_current (Meta.TabList.NORMAL, workspace);
if (current_window == null) {
current_icon = null;
return false;
}

Expand Down Expand Up @@ -375,20 +381,21 @@ namespace Gala {

private void next_window (Meta.Display display, Meta.Workspace? workspace, bool backward) {
Clutter.Actor actor;
var current = current_icon;

if (container.get_n_children () == 1) {
if (container.get_n_children () == 1 && current_icon != null) {
Clutter.get_default_backend ().get_default_seat ().bell_notify ();
return;
}

if (!backward) {
actor = current.get_next_sibling ();
if (current_icon == null) {
actor = container.get_first_child ();
} else if (!backward) {
actor = current_icon.get_next_sibling ();
if (actor == null) {
actor = container.get_first_child ();
}
} else {
actor = current.get_previous_sibling ();
actor = current_icon.get_previous_sibling ();
if (actor == null) {
actor = container.get_last_child ();
}
Expand All @@ -398,7 +405,7 @@ namespace Gala {
}

private void update_caption_text () {
var current_window = current_icon.window;
var current_window = current_icon != null ? current_icon.window : null;
var current_caption = current_window != null ? current_window.title : "n/a";
caption.set_text (current_caption);

Expand Down