xfwm4 title button tweak

Keith Hedger kdhedger at yahoo.co.uk
Mon Apr 16 20:18:38 CEST 2012


As a themer coming from metacity the inability to set a vertical 
displacement  to the title bar buttons is annoying so I wrote this patch 
for xfwm4-4.9.1 ( in 4.10pre2 ) which adds a "button_vertical_offset" 
option to both the themerc and to xconf ( 
/general/button_vertical_offset in the xfwm4 channel ) this can be a 
positiive or negative offset to shift the buttons down or up 
respectively, any thoughts?

diff -crB src/frame.c patchfiles/frame.c
*** src/frame.c    2012-04-16 18:50:45.000000000 +0100
--- patchfiles/frame.c    2012-04-16 18:53:47.000000000 +0100
***************
*** 991,999 ****
                           xfwmWindowSetBG (&c->buttons[button], my_pixmap);
                       }
                       xfwmWindowShow (&c->buttons[button], x,
!                         (frameTop (c) - 
screen_info->buttons[button][state].height + 1) / 2,
                           screen_info->buttons[button][state].width,
!                         screen_info->buttons[button][state].height, TRUE);
                       button_x[button] = x;
                       x = x + screen_info->buttons[button][state].width +
                           screen_info->params->button_spacing;
--- 991,999 ----
                           xfwmWindowSetBG (&c->buttons[button], my_pixmap);
                       }
                       xfwmWindowShow (&c->buttons[button], x,
!                         ((frameTop (c) - 
screen_info->buttons[button][state].height + 1) / 
2)+screen_info->params->button_vertical_offset,
                           screen_info->buttons[button][state].width,
!                         screen_info->buttons[button][state].height, 
TRUE);//KDH added button_vertical_offset
                       button_x[button] = x;
                       x = x + screen_info->buttons[button][state].width +
                           screen_info->params->button_spacing;
***************
*** 1028,1036 ****
                       x = x - screen_info->buttons[button][state].width -
                           screen_info->params->button_spacing;
                       xfwmWindowShow (&c->buttons[button], x,
!                         (frameTop (c) - 
screen_info->buttons[button][state].height + 1) / 2,
                           screen_info->buttons[button][state].width,
!                         screen_info->buttons[button][state].height, TRUE);
                       button_x[button] = x;
                   }
                   else
--- 1028,1036 ----
                       x = x - screen_info->buttons[button][state].width -
                           screen_info->params->button_spacing;
                       xfwmWindowShow (&c->buttons[button], x,
!                         ((frameTop (c) - 
screen_info->buttons[button][state].height + 1) / 
2)+screen_info->params->button_vertical_offset,
                           screen_info->buttons[button][state].width,
!                         screen_info->buttons[button][state].height, 
TRUE);//KDH added button_vertical_offset
                       button_x[button] = x;
                   }
                   else

diff -crB src/settings.c patchfiles/settings.c
*** src/settings.c    2012-04-16 18:50:45.000000000 +0100
--- patchfiles/settings.c    2012-04-16 18:54:41.000000000 +0100
***************
*** 550,555 ****
--- 550,557 ----
       strncpy (screen_info->params->button_layout, getStringValue 
("button_layout", rc), BUTTON_STRING_COUNT);
       screen_info->params->button_spacing = getIntValue 
("button_spacing", rc);
       screen_info->params->button_offset = getIntValue 
("button_offset", rc);
+     screen_info->params->button_vertical_offset = getIntValue 
("button_vertical_offset", rc);//KDH added button_vertical_offset
+
       screen_info->params->maximized_offset = getIntValue 
("maximized_offset", rc);
       screen_info->params->title_vertical_offset_active =
           getIntValue ("title_vertical_offset_active", rc);
***************
*** 671,676 ****
--- 673,680 ----
           {"box_resize", NULL, G_TYPE_BOOLEAN, TRUE},
           {"button_layout", NULL, G_TYPE_STRING, TRUE},
           {"button_offset", NULL, G_TYPE_INT, TRUE},
+ //KDH added button_vertical_offset
+         {"button_vertical_offset", NULL, G_TYPE_INT, TRUE},
           {"button_spacing", NULL, G_TYPE_INT, TRUE},
           {"click_to_focus", NULL, G_TYPE_BOOLEAN, TRUE},
           {"focus_delay", NULL, G_TYPE_INT, TRUE},
***************
*** 1185,1190 ****
--- 1189,1196 ----
                   }
                   else if ((!strcmp (name, "button_offset"))
                         || (!strcmp (name, "button_spacing"))
+ //KDH added button_vertical_offset
+                       || (!strcmp (name, "button_vertical_offset"))
                         || (!strcmp (name, "double_click_time"))
                         || (!strcmp (name, 
"double_DOUBLE_CLICKclick_distance"))
                         || (!strcmp (name, "maximized_offset"))
diff -crB src/settings.h patchfiles/settings.h
*** src/settings.h    2012-04-16 18:50:45.000000000 +0100
--- patchfiles/settings.h    2012-04-16 18:54:53.000000000 +0100
***************
*** 173,178 ****
--- 173,180 ----
       int xfwm_margins[4];
       int activate_action;
       int button_offset;
+ //KDH added button_vertical_offset
+     int button_vertical_offset;
       int button_spacing;
       int double_click_action;
       guint easy_click;

probably don't have to tell you this but place the patch in the  top 
level of the xfwm4-4.9.1 folder run "patch  -p0 < xfwm4.patch" and 
configure;make install as usual.

Keith.


More information about the Xfce mailing list