CREATE(NET_WM_STRUT_PARTIAL, "_NET_WM_STRUT_PARTIAL");
CREATE(NET_WM_ICON, "_NET_WM_ICON");
CREATE(NET_WM_ICON_GEOMETRY, "_NET_WM_ICON_GEOMETRY");
-/* CREATE(NET_WM_PId, "_NET_WM_PID"); */
+ CREATE(NET_WM_PID, "_NET_WM_PID");
CREATE(NET_WM_ALLOWED_ACTIONS, "_NET_WM_ALLOWED_ACTIONS");
CREATE(NET_WM_USER_TIME, "_NET_WM_USER_TIME");
- CREATE(NET_WM_USER_TIME_WINDOW, "_NET_WM_USER_TIME_WINDOW");
+/* CREATE(NET_WM_USER_TIME_WINDOW, "_NET_WM_USER_TIME_WINDOW"); */
CREATE(KDE_NET_WM_FRAME_STRUT, "_KDE_NET_WM_FRAME_STRUT");
CREATE(NET_FRAME_EXTENTS, "_NET_FRAME_EXTENTS");
-/* CREATE(NET_WM_PING, "_NET_WM_PING"); */
+ CREATE(NET_WM_PING, "_NET_WM_PING");
#ifdef SYNC
CREATE(NET_WM_SYNC_REQUEST, "_NET_WM_SYNC_REQUEST");
CREATE(NET_WM_SYNC_REQUEST_COUNTER, "_NET_WM_SYNC_REQUEST_COUNTER");
gchar *raw, *p;
guint num, i, count = 0;
- if (get_all(win, prop, obt_prop_atom(OBT_PROP_STRING), 8,
+ if (get_all(win, prop, OBT_PROP_ATOM(STRING), 8,
(guchar**)&raw, &num))
{
p = raw;
gchar *str;
guint num;
- if (get_all(win, prop, obt_prop_atom(OBT_PROP_UTF8), 8,
+ if (get_all(win, prop, OBT_PROP_ATOM(UTF8), 8,
(guchar**)&raw, &num))
{
str = g_strndup(raw, num); /* grab the first string from the list */
gchar *raw, *p;
guint num, i, count = 0;
- if (get_all(win, prop, obt_prop_atom(OBT_PROP_UTF8), 8,
+ if (get_all(win, prop, OBT_PROP_ATOM(UTF8), 8,
(guchar**)&raw, &num))
{
p = raw;
(guchar*)val, num);
}
+void obt_prop_set_string_locale(Window win, Atom prop, const gchar *val)
+{
+ gchar const *s[2] = { val, NULL };
+ obt_prop_set_strings_locale(win, prop, s);
+}
+
+void obt_prop_set_strings_locale(Window win, Atom prop, const gchar **strs)
+{
+ gint i, count;
+ gchar **lstrs;
+ XTextProperty tprop;
+
+ /* count the strings in strs, and convert them to the locale format */
+ for (count = 0; strs[count]; ++count);
+ lstrs = g_new0(char*, count);
+ for (i = 0; i < count; ++i) {
+ lstrs[i] = g_locale_from_utf8(strs[i], -1, NULL, NULL, NULL);
+ if (!lstrs[i]) {
+ lstrs[i] = g_strdup(""); /* make it an empty string */
+ g_warning("Unable to translate string '%s' from UTF8 to locale "
+ "format", strs[i]);
+ }
+ }
+
+
+ XStringListToTextProperty(lstrs, count, &tprop);
+ XSetTextProperty(obt_display, win, &tprop, prop);
+ XFree(tprop.value);
+}
+
void obt_prop_set_string_utf8(Window win, Atom prop, const gchar *val)
{
- XChangeProperty(obt_display, win, prop, obt_prop_atom(OBT_PROP_UTF8), 8,
+ XChangeProperty(obt_display, win, prop, OBT_PROP_ATOM(UTF8), 8,
PropModeReplace, (const guchar*)val, strlen(val));
}
-void obt_prop_set_strings_utf8(Window win, Atom prop, gchar **strs)
+void obt_prop_set_strings_utf8(Window win, Atom prop, const gchar **strs)
{
GString *str;
- gchar **s;
+ gchar const **s;
str = g_string_sized_new(0);
for (s = strs; *s; ++s) {
void obt_prop_message(gint screen, Window about, Atom messagetype,
glong data0, glong data1, glong data2, glong data3,
glong data4, glong mask)
+{
+ obt_prop_message_to(RootWindow(obt_display, screen), about, messagetype,
+ data0, data1, data2, data3, data4, mask);
+}
+
+void obt_prop_message_to(Window to, Window about,
+ Atom messagetype,
+ glong data0, glong data1, glong data2, glong data3,
+ glong data4, glong mask)
{
XEvent ce;
ce.xclient.type = ClientMessage;
ce.xclient.data.l[2] = data2;
ce.xclient.data.l[3] = data3;
ce.xclient.data.l[4] = data4;
- XSendEvent(obt_display, RootWindow(obt_display, screen), FALSE,
- mask, &ce);
+ XSendEvent(obt_display, to, FALSE, mask, &ce);
}