diff --git a/js/ui/realms/realmLabels.js b/js/ui/realms/realmLabels.js index 62d332e3c..28cbb0f10 100644 --- a/js/ui/realms/realmLabels.js +++ b/js/ui/realms/realmLabels.js @@ -376,7 +376,7 @@ const RealmWindowLabel = GObject.registerClass( // applies the geometry scale factor to its children itself, see // meta_window_actor_set_geometry_scale()), make sure we don't apply // 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; 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 buffer_rect = window.get_buffer_rect(); - let offsetX = frame_rect.x - buffer_rect.x; - let offsetY = frame_rect.y - buffer_rect.y; - this.set_position(offsetX + 4, offsetY + 4); + let positionX = (frame_rect.x - buffer_rect.x) + 4; + let positionY = (frame_rect.y - buffer_rect.y) + 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) { @@ -397,8 +403,8 @@ const RealmWindowLabel = GObject.registerClass( this.hide(); } else { this.show(); - this._updatePosition(window); } + this._updatePosition(window); } _resendEvent(event) {