wok diff openbox/stuff/openbox-rounded.patch @ rev 20287
Up zstd (1.3.4)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Apr 02 12:15:19 2018 +0200 (2018-04-02) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/openbox/stuff/openbox-rounded.patch Mon Apr 02 12:15:19 2018 +0200 1.3 @@ -0,0 +1,143 @@ 1.4 +--- a/openbox/config.h 2017-03-03 21:48:15.000000000 -0700 1.5 ++++ b/openbox/config.h 2017-03-06 14:35:56.084377574 -0700 1.6 +@@ -152,6 +152,9 @@ 1.7 + extern gboolean config_animate_iconify; 1.8 + /*! Size of icons in focus switching dialogs */ 1.9 + extern guint config_theme_window_list_icon_size; 1.10 ++/*! Display rounded corners for decorated windows */ 1.11 ++extern guint config_theme_cornerradius; 1.12 ++extern gboolean config_theme_menuradius; 1.13 + 1.14 + /*! The font for the active window's title */ 1.15 + extern RrFont *config_font_activewindow; 1.16 +--- a/openbox/config.c 2017-03-03 21:48:15.000000000 -0700 1.17 ++++ b/openbox/config.c 2017-03-06 14:37:06.400883218 -0700 1.18 +@@ -48,6 +48,8 @@ 1.19 + gchar *config_theme; 1.20 + gboolean config_theme_keepborder; 1.21 + guint config_theme_window_list_icon_size; 1.22 ++guint config_theme_cornerradius; 1.23 ++gboolean config_theme_menuradius; 1.24 + 1.25 + gchar *config_title_layout; 1.26 + 1.27 +@@ -702,6 +704,10 @@ 1.28 + else if (config_theme_window_list_icon_size > 96) 1.29 + config_theme_window_list_icon_size = 96; 1.30 + } 1.31 ++ if ((n = obt_xml_find_node(node, "cornerRadius"))) { 1.32 ++ config_theme_cornerradius = obt_xml_node_int(n); 1.33 ++ obt_xml_attr_bool(n, "menu", &config_theme_menuradius); 1.34 ++ } 1.35 + 1.36 + n = obt_xml_find_node(node, "font"); 1.37 + while (n) { 1.38 +@@ -1078,6 +1084,8 @@ 1.39 + config_title_layout = g_strdup("NLIMC"); 1.40 + config_theme_keepborder = TRUE; 1.41 + config_theme_window_list_icon_size = 36; 1.42 ++ config_theme_cornerradius = 0; 1.43 ++ config_theme_menuradius = TRUE; 1.44 + 1.45 + config_font_activewindow = NULL; 1.46 + config_font_inactivewindow = NULL; 1.47 +--- a/openbox/frame.c 2013-08-11 18:33:24.000000000 -0700 1.48 ++++ b/openbox/frame.c 2017-03-06 14:35:56.088377603 -0700 1.49 +@@ -334,6 +334,31 @@ 1.50 + #endif 1.51 + } 1.52 + 1.53 ++void frame_round_corners(Window window) 1.54 ++{ 1.55 ++ XWindowAttributes win_attr; 1.56 ++ XGetWindowAttributes(obt_display, window, &win_attr); 1.57 ++ int width = win_attr.width + win_attr.border_width; 1.58 ++ int height = win_attr.height + win_attr.border_width; 1.59 ++ Pixmap mask = XCreatePixmap(obt_display, window, width, height, 1); 1.60 ++ XGCValues xgcv; 1.61 ++ GC shape_gc = XCreateGC(obt_display, mask, 0, &xgcv); 1.62 ++ int rad = config_theme_cornerradius; 1.63 ++ int dia = 2 * rad; 1.64 ++ XSetForeground(obt_display, shape_gc, 0); 1.65 ++ XFillRectangle(obt_display, mask, shape_gc, 0, 0, width, height); 1.66 ++ XSetForeground(obt_display, shape_gc, 1); 1.67 ++ XFillArc(obt_display, mask, shape_gc, 0, 0, dia, dia, 0, 23040); 1.68 ++ XFillArc(obt_display, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040); 1.69 ++ XFillArc(obt_display, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040); 1.70 ++ XFillArc(obt_display, mask, shape_gc, width-dia-1, height-dia-1, dia, dia, 1.71 ++ 0, 23040); 1.72 ++ XFillRectangle(obt_display, mask, shape_gc, rad, 0, width-dia, height); 1.73 ++ XFillRectangle(obt_display, mask, shape_gc, 0, rad, width, height-dia); 1.74 ++ XShapeCombineMask(obt_display, window, ShapeBounding, 0, 0, mask, ShapeSet); 1.75 ++ XFreePixmap(obt_display, mask); 1.76 ++} 1.77 ++ 1.78 + void frame_adjust_area(ObFrame *self, gboolean moved, 1.79 + gboolean resized, gboolean fake) 1.80 + { 1.81 +@@ -857,7 +882,6 @@ 1.82 + 1.83 + if (resized) { 1.84 + self->need_render = TRUE; 1.85 +- framerender_frame(self); 1.86 + frame_adjust_shape(self); 1.87 + } 1.88 + 1.89 +@@ -884,7 +908,9 @@ 1.90 + { 1.91 + XResizeWindow(obt_display, self->label, self->label_width, 1.92 + ob_rr_theme->label_height); 1.93 ++ self->need_render = TRUE; 1.94 + } 1.95 ++ framerender_frame(self); 1.96 + } 1.97 + 1.98 + static void frame_adjust_cursors(ObFrame *self) 1.99 +@@ -958,6 +984,8 @@ 1.100 + XMoveResizeWindow(obt_display, self->backfront, 0, 0, 1.101 + self->client->area.width, 1.102 + self->client->area.height); 1.103 ++ self->need_render = TRUE; 1.104 ++ framerender_frame(self); 1.105 + } 1.106 + 1.107 + void frame_adjust_state(ObFrame *self) 1.108 +--- a/openbox/framerender.c 2013-08-11 18:33:24.000000000 -0700 1.109 ++++ b/openbox/framerender.c 2017-03-06 14:35:56.088377603 -0700 1.110 +@@ -21,6 +21,7 @@ 1.111 + #include "openbox.h" 1.112 + #include "screen.h" 1.113 + #include "client.h" 1.114 ++#include "config.h" 1.115 + #include "framerender.h" 1.116 + #include "obrender/theme.h" 1.117 + 1.118 +@@ -42,6 +43,9 @@ 1.119 + return; 1.120 + self->need_render = FALSE; 1.121 + 1.122 ++ if ( !self->max_horz && !self->max_vert && config_theme_cornerradius ) 1.123 ++ frame_round_corners(self->window); 1.124 ++ 1.125 + { 1.126 + gulong px; 1.127 + 1.128 +--- a/openbox/menuframe.c 2013-08-11 18:33:24.000000000 -0700 1.129 ++++ b/openbox/menuframe.c 2017-03-06 14:35:56.088377603 -0700 1.130 +@@ -17,6 +17,7 @@ 1.131 + See the COPYING file for a copy of the GNU General Public License. 1.132 + */ 1.133 + 1.134 ++#include "frame.h" 1.135 + #include "menuframe.h" 1.136 + #include "client.h" 1.137 + #include "menu.h" 1.138 +@@ -838,6 +839,9 @@ 1.139 + 1.140 + RECT_SET_SIZE(self->area, w, h); 1.141 + 1.142 ++ if ( config_theme_menuradius ) 1.143 ++ frame_round_corners(self->window); 1.144 ++ 1.145 + XFlush(obt_display); 1.146 + }