The framewin creation is the same in the "if", "else if" and "else"
blocks, so, we can join them.

Signed-off-by: Rodolfo García Peñas (kix) <[email protected]>
---
 src/framewin.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/framewin.c b/src/framewin.c
index 4d5357e..18332ab 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -249,8 +249,9 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
 
                        if (flags & WFF_LEFT_BUTTON) {
                                fwin->flags.left_button = 1;
+                               fwin->left_button = wcore_create(bsize, bsize);
+
                                if (wPreferences.new_style == TS_NEW) {
-                                       fwin->left_button = wcore_create(bsize, 
bsize);
                                        wcore_map(fwin->left_button, fwin->core,
                                                  fwin->core->screen_ptr,
                                                  0, 0, 0,
@@ -264,7 +265,6 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
                                                XMapRaised(dpy, 
fwin->left_button->window);
 
                                } else if (wPreferences.new_style == TS_OLD) {
-                                       fwin->left_button = wcore_create(bsize, 
bsize);
                                        wcore_map(fwin->left_button, 
fwin->titlebar,
                                                  fwin->titlebar->screen_ptr,
                                                  3, (theight - bsize) / 2, 0,
@@ -281,7 +281,6 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
                                                XMapRaised(dpy, 
fwin->left_button->window);
 
                                } else {
-                                       fwin->left_button = wcore_create(bsize, 
bsize);
                                        wcore_map(fwin->left_button, 
fwin->titlebar,
                                                  fwin->titlebar->screen_ptr,
                                                  3, (theight-bsize) / 2, 0,
@@ -296,14 +295,14 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
                                                fwin->flags.lbutton_dont_fit = 
1;
                                        else
                                                XMapRaised(dpy, 
fwin->left_button->window);
-
                                }
                        }
 #ifdef XKB_BUTTON_HINT
                        if (flags & WFF_LANGUAGE_BUTTON) {
                                fwin->flags.language_button = 1;
+                               fwin->language_button = wcore_create(bsize, 
bsize);
+
                                if (wPreferences.new_style == TS_NEW) {
-                                       fwin->language_button = 
wcore_create(bsize, bsize);
                                        wcore_map(fwin->language_button, 
fwin->core,
                                                  fwin->core->screen_ptr,
                                                  bsize, 0, 0,
@@ -316,7 +315,6 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
                                        else
                                                XMapRaised(dpy, 
fwin->language_button->window);
                                } else {
-                                       fwin->language_button = 
wcore_create(bsize, bsize);
                                        wcore_map(fwin->language_button, 
fwin->titlebar,
                                                  fwin->titlebar->screen_ptr,
                                                  bsize + 6, (theight - bsize) 
/ 2, 0,
@@ -337,8 +335,9 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
 
                        if (flags & WFF_RIGHT_BUTTON) {
                                fwin->flags.right_button = 1;
+                               fwin->right_button = wcore_create(bsize, bsize);
+
                                if (wPreferences.new_style == TS_NEW) {
-                                       fwin->right_button = 
wcore_create(bsize, bsize);
                                        wcore_map(fwin->right_button, 
fwin->core,
                                                  fwin->core->screen_ptr,
                                                  width - bsize + 1, 0, 0,
@@ -346,7 +345,6 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
                                                  
fwin->core->screen_ptr->w_visual,
                                                  
fwin->core->screen_ptr->w_colormap);
                                } else if (wPreferences.new_style == TS_OLD) {
-                                       fwin->right_button = 
wcore_create(bsize, bsize);
                                        wcore_map(fwin->right_button, 
fwin->titlebar,
                                                  fwin->titlebar->screen_ptr,
                                                  width - bsize - 3, (theight - 
bsize) / 2, 0,
@@ -357,7 +355,6 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
                                        XSetWindowBackground(dpy, 
fwin->right_button->window,
                                                             
scr->widget_texture->normal.pixel);
                                } else {
-                                       fwin->right_button = 
wcore_create(bsize, bsize);
                                        wcore_map(fwin->right_button, 
fwin->titlebar,
                                                  fwin->titlebar->screen_ptr,
                                                  width - bsize - 3, (theight - 
bsize) / 2, 0,
-- 
1.8.4.rc3


-- 
To unsubscribe, send mail to [email protected].

Reply via email to