Update the RGBA cursor if an icon is set after the cursor has been
* gtk/gtkdnd.c: Update the RGBA cursor if an icon is set after the cursor has been constructed. Also handle repeated setting of icons correctly.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkdnd.c: Update the RGBA cursor if an
|
||||||
|
icon is set after the cursor has been constructed.
|
||||||
|
Also handle repeated setting of icons correctly.
|
||||||
|
|
||||||
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkbutton.c (gtk_button_set_image): Add some more
|
* gtk/gtkbutton.c (gtk_button_set_image): Add some more
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkdnd.c: Update the RGBA cursor if an
|
||||||
|
icon is set after the cursor has been constructed.
|
||||||
|
Also handle repeated setting of icons correctly.
|
||||||
|
|
||||||
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkbutton.c (gtk_button_set_image): Add some more
|
* gtk/gtkbutton.c (gtk_button_set_image): Add some more
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkdnd.c: Update the RGBA cursor if an
|
||||||
|
icon is set after the cursor has been constructed.
|
||||||
|
Also handle repeated setting of icons correctly.
|
||||||
|
|
||||||
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
2005-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkbutton.c (gtk_button_set_image): Add some more
|
* gtk/gtkbutton.c (gtk_button_set_image): Add some more
|
||||||
|
|||||||
58
gtk/gtkdnd.c
58
gtk/gtkdnd.c
@ -25,6 +25,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "gdkconfig.h"
|
#include "gdkconfig.h"
|
||||||
|
|
||||||
#include "gdk/gdkkeysyms.h"
|
#include "gdk/gdkkeysyms.h"
|
||||||
@ -196,6 +200,7 @@ static void gtk_drag_get_event_actions (GdkEvent *event,
|
|||||||
static GdkCursor * gtk_drag_get_cursor (GdkDisplay *display,
|
static GdkCursor * gtk_drag_get_cursor (GdkDisplay *display,
|
||||||
GdkDragAction action,
|
GdkDragAction action,
|
||||||
GtkDragSourceInfo *info);
|
GtkDragSourceInfo *info);
|
||||||
|
static void gtk_drag_update_cursor (GtkDragSourceInfo *info);
|
||||||
static GtkWidget *gtk_drag_get_ipc_widget (GdkScreen *screen);
|
static GtkWidget *gtk_drag_get_ipc_widget (GdkScreen *screen);
|
||||||
static void gtk_drag_release_ipc_widget (GtkWidget *widget);
|
static void gtk_drag_release_ipc_widget (GtkWidget *widget);
|
||||||
|
|
||||||
@ -620,7 +625,7 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
for (j = 0; j < 10; j++)
|
for (j = 0; j < 10; j++)
|
||||||
{
|
{
|
||||||
const gchar *opt;
|
const gchar *opt;
|
||||||
const gchar key[32];
|
gchar key[32];
|
||||||
gchar **toks;
|
gchar **toks;
|
||||||
|
|
||||||
g_snprintf (key, 32, "comment%d", j);
|
g_snprintf (key, 32, "comment%d", j);
|
||||||
@ -726,6 +731,37 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
return drag_cursors[i].cursor;
|
return drag_cursors[i].cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_drag_update_cursor (GtkDragSourceInfo *info)
|
||||||
|
{
|
||||||
|
GdkCursor *cursor;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
if (!info->have_grab)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0 ; i < n_drag_cursors - 1; i++)
|
||||||
|
if (info->cursor == drag_cursors[i].cursor ||
|
||||||
|
info->cursor == info->drag_cursors[i])
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == n_drag_cursors)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cursor = gtk_drag_get_cursor (gdk_cursor_get_display (info->cursor),
|
||||||
|
i, info);
|
||||||
|
|
||||||
|
if (cursor != info->cursor)
|
||||||
|
{
|
||||||
|
gdk_pointer_grab (info->ipc_widget->window, FALSE,
|
||||||
|
GDK_POINTER_MOTION_MASK |
|
||||||
|
GDK_BUTTON_RELEASE_MASK,
|
||||||
|
NULL,
|
||||||
|
cursor, info->grab_time);
|
||||||
|
info->cursor = cursor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/********************
|
/********************
|
||||||
* Destination side *
|
* Destination side *
|
||||||
********************/
|
********************/
|
||||||
@ -2125,8 +2161,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
|||||||
&info->cur_screen, &info->cur_x, &info->cur_y, NULL);
|
&info->cur_screen, &info->cur_x, &info->cur_y, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_emit_by_name (widget, "drag_begin",
|
g_signal_emit_by_name (widget, "drag_begin", info->context);
|
||||||
info->context);
|
|
||||||
|
|
||||||
/* Ensure that we have an icon before we start the drag; the
|
/* Ensure that we have an icon before we start the drag; the
|
||||||
* application may have set one in ::drag_begin, or it may
|
* application may have set one in ::drag_begin, or it may
|
||||||
@ -2724,13 +2759,20 @@ gtk_drag_set_icon_window (GdkDragContext *context,
|
|||||||
gtk_drag_remove_icon (info);
|
gtk_drag_remove_icon (info);
|
||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
gtk_widget_ref (widget);
|
gtk_widget_ref (widget);
|
||||||
|
|
||||||
info->icon_window = widget;
|
info->icon_window = widget;
|
||||||
info->hot_x = hot_x;
|
info->hot_x = hot_x;
|
||||||
info->hot_y = hot_y;
|
info->hot_y = hot_y;
|
||||||
info->destroy_icon = destroy_on_release;
|
info->destroy_icon = destroy_on_release;
|
||||||
|
|
||||||
|
if (widget && info->icon_pixbuf)
|
||||||
|
{
|
||||||
|
g_object_unref (info->icon_pixbuf);
|
||||||
|
info->icon_pixbuf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_drag_update_cursor (info);
|
||||||
gtk_drag_update_icon (info);
|
gtk_drag_update_icon (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2836,8 +2878,14 @@ set_icon_stock_pixbuf (GdkDragContext *context,
|
|||||||
GtkDragSourceInfo *info;
|
GtkDragSourceInfo *info;
|
||||||
|
|
||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
|
|
||||||
info = gtk_drag_get_source_info (context, FALSE);
|
info = gtk_drag_get_source_info (context, FALSE);
|
||||||
|
|
||||||
|
if (info->icon_pixbuf)
|
||||||
|
g_object_unref (info->icon_pixbuf);
|
||||||
info->icon_pixbuf = pixbuf;
|
info->icon_pixbuf = pixbuf;
|
||||||
|
|
||||||
|
gtk_drag_set_icon_window (context, NULL, hot_x, hot_y, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user