forked from AuroraMiddleware/gtk
Deal with property encoding functions
Move everything dealing with compound text to be X11 specific Only gdk_text_property_to_utf8_list and gdk_utf8_to_string_target are kept across backends, so add vfuncs for these. Also, remove the non-multihead-safe variants of all these.
This commit is contained in:
parent
61104d58ea
commit
572bb20011
@ -197,8 +197,6 @@ gdk_event_type_get_type G_GNUC_CONST
|
||||
gdk_extension_mode_get_type G_GNUC_CONST
|
||||
gdk_filter_return_get_type G_GNUC_CONST
|
||||
gdk_flush
|
||||
gdk_free_compound_text
|
||||
gdk_free_text_list
|
||||
gdk_get_default_root_window
|
||||
gdk_get_display
|
||||
gdk_get_display_arg_name
|
||||
@ -323,15 +321,10 @@ gdk_set_show_events
|
||||
gdk_setting_action_get_type G_GNUC_CONST
|
||||
gdk_setting_get
|
||||
gdk_status_get_type G_GNUC_CONST
|
||||
gdk_string_to_compound_text
|
||||
gdk_string_to_compound_text_for_display
|
||||
gdk_synthesize_window_state
|
||||
gdk_test_render_sync
|
||||
gdk_test_simulate_button
|
||||
gdk_test_simulate_key
|
||||
gdk_text_property_to_text_list
|
||||
gdk_text_property_to_text_list_for_display
|
||||
gdk_text_property_to_utf8_list
|
||||
gdk_text_property_to_utf8_list_for_display
|
||||
gdk_threads_add_idle
|
||||
gdk_threads_add_idle_full
|
||||
@ -344,8 +337,6 @@ gdk_threads_init
|
||||
gdk_threads_leave
|
||||
gdk_threads_set_lock_functions
|
||||
gdk_unicode_to_keyval G_GNUC_CONST
|
||||
gdk_utf8_to_compound_text
|
||||
gdk_utf8_to_compound_text_for_display
|
||||
gdk_utf8_to_string_target
|
||||
gdk_visibility_state_get_type G_GNUC_CONST
|
||||
gdk_visual_get_best
|
||||
@ -539,7 +530,12 @@ gdk_x11_display_get_xdisplay
|
||||
gdk_x11_display_grab
|
||||
gdk_x11_display_set_cursor_theme
|
||||
gdk_x11_display_set_startup_notification_id
|
||||
gdk_x11_display_string_to_compound_text
|
||||
gdk_x11_display_text_property_to_text_list
|
||||
gdk_x11_display_ungrab
|
||||
gdk_x11_display_utf8_to_compound_text
|
||||
gdk_x11_free_compound_text
|
||||
gdk_x11_free_text_list
|
||||
gdk_x11_get_default_root_xwindow
|
||||
gdk_x11_get_default_screen
|
||||
gdk_x11_get_default_xdisplay
|
||||
|
@ -220,6 +220,15 @@ struct _GdkDisplayClass
|
||||
GdkAtom target,
|
||||
guint32 time);
|
||||
|
||||
gint (*text_property_to_utf8_list) (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
gchar * (*utf8_to_string_target) (GdkDisplay *display,
|
||||
const gchar *text);
|
||||
|
||||
/* Signals */
|
||||
void (*closed) (GdkDisplay *display,
|
||||
gboolean is_error);
|
||||
|
@ -79,35 +79,6 @@ void gdk_property_change (GdkWindow *window,
|
||||
void gdk_property_delete (GdkWindow *window,
|
||||
GdkAtom property);
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
gint gdk_text_property_to_text_list (GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
gint gdk_text_property_to_utf8_list (GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
gboolean gdk_utf8_to_compound_text (const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length);
|
||||
gint gdk_string_to_compound_text (const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length);
|
||||
#endif /* GDK_MULTIHEAD_SAFE */
|
||||
|
||||
gint gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
@ -116,21 +87,6 @@ gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
gchar ***list);
|
||||
|
||||
gchar *gdk_utf8_to_string_target (const gchar *str);
|
||||
gint gdk_string_to_compound_text_for_display (GdkDisplay *display,
|
||||
const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length);
|
||||
gboolean gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
|
||||
const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length);
|
||||
|
||||
void gdk_free_text_list (gchar **list);
|
||||
void gdk_free_compound_text (guchar *ctext);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -137,116 +137,6 @@ gdk_selection_send_notify (GdkNativeWindow requestor,
|
||||
target, property, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_text_property_to_text_list:
|
||||
* @encoding: an atom representing the encoding. The most common
|
||||
* values for this are <literal>STRING</literal>,
|
||||
* or <literal>COMPOUND_TEXT</literal>. This is
|
||||
* value used as the type for the property.
|
||||
* @format: the format of the property.
|
||||
* @text: the text data.
|
||||
* @length: the length of the property, in items.
|
||||
* @list: location to store a terminated array of strings
|
||||
* in the encoding of the current locale. This
|
||||
* array should be freed using gdk_free_text_list().
|
||||
*
|
||||
* Converts a text string from the encoding as it is stored in
|
||||
* a property into an array of strings in the encoding of
|
||||
* the current local. (The elements of the array represent
|
||||
* the nul-separated elements of the original text string.)
|
||||
*
|
||||
* Returns: the number of strings stored in @list, or 0,
|
||||
* if the conversion failed.
|
||||
*/
|
||||
gint
|
||||
gdk_text_property_to_text_list (GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
return gdk_text_property_to_text_list_for_display (gdk_display_get_default (),
|
||||
encoding, format, text, length, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_text_property_to_utf8_list:
|
||||
* @encoding: an atom representing the encoding of the text
|
||||
* @format: the format of the property
|
||||
* @text: the text to convert
|
||||
* @length: the length of @text, in bytes
|
||||
* @list: (allow-none): location to store the list of strings or %NULL. The
|
||||
* list should be freed with g_strfreev().
|
||||
*
|
||||
* Convert a text property in the giving encoding to
|
||||
* a list of UTF-8 strings.
|
||||
*
|
||||
* Return value: the number of strings in the resulting
|
||||
* list.
|
||||
**/
|
||||
gint
|
||||
gdk_text_property_to_utf8_list (GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
return gdk_text_property_to_utf8_list_for_display (gdk_display_get_default (),
|
||||
encoding, format, text, length, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_string_to_compound_text:
|
||||
* @str: a nul-terminated string.
|
||||
* @encoding: location to store the encoding atom (to be used as
|
||||
* the type for the property).
|
||||
* @format: location to store the format for the property.
|
||||
* @ctext: location to store newly allocated data for the property.
|
||||
* @length: location to store the length of @ctext in items.
|
||||
*
|
||||
* Converts a string from the encoding of the current locale
|
||||
* into a form suitable for storing in a window property.
|
||||
*
|
||||
* Returns: 0 upon sucess, non-zero upon failure.
|
||||
*/
|
||||
gint
|
||||
gdk_string_to_compound_text (const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length)
|
||||
{
|
||||
return gdk_string_to_compound_text_for_display (gdk_display_get_default (),
|
||||
str, encoding, format,
|
||||
ctext, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_utf8_to_compound_text:
|
||||
* @str: a UTF-8 string
|
||||
* @encoding: location to store resulting encoding
|
||||
* @format: location to store format of the result
|
||||
* @ctext: location to store the data of the result
|
||||
* @length: location to store the length of the data
|
||||
* stored in @ctext
|
||||
*
|
||||
* Convert from UTF-8 to compound text.
|
||||
*
|
||||
* Return value: %TRUE if the conversion succeeded, otherwise
|
||||
* false.
|
||||
**/
|
||||
gboolean
|
||||
gdk_utf8_to_compound_text (const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length)
|
||||
{
|
||||
return gdk_utf8_to_compound_text_for_display (gdk_display_get_default (),
|
||||
str, encoding, format,
|
||||
ctext, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_selection_owner_set_for_display:
|
||||
* @display: the #GdkDisplay
|
||||
@ -386,3 +276,58 @@ gdk_selection_convert (GdkWindow *requestor,
|
||||
GDK_DISPLAY_GET_CLASS (display)
|
||||
->convert_selection (display, requestor, selection, target, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_text_property_to_utf8_list_for_display:
|
||||
* @display: a #GdkDisplay
|
||||
* @encoding: an atom representing the encoding of the text
|
||||
* @format: the format of the property
|
||||
* @text: the text to convert
|
||||
* @length: the length of @text, in bytes
|
||||
* @list: location to store the list of strings or %NULL. The
|
||||
* list should be freed with g_strfreev().
|
||||
*
|
||||
* Converts a text property in the given encoding to
|
||||
* a list of UTF-8 strings.
|
||||
*
|
||||
* Return value: the number of strings in the resulting list
|
||||
*
|
||||
* Since: 2.2
|
||||
*/
|
||||
gint
|
||||
gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
g_return_val_if_fail (text != NULL, 0);
|
||||
g_return_val_if_fail (length >= 0, 0);
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)
|
||||
->text_property_to_utf8_list (display, encoding, format, text, length, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_utf8_to_string_target:
|
||||
* @str: a UTF-8 string
|
||||
*
|
||||
* Converts an UTF-8 string into the best possible representation
|
||||
* as a STRING. The representation of characters not in STRING
|
||||
* is not specified; it may be as pseudo-escape sequences
|
||||
* \x{ABCD}, or it may be in some other form of approximation.
|
||||
*
|
||||
* Return value: the newly-allocated string, or %NULL if the
|
||||
* conversion failed. (It should not fail for
|
||||
* any properly formed UTF-8 string unless system
|
||||
* limits like memory or file descriptors are exceeded.)
|
||||
**/
|
||||
gchar *
|
||||
gdk_utf8_to_string_target (const gchar *str)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->utf8_to_string_target (display, str);
|
||||
}
|
||||
|
@ -2765,4 +2765,6 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
|
||||
display_class->send_selection_notify = _gdk_x11_display_send_selection_notify;
|
||||
display_class->get_selection_property = _gdk_x11_display_get_selection_property;
|
||||
display_class->convert_selection = _gdk_x11_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target;
|
||||
}
|
||||
|
@ -213,6 +213,15 @@ void _gdk_x11_display_convert_selection (GdkDisplay *display,
|
||||
GdkAtom target,
|
||||
guint32 time);
|
||||
|
||||
gint _gdk_x11_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
gchar * _gdk_x11_display_utf8_to_string_target (GdkDisplay *displayt,
|
||||
const gchar *str);
|
||||
|
||||
void _gdk_x11_device_check_extension_events (GdkDevice *device);
|
||||
|
||||
GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display);
|
||||
|
@ -332,14 +332,14 @@ _gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_text_property_to_text_list_for_display:
|
||||
* @display: The #GdkDisplay where the encoding is defined.
|
||||
* gdk_x11_display_text_property_to_text_list:
|
||||
* @display: The #GdkDisplay where the encoding is defined
|
||||
* @encoding: an atom representing the encoding. The most
|
||||
* common values for this are STRING, or COMPOUND_TEXT.
|
||||
* This is value used as the type for the property.
|
||||
* @format: the format of the property.
|
||||
* @text: The text data.
|
||||
* @length: The number of items to transform.
|
||||
* This is value used as the type for the property
|
||||
* @format: the format of the property
|
||||
* @text: The text data
|
||||
* @length: The number of items to transform
|
||||
* @list: location to store a terminated array of strings in
|
||||
* the encoding of the current locale. This array should be
|
||||
* freed using gdk_free_text_list().
|
||||
@ -350,12 +350,12 @@ _gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
||||
* nul-separated elements of the original text string.)
|
||||
*
|
||||
* Returns: the number of strings stored in list, or 0,
|
||||
* if the conversion failed.
|
||||
* if the conversion failed
|
||||
*
|
||||
* Since: 2.2
|
||||
* Since: 3.0
|
||||
*/
|
||||
gint
|
||||
gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
||||
gdk_x11_display_text_property_to_text_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
@ -385,7 +385,7 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
||||
else
|
||||
{
|
||||
if (list)
|
||||
*list = local_list;
|
||||
*list = g_strdupv (local_list);
|
||||
else
|
||||
XFreeStringList (local_list);
|
||||
|
||||
@ -394,15 +394,15 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_free_text_list:
|
||||
* gdk_x11_free_text_list:
|
||||
* @list: the value stored in the @list parameter by
|
||||
* a call to gdk_text_property_to_text_list().
|
||||
* a call to gdk_x11_display_text_property_to_text_list().
|
||||
*
|
||||
* Frees the array of strings created by
|
||||
* gdk_text_property_to_text_list().
|
||||
* gdk_x11_display_text_property_to_text_list().
|
||||
*/
|
||||
void
|
||||
gdk_free_text_list (gchar **list)
|
||||
gdk_x11_free_text_list (gchar **list)
|
||||
{
|
||||
g_return_if_fail (list != NULL);
|
||||
|
||||
@ -487,36 +487,14 @@ make_list (const gchar *text,
|
||||
return n_strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_text_property_to_utf8_list_for_display:
|
||||
* @display: a #GdkDisplay
|
||||
* @encoding: an atom representing the encoding of the text
|
||||
* @format: the format of the property
|
||||
* @text: the text to convert
|
||||
* @length: the length of @text, in bytes
|
||||
* @list: location to store the list of strings or %NULL. The
|
||||
* list should be freed with g_strfreev().
|
||||
*
|
||||
* Converts a text property in the given encoding to
|
||||
* a list of UTF-8 strings.
|
||||
*
|
||||
* Return value: the number of strings in the resulting
|
||||
* list.
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
gint
|
||||
gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
_gdk_x11_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
g_return_val_if_fail (text != NULL, 0);
|
||||
g_return_val_if_fail (length >= 0, 0);
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
|
||||
|
||||
if (encoding == GDK_TARGET_STRING)
|
||||
{
|
||||
return make_list ((gchar *)text, length, TRUE, list);
|
||||
@ -537,7 +515,7 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
|
||||
/* Probably COMPOUND text, we fall back to Xlib routines
|
||||
*/
|
||||
local_count = gdk_text_property_to_text_list_for_display (display,
|
||||
local_count = gdk_x11_display_text_property_to_text_list (display,
|
||||
encoding,
|
||||
format,
|
||||
text,
|
||||
@ -583,7 +561,7 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
}
|
||||
|
||||
if (local_count)
|
||||
gdk_free_text_list (local_list);
|
||||
gdk_x11_free_text_list (local_list);
|
||||
|
||||
if (list)
|
||||
(*list)[count] = NULL;
|
||||
@ -593,24 +571,24 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_string_to_compound_text_for_display:
|
||||
* @display: the #GdkDisplay where the encoding is defined.
|
||||
* @str: a nul-terminated string.
|
||||
* gdk_x11_display_string_to_compound_text:
|
||||
* @display: the #GdkDisplay where the encoding is defined
|
||||
* @str: a nul-terminated string
|
||||
* @encoding: location to store the encoding atom
|
||||
* (to be used as the type for the property).
|
||||
* (to be used as the type for the property)
|
||||
* @format: location to store the format of the property
|
||||
* @ctext: location to store newly allocated data for the property.
|
||||
* @ctext: location to store newly allocated data for the property
|
||||
* @length: the length of @text, in bytes
|
||||
*
|
||||
* Convert a string from the encoding of the current
|
||||
* locale into a form suitable for storing in a window property.
|
||||
*
|
||||
* Returns: 0 upon success, non-zero upon failure.
|
||||
* Returns: 0 upon success, non-zero upon failure
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
* Since: 3.0
|
||||
*/
|
||||
gint
|
||||
gdk_string_to_compound_text_for_display (GdkDisplay *display,
|
||||
gdk_x11_display_string_to_compound_text (GdkDisplay *display,
|
||||
const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
@ -705,28 +683,15 @@ sanitize_utf8 (const gchar *src,
|
||||
return g_string_free (result, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_utf8_to_string_target:
|
||||
* @str: a UTF-8 string
|
||||
*
|
||||
* Converts an UTF-8 string into the best possible representation
|
||||
* as a STRING. The representation of characters not in STRING
|
||||
* is not specified; it may be as pseudo-escape sequences
|
||||
* \x{ABCD}, or it may be in some other form of approximation.
|
||||
*
|
||||
* Return value: the newly-allocated string, or %NULL if the
|
||||
* conversion failed. (It should not fail for
|
||||
* any properly formed UTF-8 string unless system
|
||||
* limits like memory or file descriptors are exceeded.)
|
||||
**/
|
||||
gchar *
|
||||
gdk_utf8_to_string_target (const gchar *str)
|
||||
_gdk_x11_display_utf8_to_string_target (GdkDisplay *display,
|
||||
const gchar *str)
|
||||
{
|
||||
return sanitize_utf8 (str, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_utf8_to_compound_text_for_display:
|
||||
* gdk_x11_display_utf8_to_compound_text:
|
||||
* @display: a #GdkDisplay
|
||||
* @str: a UTF-8 string
|
||||
* @encoding: location to store resulting encoding
|
||||
@ -737,13 +702,13 @@ gdk_utf8_to_string_target (const gchar *str)
|
||||
*
|
||||
* Converts from UTF-8 to compound text.
|
||||
*
|
||||
* Return value: %TRUE if the conversion succeeded, otherwise
|
||||
* %FALSE.
|
||||
* Return value: %TRUE if the conversion succeeded,
|
||||
* otherwise %FALSE
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
* Since: 3.0
|
||||
*/
|
||||
gboolean
|
||||
gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
|
||||
gdk_x11_display_utf8_to_compound_text (GdkDisplay *display,
|
||||
const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
@ -795,7 +760,7 @@ gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
|
||||
else
|
||||
locale_str = tmp_str;
|
||||
|
||||
result = gdk_string_to_compound_text_for_display (display, locale_str,
|
||||
result = gdk_x11_display_string_to_compound_text (display, locale_str,
|
||||
encoding, format,
|
||||
ctext, length);
|
||||
result = (result == Success? TRUE : FALSE);
|
||||
@ -806,13 +771,16 @@ gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_free_compound_text:
|
||||
* gdk_x11_free_compound_text:
|
||||
* @ctext: The pointer stored in @ctext from a call to
|
||||
* gdk_string_to_compound_text().
|
||||
* gdk_x11_display_string_to_compound_text().
|
||||
*
|
||||
* Frees the data returned from gdk_string_to_compound_text().
|
||||
* Frees the data returned from gdk_x11_display_string_to_compound_text().
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void gdk_free_compound_text (guchar *ctext)
|
||||
void
|
||||
gdk_x11_free_compound_text (guchar *ctext)
|
||||
{
|
||||
if (ctext)
|
||||
XFree (ctext);
|
||||
|
@ -2232,7 +2232,7 @@ set_text_property (GdkDisplay *display,
|
||||
{
|
||||
GdkAtom gdk_type;
|
||||
|
||||
gdk_utf8_to_compound_text_for_display (display,
|
||||
gdk_x11_display_utf8_to_compound_text (display,
|
||||
utf8_str, &gdk_type, &prop_format,
|
||||
(guchar **)&prop_text, &prop_length);
|
||||
prop_type = gdk_x11_atom_to_xatom_for_display (display, gdk_type);
|
||||
@ -2249,7 +2249,7 @@ set_text_property (GdkDisplay *display,
|
||||
prop_length);
|
||||
|
||||
if (is_compound_text)
|
||||
gdk_free_compound_text ((guchar *)prop_text);
|
||||
gdk_x11_free_compound_text ((guchar *)prop_text);
|
||||
else
|
||||
g_free (prop_text);
|
||||
}
|
||||
|
@ -231,6 +231,30 @@ GdkWindow *gdk_x11_window_foreign_new_for_display (GdkDisplay *display,
|
||||
GdkWindow *gdk_x11_window_lookup_for_display (GdkDisplay *display,
|
||||
Window window);
|
||||
|
||||
gint gdk_x11_display_text_property_to_text_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
void gdk_x11_free_text_list (gchar **list);
|
||||
gint gdk_x11_display_string_to_compound_text (GdkDisplay *display,
|
||||
const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length);
|
||||
gboolean gdk_x11_display_utf8_to_compound_text (GdkDisplay *display,
|
||||
const gchar *str,
|
||||
GdkAtom *encoding,
|
||||
gint *format,
|
||||
guchar **ctext,
|
||||
gint *length);
|
||||
void gdk_x11_free_compound_text (guchar *ctext);
|
||||
|
||||
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_X_H__ */
|
||||
|
@ -1319,17 +1319,21 @@ selection_set_compound_text (GtkSelectionData *selection_data,
|
||||
gint new_length;
|
||||
gboolean result = FALSE;
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
if (GDK_IS_DISPLAY_X11 (selection_data->display))
|
||||
{
|
||||
tmp = g_strndup (str, len);
|
||||
if (gdk_utf8_to_compound_text_for_display (selection_data->display, tmp,
|
||||
if (gdk_x11_display_utf8_to_compound_text (selection_data->display, tmp,
|
||||
&encoding, &format, &text, &new_length))
|
||||
{
|
||||
gtk_selection_data_set (selection_data, encoding, format, text, new_length);
|
||||
gdk_free_compound_text (text);
|
||||
gdk_x11_free_compound_text (text);
|
||||
|
||||
result = TRUE;
|
||||
}
|
||||
|
||||
g_free (tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user