On Sun, 29 Sep 2013, Rodolfo kix Garcia escribió: > Carlos, see the default and normal cursors, both use 0. Perhaps we should use > only one of them (if is possible)
Hi Carlos, I am attaching an small patch to join the Default and Normal cursors. After this patch, we can remove the extra numbers in the enum. Cheers, kix -- ||// //\\// Rodolfo "kix" Garcia ||\\// //\\ http://www.kix.es/
>From 18a547a52700428d48d5ab6c2630efdac8d03c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= <[email protected]> Date: Sun, 29 Sep 2013 16:41:46 +0200 Subject: [PATCH] Join default and normal cursor The constant WCUR_DEFAULT and WCUR_NORMAL uses the same value (0), to store the value for the default and normal cursor. Because is a preprocessor variable, we can join both with the name WCUR_DEFAULT or WCUR_NORMAL because the value is the same (0). I select WCUR_NORMAL to indicate that the value is Normal, selected or no by the user. --- src/WindowMaker.h | 1 - src/moveres.c | 6 +++--- src/screen.c | 2 +- src/wcore.c | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 6c29c9c..72cc848 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -103,7 +103,6 @@ typedef struct WObjDescriptor { #endif /* XKB_BUTTON_HINT */ /* cursors */ -#define WCUR_DEFAULT 0 #define WCUR_NORMAL 0 #define WCUR_MOVE 1 #define WCUR_RESIZE 2 diff --git a/src/moveres.c b/src/moveres.c index cd8d096..86658b8 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -1243,7 +1243,7 @@ int wKeyboardMoveResizeWindow(WWindow * wwin) XGrabServer(dpy); XGrabPointer(dpy, scr->root_win, True, PointerMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, - GrabModeAsync, None, wCursor[WCUR_DEFAULT], CurrentTime); + GrabModeAsync, None, wCursor[WCUR_NORMAL], CurrentTime); @@ -2156,7 +2156,7 @@ void wSelectWindows(WScreen * scr, XEvent * ev) if (XGrabPointer(dpy, scr->root_win, False, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, - GrabModeAsync, None, wCursor[WCUR_DEFAULT], CurrentTime) != Success) { + GrabModeAsync, None, wCursor[WCUR_NORMAL], CurrentTime) != Success) { return; } XGrabServer(dpy); @@ -2218,7 +2218,7 @@ void InteractivePlaceWindow(WWindow * wwin, int *x_ret, int *y_ret, unsigned wid int junk; if (XGrabPointer(dpy, root, True, PointerMotionMask | ButtonPressMask, - GrabModeAsync, GrabModeAsync, None, wCursor[WCUR_DEFAULT], CurrentTime) != Success) { + GrabModeAsync, GrabModeAsync, None, wCursor[WCUR_NORMAL], CurrentTime) != Success) { *x_ret = 0; *y_ret = 0; return; diff --git a/src/screen.c b/src/screen.c index 702a3e7..3c11c05 100644 --- a/src/screen.c +++ b/src/screen.c @@ -465,7 +465,7 @@ static void createInternalWindows(WScreen * scr) attribs.override_redirect = True; attribs.background_pixmap = None; attribs.background_pixel = scr->white_pixel; - attribs.cursor = wCursor[WCUR_DEFAULT]; + attribs.cursor = wCursor[WCUR_NORMAL]; vmask |= CWColormap; attribs.colormap = scr->w_colormap; scr->dock_shadow = diff --git a/src/wcore.c b/src/wcore.c index 3e77fbf..e1beb6a 100644 --- a/src/wcore.c +++ b/src/wcore.c @@ -51,7 +51,7 @@ WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int h vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | CWColormap; attribs.override_redirect = True; - attribs.cursor = wCursor[WCUR_DEFAULT]; + attribs.cursor = wCursor[WCUR_NORMAL]; attribs.background_pixmap = None; attribs.background_pixel = screen->black_pixel; attribs.border_pixel = border_pixel; @@ -102,7 +102,7 @@ WCoreWindow *wCoreCreate(WCoreWindow *parent, int x, int y, int width, int heigh core = wmalloc(sizeof(WCoreWindow)); vmask = CWBorderPixel | CWCursor | CWEventMask | CWColormap; - attribs.cursor = wCursor[WCUR_DEFAULT]; + attribs.cursor = wCursor[WCUR_NORMAL]; attribs.background_pixmap = None; attribs.background_pixel = parent->screen_ptr->black_pixel; attribs.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | -- 1.8.4.rc3
