@@ -26,6 +26,7 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
2626 private Gala . Text caption;
2727 private ShadowEffect shadow_effect;
2828 private BackgroundBlurEffect blur_effect;
29+ private int previous_icon_index = 0 ;
2930
3031 private WindowSwitcherIcon ? _current_icon = null ;
3132 private WindowSwitcherIcon ? current_icon {
@@ -48,8 +49,6 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
4849 }
4950 }
5051
51- private double previous_progress = 0d ;
52-
5352 public WindowSwitcher (WindowManager wm ) {
5453 Object (wm: wm);
5554 }
@@ -225,16 +224,17 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
225224 return ;
226225 }
227226
228- var is_step = ((int ) (previous_progress / GESTURE_STEP ) - (int ) (progress / GESTURE_STEP )). abs () >= 1 ;
227+ var new_index = (int ) Math . round (progress / GESTURE_STEP );
228+ var is_step = new_index != previous_icon_index;
229229
230- previous_progress = progress ;
230+ previous_icon_index = new_index ;
231231
232232 if (container. get_n_children () == 1 && current_icon != null && is_step) {
233233 InternalUtils . bell_notify (wm. get_display ());
234234 return ;
235235 }
236236
237- var current_index = ( int ) (progress / GESTURE_STEP ) % container. get_n_children ();
237+ var current_index = new_index % container. get_n_children ();
238238
239239 if (current_index < 0 ) {
240240 current_index = container. get_n_children () + current_index;
0 commit comments