ibus-candidate-popup: Scale coordinates from IBus
The coordinates are effectively in the windowing system coordinate space, which when scaling Xwayland, we need to scale these. Do this with the Meta.Window.protocol_to_stage() function on the focused window, which handles it correctly for the corresponding windowing system and configuration. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3458>
This commit is contained in:
parent
df53f8d6f1
commit
6982f2daae
@ -1,6 +1,7 @@
|
|||||||
import Clutter from 'gi://Clutter';
|
import Clutter from 'gi://Clutter';
|
||||||
import GObject from 'gi://GObject';
|
import GObject from 'gi://GObject';
|
||||||
import IBus from 'gi://IBus';
|
import IBus from 'gi://IBus';
|
||||||
|
import Mtk from 'gi://Mtk';
|
||||||
import St from 'gi://St';
|
import St from 'gi://St';
|
||||||
|
|
||||||
import * as BoxPointer from './boxpointer.js';
|
import * as BoxPointer from './boxpointer.js';
|
||||||
@ -203,14 +204,29 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
||||||
this._setDummyCursorGeometry(x, y, w, h);
|
const focusWindow = global.display.focus_window;
|
||||||
|
let rect = new Mtk.Rectangle({x, y, width: w, height: h});
|
||||||
|
if (!global.stage.key_focus && focusWindow)
|
||||||
|
rect = focusWindow.protocol_to_stage_rect(rect);
|
||||||
|
this._setDummyCursorGeometry(
|
||||||
|
rect.x,
|
||||||
|
rect.y,
|
||||||
|
rect.width,
|
||||||
|
rect.height);
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
panelService.connect('set-cursor-location-relative', (ps, x, y, w, h) => {
|
panelService.connect('set-cursor-location-relative', (ps, x, y, w, h) => {
|
||||||
if (!global.display.focus_window)
|
const focusWindow = global.display.focus_window;
|
||||||
|
if (!focusWindow)
|
||||||
return;
|
return;
|
||||||
let window = global.display.focus_window.get_compositor_private();
|
let rect = new Mtk.Rectangle({x, y, width: w, height: h});
|
||||||
this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
|
rect = focusWindow.protocol_to_stage_rect(rect);
|
||||||
|
const windowActor = focusWindow.get_compositor_private();
|
||||||
|
this._setDummyCursorGeometry(
|
||||||
|
windowActor.x + rect.x,
|
||||||
|
windowActor.y + rect.y,
|
||||||
|
rect.w,
|
||||||
|
rect.h);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Only recent IBus versions have support for this signal
|
// Only recent IBus versions have support for this signal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user