# HG changeset patch # User Christophe Lincoln # Date 1490557143 -7200 # Node ID 4888cf6f4513620b749c1118dc1336346cb1da03 # Parent de17d022fe9c12444d397ed38da62a6bb8ef2060 openbox: patch to have round corners :-) diff -r de17d022fe9c -r 4888cf6f4513 openbox-imlib2/receipt --- a/openbox-imlib2/receipt Sun Mar 26 15:53:23 2017 +0200 +++ b/openbox-imlib2/receipt Sun Mar 26 21:39:03 2017 +0200 @@ -5,7 +5,6 @@ SOURCE="openbox" CATEGORY="x-window" SHORT_DESC="Small-footprint and standard compliant Window Manager (Allow icons in menus)." -SUGGESTED="obconf pcmanfm hsetroot" MAINTAINER="pankso@slitaz.org" LICENSE="GPL2" TARBALL="$SOURCE-$VERSION.tar.gz" @@ -14,6 +13,7 @@ TAGS="window-manager" PROVIDE="openbox" +SUGGESTED="obconf spacefm pcmanfm hsetroot wbar2 conky" DEPENDS="startup-notification pango glib xorg-libX11 fontconfig freetype \ xorg-libXrandr xorg-libXft xorg-libXinerama xorg-libXcursor libxml2 imlib2 \ slitaz-configs" @@ -23,8 +23,8 @@ # Rules to configure and make the package. compile_rules() { - cd $src chmod +x install-sh + patch -p1 < ${stuff}/openbox-rounded.patch || exit 1 ./configure \ --prefix=/usr \ --sysconfdir=/etc \ diff -r de17d022fe9c -r 4888cf6f4513 openbox-imlib2/stuff/openbox-rounded.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openbox-imlib2/stuff/openbox-rounded.patch Sun Mar 26 21:39:03 2017 +0200 @@ -0,0 +1,143 @@ +--- a/openbox/config.h 2017-03-03 21:48:15.000000000 -0700 ++++ b/openbox/config.h 2017-03-06 14:35:56.084377574 -0700 +@@ -152,6 +152,9 @@ + extern gboolean config_animate_iconify; + /*! Size of icons in focus switching dialogs */ + extern guint config_theme_window_list_icon_size; ++/*! Display rounded corners for decorated windows */ ++extern guint config_theme_cornerradius; ++extern gboolean config_theme_menuradius; + + /*! The font for the active window's title */ + extern RrFont *config_font_activewindow; +--- a/openbox/config.c 2017-03-03 21:48:15.000000000 -0700 ++++ b/openbox/config.c 2017-03-06 14:37:06.400883218 -0700 +@@ -48,6 +48,8 @@ + gchar *config_theme; + gboolean config_theme_keepborder; + guint config_theme_window_list_icon_size; ++guint config_theme_cornerradius; ++gboolean config_theme_menuradius; + + gchar *config_title_layout; + +@@ -702,6 +704,10 @@ + else if (config_theme_window_list_icon_size > 96) + config_theme_window_list_icon_size = 96; + } ++ if ((n = obt_xml_find_node(node, "cornerRadius"))) { ++ config_theme_cornerradius = obt_xml_node_int(n); ++ obt_xml_attr_bool(n, "menu", &config_theme_menuradius); ++ } + + n = obt_xml_find_node(node, "font"); + while (n) { +@@ -1078,6 +1084,8 @@ + config_title_layout = g_strdup("NLIMC"); + config_theme_keepborder = TRUE; + config_theme_window_list_icon_size = 36; ++ config_theme_cornerradius = 0; ++ config_theme_menuradius = TRUE; + + config_font_activewindow = NULL; + config_font_inactivewindow = NULL; +--- a/openbox/frame.c 2013-08-11 18:33:24.000000000 -0700 ++++ b/openbox/frame.c 2017-03-06 14:35:56.088377603 -0700 +@@ -334,6 +334,31 @@ + #endif + } + ++void frame_round_corners(Window window) ++{ ++ XWindowAttributes win_attr; ++ XGetWindowAttributes(obt_display, window, &win_attr); ++ int width = win_attr.width + win_attr.border_width; ++ int height = win_attr.height + win_attr.border_width; ++ Pixmap mask = XCreatePixmap(obt_display, window, width, height, 1); ++ XGCValues xgcv; ++ GC shape_gc = XCreateGC(obt_display, mask, 0, &xgcv); ++ int rad = config_theme_cornerradius; ++ int dia = 2 * rad; ++ XSetForeground(obt_display, shape_gc, 0); ++ XFillRectangle(obt_display, mask, shape_gc, 0, 0, width, height); ++ XSetForeground(obt_display, shape_gc, 1); ++ XFillArc(obt_display, mask, shape_gc, 0, 0, dia, dia, 0, 23040); ++ XFillArc(obt_display, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040); ++ XFillArc(obt_display, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040); ++ XFillArc(obt_display, mask, shape_gc, width-dia-1, height-dia-1, dia, dia, ++ 0, 23040); ++ XFillRectangle(obt_display, mask, shape_gc, rad, 0, width-dia, height); ++ XFillRectangle(obt_display, mask, shape_gc, 0, rad, width, height-dia); ++ XShapeCombineMask(obt_display, window, ShapeBounding, 0, 0, mask, ShapeSet); ++ XFreePixmap(obt_display, mask); ++} ++ + void frame_adjust_area(ObFrame *self, gboolean moved, + gboolean resized, gboolean fake) + { +@@ -857,7 +882,6 @@ + + if (resized) { + self->need_render = TRUE; +- framerender_frame(self); + frame_adjust_shape(self); + } + +@@ -884,7 +908,9 @@ + { + XResizeWindow(obt_display, self->label, self->label_width, + ob_rr_theme->label_height); ++ self->need_render = TRUE; + } ++ framerender_frame(self); + } + + static void frame_adjust_cursors(ObFrame *self) +@@ -958,6 +984,8 @@ + XMoveResizeWindow(obt_display, self->backfront, 0, 0, + self->client->area.width, + self->client->area.height); ++ self->need_render = TRUE; ++ framerender_frame(self); + } + + void frame_adjust_state(ObFrame *self) +--- a/openbox/framerender.c 2013-08-11 18:33:24.000000000 -0700 ++++ b/openbox/framerender.c 2017-03-06 14:35:56.088377603 -0700 +@@ -21,6 +21,7 @@ + #include "openbox.h" + #include "screen.h" + #include "client.h" ++#include "config.h" + #include "framerender.h" + #include "obrender/theme.h" + +@@ -42,6 +43,9 @@ + return; + self->need_render = FALSE; + ++ if ( !self->max_horz && !self->max_vert && config_theme_cornerradius ) ++ frame_round_corners(self->window); ++ + { + gulong px; + +--- a/openbox/menuframe.c 2013-08-11 18:33:24.000000000 -0700 ++++ b/openbox/menuframe.c 2017-03-06 14:35:56.088377603 -0700 +@@ -17,6 +17,7 @@ + See the COPYING file for a copy of the GNU General Public License. + */ + ++#include "frame.h" + #include "menuframe.h" + #include "client.h" + #include "menu.h" +@@ -838,6 +839,9 @@ + + RECT_SET_SIZE(self->area, w, h); + ++ if ( config_theme_menuradius ) ++ frame_round_corners(self->window); ++ + XFlush(obt_display); + } diff -r de17d022fe9c -r 4888cf6f4513 openbox/receipt --- a/openbox/receipt Sun Mar 26 15:53:23 2017 +0200 +++ b/openbox/receipt Sun Mar 26 21:39:03 2017 +0200 @@ -33,6 +33,7 @@ compile_rules() { chmod +x install-sh + patch -p1 < ${stuff}/openbox-rounded.patch || exit 1 ./configure \ --prefix=/usr \ --sysconfdir=/etc \ diff -r de17d022fe9c -r 4888cf6f4513 openbox/stuff/openbox-rounded.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openbox/stuff/openbox-rounded.patch Sun Mar 26 21:39:03 2017 +0200 @@ -0,0 +1,143 @@ +--- a/openbox/config.h 2017-03-03 21:48:15.000000000 -0700 ++++ b/openbox/config.h 2017-03-06 14:35:56.084377574 -0700 +@@ -152,6 +152,9 @@ + extern gboolean config_animate_iconify; + /*! Size of icons in focus switching dialogs */ + extern guint config_theme_window_list_icon_size; ++/*! Display rounded corners for decorated windows */ ++extern guint config_theme_cornerradius; ++extern gboolean config_theme_menuradius; + + /*! The font for the active window's title */ + extern RrFont *config_font_activewindow; +--- a/openbox/config.c 2017-03-03 21:48:15.000000000 -0700 ++++ b/openbox/config.c 2017-03-06 14:37:06.400883218 -0700 +@@ -48,6 +48,8 @@ + gchar *config_theme; + gboolean config_theme_keepborder; + guint config_theme_window_list_icon_size; ++guint config_theme_cornerradius; ++gboolean config_theme_menuradius; + + gchar *config_title_layout; + +@@ -702,6 +704,10 @@ + else if (config_theme_window_list_icon_size > 96) + config_theme_window_list_icon_size = 96; + } ++ if ((n = obt_xml_find_node(node, "cornerRadius"))) { ++ config_theme_cornerradius = obt_xml_node_int(n); ++ obt_xml_attr_bool(n, "menu", &config_theme_menuradius); ++ } + + n = obt_xml_find_node(node, "font"); + while (n) { +@@ -1078,6 +1084,8 @@ + config_title_layout = g_strdup("NLIMC"); + config_theme_keepborder = TRUE; + config_theme_window_list_icon_size = 36; ++ config_theme_cornerradius = 0; ++ config_theme_menuradius = TRUE; + + config_font_activewindow = NULL; + config_font_inactivewindow = NULL; +--- a/openbox/frame.c 2013-08-11 18:33:24.000000000 -0700 ++++ b/openbox/frame.c 2017-03-06 14:35:56.088377603 -0700 +@@ -334,6 +334,31 @@ + #endif + } + ++void frame_round_corners(Window window) ++{ ++ XWindowAttributes win_attr; ++ XGetWindowAttributes(obt_display, window, &win_attr); ++ int width = win_attr.width + win_attr.border_width; ++ int height = win_attr.height + win_attr.border_width; ++ Pixmap mask = XCreatePixmap(obt_display, window, width, height, 1); ++ XGCValues xgcv; ++ GC shape_gc = XCreateGC(obt_display, mask, 0, &xgcv); ++ int rad = config_theme_cornerradius; ++ int dia = 2 * rad; ++ XSetForeground(obt_display, shape_gc, 0); ++ XFillRectangle(obt_display, mask, shape_gc, 0, 0, width, height); ++ XSetForeground(obt_display, shape_gc, 1); ++ XFillArc(obt_display, mask, shape_gc, 0, 0, dia, dia, 0, 23040); ++ XFillArc(obt_display, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040); ++ XFillArc(obt_display, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040); ++ XFillArc(obt_display, mask, shape_gc, width-dia-1, height-dia-1, dia, dia, ++ 0, 23040); ++ XFillRectangle(obt_display, mask, shape_gc, rad, 0, width-dia, height); ++ XFillRectangle(obt_display, mask, shape_gc, 0, rad, width, height-dia); ++ XShapeCombineMask(obt_display, window, ShapeBounding, 0, 0, mask, ShapeSet); ++ XFreePixmap(obt_display, mask); ++} ++ + void frame_adjust_area(ObFrame *self, gboolean moved, + gboolean resized, gboolean fake) + { +@@ -857,7 +882,6 @@ + + if (resized) { + self->need_render = TRUE; +- framerender_frame(self); + frame_adjust_shape(self); + } + +@@ -884,7 +908,9 @@ + { + XResizeWindow(obt_display, self->label, self->label_width, + ob_rr_theme->label_height); ++ self->need_render = TRUE; + } ++ framerender_frame(self); + } + + static void frame_adjust_cursors(ObFrame *self) +@@ -958,6 +984,8 @@ + XMoveResizeWindow(obt_display, self->backfront, 0, 0, + self->client->area.width, + self->client->area.height); ++ self->need_render = TRUE; ++ framerender_frame(self); + } + + void frame_adjust_state(ObFrame *self) +--- a/openbox/framerender.c 2013-08-11 18:33:24.000000000 -0700 ++++ b/openbox/framerender.c 2017-03-06 14:35:56.088377603 -0700 +@@ -21,6 +21,7 @@ + #include "openbox.h" + #include "screen.h" + #include "client.h" ++#include "config.h" + #include "framerender.h" + #include "obrender/theme.h" + +@@ -42,6 +43,9 @@ + return; + self->need_render = FALSE; + ++ if ( !self->max_horz && !self->max_vert && config_theme_cornerradius ) ++ frame_round_corners(self->window); ++ + { + gulong px; + +--- a/openbox/menuframe.c 2013-08-11 18:33:24.000000000 -0700 ++++ b/openbox/menuframe.c 2017-03-06 14:35:56.088377603 -0700 +@@ -17,6 +17,7 @@ + See the COPYING file for a copy of the GNU General Public License. + */ + ++#include "frame.h" + #include "menuframe.h" + #include "client.h" + #include "menu.h" +@@ -838,6 +839,9 @@ + + RECT_SET_SIZE(self->area, w, h); + ++ if ( config_theme_menuradius ) ++ frame_round_corners(self->window); ++ + XFlush(obt_display); + }