aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgrodriguez <guille.rodriguez@gmail.com>2014-01-31 10:20:36 +0100
committergrodriguez <guille.rodriguez@gmail.com>2014-01-31 10:20:36 +0100
commit0c55ec7edac2a4ffaba9eb617a5de2ca197b4bbe (patch)
treebc1390cc273b190a393bd7d26a12d1ca6aa19189 /src
parent051a91a1739e19981a7169afef7d85af4de8e62f (diff)
downloadmirror-meh-0c55ec7edac2a4ffaba9eb617a5de2ca197b4bbe.tar.gz
mirror-meh-0c55ec7edac2a4ffaba9eb617a5de2ca197b4bbe.tar.bz2
mirror-meh-0c55ec7edac2a4ffaba9eb617a5de2ca197b4bbe.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/xlib.c10
1 files changed, 10 insertions, 0 deletions
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;