diff options
author | Weseung Hwang <weseung@gmail.com> | 2011-01-25 16:12:21 -0800 |
---|---|---|
committer | Weseung Hwang <weseung@gmail.com> | 2011-01-25 16:12:21 -0800 |
commit | 7df02598f2484e213d31723390ed549419580dba (patch) | |
tree | ee2790576334f487715badd10c4893a987fcc67b | |
parent | 61e7dbfe8e955b7915ba1a61ed3ad368ea668566 (diff) |
Added tests for detecting cursor enter/leave events of the nested window. Also added a new logging functionality by using xf86DrvMsg(): to view this updating in real-time, execute: tail -F $PREFIX/var/log/Xorg.1.log
-rw-r--r-- | src/xlibclient.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/xlibclient.c b/src/xlibclient.c index 316e6e9..aeb27a4 100644 --- a/src/xlibclient.c +++ b/src/xlibclient.c @@ -111,11 +111,11 @@ NestedClientCreateScreen(int scrnIndex, XSetWMNormalHints(pPriv->display, pPriv->window, &sizeHints); XStoreName(pPriv->display, pPriv->window, "TTCCWN#123456"); - + XMapWindow(pPriv->display, pPriv->window); XSelectInput(pPriv->display, pPriv->window, ExposureMask | - PointerMotionMask); + PointerMotionMask | EnterWindowMask | LeaveWindowMask ); if (XShmQueryExtension(pPriv->display)) { if (XShmQueryVersion(pPriv->display, &shmMajor, &shmMinor, @@ -258,20 +258,30 @@ NestedClientTimerCallback(NestedClientPrivatePtr pPriv) { NestedClientUpdateScreen(pPriv, ((XExposeEvent*)&ev)->x, ((XExposeEvent*)&ev)->y, - ((XExposeEvent*)&ev)->x + ((XExposeEvent*)&ev)->width, - ((XExposeEvent*)&ev)->y + ((XExposeEvent*)&ev)->height); + ((XExposeEvent*)&ev)->x + + ((XExposeEvent*)&ev)->width, + ((XExposeEvent*)&ev)->y + + ((XExposeEvent*)&ev)->height); } if (ev.type == MotionNotify) { XDrawString(pPriv->display, pPriv->window, DefaultGC(pPriv->display, pPriv->screenNumber), - ((XMotionEvent*)&ev)->x, ((XMotionEvent*)&ev)->y, msg, - strlen(msg)); + ((XMotionEvent*)&ev)->x, ((XMotionEvent*)&ev)->y, + msg, strlen(msg)); XDrawString(pPriv->display, pPriv->window, DefaultGC(pPriv->display, pPriv->screenNumber), ((XMotionEvent*)&ev)->x_root, ((XMotionEvent*)&ev)->y_root, msg2, strlen(msg2)); } + + if (ev.type == EnterNotify) { + xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Cursor entered window!\n"); + } + + if (ev.type == LeaveNotify) { + xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Cursor left window!\n"); + } } } @@ -283,6 +293,7 @@ NestedClientCloseScreen(NestedClientPrivatePtr pPriv) { } else { free(pPriv->img->data); } + XDestroyImage(pPriv->img); XCloseDisplay(pPriv->display); } |