>From a280e1aa0fe1e2500f6f687b7b195cbb2bca9ba2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Sat, 6 Oct 2012 18:18:43 +0200
Subject: [PATCH 2/3] wcore set vmask in one step

This patch set the vmask in one line.

- vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect;
- vmask |= CWColormap;

Is similar to:

+ vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | 
CWColormap;

And vmask is not used between the two original lines, therefore we can do the
initialization in only one line.
---
 src/wcore.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/wcore.c b/src/wcore.c
index ce57942..1abe842 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
 
        core = wmalloc(sizeof(WCoreWindow));
 
-       vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect;
+       vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | 
CWColormap;
        attribs.override_redirect = True;
        attribs.cursor = wCursor[WCUR_DEFAULT];
        attribs.background_pixmap = None;
@@ -61,7 +61,6 @@ WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int 
y, int width, int h
                             ButtonReleaseMask | ButtonMotionMask |
                             ExposureMask | EnterWindowMask | LeaveWindowMask;
 
-       vmask |= CWColormap;
        attribs.colormap = colormap;
 
        core->window = XCreateWindow(dpy, screen->root_win, x, y, width, height,
@@ -99,14 +98,13 @@ WCoreWindow *wCoreCreate(WCoreWindow *parent, int x, int y, 
int width, int heigh
 
        core = wmalloc(sizeof(WCoreWindow));
 
-       vmask = CWBorderPixel | CWCursor | CWEventMask;
+       vmask = CWBorderPixel | CWCursor | CWEventMask | CWColormap;
        attribs.cursor = wCursor[WCUR_DEFAULT];
        attribs.background_pixmap = None;
        attribs.background_pixel = parent->screen_ptr->black_pixel;
        attribs.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask |
                             ButtonReleaseMask | ButtonMotionMask |
                             ExposureMask | EnterWindowMask | LeaveWindowMask;
-       vmask |= CWColormap;
        attribs.colormap = parent->screen_ptr->w_colormap;
        core->window = XCreateWindow(dpy, parent->window, x, y, width, height, 
0,
                          parent->screen_ptr->w_depth, CopyFromParent,
-- 
1.7.10.4

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From a280e1aa0fe1e2500f6f687b7b195cbb2bca9ba2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Sat, 6 Oct 2012 18:18:43 +0200
Subject: [PATCH 2/3] wcore set vmask in one step

This patch set the vmask in one line.

- vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect;
- vmask |= CWColormap;

Is similar to:

+ vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | CWColormap;

And vmask is not used between the two original lines, therefore we can do the
initialization in only one line.
---
 src/wcore.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/wcore.c b/src/wcore.c
index ce57942..1abe842 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
 
 	core = wmalloc(sizeof(WCoreWindow));
 
-	vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect;
+	vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | CWColormap;
 	attribs.override_redirect = True;
 	attribs.cursor = wCursor[WCUR_DEFAULT];
 	attribs.background_pixmap = None;
@@ -61,7 +61,6 @@ WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int h
 			     ButtonReleaseMask | ButtonMotionMask |
 			     ExposureMask | EnterWindowMask | LeaveWindowMask;
 
-	vmask |= CWColormap;
 	attribs.colormap = colormap;
 
 	core->window = XCreateWindow(dpy, screen->root_win, x, y, width, height,
@@ -99,14 +98,13 @@ WCoreWindow *wCoreCreate(WCoreWindow *parent, int x, int y, int width, int heigh
 
 	core = wmalloc(sizeof(WCoreWindow));
 
-	vmask = CWBorderPixel | CWCursor | CWEventMask;
+	vmask = CWBorderPixel | CWCursor | CWEventMask | CWColormap;
 	attribs.cursor = wCursor[WCUR_DEFAULT];
 	attribs.background_pixmap = None;
 	attribs.background_pixel = parent->screen_ptr->black_pixel;
 	attribs.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask |
 			     ButtonReleaseMask | ButtonMotionMask |
 			     ExposureMask | EnterWindowMask | LeaveWindowMask;
-	vmask |= CWColormap;
 	attribs.colormap = parent->screen_ptr->w_colormap;
 	core->window = XCreateWindow(dpy, parent->window, x, y, width, height, 0,
 			  parent->screen_ptr->w_depth, CopyFromParent,
-- 
1.7.10.4

Reply via email to