Position and scale label correctly for hipdi on wayland

This commit is contained in:
Bruce Leidl 2025-05-14 18:48:56 +00:00
parent 652b89c1c6
commit a8447b5dca

View File

@ -376,7 +376,7 @@ const RealmWindowLabel = GObject.registerClass(
// applies the geometry scale factor to its children itself, see // applies the geometry scale factor to its children itself, see
// meta_window_actor_set_geometry_scale()), make sure we don't apply // meta_window_actor_set_geometry_scale()), make sure we don't apply
// the factor twice in the end. // the factor twice in the end.
if (this._actor.metaWindow.get_client_type() !== Meta.WindowClientType.WAYLAND) if (this._actor.metaWindow && this._actor.metaWindow.get_client_type() !== Meta.WindowClientType.WAYLAND)
return; return;
let {scaleFactor} = St.ThemeContext.get_for_stage(global.stage); let {scaleFactor} = St.ThemeContext.get_for_stage(global.stage);
@ -387,9 +387,15 @@ const RealmWindowLabel = GObject.registerClass(
let frame_rect = window.get_frame_rect(); let frame_rect = window.get_frame_rect();
let buffer_rect = window.get_buffer_rect(); let buffer_rect = window.get_buffer_rect();
let offsetX = frame_rect.x - buffer_rect.x; let positionX = (frame_rect.x - buffer_rect.x) + 4;
let offsetY = frame_rect.y - buffer_rect.y; let positionY = (frame_rect.y - buffer_rect.y) + 4;
this.set_position(offsetX + 4, offsetY + 4);
if (this._actor.metaWindow && this._actor.metaWindow.get_client_type() === Meta.WindowClientType.WAYLAND) {
let {scaleFactor} = St.ThemeContext.get_for_stage(global.stage);
positionX /= scaleFactor;
positionY /= scaleFactor;
}
this.set_position(positionX, positionY);
} }
_update(window) { _update(window) {
@ -397,8 +403,8 @@ const RealmWindowLabel = GObject.registerClass(
this.hide(); this.hide();
} else { } else {
this.show(); this.show();
this._updatePosition(window);
} }
this._updatePosition(window);
} }
_resendEvent(event) { _resendEvent(event) {