diff --git a/src/components/applications.js b/src/components/applications.js index a368241d..b3863bb6 100644 --- a/src/components/applications.js +++ b/src/components/applications.js @@ -1,11 +1,14 @@ import Shell from 'gi://Shell'; import Clutter from 'gi://Clutter'; import Meta from 'gi://Meta'; +import Gio from 'gi://Gio' import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import { PaintSignals } from '../effects/paint_signals.js'; import { ApplicationsService } from '../dbus/services.js'; +const mutter_gsettings = new Gio.Settings({ schema: 'org.gnome.mutter' }); + export const ApplicationsBlur = class ApplicationsBlur { constructor(connections, settings, _) { @@ -416,15 +419,27 @@ export const ApplicationsBlur = class ApplicationsBlur { }); } + /// Compute the size and position for a blur actor. + /// If `scale-monitor-framebuffer` experimental feature if on, we don't need to manage scaling. + /// Else, on wayland, we need to divide by the scale to get the correct result. compute_allocation(meta_window) { + const scale_monitor_framebuffer = mutter_gsettings.get_strv('experimental-features') + .includes('scale-monitor-framebuffer'); + const is_wayland = Meta.is_wayland_compositor(); + const monitor_index = meta_window.get_monitor(); + // check if the window is using wayland, or xwayland/xorg for rendering + const scale = !scale_monitor_framebuffer && is_wayland && meta_window.get_client_type() == 0 + ? Main.layoutManager.monitors[monitor_index].geometry_scale + : 1; + let frame = meta_window.get_frame_rect(); let buffer = meta_window.get_buffer_rect(); return { - x: (frame.x - buffer.x), - y: (frame.y - buffer.y), - width: frame.width, - height: frame.height + x: (frame.x - buffer.x) / scale, + y: (frame.y - buffer.y) / scale, + width: frame.width / scale, + height: frame.height / scale }; } @@ -532,4 +547,4 @@ export const ApplicationsBlur = class ApplicationsBlur { if (this.settings.DEBUG) console.log(`[Blur my Shell > applications] ${str}`); } -}; \ No newline at end of file +};