Re: Support for _NET_DESKTOP_LAYOUT property, i.e. config_desktops_rows option, request

Ilya Tumaykin <[email protected]>
Newsgroups gmane.comp.window-managers.openbox
Message-ID <2382882.9engUFzk0t@photon>
I've tried to adopt the patch mentioned previously to openbox-3.5.2 (see 
attachments). Openbox builds fine with that, but _NET_DESKTOP_LAYOUT property 
is still stuck to 0,0,0,0 upon login to KDE/Openbox.

Also, I've tried setlayout program mentioned here: 
http://openbox.org/wiki/Help:FAQ#How_do_I_put_my_desktops_into_a_grid_layout_instead_of_a_single_row.3F
_NET_DESKTOP_LAYOUT is properly updated using it, but KDE's pager is showing a 
single row ignoring changes to the said property.

Can anyone give me any further ideas either how to improve the patch so it 
actually sets _NET_DESKTOP_LAYOUT, or how to make KDE pager update it's view 
depending on _NET_DESKTOP_LAYOUT value?

Thanks for any help.

On 29.01.14 18:46:44 you wrote:
> Hello.
> 
> I've been using Openbox for a long time together with various panels and
> pagers. Now I'm trying to get KDE/Openbox tandem work as neatly as plain
> Openbox. And it works fine in most aspects.
> 
> However, one of the missing functionality pieces of the said tandem is the
> correct number of rows in pager, i.e. correct _NET_DESKTOP_LAYOUT property
> setup. I've read EWMH spec and aware that this property should be set by
> pager, not WM. Unfortunately, KDE does not follow standard in this case and
> use KWin to set this property since 4.8.0 (see
> https://bugs.kde.org/show_bug.cgi?id=277965#c7).
> 
> After some googling I've found a patch, which adds this functionality to
> Openbox. It was mentioned in 2004 and 2005 in Openbox ML:
> http://icculus.org/pipermail/openbox/2004-June/002624.html and
> http://icculus.org/pipermail/openbox/2005-September/003667.html.
> 
> In these mails this patch is considered unfinished/unstable. I would like to
> know if this patch (possibly an updated verision) could be included in
> Openbox now? Otherwise KDE/Openbox tandem is broken. Maybe I could help to
> improve/test this patch in some way? I am not Xlib programmer, but I will
> try to do my best, if you give me some hints on what needs to be done.

-- 
Best regards.
Tumaykin Ilya.

_______________________________________________
openbox mailing list
[email protected]
http://icculus.org/mailman/listinfo/openbox
openbox_desktop_rows.patch (text/x-patch, 3.2 KB)
diff -ur openbox-3.5.2-original/openbox/config.c openbox-3.5.2/openbox/config.c
--- openbox-3.5.2-original/openbox/config.c	2013-08-12 05:33:24.000000000 +0400
+++ openbox-3.5.2/openbox/config.c	2014-02-01 23:54:59.550983877 +0400
@@ -60,6 +60,7 @@
 RrFont *config_font_inactiveosd;
 
 guint   config_desktops_num;
+guint   config_desktops_rows;
 GSList *config_desktops_names;
 guint   config_screen_firstdesk;
 guint   config_desktop_popup_time;
@@ -765,6 +766,11 @@
         if (d > 0)
             config_desktops_num = (unsigned) d;
     }
+    if ((n = obt_xml_find_node(node, "rows"))) {
+        gint d = obt_xml_node_int(n);
+        if (d > 0)
+            config_desktops_rows = (unsigned) d;
+    }
     if ((n = obt_xml_find_node(node, "firstdesk"))) {
         gint d = obt_xml_node_int(n);
         if (d > 0)
@@ -1083,6 +1089,7 @@
     obt_xml_register(i, "theme", parse_theme, NULL);
 
     config_desktops_num = 4;
+    config_desktops_rows = 1;
     config_screen_firstdesk = 1;
     config_desktops_names = NULL;
     config_desktop_popup_time = 875;
diff -ur openbox-3.5.2-original/openbox/config.h openbox-3.5.2/openbox/config.h
--- openbox-3.5.2-original/openbox/config.h	2013-08-12 05:33:24.000000000 +0400
+++ openbox-3.5.2/openbox/config.h	2014-02-01 23:55:59.377983124 +0400
@@ -166,6 +166,8 @@
 
 /*! The number of desktops */
 extern guint config_desktops_num;
+/*! The number of desktops rows */
+extern guint config_desktops_rows;
 /*! Desktop to start on, put 5 to start in the center of a 3x3 grid */
 extern guint config_screen_firstdesk;
 /*! Names for the desktops */
diff -ur openbox-3.5.2-original/openbox/screen.c openbox-3.5.2/openbox/screen.c
--- openbox-3.5.2-original/openbox/screen.c	2013-08-12 05:33:24.000000000 +0400
+++ openbox-3.5.2/openbox/screen.c	2014-02-02 00:06:56.820974853 +0400
@@ -165,7 +165,7 @@
     XSetWindowAttributes attrib;
     pid_t pid;
     gint i, num_support;
-    gulong *supported;
+    gulong *supported, layout[4];
 
     /* create the netwm support window */
     attrib.override_redirect = TRUE;
@@ -201,6 +201,14 @@
     pid = getpid();
     OBT_PROP_SET32(obt_root(ob_screen), OPENBOX_PID, CARDINAL, pid);
 
+    /* set desktop layout */
+    layout[0] = screen_desktop_layout.orientation;
+    layout[1] = screen_desktop_layout.columns;
+    layout[2] = screen_desktop_layout.rows;
+    layout[3] = screen_desktop_layout.start_corner;
+    OBT_PROP_SETA32(obt_root(ob_screen),
+                   NET_DESKTOP_LAYOUT, CARDINAL, layout, 4);
+
     /* set supporting window */
     OBT_PROP_SET32(obt_root(ob_screen),
                    NET_SUPPORTING_WM_CHECK, WINDOW, screen_support_win);
@@ -1133,8 +1141,10 @@
 
     screen_desktop_layout.orientation = OB_ORIENTATION_HORZ;
     screen_desktop_layout.start_corner = OB_CORNER_TOPLEFT;
-    screen_desktop_layout.rows = 1;
-    screen_desktop_layout.columns = screen_num_desktops;
+    screen_desktop_layout.rows = config_desktops_rows;
+    screen_desktop_layout.columns = screen_num_desktops / config_desktops_rows;
+    if (screen_num_desktops % config_desktops_rows)
+        screen_desktop_layout.columns += 1;
 
     if (OBT_PROP_GETA32(obt_root(ob_screen),
                         NET_DESKTOP_LAYOUT, CARDINAL, &data, &num)) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.