summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2019-06-12 16:57:48 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2019-06-12 16:57:48 +0100
commite1c4069a72fbf23ecfacaec04330ed4fc6e7271a (patch)
tree9995495308fadd5123bd188cfdfbbb11f66b961c
parenta2dee79439a6ecc05b36e55eaeb350f90e13e831 (diff)
downloaddeluge-e1c4069a72fbf23ecfacaec04330ed4fc6e7271a.tar.gz
deluge-e1c4069a72fbf23ecfacaec04330ed4fc6e7271a.tar.bz2
deluge-e1c4069a72fbf23ecfacaec04330ed4fc6e7271a.zip
[Gtk] Refactor presenting window
Include the correct usage for other display servers. Still not sure how to get the proper timestamp for Wayland or Quartz but I read that using 0 equals the GDK_CURRENT_TIME which suffices for now.
-rw-r--r--deluge/ui/gtk3/addtorrentdialog.py8
-rw-r--r--deluge/ui/gtk3/mainwindow.py11
2 files changed, 15 insertions, 4 deletions
diff --git a/deluge/ui/gtk3/addtorrentdialog.py b/deluge/ui/gtk3/addtorrentdialog.py
index f987c9d50..9ede71023 100644
--- a/deluge/ui/gtk3/addtorrentdialog.py
+++ b/deluge/ui/gtk3/addtorrentdialog.py
@@ -176,11 +176,17 @@ class AddTorrentDialog(component.Component):
self.dialog.set_transient_for(None)
self.dialog.set_position(Gtk.WindowPosition.CENTER)
- self.dialog.present()
if focus:
timestamp = main_window.get_timestamp()
if windowing('X11'):
+ # Use present with X11 set_user_time since
+ # present_with_time is inconsistent.
+ self.dialog.present()
self.dialog.get_window().set_user_time(timestamp)
+ else:
+ self.dialog.present_with_time(timestamp)
+ else:
+ self.dialog.present()
def hide(self):
self.dialog.hide()
diff --git a/deluge/ui/gtk3/mainwindow.py b/deluge/ui/gtk3/mainwindow.py
index 2bdc6a91b..5b4240c6a 100644
--- a/deluge/ui/gtk3/mainwindow.py
+++ b/deluge/ui/gtk3/mainwindow.py
@@ -178,9 +178,14 @@ class MainWindow(component.Component):
def restore():
# Restore the proper x,y coords for the window prior to showing it
component.resume(self.child_components)
- self.window.present()
- if GdkX11:
- self.window.get_window().set_user_time(self.get_timestamp())
+ timestamp = self.get_timestamp()
+ if windowing('X11'):
+ # Use present with X11 set_user_time since
+ # present_with_time is inconsistent.
+ self.window.present()
+ self.window.get_window().set_user_time(timestamp)
+ else:
+ self.window.present_with_time(timestamp)
self.load_window_state()
if self.config['lock_tray'] and not self.visible():