#include <string.h>
#include "gdk.h"
#include "gdkprivate.h"
+#include "gdkx.h"
gint
guint32 time,
gint send_event)
{
- GdkWindowPrivate *private;
Display *xdisplay;
Window xwindow;
if (owner)
{
+ GdkWindowPrivate *private;
+
private = (GdkWindowPrivate*) owner;
+ if (private->destroyed)
+ return FALSE;
+
xdisplay = private->xdisplay;
xwindow = private->xwindow;
}
g_return_if_fail (requestor != NULL);
private = (GdkWindowPrivate*) requestor;
+ if (private->destroyed)
+ return;
XConvertSelection (private->xdisplay, selection, target,
gdk_selection_property, private->xwindow, time);
moderate length, to avoid two round trips to the server */
private = (GdkWindowPrivate*) requestor;
+ if (private->destroyed)
+ return 0;
XGetWindowProperty (private->xdisplay, private->xwindow,
gdk_selection_property, 0, 0, False,
XSendEvent (gdk_display, requestor, False, NoEventMask, (XEvent*) &xevent);
}
+
+gint
+gdk_text_property_to_text_list (GdkAtom encoding, gint format,
+ guchar *text, gint length,
+ gchar ***list)
+{
+ XTextProperty property;
+ gint count = 0;
+ gint res;
+
+ if (!list)
+ return 0;
+
+ property.value = text;
+ property.encoding = encoding;
+ property.format = format;
+ property.nitems = length;
+ res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
+
+ if (res == XNoMemory || res == XLocaleNotSupported ||
+ res == XConverterNotFound)
+ return 0;
+ else
+ return count;
+}
+
+void
+gdk_free_text_list (gchar **list)
+{
+ XFreeStringList (list);
+}
+
+gint
+gdk_string_to_compound_text (gchar *str,
+ GdkAtom *encoding, gint *format,
+ guchar **ctext, gint *length)
+{
+ gint res;
+ XTextProperty property;
+
+ res = XmbTextListToTextProperty (GDK_DISPLAY(),
+ &str, 1, XCompoundTextStyle,
+ &property);
+ if (res != Success)
+ {
+ property.encoding = None;
+ property.format = None;
+ property.value = NULL;
+ property.nitems = 0;
+ }
+
+ if (encoding)
+ *encoding = property.encoding;
+ if (format)
+ *format = property.format;
+ if (ctext)
+ *ctext = property.value;
+ if (length)
+ *length = property.nitems;
+
+ return res;
+}
+
+void gdk_free_compound_text (guchar *ctext)
+{
+ if (ctext)
+ XFree (ctext);
+}