]> Dogcows Code - chaz/openbox/commitdiff
add most of the root window props get functions
authorDana Jansens <danakj@orodu.net>
Sat, 12 Apr 2003 02:03:28 +0000 (02:03 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 12 Apr 2003 02:03:28 +0000 (02:03 +0000)
cwmcc/client_props.c
cwmcc/prop.h
cwmcc/root_props.c
cwmcc/root_props.h

index 34ae4ecd9107d8d3f419fefe505bff590dcd81dd..30644dd89f1ad3b42e3133085bc3b90d74783d4d 100644 (file)
@@ -2,7 +2,6 @@
 #include "atom.h"
 #include "prop.h"
 #include "client_props.h"
-#include "render/render.h"
 
 #include <X11/Xutil.h>
 #ifdef HAVE_STRING_H
index c046f5b8b9653c2c20d90cce94b91e4643359ae7..c9cb0751a691dcdebf66e5d86d1a6fafd85d352d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __prop_h
-#define __prop_h
+#ifndef __cwmcc_prop_h
+#define __cwmcc_prop_h
 
 #include <glib.h>
 #include <X11/Xlib.h>
index 7339cbbac2a102de2868409088201decfb4b2960..ef03e4454f2ca28f178f5dccd03371f65fc41aad 100644 (file)
@@ -1,10 +1,8 @@
 #include "cwmcc_internal.h"
 #include "atom.h"
 #include "prop.h"
-#include "client_props.h"
-#include "render/render.h"
+#include "root_props.h"
 
-#include <X11/Xutil.h>
 #ifdef HAVE_STRING_H
 #  include <string.h>
 #endif
@@ -114,3 +112,88 @@ void cwmcc_root_get_active_window(Window win, Window *window)
     }
 }
 
+/*void cwmcc_root_get_workarea(Window win, Rect a)
+{
+}*/
+
+void cwmcc_root_get_supporting_wm_check(Window win, Window *window)
+{
+    if (!prop_get32(win, CWMCC_ATOM(root, net_supporting_wm_check),
+                    CWMCC_ATOM(type, window), window)) {
+        g_warning("Failed to read NET_SUPPORTING_WM_CHECK from 0x%lx", win);
+        *window = None;
+    }
+}
+
+void cwmcc_root_get_desktop_layout(Window win,
+                                   struct Cwmcc_DesktopLayout *layout)
+{
+    gulong *data = NULL, num;
+    gulong desks;
+
+    /* need the number of desktops */
+    cwmcc_root_get_number_of_desktops(win, &desks);
+
+    layout->orientation = Cwmcc_Orientation_Horz;
+    layout->start_corner = Cwmcc_Corner_TopLeft;
+    layout->rows = 1;
+    layout->columns = desks;
+
+    if (!prop_get_array32(win, CWMCC_ATOM(root, net_desktop_layout),
+                    CWMCC_ATOM(type, cardinal), &data, &num)) {
+        g_warning("Failed to read NET_DESKTOP_LAYOUT from 0x%lx", win);
+    } else if (num != 4) {
+        g_warning("Read invalid NET_DESKTOP_LAYOUT from 0x%lx", win);
+    } else {
+        if (data[0] == Cwmcc_Orientation_Horz ||
+            data[0] == Cwmcc_Orientation_Vert)
+            layout->orientation = data[0];
+        if (data[3] == Cwmcc_Corner_TopLeft ||
+            data[3] == Cwmcc_Corner_TopRight ||
+            data[3] == Cwmcc_Corner_BottomLeft ||
+            data[3] == Cwmcc_Corner_BottomRight)
+            layout->start_corner = data[3];
+        layout->rows = data[2];
+        layout->columns = data[1];
+
+       /* bounds checking */
+       if (layout->orientation == Cwmcc_Orientation_Horz) {
+           if (layout->rows > desks)
+               layout->rows = desks;
+           if (layout->columns > ((desks + desks % layout->rows) /
+                                   layout->rows))
+               layout->columns = ((desks + desks % layout->rows) /
+                                   layout->rows);
+       } else {
+           if (layout->columns > desks)
+               layout->columns = desks;
+           if (layout->rows > ((desks + desks % layout->columns) /
+                                layout->columns))
+               layout->rows = ((desks + desks % layout->columns) /
+                                layout->columns);
+       }
+    }
+    g_free(data);
+}
+
+void cwmcc_root_get_showing_desktop(Window win, gboolean *showing)
+{
+    gulong a;
+
+    if (!prop_get32(win, CWMCC_ATOM(root, net_showing_desktop),
+                    CWMCC_ATOM(type, cardinal), &a)) {
+        g_warning("Failed to read NET_SHOWING_DESKTOP from 0x%lx", win);
+        a = FALSE;
+    }
+    *showing = !!a;
+}
+
+void cwmcc_root_get_openbox_pid(Window win, gulong *pid)
+{
+    if (!prop_get32(win, CWMCC_ATOM(root, openbox_pid),
+                    CWMCC_ATOM(type, cardinal), pid)) {
+        g_warning("Failed to read OPENBOX_PID from 0x%lx", win);
+        *pid = 0;
+    }
+}
+
index 0bc5fef711961fe0dbb3b290ba721284042cf30b..ca43f1364620c99b6a623e50f3bc3aae38c2d060 100644 (file)
@@ -1,6 +1,56 @@
-#ifndef __cwmcc_root_props_h
-#define __cwmcc_root_props_h
+/*#ifndef __cwmcc_root_props_h
+  #define __cwmcc_root_props_h*/
+
+#include <X11/Xlib.h>
+#include <glib.h>
 
 void cwmcc_root_get_supported(Window win, Atom **atoms);
 
-#endif
+void cwmcc_root_get_client_list(Window win, Window **windows);
+
+void cwmcc_root_get_client_list_stacking(Window win, Window **windows);
+
+void cwmcc_root_get_number_of_desktops(Window win, gulong *desktops);
+
+void cwmcc_root_get_desktop_geometry(Window win, gulong *w, gulong *h);
+
+void cwmcc_root_get_desktop_viewport(Window win, gulong *x, gulong *y);
+
+void cwmcc_root_get_current_desktop(Window win, gulong *desktop);
+
+void cwmcc_root_get_desktop_names(Window win, char ***names);
+
+void cwmcc_root_get_active_window(Window win, Window *window);
+
+/*void cwmcc_root_get_workarea(Window win, Rect a)*/
+
+void cwmcc_root_get_supporting_wm_check(Window win, Window *window);
+
+/*! Orientation of the desktops */
+enum Cwmcc_Orientation {
+    Cwmcc_Orientation_Horz = 0,
+    Cwmcc_Orientation_Vert = 1
+};
+
+enum Cwmcc_Corner {
+    Cwmcc_Corner_TopLeft = 0,
+    Cwmcc_Corner_TopRight = 1,
+    Cwmcc_Corner_BottomRight = 2,
+    Cwmcc_Corner_BottomLeft = 3
+};
+
+struct Cwmcc_DesktopLayout {
+    enum Cwmcc_Orientation orientation;
+    enum Cwmcc_Corner start_corner;
+    guint rows;
+    guint columns;
+};
+
+void cwmcc_root_get_desktop_layout(Window win,
+                                   struct Cwmcc_DesktopLayout *layout);
+
+void cwmcc_root_get_showing_desktop(Window win, gboolean *showing);
+
+void cwmcc_root_get_openbox_pid(Window win, gulong *pid);
+
+/*#endif*/
This page took 0.034503 seconds and 4 git commands to generate.