Skip to content

Commit 1fdffa5

Browse files
authored
Merge branch 'main' into leolost/gesture-action
2 parents 2755d30 + eca9b14 commit 1fdffa5

17 files changed

+191
-143
lines changed

lib/Drawing/Canvas.vala

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,33 @@ public class Gala.Drawing.Canvas : GLib.Object, Clutter.Content {
99
private int height = -1;
1010
private float scale_factor = 1.0f;
1111

12+
private Cogl.Context? cogl_context;
13+
1214
private Cogl.Texture? texture = null;
1315
private Cogl.Bitmap? bitmap = null;
1416

1517
private bool dirty = false;
1618

1719
public signal void draw (Cairo.Context cr, int width, int height);
1820

19-
private void emit_draw () requires (width > 0 && height > 0) {
21+
public override void attached (Clutter.Actor actor) {
22+
#if HAS_MUTTER47
23+
cogl_context = actor.context.get_backend ().get_cogl_context ();
24+
#else
25+
cogl_context = Clutter.get_default_backend ().get_cogl_context ();
26+
#endif
27+
}
28+
29+
public override void detached (Clutter.Actor actor) {
30+
cogl_context = null;
31+
}
32+
33+
private void emit_draw () requires (width > 0 && height > 0 && cogl_context != null) {
2034
dirty = true;
2135
int real_width = (int) Math.ceilf (width * scale_factor);
2236
int real_height = (int) Math.ceilf (height * scale_factor);
2337
if (bitmap == null) {
24-
unowned Cogl.Context ctx = Clutter.get_default_backend ().get_cogl_context ();
25-
bitmap = new Cogl.Bitmap.with_size (ctx, real_width, real_height, Cogl.PixelFormat.CAIRO_ARGB32_COMPAT);
38+
bitmap = new Cogl.Bitmap.with_size (cogl_context, real_width, real_height, Cogl.PixelFormat.CAIRO_ARGB32_COMPAT);
2639
}
2740

2841
unowned Cogl.Buffer? buffer = bitmap.get_buffer ();

lib/ShadowEffect.vala

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,33 @@ public class Gala.ShadowEffect : Clutter.Effect {
5555
public int border_radius { get; set; default = 9;}
5656

5757
private int shadow_size;
58-
private Cogl.Pipeline pipeline;
58+
private Cogl.Pipeline? pipeline;
5959
private string? current_key = null;
6060

6161
public ShadowEffect (string css_class = "") {
6262
Object (css_class: css_class);
6363
}
6464

65-
construct {
66-
pipeline = new Cogl.Pipeline (Clutter.get_default_backend ().get_cogl_context ());
67-
}
68-
6965
~ShadowEffect () {
7066
if (current_key != null) {
7167
decrement_shadow_users (current_key);
7268
}
7369
}
7470

71+
public override void set_actor (Clutter.Actor? actor) {
72+
base.set_actor (actor);
73+
74+
if (actor != null) {
75+
#if HAS_MUTTER47
76+
pipeline = new Cogl.Pipeline (actor.context.get_backend ().get_cogl_context ());
77+
#else
78+
pipeline = new Cogl.Pipeline (Clutter.get_default_backend ().get_cogl_context ());
79+
#endif
80+
} else {
81+
pipeline = null;
82+
}
83+
}
84+
7585
private Cogl.Texture? get_shadow (Cogl.Context context, int width, int height, int shadow_size) {
7686
var old_key = current_key;
7787
current_key = "%ix%i:%i".printf (width, height, shadow_size);

po/hu.po

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: noise\n"
99
"Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n"
1010
"POT-Creation-Date: 2024-12-18 21:23+0000\n"
11-
"PO-Revision-Date: 2024-12-08 11:16+0000\n"
11+
"PO-Revision-Date: 2025-01-16 17:55+0000\n"
1212
"Last-Translator: TomiOhl <[email protected]>\n"
1313
"Language-Team: Hungarian <https://l10n.elementary.io/projects/desktop/gala/"
1414
"hu/>\n"
@@ -17,7 +17,7 @@ msgstr ""
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919
"Plural-Forms: nplurals=2; plural=n != 1;\n"
20-
"X-Generator: Weblate 5.8.4\n"
20+
"X-Generator: Weblate 5.9.2\n"
2121
"X-Launchpad-Export-Date: 2017-02-21 05:47+0000\n"
2222

2323
#: daemon/DBus.vala:82 daemon-gtk3/BackgroundMenu.vala:11
@@ -128,17 +128,17 @@ msgstr "Frissített fordítások"
128128

129129
#: data/gala.metainfo.xml.in:35
130130
msgid "Fixed rare crash when a dock window was killed"
131-
msgstr ""
131+
msgstr "Ritka összeomlás javítva dokk ablak leállításakor"
132132

133133
#: data/gala.metainfo.xml.in:36
134134
msgid "Added interactive screenshot shortcut"
135-
msgstr ""
135+
msgstr "Gyorsparancs interaktív képernyőképhez"
136136

137137
#: data/gala.metainfo.xml.in:37
138-
#, fuzzy
139-
#| msgid "Fix potential crash when taking screenshots"
140138
msgid "Fixed crash when using tiling shortcuts"
141-
msgstr "Esetleges összeomlás javítva képernyőkép készítésekor"
139+
msgstr ""
140+
"Összeomlás javítva ablakok felosztásával kapcsolatos gyorsparancsok "
141+
"használatakor"
142142

143143
#: data/gala.metainfo.xml.in:56
144144
msgid "Improved shadows performance"

src/Background/BlurEffect.vala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ public class Gala.BlurEffect : Clutter.Effect {
2929
}
3030

3131
construct {
32+
#if HAS_MUTTER47
33+
unowned var ctx = actor.context.get_backend ().get_cogl_context ();
34+
#else
3235
unowned var ctx = Clutter.get_default_backend ().get_cogl_context ();
36+
#endif
3337

3438
actor_pipeline = new Cogl.Pipeline (ctx);
3539
actor_pipeline.set_layer_null_texture (0);
@@ -98,7 +102,11 @@ public class Gala.BlurEffect : Clutter.Effect {
98102
return true;
99103
}
100104

105+
#if HAS_MUTTER47
106+
unowned var ctx = actor.context.get_backend ().get_cogl_context ();
107+
#else
101108
unowned var ctx = Clutter.get_default_backend ().get_cogl_context ();
109+
#endif
102110

103111
framebuffer = null;
104112
texture = null;
@@ -136,7 +144,11 @@ public class Gala.BlurEffect : Clutter.Effect {
136144

137145
actor_painted = false;
138146

147+
#if HAS_MUTTER47
148+
unowned var ctx = actor.context.get_backend ().get_cogl_context ();
149+
#else
139150
unowned var ctx = Clutter.get_default_backend ().get_cogl_context ();
151+
#endif
140152

141153
actor_framebuffer = null;
142154
actor_texture = null;

src/Gestures/GestureTracker.vala

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public class Gala.GestureTracker : Object {
7575
*/
7676
public bool enabled { get; set; default = true; }
7777

78+
public bool recognizing { get; private set; }
79+
7880
/**
7981
* Emitted when a new gesture is detected.
8082
* This should only be used to determine whether the gesture should be handled. This shouldn't
@@ -193,6 +195,23 @@ public class Gala.GestureTracker : Object {
193195
}
194196
}
195197

198+
/**
199+
* Connects a callback that will only be called if != 0 completions were made.
200+
* If with_gesture is false it will be called immediately, otherwise once {@link on_end} is emitted.
201+
*/
202+
public void add_success_callback (bool with_gesture, owned OnEnd callback) {
203+
if (!with_gesture) {
204+
callback (1, 1, min_animation_duration);
205+
} else {
206+
ulong handler_id = on_end.connect ((percentage, completions, duration) => {
207+
if (completions != 0) {
208+
callback (percentage, completions, duration);
209+
}
210+
});
211+
handlers.add (handler_id);
212+
}
213+
}
214+
196215
private void disconnect_all_handlers () {
197216
foreach (var handler in handlers) {
198217
disconnect (handler);
@@ -242,6 +261,7 @@ public class Gala.GestureTracker : Object {
242261
on_begin (percentage);
243262
}
244263

264+
recognizing = true;
245265
previous_percentage = percentage;
246266
previous_time = elapsed_time;
247267
}
@@ -283,6 +303,7 @@ public class Gala.GestureTracker : Object {
283303
}
284304

285305
disconnect_all_handlers ();
306+
recognizing = false;
286307
previous_percentage = 0;
287308
previous_time = 0;
288309
percentage_delta = 0;

src/InternalUtils.vala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,5 +380,23 @@ namespace Gala {
380380
new_parent.add_child (actor);
381381
actor.unref ();
382382
}
383+
384+
public static void bell_notify (Meta.Display display) {
385+
#if HAS_MUTTER47
386+
display.get_stage ().context.get_backend ().get_default_seat ().bell_notify ();
387+
#else
388+
Clutter.get_default_backend ().get_default_seat ().bell_notify ();
389+
#endif
390+
}
391+
392+
public static void update_transients_visible (Meta.Window window, bool visible) {
393+
window.foreach_transient ((transient) => {
394+
unowned var actor = (Meta.WindowActor) transient.get_compositor_private ();
395+
396+
actor.visible = visible;
397+
398+
return true;
399+
});
400+
}
383401
}
384402
}

src/ShellClients/HideTracker.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public class Gala.HideTracker : Object {
152152
});
153153
}
154154

155-
private void update_overlap () {
155+
public void update_overlap () {
156156
overlap = false;
157157
focus_overlap = false;
158158
focus_maximized_overlap = false;

0 commit comments

Comments
 (0)