Skip to content

Commit 0f77017

Browse files
authored
Merge branch 'main' into lenemter/fix-dbus-name-owning
2 parents b9dbdbe + 22a7a05 commit 0f77017

File tree

10 files changed

+69
-46
lines changed

10 files changed

+69
-46
lines changed

lib/Gestures/ActorTarget.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
8484
switch (update_type) {
8585
case START:
8686
ongoing_animations++;
87+
notify_property ("animating");
8788
start_progress (action);
8889
break;
8990
case UPDATE:
@@ -94,6 +95,7 @@ public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
9495
break;
9596
case END:
9697
ongoing_animations--;
98+
notify_property ("animating");
9799
end_progress (action);
98100
break;
99101
}

lib/Gestures/TouchpadBackend.vala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ private class Gala.TouchpadBackend : Object, GestureBackend {
5656
return Clutter.EVENT_PROPAGATE;
5757
}
5858

59-
if (state == IGNORED) {
60-
if (event.get_gesture_phase () == END || event.get_gesture_phase () == CANCEL) {
61-
reset ();
62-
}
59+
if (state != ONGOING && (event.get_gesture_phase () == END || event.get_gesture_phase () == CANCEL)) {
60+
reset ();
61+
return Clutter.EVENT_PROPAGATE;
62+
}
6363

64+
if (state == IGNORED) {
6465
return Clutter.EVENT_PROPAGATE;
6566
}
6667

lib/Utils.vala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,5 +486,24 @@ namespace Gala {
486486
public static int calculate_button_size (float monitor_scale) {
487487
return Utils.scale_to_int (BUTTON_SIZE, monitor_scale);
488488
}
489+
490+
private static bool? framebuffer_is_logical = null;
491+
public static bool get_framebuffer_is_logical () {
492+
if (framebuffer_is_logical != null) {
493+
return framebuffer_is_logical;
494+
}
495+
496+
framebuffer_is_logical = false;
497+
498+
var experimental_features = new Settings ("org.gnome.mutter").get_strv ("experimental-features");
499+
for (var i = 0; i < experimental_features.length; i++) {
500+
if (experimental_features[i] == "scale-monitor-framebuffer") {
501+
framebuffer_is_logical = true;
502+
break;
503+
}
504+
}
505+
506+
return framebuffer_is_logical;
507+
}
489508
}
490509
}

