Skip to content

Commit

Permalink
Fix fullscreen/unfullscreen not handle correctly when trigger by wind…
Browse files Browse the repository at this point in the history
…ow manager

Expect handling from accel-key fullscreen toggle, also handle from window state changed.

Because if you bind same accel-key for fullscreen in window manager, you will not trigger it
from Guake toggle fullscreen, instead from wm.

This should fix wierd window size & position when first using Guake fullscreen toggle, then
toggle fullscreen by wm hotkey.
  • Loading branch information
mlouielu authored and gsemet committed May 13, 2019
1 parent ff5490e commit 5205ce2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,9 @@ def is_iconified(self):
return False

def window_event(self, window, event):
state = event.new_window_state
log.debug("Received window state event: %s", state)
window_state = event.new_window_state
self.fullscreen_manager.set_window_state(window_state)
log.debug("Received window state event: %s", window_state)

def show_hide(self, *args):
"""Toggles the main window visibility
Expand Down
11 changes: 11 additions & 0 deletions guake/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,21 @@ def __init__(self, settings, window, guake=None):
self.settings = settings
self.window = window
self.guake = guake
self.window_state = None

def is_fullscreen(self):
return getattr(self.window, self.FULLSCREEN_ATTR, False)

def set_window_state(self, window_state):
self.window_state = window_state
setattr(self.window, self.FULLSCREEN_ATTR, bool(window_state & Gdk.WindowState.FULLSCREEN))

if not window_state & Gdk.WindowState.WITHDRAWN:
if self.is_fullscreen():
self.fullscreen()
else:
self.unfullscreen()

def fullscreen(self):
self.window.fullscreen()
setattr(self.window, self.FULLSCREEN_ATTR, True)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixes:
- Fix fullscreen/unfullscreen not handle correctly when trigger by wm

3 comments on commit 5205ce2

@tytan652
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to cause this #1720

@VintageCake
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks the "Appear on mouse display" feature when using multi-monitor setups, see #1720, #1738.

@AurelReb
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on i3wm, this commit breaks placement. Every toggle of guake moves the terminal slightly down-right its previous position

Please sign in to comment.