Remove deprecated Gdk.Screen methods

height() and weidth() is not supported any more
This commit is contained in:
Philipp Hörist 2017-12-17 22:29:30 +01:00
parent e3effdcb6c
commit f4a6b0299a
2 changed files with 13 additions and 6 deletions

View File

@ -3177,11 +3177,12 @@ class PopupNotificationWindow:
window_width, self.window_height = self.window.get_size() window_width, self.window_height = self.window.get_size()
app.interface.roster.popups_notification_height += self.window_height app.interface.roster.popups_notification_height += self.window_height
pos_x = app.config.get('notification_position_x') pos_x = app.config.get('notification_position_x')
screen_w, screen_h = gtkgui_helpers.get_display_geometry()
if pos_x < 0: if pos_x < 0:
pos_x = Gdk.Screen.width() - window_width + pos_x + 1 pos_x = screen_w - window_width + pos_x + 1
pos_y = app.config.get('notification_position_y') pos_y = app.config.get('notification_position_y')
if pos_y < 0: if pos_y < 0:
pos_y = Gdk.Screen.height() - \ pos_y = screen_h - \
app.interface.roster.popups_notification_height + pos_y + 1 app.interface.roster.popups_notification_height + pos_y + 1
self.window.move(pos_x, pos_y) self.window.move(pos_x, pos_y)
@ -3213,8 +3214,9 @@ class PopupNotificationWindow:
current_index += 1 current_index += 1
window_width, window_height = window_instance.window.get_size() window_width, window_height = window_instance.window.get_size()
app.interface.roster.popups_notification_height += window_height app.interface.roster.popups_notification_height += window_height
window_instance.window.move(Gdk.Screen.width() - window_width, screen_w, screen_h = gtkgui_helpers.get_display_geometry()
Gdk.Screen.height() - \ window_instance.window.move(screen_w - window_width,
screen_h - \
app.interface.roster.popups_notification_height) app.interface.roster.popups_notification_height)
def on_popup_notification_window_button_press_event(self, widget, event): def on_popup_notification_window_button_press_event(self, widget, event):

View File

@ -99,8 +99,11 @@ if os.name == 'nt':
from gajim.common import helpers from gajim.common import helpers
screen_w = Gdk.Screen.width() def get_display_geometry():
screen_h = Gdk.Screen.height() display = Gdk.Display.get_default()
monitor = display.get_monitor(0)
geometry = monitor.get_geometry()
return geometry.width, geometry.height
def add_image_to_button(button, icon_name): def add_image_to_button(button, icon_name):
img = Gtk.Image() img = Gtk.Image()
@ -171,6 +174,7 @@ def move_window(window, x, y):
""" """
Move the window, but also check if out of screen Move the window, but also check if out of screen
""" """
screen_w, screen_h = get_display_geometry()
if x < 0: if x < 0:
x = 0 x = 0
if y < 0: if y < 0:
@ -186,6 +190,7 @@ def resize_window(window, w, h):
""" """
Resize window, but also checks if huge window or negative values Resize window, but also checks if huge window or negative values
""" """
screen_w, screen_h = get_display_geometry()
if not w or not h: if not w or not h:
return return
if w > screen_w: if w > screen_w: