Skip to content

Commit c668105

Browse files
committed
app/window: get monitor scale through D-Bus, don't trust Gdk
1 parent 097d317 commit c668105

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ddterm/app/appwindow.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -593,20 +593,20 @@ class DDTermAppWindow extends Gtk.ApplicationWindow {
593593
if (!rect)
594594
return;
595595

596-
let [target_x, target_y, target_w, target_h] = rect;
596+
let [, , target_w, target_h] = rect;
597597

598598
if (this.display_config.layout_mode !== LayoutMode.LOGICAL) {
599-
const display = this.get_display();
600-
const target_monitor = display.get_monitor_at_point(target_x, target_y);
599+
const scale = this.extension_dbus.TargetMonitorScale;
601600

602-
target_w = Math.floor(target_w / target_monitor.scale_factor);
603-
target_h = Math.floor(target_h / target_monitor.scale_factor);
601+
if (!scale)
602+
return;
603+
604+
target_w = Math.floor(target_w / scale);
605+
target_h = Math.floor(target_h / scale);
604606
}
605607

606608
this.resize(target_w, target_h);
607-
608-
if (this.window)
609-
this.window.resize(target_w, target_h);
609+
this.window?.resize(target_w, target_h);
610610
}
611611

612612
update_tab_label_width() {

0 commit comments

Comments
 (0)