wok rev 19864

openbox: patch to have round corners :-)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 26 21:39:03 2017 +0200 (2017-03-26)
parents de17d022fe9c
children b3f977aa0e0d
files openbox-imlib2/receipt openbox-imlib2/stuff/openbox-rounded.patch openbox/receipt openbox/stuff/openbox-rounded.patch
line diff
     1.1 --- a/openbox-imlib2/receipt	Sun Mar 26 15:53:23 2017 +0200
     1.2 +++ b/openbox-imlib2/receipt	Sun Mar 26 21:39:03 2017 +0200
     1.3 @@ -5,7 +5,6 @@
     1.4  SOURCE="openbox"
     1.5  CATEGORY="x-window"
     1.6  SHORT_DESC="Small-footprint and standard compliant Window Manager (Allow icons in menus)."
     1.7 -SUGGESTED="obconf pcmanfm hsetroot"
     1.8  MAINTAINER="pankso@slitaz.org"
     1.9  LICENSE="GPL2"
    1.10  TARBALL="$SOURCE-$VERSION.tar.gz"
    1.11 @@ -14,6 +13,7 @@
    1.12  TAGS="window-manager"
    1.13  PROVIDE="openbox"
    1.14  
    1.15 +SUGGESTED="obconf spacefm pcmanfm hsetroot wbar2 conky"
    1.16  DEPENDS="startup-notification pango glib xorg-libX11 fontconfig freetype \
    1.17  xorg-libXrandr xorg-libXft xorg-libXinerama xorg-libXcursor libxml2 imlib2 \
    1.18  slitaz-configs"
    1.19 @@ -23,8 +23,8 @@
    1.20  # Rules to configure and make the package.
    1.21  compile_rules()
    1.22  {
    1.23 -	cd $src
    1.24  	chmod +x install-sh
    1.25 +	patch -p1 < ${stuff}/openbox-rounded.patch || exit 1
    1.26  	./configure \
    1.27  		--prefix=/usr \
    1.28  		--sysconfdir=/etc \
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/openbox-imlib2/stuff/openbox-rounded.patch	Sun Mar 26 21:39:03 2017 +0200
     2.3 @@ -0,0 +1,143 @@
     2.4 +--- a/openbox/config.h	2017-03-03 21:48:15.000000000 -0700
     2.5 ++++ b/openbox/config.h	2017-03-06 14:35:56.084377574 -0700
     2.6 +@@ -152,6 +152,9 @@
     2.7 + extern gboolean config_animate_iconify;
     2.8 + /*! Size of icons in focus switching dialogs */
     2.9 + extern guint config_theme_window_list_icon_size;
    2.10 ++/*! Display rounded corners for decorated windows */
    2.11 ++extern guint config_theme_cornerradius;
    2.12 ++extern gboolean config_theme_menuradius;
    2.13 + 
    2.14 + /*! The font for the active window's title */
    2.15 + extern RrFont *config_font_activewindow;
    2.16 +--- a/openbox/config.c	2017-03-03 21:48:15.000000000 -0700
    2.17 ++++ b/openbox/config.c	2017-03-06 14:37:06.400883218 -0700
    2.18 +@@ -48,6 +48,8 @@
    2.19 + gchar   *config_theme;
    2.20 + gboolean config_theme_keepborder;
    2.21 + guint    config_theme_window_list_icon_size;
    2.22 ++guint	 config_theme_cornerradius;
    2.23 ++gboolean config_theme_menuradius;
    2.24 + 
    2.25 + gchar   *config_title_layout;
    2.26 + 
    2.27 +@@ -702,6 +704,10 @@
    2.28 +         else if (config_theme_window_list_icon_size > 96)
    2.29 +             config_theme_window_list_icon_size = 96;
    2.30 +     }
    2.31 ++    if ((n = obt_xml_find_node(node, "cornerRadius"))) {
    2.32 ++	config_theme_cornerradius = obt_xml_node_int(n);
    2.33 ++	obt_xml_attr_bool(n, "menu", &config_theme_menuradius);
    2.34 ++    }
    2.35 + 
    2.36 +     n = obt_xml_find_node(node, "font");
    2.37 +     while (n) {
    2.38 +@@ -1078,6 +1084,8 @@
    2.39 +     config_title_layout = g_strdup("NLIMC");
    2.40 +     config_theme_keepborder = TRUE;
    2.41 +     config_theme_window_list_icon_size = 36;
    2.42 ++    config_theme_cornerradius = 0;
    2.43 ++    config_theme_menuradius = TRUE;
    2.44 + 
    2.45 +     config_font_activewindow = NULL;
    2.46 +     config_font_inactivewindow = NULL;
    2.47 +--- a/openbox/frame.c	2013-08-11 18:33:24.000000000 -0700
    2.48 ++++ b/openbox/frame.c	2017-03-06 14:35:56.088377603 -0700
    2.49 +@@ -334,6 +334,31 @@
    2.50 + #endif
    2.51 + }
    2.52 + 
    2.53 ++void frame_round_corners(Window window)
    2.54 ++{
    2.55 ++    XWindowAttributes win_attr;
    2.56 ++    XGetWindowAttributes(obt_display, window, &win_attr);
    2.57 ++    int width = win_attr.width + win_attr.border_width;
    2.58 ++    int height = win_attr.height + win_attr.border_width;
    2.59 ++    Pixmap mask = XCreatePixmap(obt_display, window, width, height, 1);
    2.60 ++    XGCValues xgcv;
    2.61 ++    GC shape_gc = XCreateGC(obt_display, mask, 0, &xgcv);
    2.62 ++    int rad = config_theme_cornerradius;
    2.63 ++    int dia = 2 * rad;
    2.64 ++    XSetForeground(obt_display, shape_gc, 0);
    2.65 ++    XFillRectangle(obt_display, mask, shape_gc, 0, 0, width, height);
    2.66 ++    XSetForeground(obt_display, shape_gc, 1);
    2.67 ++    XFillArc(obt_display, mask, shape_gc, 0, 0, dia, dia, 0, 23040);
    2.68 ++    XFillArc(obt_display, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040);
    2.69 ++    XFillArc(obt_display, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040);
    2.70 ++    XFillArc(obt_display, mask, shape_gc, width-dia-1, height-dia-1, dia, dia,
    2.71 ++        0, 23040);
    2.72 ++    XFillRectangle(obt_display, mask, shape_gc, rad, 0, width-dia, height);
    2.73 ++    XFillRectangle(obt_display, mask, shape_gc, 0, rad, width, height-dia);
    2.74 ++    XShapeCombineMask(obt_display, window, ShapeBounding, 0, 0, mask, ShapeSet);
    2.75 ++    XFreePixmap(obt_display, mask);
    2.76 ++}
    2.77 ++
    2.78 + void frame_adjust_area(ObFrame *self, gboolean moved,
    2.79 +                        gboolean resized, gboolean fake)
    2.80 + {
    2.81 +@@ -857,7 +882,6 @@
    2.82 + 
    2.83 +         if (resized) {
    2.84 +             self->need_render = TRUE;
    2.85 +-            framerender_frame(self);
    2.86 +             frame_adjust_shape(self);
    2.87 +         }
    2.88 + 
    2.89 +@@ -884,7 +908,9 @@
    2.90 +     {
    2.91 +         XResizeWindow(obt_display, self->label, self->label_width,
    2.92 +                       ob_rr_theme->label_height);
    2.93 ++	self->need_render = TRUE;
    2.94 +     }
    2.95 ++    framerender_frame(self);
    2.96 + }
    2.97 + 
    2.98 + static void frame_adjust_cursors(ObFrame *self)
    2.99 +@@ -958,6 +984,8 @@
   2.100 +     XMoveResizeWindow(obt_display, self->backfront, 0, 0,
   2.101 +                       self->client->area.width,
   2.102 +                       self->client->area.height);
   2.103 ++    self->need_render = TRUE;
   2.104 ++    framerender_frame(self);
   2.105 + }
   2.106 + 
   2.107 + void frame_adjust_state(ObFrame *self)
   2.108 +--- a/openbox/framerender.c	2013-08-11 18:33:24.000000000 -0700
   2.109 ++++ b/openbox/framerender.c	2017-03-06 14:35:56.088377603 -0700
   2.110 +@@ -21,6 +21,7 @@
   2.111 + #include "openbox.h"
   2.112 + #include "screen.h"
   2.113 + #include "client.h"
   2.114 ++#include "config.h"
   2.115 + #include "framerender.h"
   2.116 + #include "obrender/theme.h"
   2.117 + 
   2.118 +@@ -42,6 +43,9 @@
   2.119 +         return;
   2.120 +     self->need_render = FALSE;
   2.121 + 
   2.122 ++    if ( !self->max_horz && !self->max_vert && config_theme_cornerradius )
   2.123 ++        frame_round_corners(self->window);
   2.124 ++
   2.125 +     {
   2.126 +         gulong px;
   2.127 + 
   2.128 +--- a/openbox/menuframe.c	2013-08-11 18:33:24.000000000 -0700
   2.129 ++++ b/openbox/menuframe.c	2017-03-06 14:35:56.088377603 -0700
   2.130 +@@ -17,6 +17,7 @@
   2.131 +    See the COPYING file for a copy of the GNU General Public License.
   2.132 + */
   2.133 + 
   2.134 ++#include "frame.h"
   2.135 + #include "menuframe.h"
   2.136 + #include "client.h"
   2.137 + #include "menu.h"
   2.138 +@@ -838,6 +839,9 @@
   2.139 + 
   2.140 +     RECT_SET_SIZE(self->area, w, h);
   2.141 + 
   2.142 ++    if ( config_theme_menuradius )
   2.143 ++        frame_round_corners(self->window);
   2.144 ++
   2.145 +     XFlush(obt_display);
   2.146 + }
     3.1 --- a/openbox/receipt	Sun Mar 26 15:53:23 2017 +0200
     3.2 +++ b/openbox/receipt	Sun Mar 26 21:39:03 2017 +0200
     3.3 @@ -33,6 +33,7 @@
     3.4  compile_rules()
     3.5  {
     3.6  	chmod +x install-sh
     3.7 +	patch -p1 < ${stuff}/openbox-rounded.patch || exit 1
     3.8  	./configure \
     3.9  		--prefix=/usr \
    3.10  		--sysconfdir=/etc \
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/openbox/stuff/openbox-rounded.patch	Sun Mar 26 21:39:03 2017 +0200
     4.3 @@ -0,0 +1,143 @@
     4.4 +--- a/openbox/config.h	2017-03-03 21:48:15.000000000 -0700
     4.5 ++++ b/openbox/config.h	2017-03-06 14:35:56.084377574 -0700
     4.6 +@@ -152,6 +152,9 @@
     4.7 + extern gboolean config_animate_iconify;
     4.8 + /*! Size of icons in focus switching dialogs */
     4.9 + extern guint config_theme_window_list_icon_size;
    4.10 ++/*! Display rounded corners for decorated windows */
    4.11 ++extern guint config_theme_cornerradius;
    4.12 ++extern gboolean config_theme_menuradius;
    4.13 + 
    4.14 + /*! The font for the active window's title */
    4.15 + extern RrFont *config_font_activewindow;
    4.16 +--- a/openbox/config.c	2017-03-03 21:48:15.000000000 -0700
    4.17 ++++ b/openbox/config.c	2017-03-06 14:37:06.400883218 -0700
    4.18 +@@ -48,6 +48,8 @@
    4.19 + gchar   *config_theme;
    4.20 + gboolean config_theme_keepborder;
    4.21 + guint    config_theme_window_list_icon_size;
    4.22 ++guint	 config_theme_cornerradius;
    4.23 ++gboolean config_theme_menuradius;
    4.24 + 
    4.25 + gchar   *config_title_layout;
    4.26 + 
    4.27 +@@ -702,6 +704,10 @@
    4.28 +         else if (config_theme_window_list_icon_size > 96)
    4.29 +             config_theme_window_list_icon_size = 96;
    4.30 +     }
    4.31 ++    if ((n = obt_xml_find_node(node, "cornerRadius"))) {
    4.32 ++	config_theme_cornerradius = obt_xml_node_int(n);
    4.33 ++	obt_xml_attr_bool(n, "menu", &config_theme_menuradius);
    4.34 ++    }
    4.35 + 
    4.36 +     n = obt_xml_find_node(node, "font");
    4.37 +     while (n) {
    4.38 +@@ -1078,6 +1084,8 @@
    4.39 +     config_title_layout = g_strdup("NLIMC");
    4.40 +     config_theme_keepborder = TRUE;
    4.41 +     config_theme_window_list_icon_size = 36;
    4.42 ++    config_theme_cornerradius = 0;
    4.43 ++    config_theme_menuradius = TRUE;
    4.44 + 
    4.45 +     config_font_activewindow = NULL;
    4.46 +     config_font_inactivewindow = NULL;
    4.47 +--- a/openbox/frame.c	2013-08-11 18:33:24.000000000 -0700
    4.48 ++++ b/openbox/frame.c	2017-03-06 14:35:56.088377603 -0700
    4.49 +@@ -334,6 +334,31 @@
    4.50 + #endif
    4.51 + }
    4.52 + 
    4.53 ++void frame_round_corners(Window window)
    4.54 ++{
    4.55 ++    XWindowAttributes win_attr;
    4.56 ++    XGetWindowAttributes(obt_display, window, &win_attr);
    4.57 ++    int width = win_attr.width + win_attr.border_width;
    4.58 ++    int height = win_attr.height + win_attr.border_width;
    4.59 ++    Pixmap mask = XCreatePixmap(obt_display, window, width, height, 1);
    4.60 ++    XGCValues xgcv;
    4.61 ++    GC shape_gc = XCreateGC(obt_display, mask, 0, &xgcv);
    4.62 ++    int rad = config_theme_cornerradius;
    4.63 ++    int dia = 2 * rad;
    4.64 ++    XSetForeground(obt_display, shape_gc, 0);
    4.65 ++    XFillRectangle(obt_display, mask, shape_gc, 0, 0, width, height);
    4.66 ++    XSetForeground(obt_display, shape_gc, 1);
    4.67 ++    XFillArc(obt_display, mask, shape_gc, 0, 0, dia, dia, 0, 23040);
    4.68 ++    XFillArc(obt_display, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040);
    4.69 ++    XFillArc(obt_display, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040);
    4.70 ++    XFillArc(obt_display, mask, shape_gc, width-dia-1, height-dia-1, dia, dia,
    4.71 ++        0, 23040);
    4.72 ++    XFillRectangle(obt_display, mask, shape_gc, rad, 0, width-dia, height);
    4.73 ++    XFillRectangle(obt_display, mask, shape_gc, 0, rad, width, height-dia);
    4.74 ++    XShapeCombineMask(obt_display, window, ShapeBounding, 0, 0, mask, ShapeSet);
    4.75 ++    XFreePixmap(obt_display, mask);
    4.76 ++}
    4.77 ++
    4.78 + void frame_adjust_area(ObFrame *self, gboolean moved,
    4.79 +                        gboolean resized, gboolean fake)
    4.80 + {
    4.81 +@@ -857,7 +882,6 @@
    4.82 + 
    4.83 +         if (resized) {
    4.84 +             self->need_render = TRUE;
    4.85 +-            framerender_frame(self);
    4.86 +             frame_adjust_shape(self);
    4.87 +         }
    4.88 + 
    4.89 +@@ -884,7 +908,9 @@
    4.90 +     {
    4.91 +         XResizeWindow(obt_display, self->label, self->label_width,
    4.92 +                       ob_rr_theme->label_height);
    4.93 ++	self->need_render = TRUE;
    4.94 +     }
    4.95 ++    framerender_frame(self);
    4.96 + }
    4.97 + 
    4.98 + static void frame_adjust_cursors(ObFrame *self)
    4.99 +@@ -958,6 +984,8 @@
   4.100 +     XMoveResizeWindow(obt_display, self->backfront, 0, 0,
   4.101 +                       self->client->area.width,
   4.102 +                       self->client->area.height);
   4.103 ++    self->need_render = TRUE;
   4.104 ++    framerender_frame(self);
   4.105 + }
   4.106 + 
   4.107 + void frame_adjust_state(ObFrame *self)
   4.108 +--- a/openbox/framerender.c	2013-08-11 18:33:24.000000000 -0700
   4.109 ++++ b/openbox/framerender.c	2017-03-06 14:35:56.088377603 -0700
   4.110 +@@ -21,6 +21,7 @@
   4.111 + #include "openbox.h"
   4.112 + #include "screen.h"
   4.113 + #include "client.h"
   4.114 ++#include "config.h"
   4.115 + #include "framerender.h"
   4.116 + #include "obrender/theme.h"
   4.117 + 
   4.118 +@@ -42,6 +43,9 @@
   4.119 +         return;
   4.120 +     self->need_render = FALSE;
   4.121 + 
   4.122 ++    if ( !self->max_horz && !self->max_vert && config_theme_cornerradius )
   4.123 ++        frame_round_corners(self->window);
   4.124 ++
   4.125 +     {
   4.126 +         gulong px;
   4.127 + 
   4.128 +--- a/openbox/menuframe.c	2013-08-11 18:33:24.000000000 -0700
   4.129 ++++ b/openbox/menuframe.c	2017-03-06 14:35:56.088377603 -0700
   4.130 +@@ -17,6 +17,7 @@
   4.131 +    See the COPYING file for a copy of the GNU General Public License.
   4.132 + */
   4.133 + 
   4.134 ++#include "frame.h"
   4.135 + #include "menuframe.h"
   4.136 + #include "client.h"
   4.137 + #include "menu.h"
   4.138 +@@ -838,6 +839,9 @@
   4.139 + 
   4.140 +     RECT_SET_SIZE(self->area, w, h);
   4.141 + 
   4.142 ++    if ( config_theme_menuradius )
   4.143 ++        frame_round_corners(self->window);
   4.144 ++
   4.145 +     XFlush(obt_display);
   4.146 + }