From 0c55ec7edac2a4ffaba9eb617a5de2ca197b4bbe Mon Sep 17 00:00:00 2001 From: grodriguez Date: Fri, 31 Jan 2014 10:20:36 +0100 Subject: Fix for use without window manager Handle MapNotify event to make sure we have valid width and height in case we never get a ConfigureNotify event (for example when there's no window manager) --- src/xlib.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xlib.c b/src/xlib.c index e46e358..07b50d6 100644 --- a/src/xlib.c +++ b/src/xlib.c @@ -226,6 +226,16 @@ void handlekeypress(XEvent *event){ void handleevent(XEvent *event){ switch(event->type){ + /* Might not get ConfigureNotify, for example if there's no window manager */ + case MapNotify: + if (!width || !height) + { + XWindowAttributes attr; + XGetWindowAttributes(event->xmap.display, event->xmap.window, &attr); + width = attr.width; + height = attr.height; + } + break; case ConfigureNotify: if(width != event->xconfigure.width || height != event->xconfigure.height){ width = event->xconfigure.width; -- cgit v1.2.3