From 72913ebe78ff5262ce640738671a129ef17cf65f Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Fri, 21 Apr 2023 23:40:29 -0500 Subject: [PATCH] Window drag offset fix --- src/new-src/core/widgets/region/body_grid.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/new-src/core/widgets/region/body_grid.py b/src/new-src/core/widgets/region/body_grid.py index aea24fc..da8808f 100644 --- a/src/new-src/core/widgets/region/body_grid.py +++ b/src/new-src/core/widgets/region/body_grid.py @@ -22,8 +22,8 @@ class BodyGrid(Gtk.Grid): self._update_block = False self._drag_start_x = 0 self._drag_start_y = 0 - self._current_x, \ - self._current_y = window.get_position() + self._current_x = 0 + self._current_y = 0 self._w1 = 0.0 self._h1 = 0.0 @@ -93,6 +93,11 @@ class BodyGrid(Gtk.Grid): self._is_dragging = True self._drag_start_x = eve.x_root self._drag_start_y = eve.y_root + + if self._current_x == 0: + self._current_x, \ + self._current_y = self._window.get_position() + self._w1 = self._window.get_size()[0] # Ref window width self._h1 = self._window.get_size()[1] # Ref window height @@ -137,9 +142,9 @@ class BodyGrid(Gtk.Grid): else: self._current_y = self._current_y + self._drag_start_x = eve.x_root + self._drag_start_y = eve.y_root - self._drag_start_x = self._current_x - self._drag_start_y = self._current_y self._update_block = True self._window.move(self._current_x, self._current_y)