Skip to content

Commit

Permalink
* don't re-set window decorations for modal windows (this is what gtk…
Browse files Browse the repository at this point in the history
… does)

* don't set SYSMENU (and min max) if the window does not have CAPTION

git-svn-id: https://xpra.org/svn/Xpra/trunk@11284 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 18, 2015
1 parent e993966 commit c68a436
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/xpra/platform/win32/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,24 @@ def fixup_window_style(self, *args):
if not hwnd:
return
try:
#warning: accessing "_metadata" on the client window class is fugly..
metadata = getattr(self, "_metadata", {})
if metadata.get("modal", False):
#window is not / no longer meant to be decorated
#(this is what GTK does for modal windows - keep it consistent)
return
cur_style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE)
#re-add taskbar menu:
style = cur_style
style |= win32con.WS_SYSMENU
style |= win32con.WS_MAXIMIZEBOX
#can always minimize:
style |= win32con.WS_MINIMIZEBOX
if style!=cur_style:
log("fixup_window_style() using %s (%#x) instead of %s (%#x) on window %#x", style_str(style), style, style_str(cur_style), cur_style, hwnd)
win32gui.SetWindowLong(hwnd, win32con.GWL_STYLE, style)
else:
log("fixup_window_style() unchanged style %s (%#x) on window %#x", style_str(style), style, hwnd)
if cur_style & win32con.WS_CAPTION:
style |= win32con.WS_SYSMENU
style |= win32con.WS_MAXIMIZEBOX
style |= win32con.WS_MINIMIZEBOX
if style!=cur_style:
log("fixup_window_style() using %s (%#x) instead of %s (%#x) on window %#x with metadata=%s", style_str(style), style, style_str(cur_style), cur_style, hwnd, metadata)
win32gui.SetWindowLong(hwnd, win32con.GWL_STYLE, style)
else:
log("fixup_window_style() unchanged style %s (%#x) on window %#x", style_str(style), style, hwnd)
except:
log.warn("failed to fixup window style", exc_info=True)

Expand Down

0 comments on commit c68a436

Please sign in to comment.