mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 15:15:39 +03:00
WindowClone: Make close button and title respect animations key (#1551)
This commit is contained in:
parent
4e00b82dd7
commit
10e5a6dfde
@ -29,6 +29,7 @@
|
||||
<issue url="https://github.com/elementary/gala/issues/1517">The second time I click on a workspace, all applications in that workspace close</issue>
|
||||
<issue url="https://github.com/elementary/gala/issues/1482">Duplicate "Plus" workspaces</issue>
|
||||
<issue url="https://github.com/elementary/gala/issues/1203">Artifact around non native apps in the overview mode</issue>
|
||||
<issue url="https://github.com/elementary/gala/issues/507">Close buttons in Multitasking View don't respect animations key</issue>
|
||||
<issue url="https://github.com/elementary/gala/issues/1505">"Not responding" dialog and not responding app close after inactivity</issue>
|
||||
<issue url="https://github.com/elementary/gala/issues/1185">Unmaximize effect not working with mutter >= 3.38</issue>
|
||||
<issue url="https://github.com/elementary/gala/issues/1536">Several (un-)maximize animations are not played</issue>
|
||||
|
@ -26,6 +26,7 @@ namespace Gala {
|
||||
public class MonitorClone : Clutter.Actor {
|
||||
public signal void window_selected (Meta.Window window);
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
public Meta.Display display { get; construct; }
|
||||
public int monitor { get; construct; }
|
||||
public GestureTracker gesture_tracker { get; construct; }
|
||||
@ -33,8 +34,8 @@ namespace Gala {
|
||||
private WindowCloneContainer window_container;
|
||||
private BackgroundManager background;
|
||||
|
||||
public MonitorClone (Meta.Display display, int monitor, GestureTracker gesture_tracker) {
|
||||
Object (display: display, monitor: monitor, gesture_tracker: gesture_tracker);
|
||||
public MonitorClone (WindowManager wm, Meta.Display display, int monitor, GestureTracker gesture_tracker) {
|
||||
Object (wm: wm, display: display, monitor: monitor, gesture_tracker: gesture_tracker);
|
||||
}
|
||||
|
||||
construct {
|
||||
@ -43,7 +44,7 @@ namespace Gala {
|
||||
background = new BackgroundManager (display, monitor, false);
|
||||
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
|
||||
window_container = new WindowCloneContainer (gesture_tracker);
|
||||
window_container = new WindowCloneContainer (wm, gesture_tracker);
|
||||
window_container.window_selected.connect ((w) => { window_selected (w); });
|
||||
display.restacked.connect (window_container.restack_windows);
|
||||
|
||||
|
@ -146,7 +146,7 @@ namespace Gala {
|
||||
if (monitor == primary)
|
||||
continue;
|
||||
|
||||
var monitor_clone = new MonitorClone (display, monitor, multitasking_gesture_tracker);
|
||||
var monitor_clone = new MonitorClone (wm, display, monitor, multitasking_gesture_tracker);
|
||||
monitor_clone.window_selected.connect (window_selected);
|
||||
monitor_clone.visible = opened;
|
||||
|
||||
@ -403,7 +403,7 @@ namespace Gala {
|
||||
|
||||
private void add_workspace (int num) {
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
var workspace = new WorkspaceClone (manager.get_workspace_by_index (num), multitasking_gesture_tracker);
|
||||
var workspace = new WorkspaceClone (wm, manager.get_workspace_by_index (num), multitasking_gesture_tracker);
|
||||
workspace.window_selected.connect (window_selected);
|
||||
workspace.selected.connect (activate_workspace);
|
||||
|
||||
|
@ -27,6 +27,8 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
*/
|
||||
public signal void request_reposition ();
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
|
||||
public Meta.Window window { get; construct; }
|
||||
|
||||
/**
|
||||
@ -86,8 +88,8 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
private Clutter.Actor window_icon;
|
||||
private Tooltip window_title;
|
||||
|
||||
public WindowClone (Meta.Window window, GestureTracker? gesture_tracker, bool overview_mode = false) {
|
||||
Object (window: window, gesture_tracker: gesture_tracker, overview_mode: overview_mode);
|
||||
public WindowClone (WindowManager wm, Meta.Window window, GestureTracker? gesture_tracker, bool overview_mode = false) {
|
||||
Object (wm: wm, window: window, gesture_tracker: gesture_tracker, overview_mode: overview_mode);
|
||||
}
|
||||
|
||||
construct {
|
||||
@ -119,7 +121,6 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
|
||||
close_button = Utils.create_close_button ();
|
||||
close_button.opacity = 0;
|
||||
close_button.set_easing_duration (FADE_ANIMATION_DURATION);
|
||||
close_button.button_press_event.connect (() => {
|
||||
close_window ();
|
||||
return Gdk.EVENT_STOP;
|
||||
@ -137,7 +138,6 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
|
||||
window_title = new Tooltip ();
|
||||
window_title.opacity = 0;
|
||||
window_title.set_easing_duration (FADE_ANIMATION_DURATION);
|
||||
|
||||
active_shape = new ActiveShape ();
|
||||
active_shape.opacity = 0;
|
||||
@ -464,14 +464,34 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
return Gdk.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
close_button.save_easing_state ();
|
||||
close_button.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
close_button.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
close_button.opacity = in_slot_animation ? 0 : 255;
|
||||
close_button.restore_easing_state ();
|
||||
|
||||
window_title.save_easing_state ();
|
||||
window_title.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
window_title.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
window_title.opacity = in_slot_animation ? 0 : 255;
|
||||
window_title.restore_easing_state ();
|
||||
|
||||
return Gdk.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
public override bool leave_event (Clutter.CrossingEvent event) {
|
||||
close_button.save_easing_state ();
|
||||
close_button.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
close_button.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
close_button.opacity = 0;
|
||||
close_button.restore_easing_state ();
|
||||
|
||||
window_title.save_easing_state ();
|
||||
window_title.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
window_title.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
window_title.opacity = 0;
|
||||
window_title.restore_easing_state ();
|
||||
|
||||
return Gdk.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
@ -482,11 +502,6 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
public void place_widgets (int dest_width, int dest_height) {
|
||||
var scale_factor = InternalUtils.get_ui_scaling_factor ();
|
||||
|
||||
close_button.save_easing_state ();
|
||||
window_title.save_easing_state ();
|
||||
close_button.set_easing_duration (0);
|
||||
window_title.set_easing_duration (0);
|
||||
|
||||
var close_button_size = CLOSE_WINDOW_ICON_SIZE * scale_factor;
|
||||
close_button.set_size (close_button_size, close_button_size);
|
||||
|
||||
@ -502,9 +517,6 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
window_title.set_text (window.get_title () ?? "", false);
|
||||
window_title.set_max_width (dest_width - (TITLE_MAX_WIDTH_MARGIN * scale_factor));
|
||||
set_window_title_position (dest_width, dest_height);
|
||||
|
||||
close_button.restore_easing_state ();
|
||||
window_title.restore_easing_state ();
|
||||
}
|
||||
|
||||
private void toggle_shadow (bool show) {
|
||||
|
@ -27,6 +27,7 @@ namespace Gala {
|
||||
public int padding_right { get; set; default = 12; }
|
||||
public int padding_bottom { get; set; default = 12; }
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
public GestureTracker? gesture_tracker { get; construct; }
|
||||
public bool overview_mode { get; construct; }
|
||||
|
||||
@ -38,8 +39,8 @@ namespace Gala {
|
||||
*/
|
||||
private WindowClone? current_window;
|
||||
|
||||
public WindowCloneContainer (GestureTracker? gesture_tracker, bool overview_mode = false) {
|
||||
Object (gesture_tracker: gesture_tracker, overview_mode: overview_mode);
|
||||
public WindowCloneContainer (WindowManager wm, GestureTracker? gesture_tracker, bool overview_mode = false) {
|
||||
Object (wm: wm, gesture_tracker: gesture_tracker, overview_mode: overview_mode);
|
||||
}
|
||||
|
||||
construct {
|
||||
@ -66,7 +67,7 @@ namespace Gala {
|
||||
|
||||
var windows_ordered = display.sort_windows_by_stacking (windows);
|
||||
|
||||
var new_window = new WindowClone (window, gesture_tracker, overview_mode);
|
||||
var new_window = new WindowClone (wm, window, gesture_tracker, overview_mode);
|
||||
|
||||
new_window.selected.connect (window_selected_cb);
|
||||
new_window.destroy.connect (window_destroyed);
|
||||
|
@ -150,7 +150,7 @@ public class Gala.WindowOverview : Clutter.Actor, ActivatableComponent {
|
||||
for (var i = 0; i < display.get_n_monitors (); i++) {
|
||||
var geometry = display.get_monitor_geometry (i);
|
||||
|
||||
var container = new WindowCloneContainer (null, true) {
|
||||
var container = new WindowCloneContainer (wm, null, true) {
|
||||
padding_top = TOP_GAP,
|
||||
padding_left = BORDER,
|
||||
padding_right = BORDER,
|
||||
|
@ -134,6 +134,7 @@ namespace Gala {
|
||||
*/
|
||||
public signal void selected (bool close_view);
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
public Meta.Workspace workspace { get; construct; }
|
||||
public GestureTracker gesture_tracker { get; construct; }
|
||||
public IconGroup icon_group { get; private set; }
|
||||
@ -159,8 +160,8 @@ namespace Gala {
|
||||
|
||||
private uint hover_activate_timeout = 0;
|
||||
|
||||
public WorkspaceClone (Meta.Workspace workspace, GestureTracker gesture_tracker) {
|
||||
Object (workspace: workspace, gesture_tracker: gesture_tracker);
|
||||
public WorkspaceClone (WindowManager wm, Meta.Workspace workspace, GestureTracker gesture_tracker) {
|
||||
Object (wm: wm, workspace: workspace, gesture_tracker: gesture_tracker);
|
||||
}
|
||||
|
||||
construct {
|
||||
@ -176,7 +177,7 @@ namespace Gala {
|
||||
return false;
|
||||
});
|
||||
|
||||
window_container = new WindowCloneContainer (gesture_tracker);
|
||||
window_container = new WindowCloneContainer (wm, gesture_tracker);
|
||||
window_container.window_selected.connect ((w) => { window_selected (w); });
|
||||
window_container.set_size (monitor_geometry.width, monitor_geometry.height);
|
||||
display.restacked.connect (window_container.restack_windows);
|
||||
|
Loading…
Reference in New Issue
Block a user