Dont move window between virtual desktops

Its the job of the window manager to restore a window to the correct
location
This commit is contained in:
Philipp Hörist 2018-09-18 16:28:33 +02:00
parent 31a500245f
commit 6b54863157
3 changed files with 6 additions and 45 deletions

View File

@ -316,39 +316,6 @@ def get_current_desktop(window):
current_virtual_desktop_no = prop[2][0] current_virtual_desktop_no = prop[2][0]
return current_virtual_desktop_no return current_virtual_desktop_no
def possibly_move_window_in_current_desktop(window):
"""
Moves GTK window to current virtual desktop if it is not in the current
virtual desktop
NOTE: Window is a GDK window.
"""
#TODO: property_get doesn't work:
#prop_atom = Gdk.Atom.intern('_NET_CURRENT_DESKTOP', False)
#type_atom = Gdk.Atom.intern("CARDINAL", False)
#w = Gdk.Screen.get_default().get_root_window()
#Gdk.property_get(w, prop_atom, type_atom, 0, 9999, False)
return False
if os.name == 'nt':
return False
root_window = Gdk.Screen.get_default().get_root_window()
# current user's vd
current_virtual_desktop_no = get_current_desktop(root_window)
# vd roster window is in
window_virtual_desktop = get_current_desktop(window.window)
# if one of those is None, something went wrong and we cannot know
# VD info, just hide it (default action) and not show it afterwards
if None not in (window_virtual_desktop, current_virtual_desktop_no):
if current_virtual_desktop_no != window_virtual_desktop:
# we are in another VD that the window was
# so show it in current VD
window.present()
return True
return False
def file_is_locked(path_to_file): def file_is_locked(path_to_file):
""" """
Return True if file is locked Return True if file is locked

View File

@ -114,7 +114,6 @@ class PluginsWindow:
app.plugin_manager.gui_extension_point('plugin_window', self) app.plugin_manager.gui_extension_point('plugin_window', self)
self.window.show_all() self.window.show_all()
gtkgui_helpers.possibly_move_window_in_current_desktop(self.window)
def on_key_press_event(self, widget, event): def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape: if event.keyval == Gdk.KEY_Escape:

View File

@ -368,17 +368,12 @@ class StatusIcon:
win = app.interface.roster.window win = app.interface.roster.window
if not app.events.get_systray_events(): if not app.events.get_systray_events():
# No pending events, so toggle visible/hidden for roster window # No pending events, so toggle visible/hidden for roster window
if win.get_property('visible') and (win.get_property( if win.get_property('visible'):
'has-toplevel-focus') or os.name == 'nt'): if win.get_property('has-toplevel-focus') or os.name == 'nt':
# visible in ANY virtual desktop? if app.config.get('save-roster-position'):
x, y = win.get_position()
# we could be in another VD right now. eg vd2 app.config.set('roster_x-position', x)
# and we want to show it in vd2 app.config.set('roster_y-position', y)
if not gtkgui_helpers.possibly_move_window_in_current_desktop(
win) and app.config.get('save-roster-position'):
x, y = win.get_position()
app.config.set('roster_x-position', x)
app.config.set('roster_y-position', y)
win.hide() # else we hide it from VD that was visible in win.hide() # else we hide it from VD that was visible in
else: else:
if not win.get_property('visible'): if not win.get_property('visible'):