Skip to content

Commit 6117b34

Browse files
authored
Merge branch 'main' into leolost/fix-move-resize
2 parents f9d289b + d1b04e2 commit 6117b34

9 files changed

+47
-28
lines changed

lib/Utils.vala

-10
Original file line numberDiff line numberDiff line change
@@ -400,15 +400,5 @@ namespace Gala {
400400

401401
return texture;
402402
}
403-
404-
private static Gtk.CssProvider gala_css = null;
405-
public static unowned Gtk.CssProvider? get_gala_css () {
406-
if (gala_css == null) {
407-
gala_css = new Gtk.CssProvider ();
408-
gala_css.load_from_resource ("/io/elementary/desktop/gala/gala.css");
409-
}
410-
411-
return gala_css;
412-
}
413403
}
414404
}

src/Background/BackgroundManager.vala

+11-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
1313
public WindowManager wm { get; construct; }
1414
public int monitor_index { get; construct; }
1515
public bool control_position { get; construct; }
16+
public bool rounded_corners { get; construct; }
1617
public Meta.BackgroundActor newest_background_actor {
1718
get {
1819
return (new_background_actor != null) ? new_background_actor : background_actor;
@@ -23,8 +24,8 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
2324
private Meta.BackgroundActor? background_actor;
2425
private Meta.BackgroundActor? new_background_actor = null;
2526

26-
public BackgroundManager (WindowManager wm, int monitor_index, bool control_position = true) {
27-
Object (wm: wm, monitor_index: monitor_index, control_position: control_position);
27+
public BackgroundManager (WindowManager wm, int monitor_index, bool control_position = true, bool rounded_corners = true) {
28+
Object (wm: wm, monitor_index: monitor_index, control_position: control_position, rounded_corners: rounded_corners);
2829
}
2930

3031
construct {
@@ -91,7 +92,10 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
9192
var background = new_content.background.get_data<unowned Background> ("delegate");
9293

9394
if (background.is_loaded) {
94-
new_content.rounded_clip_radius = Utils.scale_to_int (6, wm.get_display ().get_monitor_scale (monitor_index));
95+
if (rounded_corners) {
96+
new_content.rounded_clip_radius = Utils.scale_to_int (6, wm.get_display ().get_monitor_scale (monitor_index));
97+
}
98+
9599
swap_background_actor (animate);
96100
return;
97101
}
@@ -101,8 +105,11 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
101105
background.disconnect (handler);
102106
background.set_data<ulong> ("background-loaded-handler", 0);
103107

108+
if (rounded_corners) {
109+
new_content.rounded_clip_radius = Utils.scale_to_int (6, wm.get_display ().get_monitor_scale (monitor_index));
110+
}
111+
104112
swap_background_actor (animate);
105-
new_content.rounded_clip_radius = Utils.scale_to_int (6, wm.get_display ().get_monitor_scale (monitor_index));
106113
});
107114
background.set_data<ulong> ("background-loaded-handler", handler);
108115
}

src/DesktopIntegration.vala

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public class Gala.DesktopIntegration : GLib.Object {
4444
return false;
4545
}
4646

47+
if (ShellClientsManager.get_instance ().is_positioned_window (window)) {
48+
return false;
49+
}
50+
4751
switch (window.get_window_type ()) {
4852
case Meta.WindowType.NORMAL:
4953
case Meta.WindowType.DIALOG:

src/ScreenshotManager.vala

+20-7
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ namespace Gala {
300300
return Environment.get_home_dir ();
301301
}
302302

303-
private static async bool save_image (Cairo.ImageSurface image, string filename, float scale, out string used_filename) {
303+
private async bool save_image (Cairo.ImageSurface image, string filename, float scale, out string used_filename) {
304304
return (filename != "")
305305
? yield save_image_to_file (image, filename, scale, out used_filename)
306306
: save_image_to_clipboard (image, filename, out used_filename);
@@ -342,19 +342,32 @@ namespace Gala {
342342
}
343343
}
344344

345-
private static bool save_image_to_clipboard (Cairo.ImageSurface image, string filename, out string used_filename) {
345+
private bool save_image_to_clipboard (Cairo.ImageSurface image, string filename, out string used_filename) {
346346
used_filename = filename;
347347

348-
unowned Gdk.Display display = Gdk.Display.get_default ();
349-
unowned Gtk.Clipboard clipboard = Gtk.Clipboard.get_default (display);
350-
351348
var screenshot = Gdk.pixbuf_get_from_surface (image, 0, 0, image.get_width (), image.get_height ());
352349
if (screenshot == null) {
353-
warning ("could not save screenshot to clipboard: null pixbuf");
350+
warning ("Could not save screenshot to clipboard: null pixbuf");
351+
return false;
352+
}
353+
354+
uint8[] buffer;
355+
try {
356+
screenshot.save_to_buffer (out buffer, "png");
357+
} catch (Error e) {
358+
warning ("Could not save screenshot to clipboard: failed to save image to buffer: %s", e.message);
359+
return false;
360+
}
361+
362+
try {
363+
unowned var selection = wm.get_display ().get_selection ();
364+
var source = new Meta.SelectionSourceMemory ("image/png", new GLib.Bytes.take (buffer));
365+
selection.set_owner (Meta.SelectionType.SELECTION_CLIPBOARD, source);
366+
} catch (Error e) {
367+
warning ("Could not save screenshot to clipboard: failed to create new Meta.SelectionSourceMemory: %s", e.message);
354368
return false;
355369
}
356370

357-
clipboard.set_image (screenshot);
358371
return true;
359372
}
360373

src/Widgets/MultitaskingView.vala

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace Gala {
8686
brightness_effect = new Clutter.BrightnessContrastEffect ();
8787
update_brightness_effect ();
8888

89-
var blurred_bg = new BackgroundManager (wm, display.get_primary_monitor ());
89+
var blurred_bg = new BackgroundManager (wm, display.get_primary_monitor (), true, false);
9090
blurred_bg.add_effect (new BlurEffect (blurred_bg, 18));
9191
blurred_bg.add_effect (brightness_effect);
9292

src/Widgets/WorkspaceClone.vala

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ namespace Gala {
3131
Object (
3232
wm: wm,
3333
monitor_index: wm.get_display ().get_primary_monitor (),
34-
control_position: false
34+
control_position: false,
35+
rounded_corners: true
3536
);
3637
}
3738

src/WindowManager.vala

+7-3
Original file line numberDiff line numberDiff line change
@@ -2017,13 +2017,17 @@ namespace Gala {
20172017
var from_has_fullscreened = false;
20182018

20192019
// collect all windows and put them in the appropriate containers
2020-
foreach (unowned Meta.WindowActor actor in display.get_window_actors ()) {
2020+
var slist = new GLib.SList<Meta.Window> ();
2021+
display.list_all_windows ().@foreach ((win) => {
2022+
slist.append (win);
2023+
});
2024+
foreach (unowned var window in display.sort_windows_by_stacking (slist)) {
2025+
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
2026+
20212027
if (actor.is_destroyed ()) {
20222028
continue;
20232029
}
20242030

2025-
unowned var window = actor.get_meta_window ();
2026-
20272031
if (!window.showing_on_its_workspace () ||
20282032
move_primary_only && !window.is_on_primary_monitor () ||
20292033
window == moving ||

src/Zoom.vala

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class Gala.Zoom : Object {
115115
// Nothing to do if zooming out of our bounds is requested
116116
if ((current_zoom <= MIN_ZOOM && delta < 0) || (current_zoom >= MAX_ZOOM && delta >= 0)) {
117117
if (play_sound) {
118-
Gdk.beep ();
118+
Clutter.get_default_backend ().get_default_seat ().bell_notify ();
119119
}
120120
return;
121121
}

vapi/libmutter.vapi

+1-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ namespace Meta {
792792
[CCode (cheader_filename = "meta/meta-selection-source-memory.h", type_id = "meta_selection_source_memory_get_type ()")]
793793
public sealed class SelectionSourceMemory : Meta.SelectionSource {
794794
[CCode (has_construct_function = false, type = "MetaSelectionSource*")]
795-
public SelectionSourceMemory (string mimetype, GLib.Bytes content);
795+
public SelectionSourceMemory (string mimetype, GLib.Bytes content) throws GLib.Error;
796796
}
797797
[CCode (cheader_filename = "meta/meta-settings.h", has_type_id = false)]
798798
[Compact]

0 commit comments

Comments
 (0)