@@ -94,6 +94,9 @@ export default class KandoIntegration extends Extension {
9494 // This is used to get the desktop's text scaling factor.
9595 this . _shellSettings = new Gio . Settings ( { schema : 'org.gnome.desktop.interface' } ) ;
9696
97+ // This is used to get whether fractional scaling is enabled.
98+ this . _mutterSettings = new Gio . Settings ( { schema : 'org.gnome.mutter' } ) ;
99+
97100 this . _dbus = Gio . DBusExportedObject . wrapJSObject ( DBUS_INTERFACE , this ) ;
98101 this . _dbus . export ( Gio . DBus . session , '/org/gnome/shell/extensions/KandoIntegration' ) ;
99102
@@ -147,7 +150,8 @@ export default class KandoIntegration extends Extension {
147150
148151 Main . wm . _shouldAnimateActor = this . _origShouldAnimateActor ;
149152
150- this . _shellSettings = null ;
153+ this . _shellSettings = null ;
154+ this . _mutterSettings = null ;
151155
152156 this . _dbus . flush ( ) ;
153157 this . _dbus . unexport ( ) ;
@@ -214,6 +218,19 @@ export default class KandoIntegration extends Extension {
214218 const workArea = workspace . get_work_area_for_monitor ( monitor ) ;
215219
216220 const scalingFactor = this . _shellSettings . get_double ( 'text-scaling-factor' ) ;
221+ const features = this . _mutterSettings . get_strv ( 'experimental-features' ) ;
222+
223+ // If fractional scaling is disabled, the coordinates we get from global.get_pointer()
224+ // are already scaled. If it's enabled, we need to scale them manually.
225+ if ( ! features . includes ( 'scale-monitor-framebuffer' ) ) {
226+ const monitorScale = global . display . get_monitor_scale ( monitor ) ;
227+ x /= monitorScale ;
228+ y /= monitorScale ;
229+ workArea . x /= monitorScale ;
230+ workArea . y /= monitorScale ;
231+ workArea . width /= monitorScale ;
232+ workArea . height /= monitorScale ;
233+ }
217234
218235 return [
219236 windowName , windowClass , Math . round ( x / scalingFactor ) ,
0 commit comments