Skip to content

Commit 1abc686

Browse files
committed
WindowClone: always show close button
1 parent ace6eed commit 1abc686

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

src/Widgets/MultitaskingView/WindowClone.vala

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
141141
};
142142
bind_property ("monitor-scale", close_button, "monitor-scale");
143143
close_button.triggered.connect (close_window);
144-
close_button.notify["has-pointer"].connect (update_hover_widgets);
145144

146145
add_child (active_shape);
147146
add_child (clone_container);
@@ -155,9 +154,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
155154

156155
window.notify["title"].connect (() => window_title.set_text (window.get_title () ?? ""));
157156
window_title.set_text (window.get_title () ?? "");
158-
159-
notify["has-pointer"].connect (update_hover_widgets);
160-
notify["animating"].connect (update_hover_widgets);
161157
}
162158

163159
~WindowClone () {
@@ -270,27 +266,29 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
270266
add_target (new PropertyTarget (MULTITASKING_VIEW, window_icon, "opacity", typeof (uint), 0u, 255u));
271267

272268
add_target (new PropertyTarget (MULTITASKING_VIEW, window_title, "opacity", typeof (uint), 0u, 255u));
269+
270+
add_target (new PropertyTarget (MULTITASKING_VIEW, close_button, "opacity", typeof (uint), 0u, 255u));
273271
}
274272

275273
public override void update_progress (Gala.GestureAction action, double progress) {
276-
if (action != CUSTOM || !has_pointer || slot == null || !Meta.Prefs.get_gnome_animations ()) {
277-
return;
278-
}
279-
280-
var target_translation_y = (float) (-CLOSE_TRANSLATION * monitor_scale * progress);
281-
var target_opacity = (uint) (255 * (1 - progress));
274+
if (action == CUSTOM && slot != null && Meta.Prefs.get_gnome_animations ()) {
275+
var target_translation_y = (float) (-CLOSE_TRANSLATION * monitor_scale * progress);
276+
var target_opacity = (uint) (255 * (1 - progress));
282277

283-
clone_container.translation_y = target_translation_y;
284-
clone_container.opacity = target_opacity;
278+
clone_container.translation_y = target_translation_y;
279+
clone_container.opacity = target_opacity;
285280

286-
window_icon.translation_y = target_translation_y;
287-
window_icon.opacity = target_opacity;
281+
window_icon.translation_y = target_translation_y;
282+
window_icon.opacity = target_opacity;
288283

289-
window_title.translation_y = target_translation_y;
290-
window_title.opacity = target_opacity;
284+
window_title.translation_y = target_translation_y;
285+
window_title.opacity = target_opacity;
291286

292-
close_button.translation_y = target_translation_y;
293-
close_button.opacity = target_opacity;
287+
close_button.translation_y = target_translation_y;
288+
close_button.opacity = target_opacity;
289+
} else if (action == MULTITASKING_VIEW) {
290+
close_button.reactive = progress == 1;
291+
}
294292
}
295293

296294
public override void end_progress (GestureAction action) {
@@ -370,18 +368,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
370368
return Clutter.EVENT_STOP;
371369
}
372370

373-
private void update_hover_widgets () {
374-
var duration = Utils.get_animation_duration (FADE_ANIMATION_DURATION);
375-
376-
var show = (has_pointer || close_button.has_pointer) && !animating;
377-
378-
close_button.save_easing_state ();
379-
close_button.set_easing_mode (Clutter.AnimationMode.LINEAR);
380-
close_button.set_easing_duration (duration);
381-
close_button.opacity = show ? 255 : 0;
382-
close_button.restore_easing_state ();
383-
}
384-
385371
/**
386372
* Send the window the delete signal and listen for new windows to be added
387373
* to the window's workspace, in which case we check if the new window is a
@@ -620,7 +606,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
620606

621607
close_button.visible = true;
622608
window_title.visible = true;
623-
624609
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
625610

626611
if (duration > 0) {

0 commit comments

Comments
 (0)