summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-11-09 07:27:59 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-11-09 07:27:59 +0000
commit09dd88c0e56d4411db164c207995db4692a51659 (patch)
tree8f61aa256f084e4e33e49a992f4338052ff0bedf
parent5e459d11615ab8c3a061a8cfd704518d1c481644 (diff)
latest version of the omnibus GTK/OSX patch
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4115 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--patches/gtk-osx.patch294
1 files changed, 286 insertions, 8 deletions
diff --git a/patches/gtk-osx.patch b/patches/gtk-osx.patch
index 33e7be3adb..7bc110d261 100644
--- a/patches/gtk-osx.patch
+++ b/patches/gtk-osx.patch
@@ -1,6 +1,72 @@
+Index: gtk/gtktreeview.c
+===================================================================
+--- gtk/gtktreeview.c (revision 21770)
++++ gtk/gtktreeview.c (working copy)
+@@ -99,6 +99,9 @@
+
+ guint source_set : 1;
+ guint dest_set : 1;
++
++ GtkTreePath* path;
++ GtkTreeModel* model;
+ };
+
+
+@@ -6967,6 +6970,17 @@
+ return path;
+ }
+
++#ifdef GDK_WINDOWING_QUARTZ
++static void
++gtk_tree_view_catch_drag_begin (GtkWidget* widget,
++ GdkDragContext* context,
++ gpointer user_data)
++{
++ TreeViewDragInfo* drag_info = (TreeViewDragInfo*) user_data;
++ set_source_row (context, drag_info->model, drag_info->path);
++}
++#endif
++
+ static gboolean
+ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view,
+ GdkEventMotion *event)
+@@ -6979,6 +6993,7 @@
+ gint cell_x, cell_y;
+ GtkTreeModel *model;
+ gboolean retval = FALSE;
++ gint drag_begin_id;
+
+ di = get_info (tree_view);
+
+@@ -7025,13 +7040,25 @@
+
+ retval = TRUE;
+
++#ifdef GDK_WINDOWING_QUARTZ
++ /* catch drag-being signal */
++ di->model = model;
++ di->path = path;
++ drag_begin_id = g_signal_connect (tree_view, "drag-begin", G_CALLBACK (gtk_tree_view_catch_drag_begin), (gpointer) di);
++#endif
++
+ context = gtk_drag_begin (widget,
+ gtk_drag_source_get_target_list (widget),
+ di->source_actions,
+ button,
+ (GdkEvent*)event);
+
++#ifndef GDK_WINDOWING_QUARTZ
+ set_source_row (context, model, path);
++#else
++ /* disconnect drag-begin and catch drag-end */
++ g_signal_handler_disconnect (tree_view, drag_begin_id);
++#endif
+
+ out:
+ if (path)
Index: gtk/gtkquartz.c
===================================================================
---- gtk/gtkquartz.c (revision 21737)
+--- gtk/gtkquartz.c (revision 21770)
+++ gtk/gtkquartz.c (working copy)
@@ -24,6 +24,23 @@
#include "gtkalias.h"
@@ -28,7 +94,7 @@ Index: gtk/gtkquartz.c
CGColorSpaceRef colorspace;
Index: gtk/gtkquartz.h
===================================================================
---- gtk/gtkquartz.h (revision 21737)
+--- gtk/gtkquartz.h (revision 21770)
+++ gtk/gtkquartz.h (working copy)
@@ -41,6 +41,7 @@
GtkSelectionData *selection_data);
@@ -40,7 +106,7 @@ Index: gtk/gtkquartz.h
Index: gtk/gtktooltip.c
===================================================================
---- gtk/gtktooltip.c (revision 21737)
+--- gtk/gtktooltip.c (revision 21770)
+++ gtk/gtktooltip.c (working copy)
@@ -426,6 +426,7 @@
gtk_tooltip_trigger_tooltip_query (GdkDisplay *display)
@@ -67,9 +133,119 @@ Index: gtk/gtktooltip.c
_gtk_tooltip_handle_event (&event);
Index: gtk/gtkdnd-quartz.c
===================================================================
---- gtk/gtkdnd-quartz.c (revision 21737)
+--- gtk/gtkdnd-quartz.c (revision 21770)
+++ gtk/gtkdnd-quartz.c (working copy)
-@@ -1086,13 +1086,13 @@
+@@ -63,6 +63,11 @@
+ gboolean create);
+ static void gtk_drag_source_site_destroy (gpointer data);
+
++static GtkDragSourceInfo *gtk_drag_get_source_info (GdkDragContext *context,
++ gboolean create);
++
++extern GdkDragContext *gdk_quartz_drag_source_context(); /* gdk/quartz/gdkdnd-quartz.c */
++
+ struct _GtkDragSourceSite
+ {
+ GdkModifierType start_button_mask;
+@@ -89,6 +94,7 @@
+
+ struct _GtkDragSourceInfo
+ {
++ GtkWidget *source_widget;
+ GtkWidget *widget;
+ GtkTargetList *target_list; /* Targets for drag data */
+ GdkDragAction possible_actions; /* Actions allowed by source */
+@@ -96,6 +102,8 @@
+
+ gint hot_x, hot_y; /* Hot spot for drag */
+ GdkPixbuf *icon_pixbuf;
++ gboolean success;
++ gboolean delete;
+ };
+
+ struct _GtkDragDestSite
+@@ -223,7 +231,9 @@
+ selection_data,
+ 0, time);
+ }
++
+
++
+ if (site && site->flags & GTK_DEST_DEFAULT_DROP)
+ {
+ gtk_drag_finish (context,
+@@ -233,19 +243,23 @@
+ }
+ }
+
+-
+-GtkWidget *
+-gtk_drag_get_source_widget (GdkDragContext *context)
+-{
+- return NULL;
+-}
+-
+ void
+ gtk_drag_finish (GdkDragContext *context,
+ gboolean success,
+ gboolean del,
+ guint32 time)
+ {
++ GtkDragSourceInfo *info;
++ GdkDragContext* source_context = gdk_quartz_drag_source_context ();
++
++ g_assert (source_context);
++
++ info = gtk_drag_get_source_info (source_context, FALSE);
++ if (info)
++ {
++ info->success = success;
++ info->delete = del;
++ }
+ }
+
+ static void
+@@ -307,6 +321,22 @@
+ g_object_set_qdata (G_OBJECT (context), dest_info_quark, NULL);
+ }
+
++GtkWidget *
++gtk_drag_get_source_widget (GdkDragContext *context)
++{
++ GtkDragSourceInfo *info;
++ GdkDragContext* real_source_context = gdk_quartz_drag_source_context();
++
++ if (!real_source_context)
++ return NULL;
++
++ info = gtk_drag_get_source_info (real_source_context, FALSE);
++ if (!info)
++ return NULL;
++
++ return info->source_widget;
++}
++
+ /*************************************************************
+ * gtk_drag_highlight_expose:
+ * Callback for expose_event for highlighted widgets.
+@@ -857,6 +887,8 @@
+ gtk_drag_get_data (widget, context, target, time);
+ }
+
++ /* leave a note for the source-side context about the action chosen */
++
+ g_signal_emit_by_name (widget, "drag-drop",
+ context, x, y, time, &retval);
+
+@@ -1052,6 +1084,7 @@
+
+ info = gtk_drag_get_source_info (context, TRUE);
+
++ info->source_widget = g_object_ref (widget);
+ info->widget = g_object_ref (widget);
+ info->target_list = target_list;
+ gtk_target_list_ref (target_list);
+@@ -1086,13 +1119,13 @@
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 1, 1);
@@ -88,7 +264,7 @@ Index: gtk/gtkdnd-quartz.c
}
break;
case GTK_IMAGE_PIXBUF:
-@@ -1668,7 +1668,20 @@
+@@ -1668,7 +1701,20 @@
gint hot_x,
gint hot_y)
{
@@ -110,9 +286,30 @@ Index: gtk/gtkdnd-quartz.c
}
/**
+@@ -1760,6 +1806,9 @@
+ g_signal_emit_by_name (info->widget, "drag-end",
+ info->context);
+
++ if (info->source_widget)
++ g_object_unref (info->source_widget);
++
+ if (info->widget)
+ g_object_unref (info->widget);
+
+@@ -1781,6 +1830,10 @@
+ static void
+ gtk_drag_drop_finished (GtkDragSourceInfo *info)
+ {
++ if (info->success && info->delete)
++ g_signal_emit_by_name (info->source_widget, "drag-data-delete",
++ info->context);
++
+ /* Workaround for the fact that the NS API blocks until the drag is
+ * over. This way the context is still valid when returning from
+ * drag_begin, even if it will still be quite useless. See bug #501588.
Index: gdk/quartz/gdkevents-quartz.c
===================================================================
---- gdk/quartz/gdkevents-quartz.c (revision 21737)
+--- gdk/quartz/gdkevents-quartz.c (revision 21770)
+++ gdk/quartz/gdkevents-quartz.c (working copy)
@@ -112,6 +112,18 @@
return ((GdkEventPrivate *) event)->windowing_data;
@@ -133,7 +330,7 @@ Index: gdk/quartz/gdkevents-quartz.c
void
_gdk_events_init (void)
{
-@@ -1670,6 +1682,65 @@
+@@ -1668,6 +1680,65 @@
}
static gboolean
@@ -199,3 +396,84 @@ Index: gdk/quartz/gdkevents-quartz.c
gdk_event_translate (NSEvent *nsevent)
{
NSWindow *nswindow;
+Index: gdk/quartz/gdkdnd-quartz.c
+===================================================================
+--- gdk/quartz/gdkdnd-quartz.c (revision 21770)
++++ gdk/quartz/gdkdnd-quartz.c (working copy)
+@@ -101,6 +101,12 @@
+
+ GdkDragContext *_gdk_quartz_drag_source_context = NULL;
+
++GdkDragContext*
++gdk_quartz_drag_source_context()
++{
++ return _gdk_quartz_drag_source_context;
++}
++
+ GdkDragContext *
+ gdk_drag_begin (GdkWindow *window,
+ GList *targets)
+Index: gdk/quartz/GdkQuartzWindow.c
+===================================================================
+--- gdk/quartz/GdkQuartzWindow.c (revision 21770)
++++ gdk/quartz/GdkQuartzWindow.c (working copy)
+@@ -461,8 +461,29 @@
+ {
+ GdkDragAction result = 0;
+
++ /* GDK and Quartz drag operations do not map 1:1.
++ This mapping represents about the best that we
++ can come up.
++
++ Note that NSDragOperationPrivate and GDK_ACTION_PRIVATE
++ have almost opposite meanings: the GDK one means that the
++ destination is solely responsible for the action; the Quartz
++ one means that the source and destination will agree
++ privately on the action. NSOperationGeneric is close in meaning
++ to GDK_ACTION_PRIVATE but there is a problem: it will be
++ sent for any ordinary drag, and likely not understood
++ by any intra-widget drag (since the source & dest are the
++ same)
++ */
++
+ if (operation & NSDragOperationGeneric)
++ result |= GDK_ACTION_MOVE;
++ if (operation & NSDragOperationCopy)
+ result |= GDK_ACTION_COPY;
++ if (operation & NSDragOperationMove)
++ result |= GDK_ACTION_MOVE;
++ if (operation & NSDragOperationLink)
++ result |= GDK_ACTION_LINK;
+
+ return result;
+ }
+@@ -474,6 +495,10 @@
+
+ if (action & GDK_ACTION_COPY)
+ result |= NSDragOperationCopy;
++ if (action & GDK_ACTION_LINK)
++ result |= NSDragOperationLink;
++ if (action & GDK_ACTION_MOVE)
++ result |= NSDragOperationMove;
+
+ return result;
+ }
+@@ -485,6 +510,7 @@
+
+ GDK_DRAG_CONTEXT_PRIVATE (current_context)->dragging_info = sender;
+ current_context->suggested_action = drag_operation_to_drag_action ([sender draggingSourceOperationMask]);
++ current_context->actions = current_context->suggested_action;
+ }
+
+ - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
+@@ -510,6 +536,10 @@
+
+ - (void)draggingEnded:(id <NSDraggingInfo>)sender
+ {
++ /* leave a note for the source about what action was taken */
++ if (_gdk_quartz_drag_source_context && current_context)
++ _gdk_quartz_drag_source_context->action = current_context->action;
++
+ if (current_context)
+ g_object_unref (current_context);
+ current_context = NULL;