Window drag offset fix

This commit is contained in:
itdominator 2023-04-21 23:40:29 -05:00
parent c59b538236
commit 72913ebe78
1 changed files with 9 additions and 4 deletions

View File

@ -22,8 +22,8 @@ class BodyGrid(Gtk.Grid):
self._update_block = False self._update_block = False
self._drag_start_x = 0 self._drag_start_x = 0
self._drag_start_y = 0 self._drag_start_y = 0
self._current_x, \ self._current_x = 0
self._current_y = window.get_position() self._current_y = 0
self._w1 = 0.0 self._w1 = 0.0
self._h1 = 0.0 self._h1 = 0.0
@ -93,6 +93,11 @@ class BodyGrid(Gtk.Grid):
self._is_dragging = True self._is_dragging = True
self._drag_start_x = eve.x_root self._drag_start_x = eve.x_root
self._drag_start_y = eve.y_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._w1 = self._window.get_size()[0] # Ref window width
self._h1 = self._window.get_size()[1] # Ref window height self._h1 = self._window.get_size()[1] # Ref window height
@ -137,9 +142,9 @@ class BodyGrid(Gtk.Grid):
else: else:
self._current_y = self._current_y 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._update_block = True
self._window.move(self._current_x, self._current_y) self._window.move(self._current_x, self._current_y)