From c1b88634e515ae55af56606ac4ab6e8971ea6e58 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sat, 28 Mar 2020 18:06:23 -0400 Subject: [PATCH] Fix deprecation warning about Gdk.Screen [Gdk.Screen.width()](https://lazka.github.io/pgi-docs/#Gdk-3.0/classes/Screen.html#Gdk.Screen.width) and [.height()](https://lazka.github.io/pgi-docs/#Gdk-3.0/classes/Screen.html#Gdk.Screen.height) are deprecated since 3.22. The equivalent solution is to get the first monitor of the default display. --- src/usr/bin/diffuse | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 46768be..58412eb 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -7423,11 +7423,14 @@ class Diffuse(Gtk.Window): # number of created viewers (used to label some tabs) self.viewer_count = 0 + # get monitor resolution + monitor_geometry = Gdk.Display.get_default().get_monitor(0).get_geometry() + # state information that should persist across sessions self.bool_state = { 'window_maximized': False, 'search_matchcase': False, 'search_backwards': False } self.int_state = { 'window_width': 1024, 'window_height': 768 } - self.int_state['window_x'] = max(0, (Gdk.Screen.width() - self.int_state['window_width']) / 2) - self.int_state['window_y'] = max(0, (Gdk.Screen.height() - self.int_state['window_height']) / 2) + self.int_state['window_x'] = max(0, (monitor_geometry.width - self.int_state['window_width']) / 2) + self.int_state['window_y'] = max(0, (monitor_geometry.height - self.int_state['window_height']) / 2) self.connect('configure-event', self.configure_cb) self.connect('window-state-event', self.window_state_cb)