wok view openbox-imlib2/stuff/openbox-rounded.patch @ rev 20257

Add giflossy
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Mar 13 23:27:32 2018 +0100 (2018-03-13)
parents
children
line source
1 --- a/openbox/config.h 2017-03-03 21:48:15.000000000 -0700
2 +++ b/openbox/config.h 2017-03-06 14:35:56.084377574 -0700
3 @@ -152,6 +152,9 @@
4 extern gboolean config_animate_iconify;
5 /*! Size of icons in focus switching dialogs */
6 extern guint config_theme_window_list_icon_size;
7 +/*! Display rounded corners for decorated windows */
8 +extern guint config_theme_cornerradius;
9 +extern gboolean config_theme_menuradius;
11 /*! The font for the active window's title */
12 extern RrFont *config_font_activewindow;
13 --- a/openbox/config.c 2017-03-03 21:48:15.000000000 -0700
14 +++ b/openbox/config.c 2017-03-06 14:37:06.400883218 -0700
15 @@ -48,6 +48,8 @@
16 gchar *config_theme;
17 gboolean config_theme_keepborder;
18 guint config_theme_window_list_icon_size;
19 +guint config_theme_cornerradius;
20 +gboolean config_theme_menuradius;
22 gchar *config_title_layout;
24 @@ -702,6 +704,10 @@
25 else if (config_theme_window_list_icon_size > 96)
26 config_theme_window_list_icon_size = 96;
27 }
28 + if ((n = obt_xml_find_node(node, "cornerRadius"))) {
29 + config_theme_cornerradius = obt_xml_node_int(n);
30 + obt_xml_attr_bool(n, "menu", &config_theme_menuradius);
31 + }
33 n = obt_xml_find_node(node, "font");
34 while (n) {
35 @@ -1078,6 +1084,8 @@
36 config_title_layout = g_strdup("NLIMC");
37 config_theme_keepborder = TRUE;
38 config_theme_window_list_icon_size = 36;
39 + config_theme_cornerradius = 0;
40 + config_theme_menuradius = TRUE;
42 config_font_activewindow = NULL;
43 config_font_inactivewindow = NULL;
44 --- a/openbox/frame.c 2013-08-11 18:33:24.000000000 -0700
45 +++ b/openbox/frame.c 2017-03-06 14:35:56.088377603 -0700
46 @@ -334,6 +334,31 @@
47 #endif
48 }
50 +void frame_round_corners(Window window)
51 +{
52 + XWindowAttributes win_attr;
53 + XGetWindowAttributes(obt_display, window, &win_attr);
54 + int width = win_attr.width + win_attr.border_width;
55 + int height = win_attr.height + win_attr.border_width;
56 + Pixmap mask = XCreatePixmap(obt_display, window, width, height, 1);
57 + XGCValues xgcv;
58 + GC shape_gc = XCreateGC(obt_display, mask, 0, &xgcv);
59 + int rad = config_theme_cornerradius;
60 + int dia = 2 * rad;
61 + XSetForeground(obt_display, shape_gc, 0);
62 + XFillRectangle(obt_display, mask, shape_gc, 0, 0, width, height);
63 + XSetForeground(obt_display, shape_gc, 1);
64 + XFillArc(obt_display, mask, shape_gc, 0, 0, dia, dia, 0, 23040);
65 + XFillArc(obt_display, mask, shape_gc, width-dia-1, 0, dia, dia, 0, 23040);
66 + XFillArc(obt_display, mask, shape_gc, 0, height-dia-1, dia, dia, 0, 23040);
67 + XFillArc(obt_display, mask, shape_gc, width-dia-1, height-dia-1, dia, dia,
68 + 0, 23040);
69 + XFillRectangle(obt_display, mask, shape_gc, rad, 0, width-dia, height);
70 + XFillRectangle(obt_display, mask, shape_gc, 0, rad, width, height-dia);
71 + XShapeCombineMask(obt_display, window, ShapeBounding, 0, 0, mask, ShapeSet);
72 + XFreePixmap(obt_display, mask);
73 +}
74 +
75 void frame_adjust_area(ObFrame *self, gboolean moved,
76 gboolean resized, gboolean fake)
77 {
78 @@ -857,7 +882,6 @@
80 if (resized) {
81 self->need_render = TRUE;
82 - framerender_frame(self);
83 frame_adjust_shape(self);
84 }
86 @@ -884,7 +908,9 @@
87 {
88 XResizeWindow(obt_display, self->label, self->label_width,
89 ob_rr_theme->label_height);
90 + self->need_render = TRUE;
91 }
92 + framerender_frame(self);
93 }
95 static void frame_adjust_cursors(ObFrame *self)
96 @@ -958,6 +984,8 @@
97 XMoveResizeWindow(obt_display, self->backfront, 0, 0,
98 self->client->area.width,
99 self->client->area.height);
100 + self->need_render = TRUE;
101 + framerender_frame(self);
102 }
104 void frame_adjust_state(ObFrame *self)
105 --- a/openbox/framerender.c 2013-08-11 18:33:24.000000000 -0700
106 +++ b/openbox/framerender.c 2017-03-06 14:35:56.088377603 -0700
107 @@ -21,6 +21,7 @@
108 #include "openbox.h"
109 #include "screen.h"
110 #include "client.h"
111 +#include "config.h"
112 #include "framerender.h"
113 #include "obrender/theme.h"
115 @@ -42,6 +43,9 @@
116 return;
117 self->need_render = FALSE;
119 + if ( !self->max_horz && !self->max_vert && config_theme_cornerradius )
120 + frame_round_corners(self->window);
121 +
122 {
123 gulong px;
125 --- a/openbox/menuframe.c 2013-08-11 18:33:24.000000000 -0700
126 +++ b/openbox/menuframe.c 2017-03-06 14:35:56.088377603 -0700
127 @@ -17,6 +17,7 @@
128 See the COPYING file for a copy of the GNU General Public License.
129 */
131 +#include "frame.h"
132 #include "menuframe.h"
133 #include "client.h"
134 #include "menu.h"
135 @@ -838,6 +839,9 @@
137 RECT_SET_SIZE(self->area, w, h);
139 + if ( config_theme_menuradius )
140 + frame_round_corners(self->window);
141 +
142 XFlush(obt_display);
143 }