Use a string atom
This commit is contained in:
parent
f7b6a0c0af
commit
1f432a1236
@ -30,19 +30,19 @@ sugar_x11_util_set_string_property(GdkWindow *window,
|
|||||||
const char *value)
|
const char *value)
|
||||||
{
|
{
|
||||||
Atom prop_atom;
|
Atom prop_atom;
|
||||||
Atom utf8_atom;
|
Atom string_atom;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
char *prop_text;
|
char *prop_text;
|
||||||
|
|
||||||
display = gdk_drawable_get_display(window);
|
display = gdk_drawable_get_display(window);
|
||||||
prop_atom = gdk_x11_get_xatom_by_name_for_display(display, property);
|
prop_atom = gdk_x11_get_xatom_by_name_for_display(display, property);
|
||||||
utf8_atom = gdk_x11_get_xatom_by_name_for_display(display, "UTF8_ATOM");
|
string_atom = gdk_x11_get_xatom_by_name_for_display(display, "STRING_ATOM");
|
||||||
prop_text = gdk_utf8_to_string_target(value);
|
prop_text = gdk_utf8_to_string_target(value);
|
||||||
|
|
||||||
XChangeProperty(GDK_DISPLAY_XDISPLAY(display),
|
XChangeProperty(GDK_DISPLAY_XDISPLAY(display),
|
||||||
GDK_WINDOW_XID(window),
|
GDK_WINDOW_XID(window),
|
||||||
prop_atom,
|
prop_atom,
|
||||||
utf8_atom, 8,
|
string_atom, 8,
|
||||||
PropModeReplace, prop_text,
|
PropModeReplace, prop_text,
|
||||||
strlen(prop_text));
|
strlen(prop_text));
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ sugar_x11_util_get_string_property(GdkWindow *window,
|
|||||||
{
|
{
|
||||||
Atom type;
|
Atom type;
|
||||||
Atom prop_atom;
|
Atom prop_atom;
|
||||||
Atom utf8_atom;
|
Atom string_atom;
|
||||||
int format;
|
int format;
|
||||||
int result;
|
int result;
|
||||||
unsigned long bytes_after, n_items;
|
unsigned long bytes_after, n_items;
|
||||||
@ -65,17 +65,17 @@ sugar_x11_util_get_string_property(GdkWindow *window,
|
|||||||
|
|
||||||
display = gdk_drawable_get_display(window);
|
display = gdk_drawable_get_display(window);
|
||||||
prop_atom = gdk_x11_get_xatom_by_name_for_display(display, property);
|
prop_atom = gdk_x11_get_xatom_by_name_for_display(display, property);
|
||||||
utf8_atom = gdk_x11_get_xatom_by_name_for_display(display, "UTF8_ATOM");
|
string_atom = gdk_x11_get_xatom_by_name_for_display(display, "STRING_ATOM");
|
||||||
|
|
||||||
result = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(display),
|
result = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(display),
|
||||||
GDK_WINDOW_XID(window),
|
GDK_WINDOW_XID(window),
|
||||||
prop_atom,
|
prop_atom,
|
||||||
0, 1024L,
|
0, 1024L,
|
||||||
False, utf8_atom,
|
False, string_atom,
|
||||||
&type, &format, &n_items,
|
&type, &format, &n_items,
|
||||||
&bytes_after, (unsigned char **)&str);
|
&bytes_after, (unsigned char **)&str);
|
||||||
|
|
||||||
if (result == Success && str != NULL && type == utf8_atom &&
|
if (result == Success && str != NULL && type == string_atom &&
|
||||||
format == 8 && n_items > 0) {
|
format == 8 && n_items > 0) {
|
||||||
value = g_strdup(str);
|
value = g_strdup(str);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user