Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scale-monitor-framebuffer inconsistencies #534

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/components/applications.js
Original file line number Diff line number Diff line change
@@ -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, _) {
Expand Down Expand Up @@ -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
};
}

Expand Down Expand Up @@ -532,4 +547,4 @@ export const ApplicationsBlur = class ApplicationsBlur {
if (this.settings.DEBUG)
console.log(`[Blur my Shell > applications] ${str}`);
}
};
};