Bug 592883 - Spin cell rendererer problem with double click

Block 2BUTTON and 3BUTTON press events using a button press event
handler in GtkCellRendererSpin, so that they won't be eaten and
processed by tree view.
This commit is contained in:
Kristian Rietveld 2009-08-27 16:22:11 +02:00
parent 05b246accc
commit de1c79c721

View File

@ -271,6 +271,21 @@ gtk_cell_renderer_spin_key_press_event (GtkWidget *widget,
return FALSE;
}
static gboolean
gtk_cell_renderer_spin_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
/* Block 2BUTTON and 3BUTTON here, so that they won't be eaten
* by tree view.
*/
if (event->type == GDK_2BUTTON_PRESS
|| event->type == GDK_3BUTTON_PRESS)
return TRUE;
return FALSE;
}
static GtkCellEditable *
gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell,
GdkEvent *event,
@ -296,6 +311,10 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell,
spin = gtk_spin_button_new (priv->adjustment,
priv->climb_rate, priv->digits);
g_signal_connect (spin, "button-press-event",
G_CALLBACK (gtk_cell_renderer_spin_button_press_event),
NULL);
if (cell_text->text)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin),
g_ascii_strtod (cell_text->text, NULL));