summaryrefslogtreecommitdiff
path: root/app/cwm/menu.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2016-09-30 18:28:07 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2016-09-30 18:28:07 +0000
commit60d37dd205bccd3a790221848183df9419552329 (patch)
tree18607ef342517994d154d11b48a54ae135c9441f /app/cwm/menu.c
parent9ec53fcd54ffc4870669648c13cba7e127240f8b (diff)
Use instinsic X11 functions for key/btn/ptr grab/ungrab/regrab requests;
the one line wrappers provided no value and limited altering calls where needed; additionally, most of them had but one caller.
Diffstat (limited to 'app/cwm/menu.c')
-rw-r--r--app/cwm/menu.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/app/cwm/menu.c b/app/cwm/menu.c
index 57d32d0da..39c51ede0 100644
--- a/app/cwm/menu.c
+++ b/app/cwm/menu.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: menu.c,v 1.95 2016/09/30 15:12:19 okan Exp $
+ * $OpenBSD: menu.c,v 1.96 2016/09/30 18:28:06 okan Exp $
*/
#include <sys/types.h>
@@ -121,10 +121,12 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt,
XSelectInput(X_Dpy, sc->menu.win, evmask);
XMapRaised(X_Dpy, sc->menu.win);
- if (xu_ptr_grab(sc->menu.win, MENUGRABMASK,
- Conf.cursor[CF_QUESTION]) < 0) {
+ if (XGrabPointer(X_Dpy, sc->menu.win, False, MENUGRABMASK,
+ GrabModeAsync, GrabModeAsync, None, Conf.cursor[CF_QUESTION],
+ CurrentTime) != GrabSuccess) {
XUnmapWindow(X_Dpy, sc->menu.win);
return(NULL);
+
}
XGetInputFocus(X_Dpy, &focuswin, &focusrevert);
@@ -172,7 +174,7 @@ out:
xu_ptr_getpos(sc->rootwin, &xcur, &ycur);
if (xcur == mc.geom.x && ycur == mc.geom.y)
xu_ptr_setpos(sc->rootwin, xsave, ysave);
- xu_ptr_ungrab();
+ XUngrabPointer(X_Dpy, CurrentTime);
XMoveResizeWindow(X_Dpy, sc->menu.win, 0, 0, 1, 1);
XUnmapWindow(X_Dpy, sc->menu.win);
@@ -472,10 +474,13 @@ menu_handle_move(XEvent *e, struct menu_ctx *mc, struct menu_q *resultq)
if (mc->prev != -1)
menu_draw_entry(mc, resultq, mc->prev, 0);
if (mc->entry != -1) {
- (void)xu_ptr_regrab(MENUGRABMASK, Conf.cursor[CF_NORMAL]);
+ XChangeActivePointerGrab(X_Dpy, MENUGRABMASK,
+ Conf.cursor[CF_NORMAL], CurrentTime);
menu_draw_entry(mc, resultq, mc->entry, 1);
- } else
- (void)xu_ptr_regrab(MENUGRABMASK, Conf.cursor[CF_DEFAULT]);
+ } else {
+ XChangeActivePointerGrab(X_Dpy, MENUGRABMASK,
+ Conf.cursor[CF_DEFAULT], CurrentTime);
+ }
}
static struct menu *