summaryrefslogtreecommitdiff
path: root/pugl/pugl_x11.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-01-27 17:16:47 +0000
committerDavid Robillard <d@drobilla.net>2014-01-27 17:16:47 +0000
commit69be0a7d6ed810faf6d5090c826df72c58b874f3 (patch)
treea6b1522181e79f9957e023d7c96f6bff018c4b5c /pugl/pugl_x11.c
parenta983550a464d14ec2a79fa93021b2f02b64d20fa (diff)
Require PUGL_VERBOSE to be defined for logging.
Add X focus grab hack from Robin Gareus.
Diffstat (limited to 'pugl/pugl_x11.c')
-rw-r--r--pugl/pugl_x11.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index c25b273..8e1de69 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -90,15 +90,15 @@ puglCreate(PuglNativeWindow parent,
if (!vi) {
vi = glXChooseVisual(impl->display, impl->screen, attrListSgl);
impl->doubleBuffered = False;
- printf("singlebuffered rendering will be used, no doublebuffering available\n");
+ PUGL_LOG("No double buffering available\n");
} else {
impl->doubleBuffered = True;
- printf("doublebuffered rendering available\n");
+ PUGL_LOG("Double buffered rendering enabled\n");
}
int glxMajor, glxMinor;
glXQueryVersion(impl->display, &glxMajor, &glxMinor);
- printf("GLX-Version %d.%d\n", glxMajor, glxMinor);
+ PUGL_LOGF("GLX Version %d.%d\n", glxMajor, glxMinor);
impl->ctx = glXCreateContext(impl->display, vi, 0, GL_TRUE);
@@ -116,6 +116,9 @@ puglCreate(PuglNativeWindow parent,
attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask
| ButtonPressMask | ButtonReleaseMask
+#ifdef XKEYFOCUSGRAB
+ | EnterWindowMask
+#endif
| PointerMotionMask | StructureNotifyMask;
impl->win = XCreateWindow(
@@ -148,9 +151,9 @@ puglCreate(PuglNativeWindow parent,
}
if (glXIsDirect(impl->display, impl->ctx)) {
- printf("DRI enabled\n");
+ PUGL_LOG("DRI enabled (to disable, set LIBGL_ALWAYS_INDIRECT=1\n");
} else {
- printf("No DRI available\n");
+ PUGL_LOG("No DRI available\n");
}
XFree(vi);
@@ -361,6 +364,14 @@ puglProcessEvents(PuglView* view)
}
}
break;
+#ifdef PUGL_GRAB_FOCUS
+ case EnterNotify:
+ XSetInputFocus(view->impl->display,
+ view->impl->win,
+ RevertToPointerRoot,
+ CurrentTime);
+ break;
+#endif
default:
break;
}