wok-current annotate openbox-imlib2/stuff/openbox-rounded.patch @ rev 23630

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