Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/Widgets/WindowSwitcher/WindowSwitcher.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class Gala.WindowSwitcher : AbstractSwitcher, GestureTarget, RootTarget {
private int modifier_mask;
private Gala.ModalProxy? modal_proxy;
private int previous_icon_index = 0;
private bool mouse_active = true;
private uint hover_timeout_id = 0;

private WindowSwitcherIcon? _current_icon = null;
private WindowSwitcherIcon? current_icon {
Expand Down Expand Up @@ -138,6 +140,8 @@ public class Gala.WindowSwitcher : AbstractSwitcher, GestureTarget, RootTarget {
open_switcher ();
}

disable_hover ();

var binding_name = binding.get_name ();
var backward = binding_name.has_suffix ("-backward");

Expand Down Expand Up @@ -223,7 +227,7 @@ public class Gala.WindowSwitcher : AbstractSwitcher, GestureTarget, RootTarget {
icon.get_accessible ().accessible_parent = container.get_accessible ();

icon.motion_event.connect ((_icon, event) => {
if (current_icon != _icon && !gesture_controller.recognizing) {
if (mouse_active && current_icon != _icon && !gesture_controller.recognizing) {
select_icon ((WindowSwitcherIcon) _icon);
}

Expand All @@ -243,6 +247,8 @@ public class Gala.WindowSwitcher : AbstractSwitcher, GestureTarget, RootTarget {
return;
}

disable_hover ();

//Although we are setting visible via the opacity notify handler anyway
//we have to set it here manually otherwise the size gotten via get_preferred_size is wrong
visible = true;
Expand Down Expand Up @@ -331,6 +337,8 @@ public class Gala.WindowSwitcher : AbstractSwitcher, GestureTarget, RootTarget {
}

public override bool key_press_event (Clutter.Event event) {
disable_hover ();

switch (event.get_key_symbol ()) {
case Clutter.Key.Right:
if (!gesture_controller.recognizing) {
Expand Down Expand Up @@ -365,4 +373,17 @@ public class Gala.WindowSwitcher : AbstractSwitcher, GestureTarget, RootTarget {

return modifiers & Clutter.ModifierType.MODIFIER_MASK;
}

private void disable_hover () {
mouse_active = false;

if (hover_timeout_id != 0) {
Source.remove (hover_timeout_id);
}

hover_timeout_id = Timeout.add_once (300, () => {
mouse_active = true;
hover_timeout_id = 0;
});
}
}