]> Dogcows Code - chaz/openbox/commitdiff
add all functions for getting and setting window properties
authorDana Jansens <danakj@orodu.net>
Thu, 10 Apr 2003 18:48:47 +0000 (18:48 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 10 Apr 2003 18:48:47 +0000 (18:48 +0000)
cwmcc/.cvsignore
cwmcc/Makefile [new file with mode: 0644]
cwmcc/msg.c [new file with mode: 0644]
cwmcc/prop.c
cwmcc/prop.h

index 626fb25e4a752c2663a844ffae001f8f0d2fa99a..87d579f6f151d72f9a8b989d71a6a13efe2051a1 100644 (file)
@@ -1,3 +1,5 @@
 .libs
 cwmcc.lo
 libcwmcc.la
+atom.lo
+prop.lo
diff --git a/cwmcc/Makefile b/cwmcc/Makefile
new file mode 100644 (file)
index 0000000..56263a4
--- /dev/null
@@ -0,0 +1,4 @@
+all clean distclean install uninstall:
+       $(MAKE) -$(MAKEFLAGS) -C .. $@
+
+.PHONY: all clean distclean install uninstall
diff --git a/cwmcc/msg.c b/cwmcc/msg.c
new file mode 100644 (file)
index 0000000..74567a1
--- /dev/null
@@ -0,0 +1,16 @@
+void prop_message(Window about, Atom messagetype, long data0, long data1,
+                 long data2, long data3)
+{
+    XEvent ce;
+    ce.xclient.type = ClientMessage;
+    ce.xclient.message_type = messagetype;
+    ce.xclient.display = cwmcc_display;
+    ce.xclient.window = about;
+    ce.xclient.format = 32;
+    ce.xclient.data.l[0] = data0;
+    ce.xclient.data.l[1] = data1;
+    ce.xclient.data.l[2] = data2;
+    ce.xclient.data.l[3] = data3;
+    XSendEvent(cwmcc_display, ob_root, FALSE,
+              SubstructureNotifyMask | SubstructureRedirectMask, &ce);
+}
index 97f5fb94b7832059dbc28547be71da3176af4ffc..d6f648e4dbd1d86de92413e944b28ba251ca2cbd 100644 (file)
-#include "prop.h"
-#include "openbox.h"
-#include <X11/Xatom.h>
+#include "cwmcc_internal.h"
 
-Atoms prop_atoms;
+#include <X11/Xutil.h>
+#include <glib.h>
+#ifdef HAVE_STRING_H
+#  include <string.h>
+#endif
 
-#define CREATE(var, name) (prop_atoms.var = \
-                           XInternAtom(ob_display, name, FALSE))
-
-void prop_startup()
-{
-    g_assert(ob_display != NULL);
-
-    CREATE(cardinal, "CARDINAL");
-    CREATE(window, "WINDOW");
-    CREATE(pixmap, "PIXMAP");
-    CREATE(atom, "ATOM");
-    CREATE(string, "STRING");
-    CREATE(utf8, "UTF8_STRING");
-     
-    CREATE(wm_colormap_windows, "WM_COLORMAP_WINDOWS");
-    CREATE(wm_protocols, "WM_PROTOCOLS");
-    CREATE(wm_state, "WM_STATE");
-    CREATE(wm_change_state, "WM_CHANGE_STATE");
-    CREATE(wm_delete_window, "WM_DELETE_WINDOW");
-    CREATE(wm_take_focus, "WM_TAKE_FOCUS");
-    CREATE(wm_name, "WM_NAME");
-    CREATE(wm_icon_name, "WM_ICON_NAME");
-    CREATE(wm_class, "WM_CLASS");
-    CREATE(wm_window_role, "WM_WINDOW_ROLE");
-    CREATE(motif_wm_hints, "_MOTIF_WM_HINTS");
-
-    CREATE(net_supported, "_NET_SUPPORTED");
-    CREATE(net_client_list, "_NET_CLIENT_LIST");
-    CREATE(net_client_list_stacking, "_NET_CLIENT_LIST_STACKING");
-    CREATE(net_number_of_desktops, "_NET_NUMBER_OF_DESKTOPS");
-    CREATE(net_desktop_geometry, "_NET_DESKTOP_GEOMETRY");
-    CREATE(net_desktop_viewport, "_NET_DESKTOP_VIEWPORT");
-    CREATE(net_current_desktop, "_NET_CURRENT_DESKTOP");
-    CREATE(net_desktop_names, "_NET_DESKTOP_NAMES");
-    CREATE(net_active_window, "_NET_ACTIVE_WINDOW");
-    CREATE(net_workarea, "_NET_WORKAREA");
-    CREATE(net_supporting_wm_check, "_NET_SUPPORTING_WM_CHECK");
-/*   CREATE(net_virtual_roots, "_NET_VIRTUAL_ROOTS"); */
-    CREATE(net_desktop_layout, "_NET_DESKTOP_LAYOUT");
-    CREATE(net_showing_desktop, "_NET_SHOWING_DESKTOP");
-
-    CREATE(net_close_window, "_NET_CLOSE_WINDOW");
-    CREATE(net_wm_moveresize, "_NET_WM_MOVERESIZE");
-
-/*   CREATE(net_properties, "_NET_PROPERTIES"); */
-    CREATE(net_wm_name, "_NET_WM_NAME");
-    CREATE(net_wm_visible_name, "_NET_WM_VISIBLE_NAME");
-    CREATE(net_wm_icon_name, "_NET_WM_ICON_NAME");
-    CREATE(net_wm_visible_icon_name, "_NET_WM_VISIBLE_ICON_NAME");
-    CREATE(net_wm_desktop, "_NET_WM_DESKTOP");
-    CREATE(net_wm_window_type, "_NET_WM_WINDOW_TYPE");
-    CREATE(net_wm_state, "_NET_WM_STATE");
-    CREATE(net_wm_strut, "_NET_WM_STRUT");
-/*   CREATE(net_wm_icon_geometry, "_NET_WM_ICON_GEOMETRY"); */
-    CREATE(net_wm_icon, "_NET_WM_ICON");
-/*   CREATE(net_wm_pid, "_NET_WM_PID"); */
-/*   CREATE(net_wm_handled_icons, "_NET_WM_HANDLED_ICONS"); */
-    CREATE(net_wm_allowed_actions, "_NET_WM_ALLOWED_ACTIONS");
-
-/*   CREATE(net_wm_ping, "_NET_WM_PING"); */
-  
-    CREATE(net_wm_window_type_desktop, "_NET_WM_WINDOW_TYPE_DESKTOP");
-    CREATE(net_wm_window_type_dock, "_NET_WM_WINDOW_TYPE_DOCK");
-    CREATE(net_wm_window_type_toolbar, "_NET_WM_WINDOW_TYPE_TOOLBAR");
-    CREATE(net_wm_window_type_menu, "_NET_WM_WINDOW_TYPE_MENU");
-    CREATE(net_wm_window_type_utility, "_NET_WM_WINDOW_TYPE_UTILITY");
-    CREATE(net_wm_window_type_splash, "_NET_WM_WINDOW_TYPE_SPLASH");
-    CREATE(net_wm_window_type_dialog, "_NET_WM_WINDOW_TYPE_DIALOG");
-    CREATE(net_wm_window_type_normal, "_NET_WM_WINDOW_TYPE_NORMAL");
-
-    CREATE(net_wm_moveresize_size_topleft, "_NET_WM_MOVERESIZE_SIZE_TOPLEFT");
-    CREATE(net_wm_moveresize_size_topright,
-          "_NET_WM_MOVERESIZE_SIZE_TOPRIGHT");
-    CREATE(net_wm_moveresize_size_bottomleft,
-          "_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT");
-    CREATE(net_wm_moveresize_size_bottomright,
-          "_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT");
-    CREATE(net_wm_moveresize_move, "_NET_WM_MOVERESIZE_MOVE");
-    CREATE(net_wm_action_move, "_NET_WM_ACTION_MOVE");
-    CREATE(net_wm_action_resize, "_NET_WM_ACTION_RESIZE");
-    CREATE(net_wm_action_minimize, "_NET_WM_ACTION_MINIMIZE");
-    CREATE(net_wm_action_shade, "_NET_WM_ACTION_SHADE");
-    CREATE(net_wm_action_stick, "_NET_WM_ACTION_STICK");
-    CREATE(net_wm_action_maximize_horz, "_NET_WM_ACTION_MAXIMIZE_HORZ");
-    CREATE(net_wm_action_maximize_vert, "_NET_WM_ACTION_MAXIMIZE_VERT");
-    CREATE(net_wm_action_fullscreen, "_NET_WM_ACTION_FULLSCREEN");
-    CREATE(net_wm_action_change_desktop, "_NET_WM_ACTION_CHANGE_DESKTOP");
-    CREATE(net_wm_action_close, "_NET_WM_ACTION_CLOSE");
-    CREATE(net_wm_state_modal, "_NET_WM_STATE_MODAL");
-    CREATE(net_wm_state_sticky, "_NET_WM_STATE_STICKY");
-    CREATE(net_wm_state_maximized_vert, "_NET_WM_STATE_MAXIMIZED_VERT");
-    CREATE(net_wm_state_maximized_horz, "_NET_WM_STATE_MAXIMIZED_HORZ");
-    CREATE(net_wm_state_shaded, "_NET_WM_STATE_SHADED");
-    CREATE(net_wm_state_skip_taskbar, "_NET_WM_STATE_SKIP_TASKBAR");
-    CREATE(net_wm_state_skip_pager, "_NET_WM_STATE_SKIP_PAGER");
-    CREATE(net_wm_state_hidden, "_NET_WM_STATE_HIDDEN");
-    CREATE(net_wm_state_fullscreen, "_NET_WM_STATE_FULLSCREEN");
-    CREATE(net_wm_state_above, "_NET_WM_STATE_ABOVE");
-    CREATE(net_wm_state_below, "_NET_WM_STATE_BELOW");
-  
-    prop_atoms.net_wm_state_add = 1;
-    prop_atoms.net_wm_state_remove = 0;
-    prop_atoms.net_wm_state_toggle = 2;
-
-    prop_atoms.net_wm_orientation_horz = 0;
-    prop_atoms.net_wm_orientation_vert = 1;
-    prop_atoms.net_wm_topleft = 0;
-    prop_atoms.net_wm_topright = 1;
-    prop_atoms.net_wm_bottomright = 2;
-    prop_atoms.net_wm_bottomleft = 3;
-
-    CREATE(kde_net_system_tray_windows, "_KDE_NET_SYSTEM_TRAY_WINDOWS");
-    CREATE(kde_net_wm_system_tray_window_for,
-          "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR");
-    CREATE(kde_net_wm_window_type_override,
-          "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE");
-
-    CREATE(kwm_win_icon, "KWM_WIN_ICON");
-  
-    CREATE(rootpmapid, "_XROOTPMAP_ID");
-    CREATE(esetrootid, "ESETROOT_PMAP_ID");
-
-    CREATE(openbox_pid, "_OPENBOX_PID");
-    CREATE(openbox_premax, "_OPENBOX_PREMAX");
-}
-
-gboolean prop_get(Window win, Atom prop, Atom type, int size,
-                 guchar **data, gulong num)
+/* this just isn't used...
+static gboolean get(Window win, Atom prop, Atom type, int size,
+                    guchar **data, gulong num)
 {
     gboolean ret = FALSE;
     int res;
@@ -140,9 +16,9 @@ gboolean prop_get(Window win, Atom prop, Atom type, int size,
     Atom ret_type;
     int ret_size;
     gulong ret_items, bytes_left;
-    long num32 = 32 / size * num; /* num in 32-bit elements */
+    long num32 = 32 / size * num; /\* num in 32-bit elements *\/
 
