You are not logged in.

#61 2017-03-03 14:34:58

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

^I don't understand, why would you want to replace one rc file with 2 dozen .xpm files, not including the buttons? Theming Xfwm4 is a gigantic PITA just for this reason.

@HoaS, is it too much to ask for stretch builds of this?

@all who have been testing, does this affect the OB root menu (please say yes!)?

I'm asking because xfce4-notifyd now uses GTK3 and does not accept a border-radius value less than 1, which makes BL's current theming inconsistent (windows and menu are square, notifications are round. If we could have all 3 elements (window borders, root menu and notifications) with the same radius value, I would be a happy boy.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#62 2017-03-03 19:52:46

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Openbox with rounded corners

hhh wrote:

@all who have been testing, does this affect the OB root menu (please say yes!)?

No, corner clipping is only applied to decorated windows. Without reviewing actual source, I am guessing that root-menu, client-menu, and client-list-combined-menu can get the same mods. I will take a look.

hhh wrote:

I'm asking because xfce4-notifyd now uses GTK3 and does not accept a border-radius value less than 1, which makes BL's current theming inconsistent (windows and menu are square, notifications are round.

Is the round corner problem restricted to xfce4-notifyd-config? Can you manually configure square corners in the gtk3 theme? While XFCE distributes themes with rounded corners, I would be surprised if they intended to enforce round corners on all theme devs. I would categorize this as a bug. Especially if manual configuration works and the problem is restricted to xfce4-notifyd-config. Have you reported it as such?*

Furthermore, my reading of the XFCE 4.12 changelog indicates compling xfce4-notifyd with GTK3 is optional. You may be able to recompile with GTK2 and have the problem just go away. The release is already a hotch-potch of GTK2/GTK3 executables.

*Reporting as a bug now will not get stretch fixed. BL will need to compile its own binary. (If memory serves, this mirrors the problem with xfce4-power-manager at the jessie testing-to-stable transition).

Offline

#63 2017-03-03 19:59:14

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Openbox with rounded corners

o9000 wrote:

That's OK, but what I would prefer is taking this a step further and adding support for XFWM themes in Openbox. The concept is very simple: for each part of the window frame (e.g. title bar, upper right corner, close button), an image is provided. For buttons and corners, the image is drawm as is; for title bar and borders, it is tiled horizontally or vertically to the entire window size. The button geometry is computed based on the image. So a theme would look like this: https://gitlab.com/o9000/ChromeDark/tree/master/xfwm4

What do you think?

The code changes are non-trivial. It essentially requires combining the xfwm window rendering code into OB. If you like xfwm theming and rendering and merely want OB-style root menu handling, it is probably easier to add OB features to the xfwm code.

Sorry it took so long to respond. Intended to get to it but never did.

Offline

#64 2017-03-03 20:07:25

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

^^I haven't looked into all that, nor reported any bugs. I'm rather busy with 'real life' ATM.

And a confession which some here already know... although I have managed to crack live-build's cryptic manual and build our first ISOs, modify existing themes to create the Bunsen ones, backport packages and teach myself XHTML/CSS (quite rusty on that now, though), I have never taken a computer science class and only began learning my first programming language, JavaScript, last week. I'm starting by working through the w3schools' online tutorials.

That's why any tutorial I post is very hand-hold-y... I've found many tutorials make assumptions about a user's knowledge and they've been fairly worthless to me on many occasions.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#65 2017-03-03 20:28:58

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Openbox with rounded corners

^Of course, merely suggestions. We do what we have time for.

Offline

#66 2017-03-03 20:49:07

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: Openbox with rounded corners

hhh wrote:

@HoaS, is it too much to ask for stretch builds of this?

Nothing is too much for the Aitch Cube:

https://drive.google.com/open?id=0BxKgG … DNjdnJsaEk

Untested though, good luck!

big_smile

Offline

#67 2017-03-03 21:44:25

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

^I'm sorry, HoaS, I forgot to specify that I'm on i386.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#68 2017-03-03 21:46:48

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: Openbox with rounded corners

hhh wrote:

I'm on i386.

Ah, right, OK.

Give me a bit, I'll rustle up a container...

At least this build will be clean  O:)

EDIT: systemd-nspawn doesn't work if you're booting with runit...

roll

Last edited by Head_on_a_Stick (2017-03-03 22:00:49)

Offline

#69 2017-03-03 22:36:14

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: Openbox with rounded corners

@cpoakes: your patch doesn't quite apply cleanly to the stretch version; I used:

apt-get source openbox && cd openbox*
dch --nmu
quilt import -P rounded-corners.patch cpoakes.patch
quilt push
debuild -us -uc

The error was:

empty@Helium:~/openbox-3.6.1$ debuild -us -uc
 dpkg-buildpackage -rfakeroot -us -uc
dpkg-buildpackage: info: source package openbox
dpkg-buildpackage: info: source version 3.6.1-4.1
dpkg-buildpackage: info: source distribution UNRELEASED
dpkg-buildpackage: info: source changed by  <empty@Helium>
 dpkg-source --before-build openbox-3.6.1
dpkg-buildpackage: info: host architecture i386
 fakeroot debian/rules clean
dh clean
   dh_testdir
   debian/rules override_dh_auto_clean
make[1]: Entering directory '/home/empty/openbox-3.6.1'
rm -f openbox.1
#rm -f kdetrayproxy.1
rm -f gnome-panel-control.1
rm -f gdm-control.1
dh_auto_clean
make[1]: Leaving directory '/home/empty/openbox-3.6.1'
   dh_autoreconf_clean
   dh_clean
 dpkg-source -b openbox-3.6.1
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building openbox using existing ./openbox_3.6.1.orig.tar.gz
patching file openbox/config.c
Hunk #2 FAILED at 703.
Hunk #3 succeeded at 1099 (offset 20 lines).
1 out of 3 hunks FAILED
patching file openbox/config.h
patching file openbox/frame.c
patching file openbox/framerender.c
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
dpkg-source: info: if patch 'rounded-corners.patch' is correctly applied by quilt, use 'quilt refresh' to update it
dpkg-source: error: LC_ALL=C patch -t -F 0 -N -p1 -u -V never -E -b -B .pc/rounded-corners.patch/ --reject-file=- < openbox-3.6.1.orig.54ejyh/debian/patches/rounded-corners.patch gave error exit status 1
dpkg-buildpackage: error: dpkg-source -b openbox-3.6.1 gave error exit status 2
debuild: fatal error at line 1116:
dpkg-buildpackage -rfakeroot -us -uc failed

Using `quilt refresh` let the package build successfully.

@hhh: here is the i386 .deb:

https://drive.google.com/open?id=0BxKgG … WFVNFM1OGc

Offline

#70 2017-03-03 22:44:00

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

^Thanks a million! The library is closing, I'll post back when I can.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#71 2017-03-03 23:32:43

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

It installed with no problem, thanks! And if I set the radius to 1 for windows and 2 for notifications it matches, but I can't say I'm thrilled with how it looks at 1280x800. Scrot post when I can.

Still, this is a nice option to have for stretch (as well as now).

Last edited by hhh (2017-03-03 23:35:15)


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#72 2017-03-04 07:25:52

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Openbox with rounded corners

@HoaS - I'm in the midst of adapting the code for rounded corners on the menus. I am going to bang on it for a while. Once I am satisfied, I'll build the patch. Then we can see how it works with stretch. Better use of my time than debugging the last patch.

@hhh - The binary alpha mask definitely constitutes a kludge; "doing it right" is non-trivial. I don't care for the jaggies on low resolution, but at 141 DPI (1920x1080) it looks pretty good.

Offline

#73 2017-03-04 08:41:54

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Openbox with rounded corners

o9000 wrote:

taking this a step further and adding support for XFWM themes in Openbox.

use fluxbox, you get both: config-based and pixmap-based.
i hate pixmap-based. doesn't scale well and is indeed a PITA to create.
But it's the format of choice for almost everything that's older than 15 years, so i guess it must be fast.

Offline

#74 2017-03-04 11:07:07

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 417
Website

Re: Openbox with rounded corners

I don't think the main advantage of pixmaps is speed, it is the lower code complexity. Drawing a pixmap is very easy. All you need is the width, height, position and transparency layer and you're done. By contrast, parsing config files describing the color and geometry of the borders and buttons, and then drawing, scaling, updating them accordingly needs a lot code that's much more complex. That's why it takes forever to make a small change such as drawing rounded corners.

You guys keep saying it's a pain to draw the pixmaps in GIMP. I disagree. It only takes a few hours to make an entire theme, even without strong GIMP skills. By contrast, look at how much it takes to make something as simple as rounded corners with the other approach. You've been working on it for weeks.

But I understand why it might not be a good idea to switch to pixmaps at this point. Openbox just wasn't designed to work this way, and it might be difficult to change.

Anyways, I don't have time to help with this, and I'm not saying anything constructive, so I'll unsubscribe. Good luck.

Offline

#75 2017-03-04 15:00:47

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

cpoakes wrote:

The release is already a hotch-potch of GTK2/GTK3 executables.

Yes, that's what I'm seeing. xfwm4 and xfce4-session, for example, still depend on libgtk-2.

You may be able to recompile with GTK2 and have the problem just go away.

xfce4-notifyd depends on libgtk-3-0, so I don't think so. I'm wondering if I can build the jessie version on stretch, but I have a feeling I'll get screwed by the dependencies.

Anyway, I'll start a new thread for this if I make any progress.

-edit- Looks like this is the problem (if radius == 0 then radius = 6, and the preceding reason)...

diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c
index 6024a2d..686d4b1 100644
--- a/xfce4-notifyd/xfce-notify-window.c
+++ b/xfce4-notifyd/xfce-notify-window.c
@@ -359,33 +359,37 @@ xfce_notify_window_draw_rectangle (XfceNotifyWindow *window,
     border_width = get_max_border_width (context, state);
     border_padding = border_width / 2.0;
     
-    if(radius < 1) {
-        cairo_rectangle(cr, 0, 0, widget_allocation.width,
-                        widget_allocation.height);
-    } else {
-        cairo_move_to(cr, border_padding, radius + border_padding);
-        cairo_arc(cr, radius + border_padding,
-                  radius + border_padding, radius,
-                  M_PI, 3.0*M_PI/2.0);
-        cairo_line_to(cr,
-                      widget_allocation.width - radius - border_padding,
-                      border_padding);
-        cairo_arc(cr,
-                  widget_allocation.width - radius - border_padding,
-                  radius + border_padding, radius,
-                  3.0*M_PI/2.0, 0.0);
-        cairo_line_to(cr, widget_allocation.width - border_padding,
-                      widget_allocation.height - radius - border_padding);
-        cairo_arc(cr, widget_allocation.width - radius - border_padding,
-                  widget_allocation.height - radius - border_padding,
-                  radius, 0.0, M_PI/2.0);
-        cairo_line_to(cr, radius + border_padding,
-                      widget_allocation.height - border_padding);
-        cairo_arc(cr, radius + border_padding,
-                  widget_allocation.height - radius - border_padding,
-                  radius, M_PI/2.0, M_PI);
-        cairo_close_path(cr);
+    /* Always use a small rounded corners. This should not be necessary in 
+     * theory, as Adwaita defined border-radius: 0 0 6px 6px; for the 
+     * app-notification and osd css classes. The problem is that Gtk for some
+     * reason gets the border-radius as gint and not as GtkBorder. Getting 
+     * this way the first value only, which is 0. */
+    if ( radius == 0 ) {
+        radius = 6;
     }

No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#76 2017-03-04 19:09:06

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

New thread to discuss xfce4-notifyd...
https://forums.bunsenlabs.org/viewtopic.php?id=3440


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#77 2017-03-06 22:22:32

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Openbox with rounded corners

Per hhh's wish, the openbox patch has been extended to mask round corners on root- and client-list- menus in addition to decorated (normal) windows. The rc.xml parameter <cornerRadius> (in <theme> section) is augmented with an optional attribute "menu". New configuration examples:

<cornerRadius>8</cornerRadius>
<cornerRadius menu="yes">8</cornerRadius>
<cornerRadius menu="no">8</cornerRadius>

The "menu" attribute can be set to any openbox boolean value (true, false, yes, no, on, off). When omitted (or invalid value), it defaults to true. A true value gives rounded OB menu corners and a false value gives square menu corners.

The masking algorithm is encapsulated as a single function applied to both decorated windows and menus; the change in code size is minimal. The OB prompt and popup windows and their display methods are structured differently and require more time than I want to commit creating or adapting a solution for them.

The patch is designed for jessie (openbox-3.5.2), but can be applied to stretch (openbox-3.6.2; patch correctly offsets hunks as needed). Caveats from post 42814 still apply. The patch:

--- 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);
 }
 

After using round-corner OB menus, I prefer the square as they match my GTK2 and GTK3 drop-down menus. A comprehensive application of round corners would require modification of the GTK themes as well.

EDIT 08 Mar 17 - Removed extra space causing warning with quilt.

Last edited by cpoakes (2017-03-08 14:53:01)

Offline

#78 2017-03-06 22:54:45

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,039
Website

Re: Openbox with rounded corners

@cpoakes, super-cool! Thanks for your work on this. smile

And I'm with you, I've grown to like sharp corners because pixels.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#79 2017-03-07 20:15:07

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: Openbox with rounded corners

I have rebuilt the custom openbox packages with the new patch, the instructions in this post still apply:

https://forums.bunsenlabs.org/viewtopic … 248#p43248

The version has been bumped to 3.5.2-8.2 so it should upgrade OK.

Offline

#80 2017-03-07 20:39:57

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Openbox with rounded corners

^ Thanks for your continued diligence. No problems with stretch?

Offline

Board footer

Powered by FluxBB