]> Dogcows Code - chaz/openbox/blobdiff - cwmcc/prop.c
PipeCross
[chaz/openbox] / cwmcc / prop.c
index d6f648e4dbd1d86de92413e944b28ba251ca2cbd..6e9e08126c976d4b72f7ab7725a969a566ef0478 100644 (file)
@@ -1,10 +1,9 @@
 #include "cwmcc_internal.h"
+#include "atom.h"
 
 #include <X11/Xutil.h>
 #include <glib.h>
-#ifdef HAVE_STRING_H
-#  include <string.h>
-#endif
+#include <string.h>
 
 /* this just isn't used...
 static gboolean get(Window win, Atom prop, Atom type, int size,
@@ -107,18 +106,18 @@ static gboolean get_stringlist(Window win, Atom prop, char ***list, int *nstr)
     return ret;
 }
 
-gboolean prop_get32(Window win, Atom prop, Atom type, gulong *ret)
+gboolean cwmcc_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,
+gboolean cwmcc_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)
+gboolean cwmcc_prop_get_string_locale(Window win, Atom prop, char **data)
 {
     char **list;
     int nstr;
@@ -131,12 +130,12 @@ gboolean prop_get_string_locale(Window win, Atom prop, char **data)
     return FALSE;
 }
 
-gboolean prop_get_string_utf(Window win, Atom prop, Atom type, char **ret)
+gboolean cwmcc_prop_get_string_utf8(Window win, Atom prop, char **ret)
 {
     char *raw;
     gulong num;
      
-    if (get_all(win, prop, type, 8, (guchar**)&raw, &num)) {
+    if (get_all(win, prop, CWMCC_ATOM(type, utf8), 8, (guchar**)&raw, &num)) {
        *ret = g_strdup(raw); /* grab the first string from the list */
        g_free(raw);
        return TRUE;
@@ -144,12 +143,12 @@ gboolean prop_get_string_utf(Window win, Atom prop, Atom type, char **ret)
     return FALSE;
 }
 
-gboolean prop_get_strings_utf(Window win, Atom prop, Atom type, char ***ret)
+gboolean cwmcc_prop_get_strings_utf8(Window win, Atom prop, char ***ret)
 {
     char *raw, *p;
     gulong num, i;
 
-    if (get_all(win, prop, type, 8, (guchar**)&raw, &num)) {
+    if (get_all(win, prop, CWMCC_ATOM(type, utf8), 8, (guchar**)&raw, &num)) {
         *ret = g_new(char*, num + 1);
         (*ret)[num] = NULL; /* null terminated list */
 
@@ -164,11 +163,12 @@ gboolean prop_get_strings_utf(Window win, Atom prop, Atom type, char ***ret)
     return FALSE;
 }
 
-gboolean prop_get_strings_locale(Window win, Atom prop, Atom type,char ***ret){
+gboolean cwmcc_prop_get_strings_locale(Window win, Atom prop, char ***ret)
+{
     char *raw, *p;
     gulong num, i;
 
-    if (get_all(win, prop, type, 8, (guchar**)&raw, &num)) {
+    if (get_all(win, prop, CWMCC_ATOM(type, string), 8, (guchar**)&raw, &num)){
         *ret = g_new(char*, num + 1);
         (*ret)[num] = NULL; /* null terminated list */
 
@@ -189,7 +189,26 @@ gboolean prop_get_strings_locale(Window win, Atom prop, Atom type,char ***ret){
     return FALSE;
 }
 
-void prop_set_strings_utf(Window win, Atom prop, Atom type, char **strs)
+void cwmcc_prop_set32(Window win, Atom prop, Atom type, gulong val)
+{
+    XChangeProperty(cwmcc_display, win, prop, type, 32, PropModeReplace,
+                    (guchar*)&val, 1);
+}
+
+void cwmcc_prop_set_array32(Window win, Atom prop, Atom type,
+                            gulong *val, gulong num)
+{
+    XChangeProperty(cwmcc_display, win, prop, type, 32, PropModeReplace,
+                    (guchar*)val, num);
+}
+
+void cwmcc_prop_set_string_utf8(Window win, Atom prop, char *val)
+{
+    XChangeProperty(cwmcc_display, win, prop, CWMCC_ATOM(type, utf8), 8,
+                    PropModeReplace, (guchar*)val, strlen(val));
+}
+
+void cwmcc_prop_set_strings_utf8(Window win, Atom prop, char **strs)
 {
     GString *str;
     guint i;
@@ -199,11 +218,11 @@ void prop_set_strings_utf(Window win, Atom prop, Atom type, char **strs)
         str = g_string_append(str, strs[i]);
         str = g_string_append_c(str, '\0');
     }
-    XChangeProperty(cwmcc_display, win, prop, type, 8,
+    XChangeProperty(cwmcc_display, win, prop, CWMCC_ATOM(type, utf8), 8,
                     PropModeReplace, (guchar*)str->str, str->len);
 }
 
-void prop_erase(Window win, Atom prop)
+void cwmcc_prop_erase(Window win, Atom prop)
 {
     XDeleteProperty(cwmcc_display, win, prop);
 }
This page took 0.025036 seconds and 4 git commands to generate.