[gtk+/quartz-integration] Bug 571582: GtkSelection implementation for quartz.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/quartz-integration] Bug 571582: GtkSelection implementation for quartz.
- Date: Sat, 25 Dec 2010 04:27:16 +0000 (UTC)
commit 6e9fbc5e67088fedab6afa37b33affd3815c12c4
Author: John Ralls <jralls ceridwen us>
Date: Fri Dec 24 20:21:21 2010 -0800
Bug 571582: GtkSelection implementation for quartz.
gdk/quartz/gdkselection-quartz.c | 25 +++++++++++++++----------
gtk/Makefile.am | 4 +++-
gtk/gtkquartz.c | 1 +
gtk/gtkselection.c | 14 ++++++++++----
4 files changed, 29 insertions(+), 15 deletions(-)
---
diff --git a/gdk/quartz/gdkselection-quartz.c b/gdk/quartz/gdkselection-quartz.c
index 446a23e..398e9d2 100644
--- a/gdk/quartz/gdkselection-quartz.c
+++ b/gdk/quartz/gdkselection-quartz.c
@@ -32,7 +32,8 @@ _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
guint32 time,
gint send_event)
{
- /* FIXME: Implement */
+ g_print ("Not a valid interface on Quartz. Use GtkSelection.\n");
+ g_return_val_if_reached(TRUE);
return TRUE;
}
@@ -40,7 +41,7 @@ GdkWindow*
_gdk_quartz_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection)
{
- /* FIXME: Implement */
+ /* Quartz doesn't have an X-selection, so it doesn't have a gdk_selection. */
return NULL;
}
@@ -51,7 +52,9 @@ _gdk_quartz_display_convert_selection (GdkDisplay *display,
GdkAtom target,
guint32 time)
{
- /* FIXME: Implement */
+ g_print ("Not a valid interface on Quartz. Use GtkSelection.\n");
+ g_return_if_reached();
+
}
gint
@@ -61,7 +64,8 @@ _gdk_quartz_display_get_selection_property (GdkDisplay *display,
GdkAtom *ret_type,
gint *ret_format)
{
- /* FIXME: Implement */
+ g_print ("Quartz windows do not support properties.\n");
+ g_return_val_if_reached(-1);
return 0;
}
@@ -73,15 +77,16 @@ _gdk_quartz_display_send_selection_notify (GdkDisplay *display,
GdkAtom property,
guint32 time)
{
- /* FIXME: Implement */
+ g_print ("Not a valid interface on Quartz. Use GtkSelection.\n");
+ g_return_if_reached();
}
gchar *
_gdk_quartz_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str)
{
- /* FIXME: Implement */
- return NULL;
+ /* UTF8 is the standard string on OSX */
+ return g_strdup (str);
}
static gint
@@ -101,7 +106,7 @@ make_list (const gchar *text,
while (p < text + length)
{
gchar *str;
-
+
q = p;
while (*q && q < text + length)
q++;
@@ -135,7 +140,7 @@ make_list (const gchar *text,
*list = g_new (gchar *, n_strings + 1);
(*list)[n_strings] = NULL;
-
+
i = n_strings;
tmp_list = strings;
while (tmp_list)
@@ -176,7 +181,7 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
{
gchar *enc_name = gdk_atom_name (encoding);
- g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled\n", enc_name);
+ g_warning ("gdk_text_property_to_utf8_list: encoding %s not handled\n", enc_name);
g_free (enc_name);
if (list)
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 8b55108..5e3a474 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -765,7 +765,9 @@ endif
if USE_QUARTZ
gtk_clipboard_dnd_c_sources = \
gtkclipboard-quartz.c \
- gtkdnd-quartz.c
+ gtkdnd-quartz.c \
+ gtkselection-quartz.c
+
gtk_clipboard_dnd_h_sources = gtkquartz.h
else
gtk_clipboard_dnd_c_sources = gtkclipboard.c gtkdnd.c
diff --git a/gtk/gtkquartz.c b/gtk/gtkquartz.c
index 4ef47c7..19b6034 100644
--- a/gtk/gtkquartz.c
+++ b/gtk/gtkquartz.c
@@ -271,6 +271,7 @@ _gtk_quartz_set_selection_data_for_pasteboard (NSPasteboard *pasteboard,
type = target_to_pasteboard_type (target);
g_free (target);
+ g_return_if_fail (data != NULL);
if ([type isEqualTo:NSStringPboardType])
[pasteboard setString:[NSString stringWithUTF8String:(const char *)data]
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 5ee7b25..9f9d54f 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -635,6 +635,7 @@ gtk_target_table_free (GtkTargetEntry *targets,
g_free (targets);
}
+#ifndef GDK_WINDOWING_QUARTZ /* Quartz handled by gtkselection-quartz.c */
/**
* gtk_selection_owner_set_for_display:
* @display: the #Gdkdisplay where the selection is set
@@ -737,7 +738,7 @@ gtk_selection_owner_set_for_display (GdkDisplay *display,
else
return FALSE;
}
-
+#endif /* GDK_WINDOWING_QUARTZ */
/**
* gtk_selection_owner_set:
* @widget: (allow-none): a #GtkWidget, or %NULL.
@@ -939,7 +940,7 @@ gtk_selection_add_targets (GtkWidget *widget,
#endif
}
-
+#ifndef GDK_WINDOWING_QUARTZ /* Quartz is handled in gtkselection-quartz.c */
/**
* gtk_selection_remove_all:
* @widget: a #GtkWidget
@@ -1000,8 +1001,9 @@ gtk_selection_remove_all (GtkWidget *widget)
/* Remove all selection lists */
gtk_selection_target_list_remove (widget);
}
+#endif /* GDK_WINDOWING_QUARTZ */
-
+#ifndef GDK_WINDOWING_QUARTZ /* Quartz is handled in gtkselection-quartz.c */
/**
* gtk_selection_convert:
* @widget: The widget which acts as requestor
@@ -1113,7 +1115,7 @@ gtk_selection_convert (GtkWidget *widget,
return TRUE;
}
-
+#endif /* GDK_WINDOWING_QUARTZ */
/**
* gtk_selection_data_get_selection:
* @selection_data: a pointer to a #GtkSelectionData structure.
@@ -2182,6 +2184,7 @@ gtk_selection_init (void)
initialize = FALSE;
}
+#ifndef GDK_WINDOWING_QUARTZ /* Quartz handled by gtkselection-quartz.c */
/**
* _gtk_selection_clear:
* @widget: a #GtkWidget
@@ -2610,6 +2613,7 @@ _gtk_selection_incr_event (GdkWindow *window,
return TRUE;
}
+#endif /* GDK_WINDOWING_QUARTZ */
/*************************************************************
* gtk_selection_incr_timeout:
@@ -2664,6 +2668,7 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
return retval;
}
+#ifndef GDK_WINDOWING_QUARTZ /* Quartz handled by gtkselection-quartz.c */
/*************************************************************
* _gtk_selection_notify:
* Handler for "selection-notify-event" signals on windows
@@ -2862,6 +2867,7 @@ _gtk_selection_property_notify (GtkWidget *widget,
return TRUE;
}
+#endif /* GDK_WINDOWING_QUARTZ */
/*************************************************************
* gtk_selection_retrieval_timeout:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]