src/BlurManager.vala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,13 @@ public class Gala.BlurManager : Object {
3232

3333
public WindowManagerGala wm { get; construct; }
3434

35-
private bool framebuffer_is_logical = false;
3635
private GLib.HashTable<Meta.Window, BlurData?> blurred_windows = new GLib.HashTable<Meta.Window, BlurData?> (null, null);
3736

3837
private BlurManager (WindowManagerGala wm) {
3938
Object (wm: wm);
4039
}
4140

4241
construct {
43-
var experimental_features = new Settings ("org.gnome.mutter").get_strv ("experimental-features");
44-
for (var i = 0; i < experimental_features.length; i++) {
45-
if (experimental_features[i] == "scale-monitor-framebuffer") {
46-
framebuffer_is_logical = true;
47-
break;
48-
}
49-
}
50-
5142
wm.get_display ().window_created.connect ((window) => {
5243
window.notify["mutter-hints"].connect ((obj, pspec) => parse_mutter_hints ((Meta.Window) obj));
5344
parse_mutter_hints (window);
@@ -83,7 +74,7 @@ public class Gala.BlurManager : Object {
8374
var x_shadow_size = frame_rect.x - buffer_rect.x;
8475
var y_shadow_size = frame_rect.y - buffer_rect.y;
8576

86-
var monitor_scale = framebuffer_is_logical ? 1.0f : window.display.get_monitor_scale (window.get_monitor ());
77+
var monitor_scale = Utils.get_framebuffer_is_logical () ? 1.0f : window.display.get_monitor_scale (window.get_monitor ());
8778
var inverse_monitor_scale = 1.0f / monitor_scale;
8879

8980
blur_data.actor.set_position (

src/DesktopIntegration.vala

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,22 @@ public class Gala.DesktopIntegration : GLib.Object {
195195
return;
196196
}
197197

198-
notifying = true;
199-
200-
wm.get_display ().get_sound_player ().play_from_theme ("bell", _("Window has already focus"), null);
198+
unowned var display = wm.get_display ();
201199

202200
#if HAS_MUTTER49
203-
if (window.is_maximized ()) {
201+
if (window.is_maximized () || !Meta.Prefs.get_gnome_animations ()) {
204202
#else
205-
if (window.get_maximized () == BOTH) {
203+
if (window.get_maximized () == BOTH || !Meta.Prefs.get_gnome_animations ()) {
206204
#endif
207-
notifying = false;
205+
// If user has "Flash screen" enabled, make sure to respect it when shake animation is not played
206+
InternalUtils.bell_notify (display);
208207
return;
209208
}
210209

210+
display.get_sound_player ().play_from_theme ("bell", _("Window has already focus"), null);
211+
212+
notifying = true;
213+
211214
var transition = new Clutter.KeyframeTransition ("translation-x") {
212215
repeat_count = 5,
213216
duration = 100,
@@ -217,7 +220,7 @@ public class Gala.DesktopIntegration : GLib.Object {
217220
transition.set_to_value (0);
218221
transition.set_key_frames ( { 0.5, -0.5 } );
219222

220-
var offset = Utils.scale_to_int (15, wm.get_display ().get_monitor_scale (window.get_monitor ()));
223+
var offset = Utils.scale_to_int (15, display.get_monitor_scale (window.get_monitor ()));
221224
transition.set_values ( { -offset, offset });
222225

223226
transition.stopped.connect (() => {
@@ -230,9 +233,9 @@ public class Gala.DesktopIntegration : GLib.Object {
230233
});
231234

232235
#if HAS_MUTTER48
233-
wm.get_display ().get_compositor ().disable_unredirect ();
236+
display.get_compositor ().disable_unredirect ();
234237
#else
235-
wm.get_display ().disable_unredirect ();
238+
display.disable_unredirect ();
236239
#endif
237240

238241
((Meta.WindowActor) window.get_compositor_private ()).add_transition ("notify-already-focused", transition);

src/ShellClients/HideTracker.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ public class Gala.HideTracker : Object {
222222
behavior_settings.get_boolean ("enable-hotcorners-in-fullscreen")
223223
) {
224224
trigger_show ();
225+
// This handles the case that the user triggered the barrier but never hovered
226+
// the panel e.g. when triggering the barrier at a point where the dock doesnt
227+
// reach. In that case once the pointer is moved it'll recheck the hovered state.
228+
hovered = true;
225229
}
226230
}
227231
}

src/Widgets/MultitaskingView/Tooltip.vala

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
* Clutter actor to display text in a tooltip-like component.
99
*/
1010
public class Gala.Tooltip : Clutter.Actor {
11+
private const int TEXT_MARGIN = 6;
12+
private const int CORNER_RADIUS = 3;
13+
1114
public float monitor_scale { get; construct set; }
1215

1316
private Gala.Text text_actor;
@@ -18,25 +21,33 @@ public class Gala.Tooltip : Clutter.Actor {
1821

1922
construct {
2023
text_actor = new Gala.Text () {
21-
margin_left = 6,
22-
margin_top = 6,
23-
margin_bottom = 6,
24-
margin_right = 6,
2524
ellipsize = Pango.EllipsizeMode.MIDDLE,
2625
color = Drawing.Color.TOOLTIP_TEXT_COLOR
2726
};
28-
29-
add_child (text_actor);
27+
bind_property ("monitor-scale", text_actor, "margin-left", SYNC_CREATE, transform_monitor_scale_to_margin);
28+
bind_property ("monitor-scale", text_actor, "margin-top", SYNC_CREATE, transform_monitor_scale_to_margin);
29+
bind_property ("monitor-scale", text_actor, "margin-right", SYNC_CREATE, transform_monitor_scale_to_margin);
30+
bind_property ("monitor-scale", text_actor, "margin-bottom", SYNC_CREATE, transform_monitor_scale_to_margin);
3031

3132
layout_manager = new Clutter.BinLayout ();
3233
background_color = Drawing.Color.TOOLTIP_BACKGROUND;
34+
add_child (text_actor);
3335

34-
var rounded_corners_effect = new RoundedCornersEffect (3, monitor_scale);
36+
var rounded_corners_effect = new RoundedCornersEffect (CORNER_RADIUS, monitor_scale);
3537
bind_property ("monitor-scale", rounded_corners_effect, "monitor-scale");
3638
add_effect (rounded_corners_effect);
3739
}
3840

3941
public void set_text (string new_text) {
4042
text_actor.text = new_text;
4143
}
44+
45+
private static bool transform_monitor_scale_to_margin (Binding binding, Value from_value, ref Value to_value) {
46+
to_value.set_float (
47+
Utils.get_framebuffer_is_logical ()
48+
? TEXT_MARGIN
49+
: Utils.scale_to_int (TEXT_MARGIN, from_value.get_float ())
50+
);
51+
return true;
52+
}
4253
}

src/Widgets/MultitaskingView/WindowClone.vala

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
7272
private Clutter.Clone? drag_handle = null;
7373

7474
private ulong check_confirm_dialog_cb = 0;
75-
private bool in_slot_animation = false;
7675

7776
private Clutter.Actor clone_container;
7877
private Gala.CloseButton close_button;
@@ -142,7 +141,7 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
142141
};
143142
bind_property ("monitor-scale", close_button, "monitor-scale");
144143
close_button.triggered.connect (close_window);
145-
close_button.notify["has-pointer"].connect (() => update_hover_widgets ());
144+
close_button.notify["has-pointer"].connect (update_hover_widgets);
146145

147146
add_child (active_shape);
148147
add_child (clone_container);
@@ -157,7 +156,8 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
157156
window.notify["title"].connect (() => window_title.set_text (window.get_title () ?? ""));
158157
window_title.set_text (window.get_title () ?? "");
159158

160-
notify["has-pointer"].connect (() => update_hover_widgets ());
159+
notify["has-pointer"].connect (update_hover_widgets);
160+
notify["animating"].connect (update_hover_widgets);
161161
}
162162

163163
~WindowClone () {
@@ -272,12 +272,8 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
272272
add_target (new PropertyTarget (MULTITASKING_VIEW, window_title, "opacity", typeof (uint), 0u, 255u));
273273
}
274274

275-
public override void start_progress (GestureAction action) {
276-
update_hover_widgets (true);
277-
}
278-
279275
public override void update_progress (Gala.GestureAction action, double progress) {
280-
if (action != CUSTOM || slot == null || !Meta.Prefs.get_gnome_animations ()) {
276+
if (action != CUSTOM || !has_pointer || slot == null || !Meta.Prefs.get_gnome_animations ()) {
281277
return;
282278
}
283279

@@ -298,8 +294,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
298294
}
299295

300296
public override void end_progress (GestureAction action) {
301-
update_hover_widgets (false);
302-
303297
if (action == CUSTOM && get_current_commit (CUSTOM) > 0.5 && Meta.Prefs.get_gnome_animations ()) {
304298
close_window (Meta.CURRENT_TIME);
305299
}
@@ -376,14 +370,10 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
376370
return Clutter.EVENT_STOP;
377371
}
378372

379-
private void update_hover_widgets (bool? animating = null) {
380-
if (animating != null) {
381-
in_slot_animation = animating;
382-
}
383-
373+
private void update_hover_widgets () {
384374
var duration = Utils.get_animation_duration (FADE_ANIMATION_DURATION);
385375

386-
var show = (has_pointer || close_button.has_pointer) && !in_slot_animation;
376+
var show = (has_pointer || close_button.has_pointer) && !animating;
387377

388378
close_button.save_easing_state ();
389379
close_button.set_easing_mode (Clutter.AnimationMode.LINEAR);

src/WindowManager.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,7 @@ namespace Gala {
12851285

12861286
// Notifications initial animation is handled by the notification stack
12871287
if (NotificationStack.is_notification (window) || !Meta.Prefs.get_gnome_animations ()) {
1288+
dim_parent_window (window);
12881289
map_completed (actor);
12891290
return;
12901291
}

src/WindowStateSaver.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public class Gala.WindowStateSaver : GLib.Object {
8080

8181
if (app_id.has_prefix ("window:") || // if window failed to be identified, don't remember it
8282
window.window_type != Meta.WindowType.NORMAL ||
83+
window.get_transient_for () != null ||
8384
window.skip_taskbar ||
8485
!window.resizeable ||
8586
!window.allows_move ()

0 commit comments

Comments
 (0)