Skip to content

Commit b708a66

Browse files
authored
Merge branch 'main' into lenemter/introduce-property-animator
2 parents f6748bf + bb56870 commit b708a66

26 files changed

+647
-667
lines changed

daemon/MonitorLabel.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
var provider = new Gtk.CssProvider ();
3232
try {
3333
provider.load_from_string (COLORED_STYLE_CSS.printf (title, info.background_color, info.text_color));
34-
get_style_context ().add_class (title);
35-
get_style_context ().add_class ("monitor-label");
34+
add_css_class (title);
35+
add_css_class ("monitor-label");
3636

3737
Gtk.StyleContext.add_provider_for_display (
3838
Gdk.Display.get_default (),

lib/Drawing/StyleManager.vala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ public class Gala.Drawing.StyleManager : Object {
137137

138138
case 10: // Slate
139139
return 0x667885;
140+
141+
case 11: // Latte
142+
return 0xe7c591;
140143
}
141144

142145
return 0;

lib/Gestures/GestureController.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class Gala.GestureController : Object {
7373
get { return _progress; }
7474
set {
7575
_progress = value;
76-
target.propagate (UPDATE, action, value);
76+
target?.propagate (UPDATE, action, value);
7777
}
7878
}
7979

lib/Gestures/GestureSettings.vala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,6 @@ private class Gala.GestureSettings : Object {
3434
: touchpad_settings.get_boolean ("natural-scroll");
3535
}
3636

37-
public Meta.MotionDirection? get_direction (Gesture gesture) {
38-
switch (gesture.direction) {
39-
case GestureDirection.UP:
40-
return Meta.MotionDirection.UP;
41-
case GestureDirection.DOWN:
42-
return Meta.MotionDirection.DOWN;
43-
case GestureDirection.LEFT:
44-
return Meta.MotionDirection.LEFT;
45-
case GestureDirection.RIGHT:
46-
return Meta.MotionDirection.RIGHT;
47-
default:
48-
return null;
49-
}
50-
}
51-
5237
public Meta.MotionDirection? get_natural_scroll_direction (Gesture gesture) {
5338
bool natural_scroll = is_natural_scroll_enabled (gesture.performed_on_device_type);
5439

lib/Gestures/ScrollBackend.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private class Gala.ScrollBackend : Object, GestureBackend {
7373
// Scroll events apply the natural scroll preferences out of the box
7474
// Standardize them so the direction matches the physical direction of the gesture and the
7575
// GestureTracker user can decide if it wants to follow natural scroll settings or not
76-
bool natural_scroll = settings.is_natural_scroll_enabled (Clutter.InputDeviceType.TOUCHPAD_DEVICE);
76+
bool natural_scroll = GestureSettings.is_natural_scroll_enabled (Clutter.InputDeviceType.TOUCHPAD_DEVICE);
7777
if (natural_scroll) {
7878
x *= -1;
7979
y *= -1;

lib/Gestures/ToucheggBackend.vala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,6 @@ private class Gala.ToucheggBackend : Object, GestureBackend {
150150
new Thread<void> (null, (owned) run);
151151
}
152152

153-
public void stop () {
154-
try {
155-
reconnection_attempts = MAX_RECONNECTION_ATTEMPTS;
156-
157-
if (!connection.closed) {
158-
connection.close_sync ();
159-
}
160-
} catch (Error e) {
161-
// Ignore this error, the process is being killed as this point
162-
}
163-
}
164-
165153
[CCode (instance_pos = -1)]
166154
private void on_new_message (DBusConnection connection, string? sender_name, string object_path,
167155
string interface_name, string signal_name, Variant parameters) {
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
* SPDX-License-Identifier: GPL-3.0-or-later
3+
* SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
4+
*/
5+
6+
public class Gala.WorkspaceHideTracker : Object {
7+
public delegate bool ComputeShouldHideOnWorkspace (Meta.Workspace workspace);
8+
9+
public signal void switching_workspace_progress_updated (double new_progress);
10+
public signal void window_state_changed_progress_updated (double new_progress);
11+
12+
public Meta.Display display { private get; construct; }
13+
14+
private ComputeShouldHideOnWorkspace? compute_func = null;
15+
private double switch_workspace_progress = 0.0;
16+
private bool[] should_hide_on_workspace_cache = {};
17+
18+
public WorkspaceHideTracker (Meta.Display display, ComputeShouldHideOnWorkspace? compute_func) {
19+
Object (display: display);
20+
this.compute_func = compute_func;
21+
}
22+
23+
construct {
24+
display.list_all_windows ().foreach (setup_window);
25+
display.window_created.connect (setup_window);
26+
27+
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
28+
monitor_manager.monitors_changed.connect (recalculate_all_workspaces);
29+
30+
unowned var workspace_manager = display.get_workspace_manager ();
31+
workspace_manager.workspace_added.connect (recalculate_all_workspaces);
32+
workspace_manager.workspace_removed.connect (recalculate_all_workspaces);
33+
34+
recalculate_all_workspaces ();
35+
}
36+
37+
private void setup_window (Meta.Window window) {
38+
window.notify["window-type"].connect (on_window_type_changed);
39+
40+
if (!Utils.get_window_is_normal (window)) {
41+
return;
42+
}
43+
44+
if (window.on_all_workspaces) {
45+
recalculate_all_workspaces ();
46+
} else {
47+
recalculate_workspace (window);
48+
}
49+
50+
window.position_changed.connect (recalculate_workspace);
51+
window.size_changed.connect (recalculate_workspace);
52+
window.workspace_changed.connect (recalculate_all_workspaces);
53+
window.focused.connect (recalculate_workspace);
54+
window.notify["on-all-workspaces"].connect (recalculate_all_workspaces);
55+
window.notify["fullscreen"].connect (recalculate_workspace_pspec);
56+
window.notify["minimized"].connect (recalculate_workspace_pspec);
57+
window.notify["above"].connect (recalculate_workspace_pspec);
58+
window.unmanaged.connect (recalculate_workspace);
59+
}
60+
61+
private void on_window_type_changed (Object obj, ParamSpec pspec) {
62+
var window = (Meta.Window) obj;
63+
64+
window.notify["window-type"].disconnect (on_window_type_changed);
65+
window.position_changed.disconnect (recalculate_workspace);
66+
window.size_changed.disconnect (recalculate_workspace);
67+
window.workspace_changed.disconnect (recalculate_all_workspaces);
68+
window.focused.disconnect (recalculate_workspace);
69+
window.notify["on-all-workspaces"].disconnect (recalculate_all_workspaces);
70+
window.notify["fullscreen"].disconnect (recalculate_workspace_pspec);
71+
window.notify["minimized"].disconnect (recalculate_workspace_pspec);
72+
window.notify["above"].disconnect (recalculate_workspace_pspec);
73+
window.unmanaged.disconnect (recalculate_workspace);
74+
75+
setup_window (window);
76+
}
77+
78+
/**
79+
* Updates progress, it will do nothing if update_type is COMMIT or action is not SWITCH_WORKSPACE.
80+
*/
81+
public void update (GestureTarget.UpdateType update_type, GestureAction action, double progress) {
82+
if (action != SWITCH_WORKSPACE || update_type == COMMIT) {
83+
return;
84+
}
85+
86+
var new_switch_workspace_progress = progress.abs ();
87+
88+
// When number of workspaces changes, we get phantom SWITCH_WORKSPACE propagations
89+
if (switch_workspace_progress == new_switch_workspace_progress) {
90+
return;
91+
}
92+
93+
switch_workspace_progress = new_switch_workspace_progress;
94+
switching_workspace_progress_updated (get_hidden_progress ());
95+
}
96+
97+
private double get_hidden_progress () {
98+
var n_workspaces = should_hide_on_workspace_cache.length;
99+
100+
var left_workspace = int.max ((int) Math.floor (switch_workspace_progress), 0);
101+
var right_workspace = int.min ((int) Math.ceil (switch_workspace_progress), n_workspaces - 1);
102+
103+
var relative_progress = switch_workspace_progress - left_workspace;
104+
105+
return (
106+
(int) should_hide_on_workspace_cache[left_workspace] * (1.0 - relative_progress) +
107+
(int) should_hide_on_workspace_cache[right_workspace] * relative_progress
108+
);
109+
}
110+
111+
public void recalculate_all_workspaces () {
112+
unowned var workspace_manager = display.get_workspace_manager ();
113+
should_hide_on_workspace_cache = new bool[workspace_manager.n_workspaces];
114+
foreach (unowned var workspace in workspace_manager.get_workspaces ()) {
115+
internal_recalculate_workspace (workspace, false);
116+
}
117+
118+
window_state_changed_progress_updated (get_hidden_progress ());
119+
}
120+
121+
private void internal_recalculate_workspace (Meta.Workspace? workspace, bool send_signal) {
122+
if (
123+
workspace == null ||
124+
workspace.workspace_index >= should_hide_on_workspace_cache.length ||
125+
compute_func == null
126+
) {
127+
return;
128+
}
129+
130+
should_hide_on_workspace_cache[workspace.workspace_index] = compute_func (workspace);
131+
132+
if (send_signal) {
133+
window_state_changed_progress_updated (get_hidden_progress ());
134+
}
135+
}
136+
137+
private void recalculate_workspace (Meta.Window window) {
138+
internal_recalculate_workspace (window.get_workspace (), true);
139+
}
140+
141+
private void recalculate_workspace_pspec (Object obj, ParamSpec pspec) {
142+
internal_recalculate_workspace (((Meta.Window) obj).get_workspace (), true);
143+
}
144+
}

lib/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ gala_lib_sources = files(
3737
'Gestures/ScrollBackend.vala',
3838
'Gestures/SpringTimeline.vala',
3939
'Gestures/ToucheggBackend.vala',
40-
'Gestures/TouchpadBackend.vala'
40+
'Gestures/TouchpadBackend.vala',
41+
'Gestures/WorkspaceHideTracker.vala'
4142
) + gala_common_enums
4243

4344
gala_resources = gnome.compile_resources(

plugins/pip/PopupWindow.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
118118

119119
window_actor.notify["allocation"].connect (on_allocation_changed);
120120
container.set_position (container_margin, container_margin);
121-
update_clone_clip ();
121+
on_allocation_changed ();
122122

123123
unowned var window = window_actor.get_meta_window ();
124124
window.unmanaged.connect (on_close_click_clicked);

src/BackgroundBlurEffect.vala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
224224
}
225225

226226
private bool update_actor_fbo (int width, int height, float downscale_factor) {
227-
if (width <= 0 || height <= 0) {
228-
return false;
229-
}
230-
231227
if (
232228
texture_width == width &&
233229
texture_height == height &&
@@ -344,7 +340,7 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
344340
var width = (int) actor_box.get_width ();
345341
var height = (int) actor_box.get_height ();
346342

347-
if (width < 0 || height < 0) {
343+
if (width <= 0 || height <= 0) {
348344
warning ("BackgroundBlurEffect: Couldn't update framebuffers, incorrect size");
349345
return false;
350346
}

0 commit comments

Comments
 (0)