blob: 32afb15a44e5b740b51bf1c391b9262a4742820f [file] [log] [blame]
From b4a6a1c4dd8010ea4bf20567573fd91dae2d3432 Mon Sep 17 00:00:00 2001
From: Daniel Kurtz <djkurtz@chromium.org>
Date: Tue, 21 Jan 2014 00:10:13 +0800
Subject: [PATCH] native-state-x11: Don't terminate --fullscreen if EWMH Atom
not found
If the Atom "_NET_WM_STATE_FULLSCREEN" is not defined in the X server, it
could mean that the active Window Manager is not EWMH compliant, or that
there is no window manager at all. In this case, the XChangeProperty
will fail and the program will terminate with the message:
X Error of failed request: BadAtom (invalid Atom parameter)
Major opcode of failed request: 18 (X_ChangeProperty)
Atom id in failed request: 0x0
Serial number of failed request: 28
Current serial number in output stream: 30
Instead, if the Atom doesn't exist, don't call XChangeProperty, just log
a message and keep going. The window will still be fullscreen, it just
may still have decorations.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
src/native-state-x11.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/native-state-x11.cpp b/src/native-state-x11.cpp
index 9351178..3b66b77 100644
--- a/src/native-state-x11.cpp
+++ b/src/native-state-x11.cpp
@@ -139,12 +139,17 @@ NativeStateX11::create_window(WindowProperties const& properties)
}
/* set hints and properties */
+ Atom fs_atom = None;
if (properties_.fullscreen) {
- Atom atom = XInternAtom(xdpy_, "_NET_WM_STATE_FULLSCREEN", True);
+ fs_atom = XInternAtom(xdpy_, "_NET_WM_STATE_FULLSCREEN", True);
+ if (fs_atom == None)
+ Log::debug("Warning: Could not set EWMH Fullscreen hint.\n");
+ }
+ if (fs_atom != None) {
XChangeProperty(xdpy_, xwin_,
XInternAtom(xdpy_, "_NET_WM_STATE", True),
XA_ATOM, 32, PropModeReplace,
- reinterpret_cast<unsigned char*>(&atom), 1);
+ reinterpret_cast<unsigned char*>(&fs_atom), 1);
}
else {
XSizeHints sizehints;
--
1.8.5.3