forked from AuroraMiddleware/gtk
gtklinkbutton: Set cursor on button's event window
It is not necessary to (re)set the cursor on every crossing
event, and can probably yield the wrong results if there are
multiple master devices involved. Just set it on init(), and
let the inner machinery update the cursor whenever necessary.
This patch is an adaption of commit 0daf79676
in gtk-3-22, the
side effects are not as bad here because the cursor was already
being set on the widget specifically instead of the parent
widget's, but there's still some nonetheless (plus, it's simpler)
https://bugzilla.gnome.org/show_bug.cgi?id=785375
This commit is contained in:
parent
8f33385d62
commit
21062fab02
@ -106,12 +106,6 @@ static void gtk_link_button_set_property (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_link_button_clicked (GtkButton *button);
|
||||
static gboolean gtk_link_button_popup_menu (GtkWidget *widget);
|
||||
static gboolean gtk_link_button_enter_cb (GtkWidget *widget,
|
||||
GdkEventCrossing *event,
|
||||
gpointer user_data);
|
||||
static gboolean gtk_link_button_leave_cb (GtkWidget *widget,
|
||||
GdkEventCrossing *event,
|
||||
gpointer user_data);
|
||||
static void gtk_link_button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection,
|
||||
@ -132,6 +126,9 @@ static void gtk_link_button_pressed_cb (GtkGestureMultiPress *gesture,
|
||||
|
||||
static gboolean gtk_link_button_activate_link (GtkLinkButton *link_button);
|
||||
|
||||
static void set_hand_cursor (GtkWidget *widget,
|
||||
gboolean show_hand);
|
||||
|
||||
static const GtkTargetEntry link_drop_types[] = {
|
||||
{ (char *) "text/uri-list", 0, 0 },
|
||||
{ (char *) "_NETSCAPE_URL", 0, 0 }
|
||||
@ -227,10 +224,6 @@ gtk_link_button_init (GtkLinkButton *link_button)
|
||||
gtk_button_set_relief (GTK_BUTTON (link_button), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_state_flags (GTK_WIDGET (link_button), GTK_STATE_FLAG_LINK, FALSE);
|
||||
|
||||
g_signal_connect (link_button, "enter-notify-event",
|
||||
G_CALLBACK (gtk_link_button_enter_cb), NULL);
|
||||
g_signal_connect (link_button, "leave-notify-event",
|
||||
G_CALLBACK (gtk_link_button_leave_cb), NULL);
|
||||
g_signal_connect (link_button, "drag-data-get",
|
||||
G_CALLBACK (gtk_link_button_drag_data_get_cb), NULL);
|
||||
|
||||
@ -253,6 +246,8 @@ gtk_link_button_init (GtkLinkButton *link_button)
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (link_button));
|
||||
gtk_style_context_add_class (context, "link");
|
||||
|
||||
set_hand_cursor (GTK_WIDGET (link_button), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -459,26 +454,6 @@ gtk_link_button_popup_menu (GtkWidget *widget)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_link_button_enter_cb (GtkWidget *widget,
|
||||
GdkEventCrossing *crossing,
|
||||
gpointer user_data)
|
||||
{
|
||||
set_hand_cursor (widget, TRUE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_link_button_leave_cb (GtkWidget *widget,
|
||||
GdkEventCrossing *crossing,
|
||||
gpointer user_data)
|
||||
{
|
||||
set_hand_cursor (widget, FALSE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_link_button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
|
Loading…
Reference in New Issue
Block a user