-    res = XGetWindowProperty(ob_display, win, prop, 0l, num32,
+    res = XGetWindowProperty(cwmcc_display, win, prop, 0l, num32,
                             FALSE, type, &ret_type, &ret_size,
                             &ret_items, &bytes_left, &xdata);
     if (res == Success && ret_items && xdata) {
@@ -154,9 +30,10 @@ gboolean prop_get(Window win, Atom prop, Atom type, int size,
     }
     return ret;
 }
+*/
 
-gboolean prop_get_prealloc(Window win, Atom prop, Atom type, int size,
-                          guchar *data, gulong num)
+static gboolean get_prealloc(Window win, Atom prop, Atom type, int size,
+                             guchar *data, gulong num)
 {
     gboolean ret = FALSE;
     int res;
@@ -166,7 +43,7 @@ gboolean prop_get_prealloc(Window win, Atom prop, Atom type, int size,
     gulong ret_items, bytes_left;
     long num32 = 32 / size * num; /* num in 32-bit elements */
 
-    res = XGetWindowProperty(ob_display, win, prop, 0l, num32,
+    res = XGetWindowProperty(cwmcc_display, win, prop, 0l, num32,
                             FALSE, type, &ret_type, &ret_size,
                             &ret_items, &bytes_left, &xdata);
     if (res == Success && ret_items && xdata) {
@@ -193,8 +70,8 @@ gboolean prop_get_prealloc(Window win, Atom prop, Atom type, int size,
     return ret;
 }
 
-gboolean prop_get_all(Window win, Atom prop, Atom type, int size,
-                     guchar **data, gulong *num)
+static gboolean get_all(Window win, Atom prop, Atom type, int size,
+                        guchar **data, gulong *num)
 {
     gboolean ret = FALSE;
     int res;
@@ -203,7 +80,7 @@ gboolean prop_get_all(Window win, Atom prop, Atom type, int size,
     int ret_size;
     gulong ret_items, bytes_left;
 
-    res = XGetWindowProperty(ob_display, win, prop, 0l, G_MAXLONG,
+    res = XGetWindowProperty(cwmcc_display, win, prop, 0l, G_MAXLONG,
                             FALSE, type, &ret_type, &ret_size,
                             &ret_items, &bytes_left, &xdata);
     if (res == Success) {
@@ -217,86 +94,117 @@ gboolean prop_get_all(Window win, Atom prop, Atom type, int size,
     return ret;
 }
 
-gboolean prop_get_string(Window win, Atom prop, Atom type, guchar **data)
+static gboolean get_stringlist(Window win, Atom prop, char ***list, int *nstr)
 {
-    guchar *raw;
-    gulong num;
-    GString *str;
-     
-    if (prop_get_all(win, prop, type, 8, &raw, &num)) {
-       str = g_string_new_len((char*)raw, num);
-       g_assert(str->str[num] == '\0');
+    XTextProperty tprop;
+    gboolean ret = FALSE;
 
-       g_free(raw);
+    if (XGetTextProperty(cwmcc_display, win, &tprop, prop) && tprop.nitems) {
+        if (XTextPropertyToStringList(&tprop, list, nstr))
+            ret = TRUE;
+        XFree(tprop.value);
+    }
+    return ret;
+}
 
-       *data = (guchar*)g_string_free(str, FALSE);
-       return TRUE;
+gboolean prop_get32(Window win, Atom prop, Atom type, gulong *ret)
+{
+    return get_prealloc(win, prop, type, 32, (guchar*)ret, 1);
+}
+
+gboolean prop_get_array32(Window win, Atom prop, Atom type, gulong **ret,
+                          gulong *nret)
+{
+    return get_all(win, prop, type, 32, (guchar**)ret, nret);
+}
+
+gboolean prop_get_string_locale(Window win, Atom prop, char **data)
+{
+    char **list;
+    int nstr;
+
+    if (get_stringlist(win, prop, &list, &nstr) && nstr) {
+        *data = g_locale_to_utf8(list[0], -1, NULL, NULL, NULL);
+        XFreeStringList(list);
+        if (data) return TRUE;
     }
     return FALSE;
 }
 
-gboolean prop_get_strings(Window win, Atom prop, Atom type,
-                         GPtrArray *data)
+gboolean prop_get_string_utf(Window win, Atom prop, Atom type, char **ret)
 {
-    guchar *raw;
+    char *raw;
     gulong num;
-    GString *str, *str2;
-    guint i, start;
      
-    if (prop_get_all(win, prop, type, 8, &raw, &num)) {
-       str = g_string_new_len((gchar*)raw, num);
-       g_assert(str->str[num] == '\0'); /* assuming this is always true.. */
-
+    if (get_all(win, prop, type, 8, (guchar**)&raw, &num)) {
+       *ret = g_strdup(raw); /* grab the first string from the list */
        g_free(raw);
+       return TRUE;
+    }
+    return FALSE;
+}
 
-       /* split it into the list */
-       for (start = 0, i = 0; i < str->len; ++i) {
-           if (str->str[i] == '\0') {
-               str2 = g_string_new_len(&str->str[start], i - start);
-               g_ptr_array_add(data, g_string_free(str2, FALSE));
-               start = i + 1;
-           }
-       }
-       g_string_free(str, TRUE);
+gboolean prop_get_strings_utf(Window win, Atom prop, Atom type, char ***ret)
+{
+    char *raw, *p;
+    gulong num, i;
+
+    if (get_all(win, prop, type, 8, (guchar**)&raw, &num)) {
+        *ret = g_new(char*, num + 1);
+        (*ret)[num] = NULL; /* null terminated list */
+
+        p = raw;
+        for (i = 0; i < num; ++i) {
+            (*ret)[i] = g_strdup(p);
+            p = strchr(p, '\0');
+        }
+       g_free(raw);
+       return TRUE;
+    }
+    return FALSE;
+}
 
-       if (data->len > 0)
-           return TRUE;
+gboolean prop_get_strings_locale(Window win, Atom prop, Atom type,char ***ret){
+    char *raw, *p;
+    gulong num, i;
+
+    if (get_all(win, prop, type, 8, (guchar**)&raw, &num)) {
+        *ret = g_new(char*, num + 1);
+        (*ret)[num] = NULL; /* null terminated list */
+
+        p = raw;
+        for (i = 0; i < num; ++i) {
+            (*ret)[i] = g_locale_to_utf8(p, -1, NULL, NULL, NULL);
+            /* make sure translation did not fail */
+            if (!(*ret)[i]) {
+                g_strfreev(*ret); /* free what we did so far */
+                break; /* the force is not strong with us */
+            }
+            p = strchr(p, '\0');
+        }
+       g_free(raw);
+        if (i == num)
+            return TRUE;
     }
     return FALSE;
 }
 
-void prop_set_strings(Window win, Atom prop, Atom type, GPtrArray *data)
+void prop_set_strings_utf(Window win, Atom prop, Atom type, char **strs)
 {
     GString *str;
     guint i;
 
     str = g_string_sized_new(0);
-    for (i = 0; i < data->len; ++i) {
-        str = g_string_append(str, data->pdata[i]);
+    for (i = 0; strs[i]; ++i) {
+        str = g_string_append(str, strs[i]);
         str = g_string_append_c(str, '\0');
     }
-    XChangeProperty(ob_display, win, prop, type, 8,
+    XChangeProperty(cwmcc_display, win, prop, type, 8,
                     PropModeReplace, (guchar*)str->str, str->len);
 }
 
 void prop_erase(Window win, Atom prop)
 {
-    XDeleteProperty(ob_display, win, prop);
+    XDeleteProperty(cwmcc_display, win, prop);
 }
 
-void prop_message(Window about, Atom messagetype, long data0, long data1,
-                 long data2, long data3)
-{
-    XEvent ce;
-    ce.xclient.type = ClientMessage;
-    ce.xclient.message_type = messagetype;
-    ce.xclient.display = ob_display;
-    ce.xclient.window = about;
-    ce.xclient.format = 32;
-    ce.xclient.data.l[0] = data0;
-    ce.xclient.data.l[1] = data1;
-    ce.xclient.data.l[2] = data2;
-    ce.xclient.data.l[3] = data3;
-    XSendEvent(ob_display, ob_root, FALSE,
-              SubstructureNotifyMask | SubstructureRedirectMask, &ce);
-}
index c2de3b20597083702e76f4d58425b79170a6e17b..ca49ce08d97e27d891f9bc7ce85a51d80e41f8ca 100644 (file)
-#ifndef __atoms_h
-#define __atoms_h
+#ifndef __prop_h
+#define __prop_h
 
 #include <X11/Xlib.h>
-#include <glib.h>
-#ifdef HAVE_STRING_H
-#  include <string.h>
-#endif
-
-#include "openbox.h"
-
-/*! The atoms on the X server which this class will cache */
-typedef struct Atoms {
-    /* types */
-    Atom cardinal; /*!< The atom which represents the Cardinal data type */
-    Atom window;   /*!< The atom which represents window ids */
-    Atom pixmap;   /*!< The atom which represents pixmap ids */
-    Atom atom;     /*!< The atom which represents atom values */
-    Atom string;   /*!< The atom which represents ascii strings */
-    Atom utf8;     /*!< The atom which represents utf8-encoded strings */
-
-    /* window hints */
-    Atom wm_colormap_windows;
-    Atom wm_protocols;
-    Atom wm_state;
-    Atom wm_delete_window;
-    Atom wm_take_focus;
-    Atom wm_change_state;
-    Atom wm_name;
-    Atom wm_icon_name;
-    Atom wm_class;
-    Atom wm_window_role;
-    Atom motif_wm_hints;
-
-    /* NETWM atoms */
-     
-    /* root window properties */
-    Atom net_supported;
-    Atom net_client_list;
-    Atom net_client_list_stacking;
-    Atom net_number_of_desktops;
-    Atom net_desktop_geometry;
-    Atom net_desktop_viewport;
-    Atom net_current_desktop;
-    Atom net_desktop_names;
-    Atom net_active_window;
-    Atom net_workarea;
-    Atom net_supporting_wm_check;
-/*  Atom net_virtual_roots; */
-    Atom net_desktop_layout;
-    Atom net_showing_desktop;
-    /* root window messages */
-    Atom net_close_window;
-    Atom net_wm_moveresize;
-    /* application window properties */
-/*  Atom net_properties; */
-    Atom net_wm_name;
-    Atom net_wm_visible_name;
-    Atom net_wm_icon_name;
-    Atom net_wm_visible_icon_name;
-    Atom net_wm_desktop;
-    Atom net_wm_window_type;
-    Atom net_wm_state;
-    Atom net_wm_strut;
-/*  Atom net_wm_icon_geometry; */
-    Atom net_wm_icon;
-/*  Atom net_wm_pid; */
-/*  Atom net_wm_handled_icons; */
-    Atom net_wm_allowed_actions;
-    /* application protocols */
-/*  Atom   Atom net_wm_ping; */
-
-    Atom net_wm_window_type_desktop;
-    Atom net_wm_window_type_dock;
-    Atom net_wm_window_type_toolbar;
-    Atom net_wm_window_type_menu;
-    Atom net_wm_window_type_utility;
-    Atom net_wm_window_type_splash;
-    Atom net_wm_window_type_dialog;
-    Atom net_wm_window_type_normal;
-
-    Atom net_wm_moveresize_size_topleft;
-    Atom net_wm_moveresize_size_topright;
-    Atom net_wm_moveresize_size_bottomleft;
-    Atom net_wm_moveresize_size_bottomright;
-    Atom net_wm_moveresize_move;
-
-    Atom net_wm_action_move;
-    Atom net_wm_action_resize;
-    Atom net_wm_action_minimize;
-    Atom net_wm_action_shade;
-    Atom net_wm_action_stick;
-    Atom net_wm_action_maximize_horz;
-    Atom net_wm_action_maximize_vert;
-    Atom net_wm_action_fullscreen;
-    Atom net_wm_action_change_desktop;
-    Atom net_wm_action_close;
-
-    Atom net_wm_state_modal;
-    Atom net_wm_state_sticky;
-    Atom net_wm_state_maximized_vert;
-    Atom net_wm_state_maximized_horz;
-    Atom net_wm_state_shaded;
-    Atom net_wm_state_skip_taskbar;
-    Atom net_wm_state_skip_pager;
-    Atom net_wm_state_hidden;
-    Atom net_wm_state_fullscreen;
-    Atom net_wm_state_above;
-    Atom net_wm_state_below;
-
-    Atom net_wm_state_add;
-    Atom net_wm_state_remove;
-    Atom net_wm_state_toggle;
-
-    Atom net_wm_orientation_horz;
-    Atom net_wm_orientation_vert;
-    Atom net_wm_topleft;
-    Atom net_wm_topright;
-    Atom net_wm_bottomright;
-    Atom net_wm_bottomleft;
-
-    /* Extra atoms */
 
-    Atom kde_net_system_tray_windows;
-    Atom kde_net_wm_system_tray_window_for;
-    Atom kde_net_wm_window_type_override;
+/* with the exception of prop_get32, all other prop_get_* functions require
+   you to free the returned value with g_free or g_strfreev (for the char**s)
+*/
 
-    Atom kwm_win_icon;
+gboolean prop_get32(Window win, Atom prop, Atom type, gulong *ret);
 
-    Atom rootpmapid;
-    Atom esetrootid;
+gboolean prop_get_array32(Window win, Atom prop, Atom type, gulong **ret,
+                          gulong *nret);
 
-    /* Openbox specific atoms */
-     
-    Atom openbox_pid;
-    Atom openbox_premax;
-} Atoms;
-Atoms prop_atoms;
+gboolean prop_get_string(Window win, Atom prop, Atom type, char **ret);
 
-void prop_startup();
+/*! Gets a string from a property which is stored in UTF-8 encoding. */
+gboolean prop_get_string_utf(Window win, Atom prop, char **ret);
 
-gboolean prop_get(Window win, Atom prop, Atom type, int size,
-                       guchar **data, gulong num);
+/*! Gets a string from a property which is stored in the current local
+  encoding. The returned string is in UTF-8 encoding. */
+gboolean prop_get_string_locale(Window win, Atom prop, char **ret);
 
-gboolean prop_get_prealloc(Window win, Atom prop, Atom type, int size,
-                          guchar *data, gulong num);
+/*! Gets a null terminated array of strings from a property which is stored in
+  UTF-8 encoding. */
+gboolean prop_get_strings_utf(Window win, Atom prop, Atom type, char ***ret);
 
-gboolean prop_get_all(Window win, Atom prop, Atom type, int size,
-                     guchar **data, gulong *num);
+/*! Gets a null terminated array of strings from a property which is stored in
+  the current locale encoding. The returned string is in UTF-8 encoding. */
+gboolean prop_get_strings_locale(Window win, Atom prop, Atom type,char ***ret);
 
-gboolean prop_get_string(Window win, Atom prop, Atom type, guchar **data);
-gboolean prop_get_strings(Window win, Atom prop, Atom type,
-                         GPtrArray *data);
-
-void prop_set_strings(Window win, Atom prop, Atom type, GPtrArray *data);
+/*! Sets a null terminated array of strings in a property encoded as UTF-8. */
+void prop_set_strings_utf(Window win, Atom prop, Atom type, char **strs);
 
 void prop_erase(Window win, Atom prop);
 
-void prop_message(Window about, Atom messagetype, long data0, long data1,
-                 long data2, long data3);
-
-#define PROP_MSG(about, msgtype, data0, data1, data2, data3) \
-  (prop_message(about, prop_atoms.msgtype, data0, data1, data2, data3))
-
-/* Set an 8-bit property from a string */
-#define PROP_SETS(win, prop, type, value) \
-  (XChangeProperty(ob_display, win, prop_atoms.prop, prop_atoms.type, 8, \
-                  PropModeReplace, (guchar*)value, strlen(value)))
-/* Set an 8-bit property array from a GPtrArray of strings */
-#define PROP_SETSA(win, prop, type, value) \
-  (prop_set_strings(win, prop_atoms.prop, prop_atoms.type, value))
-
-/* Set a 32-bit property from a single value */
-#define PROP_SET32(win, prop, type, value) \
-  (XChangeProperty(ob_display, win, prop_atoms.prop, prop_atoms.type, 32, \
-                  PropModeReplace, (guchar*)&value, 1))
-/* Set a 32-bit property from an array */
-#define PROP_SET32A(win, prop, type, value, num) \
-  (XChangeProperty(ob_display, win, prop_atoms.prop, prop_atoms.type, 32, \
-                  PropModeReplace, (guchar*)value, num))
-
-/* Get an 8-bit property into a string */
-#define PROP_GETS(win, prop, type, value) \
-  (prop_get_string(win, prop_atoms.prop, prop_atoms.type, \
-                          (guchar**)&value))
-/* Get an 8-bit property into a GPtrArray of strings
-   (The strings must be freed, the GPtrArray must already be created.) */
-#define PROP_GETSA(win, prop, type, value) \
-  (prop_get_strings(win, prop_atoms.prop, prop_atoms.type, \
-                           value))
-
-/* Get an entire 8-bit property into an array (which must be freed) */
-#define PROP_GET8U(win, prop, type, value, num) \
-  (prop_get_all(win, prop_atoms.prop, prop_atoms.type, 8, \
-                (guchar**)&value, &num))
-
-/* Get 1 element of a 32-bit property into a given variable */
-#define PROP_GET32(win, prop, type, value) \
-  (prop_get_prealloc(win, prop_atoms.prop, prop_atoms.type, 32, \
-                    (guchar*)&value, 1))
-
-/* Get an amount of a 32-bit property into an array (which must be freed) */
-#define PROP_GET32A(win, prop, type, value, num) \
-  (prop_get(win, prop_atoms.prop, prop_atoms.type, 32, \
-           (guchar**)&value, num))
-
-/* Get an entire 32-bit property into an array (which must be freed) */
-#define PROP_GET32U(win, prop, type, value, num) \
-  (prop_get_all(win, prop_atoms.prop, prop_atoms.type, 32, \
-               (guchar**)&value, &num))
-
-#define PROP_ERASE(win, prop) (prop_erase(win, prop_atoms.prop))
-
 #endif
This page took 0.036161 seconds and 4 git commands to generate.