- Fix placement window in GTK Scale above 1

- Fixes #189
This commit is contained in:
trigg 2022-04-15 14:35:41 +00:00
parent fa5a948197
commit 3239f4da15
2 changed files with 8 additions and 4 deletions

View file

@ -13,10 +13,12 @@
"""An X11 window which can be moved and resized"""
import gi
import cairo
import logging
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position
from gi.repository import Gtk, Gdk # nopep8
log = logging.getLogger(__name__)
class DraggableWindow(Gtk.Window):
"""An X11 window which can be moved and resized"""
@ -54,13 +56,12 @@ class DraggableWindow(Gtk.Window):
self.drag_y = 0
self.force_location()
self.show_all()
def force_location(self):
"""
Move the window to previously given co-ords.
Also double check sanity on layer & decorations
"""
self.set_decorated(False)
self.set_keep_above(True)
self.move(self.pos_x, self.pos_y)
@ -137,6 +138,9 @@ class DraggableWindow(Gtk.Window):
def get_coords(self):
"""Return window position and size"""
scale = self.get_scale_factor()
(pos_x, pos_y) = self.get_position()
(width, height) = self.get_size()
pos_x = pos_x / scale
pos_y = pos_y / scale
return (pos_x, pos_y, width, height)

View file

@ -74,8 +74,8 @@ class SettingsWindow(Gtk.VBox):
Hide for later
"""
if self.placement_window:
(pos_x, pos_y) = self.placement_window.get_position()
(width, height) = self.placement_window.get_size()
(pos_x, pos_y, width, height) = self.placement_window.get_coords()
self.floating_x = pos_x
self.floating_y = pos_y
self.floating_w = width