aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hawthorn <john@freerunningtechnologies.com>2014-01-31 11:18:47 -0800
committerJohn Hawthorn <john@freerunningtechnologies.com>2014-01-31 11:18:47 -0800
commitac61822e72b401a37b26e77b2c2b716e21ba46b7 (patch)
treebc1390cc273b190a393bd7d26a12d1ca6aa19189
parent0c7a2ee97ee862fd9d50b0aabab3cf97425d7daf (diff)
parent0c55ec7edac2a4ffaba9eb617a5de2ca197b4bbe (diff)
downloadmirror-meh-ac61822e72b401a37b26e77b2c2b716e21ba46b7.tar.gz
mirror-meh-ac61822e72b401a37b26e77b2c2b716e21ba46b7.tar.bz2
mirror-meh-ac61822e72b401a37b26e77b2c2b716e21ba46b7.zip
Merge pull request #8 from guillerodriguez/master
Fixes for use without window manager
-rw-r--r--src/xlib.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/xlib.c b/src/xlib.c
index ebc3a4c..07b50d6 100644
--- a/src/xlib.c
+++ b/src/xlib.c
@@ -184,8 +184,8 @@ void backend_init(){
backend_setaspect(1, 1);
gc = XCreateGC(display, window, 0, NULL);
- XMapRaised(display, window);
XSelectInput(display, window, StructureNotifyMask | ExposureMask | KeyPressMask);
+ XMapRaised(display, window);
XFlush(display);
XSetIOErrorHandler(xquit);
XFlush(display);
@@ -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;