diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-12-06 17:27:03 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-12-06 17:27:03 +0900 |
commit | f08f1f92aa2f9e6b0d22c8b12ad011083ef30a02 (patch) | |
tree | fab12972dec7cf533876500a3fe99858ac21ff23 /gtk/gtkcellarea.c | |
parent | 0d0ec8587728ff26fbb2b14c8a7f72b39e386998 (diff) | |
download | gtk+-f08f1f92aa2f9e6b0d22c8b12ad011083ef30a02.tar.gz |
Fixed some nit-picking bugs in GtkCellArea
- Dont try fetching a cell renderer for an event when the event
coordinate is outside the cell area allocation (can happen
on the y axis, not all events are button events).
- Dont remove focus-line-width (inner area) an extra time from
GtkCellArea->event
- Dont remove focus-line-width from the cell area at all for the
editable widget... use the whole area including the focus line
(compared with git master behaviour and now it looks right, check
the multiline editable string in testtreeedit).
Diffstat (limited to 'gtk/gtkcellarea.c')
-rw-r--r-- | gtk/gtkcellarea.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 166546bc45..1fabc94d0d 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -467,7 +467,7 @@ static gint cell_attribute_find (CellAttribute *cell_attribut static void gtk_cell_area_add_editable (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellEditable *editable, - GdkRectangle *cell_area); + const GdkRectangle *cell_area); static void gtk_cell_area_remove_editable (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellEditable *editable); @@ -952,9 +952,9 @@ gtk_cell_area_real_event (GtkCellArea *area, if (button_event->button == 1) { - GtkCellRenderer *renderer; + GtkCellRenderer *renderer = NULL; GtkCellRenderer *focus_renderer; - GdkRectangle alloc_area, inner_area; + GdkRectangle alloc_area; gint event_x, event_y; /* We may need some semantics to tell us the offset of the event @@ -962,10 +962,15 @@ gtk_cell_area_real_event (GtkCellArea *area, event_x = button_event->x; event_y = button_event->y; - renderer = - gtk_cell_area_get_cell_at_position (area, context, widget, - cell_area, event_x, event_y, - &alloc_area); + /* Dont try to search for an event coordinate that is not in the area, that will + * trigger a runtime warning. + */ + if (event_x >= cell_area->x && event_x <= cell_area->x + cell_area->width && + event_y >= cell_area->y && event_y <= cell_area->y + cell_area->height) + renderer = + gtk_cell_area_get_cell_at_position (area, context, widget, + cell_area, event_x, event_y, + &alloc_area); if (renderer) { @@ -988,12 +993,10 @@ gtk_cell_area_real_event (GtkCellArea *area, if (focus_renderer != renderer) gtk_cell_area_get_cell_allocation (area, context, widget, focus_renderer, cell_area, &alloc_area); - - gtk_cell_area_inner_cell_area (area, widget, &alloc_area, &inner_area); gtk_cell_area_set_focus_cell (area, focus_renderer); retval = gtk_cell_area_activate_cell (area, widget, focus_renderer, - event, &inner_area, flags); + event, &alloc_area, flags); } } } @@ -2992,7 +2995,7 @@ static void gtk_cell_area_add_editable (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellEditable *editable, - GdkRectangle *cell_area) + const GdkRectangle *cell_area) { g_signal_emit (area, cell_area_signals[SIGNAL_ADD_EDITABLE], 0, renderer, editable, cell_area, area->priv->current_path); @@ -3157,7 +3160,6 @@ gtk_cell_area_activate_cell (GtkCellArea *area, GtkCellRendererState flags) { GtkCellRendererMode mode; - GdkRectangle inner_area; GtkCellAreaPrivate *priv; g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE); @@ -3167,10 +3169,6 @@ gtk_cell_area_activate_cell (GtkCellArea *area, priv = area->priv; - /* Remove margins from the background area to produce the cell area. - */ - gtk_cell_area_inner_cell_area (area, widget, cell_area, &inner_area); - g_object_get (renderer, "mode", &mode, NULL); if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) @@ -3179,7 +3177,7 @@ gtk_cell_area_activate_cell (GtkCellArea *area, event, widget, priv->current_path, cell_area, - &inner_area, + cell_area, flags)) return TRUE; } @@ -3192,7 +3190,7 @@ gtk_cell_area_activate_cell (GtkCellArea *area, event, widget, priv->current_path, cell_area, - &inner_area, + cell_area, flags); if (editable_widget != NULL) @@ -3204,7 +3202,7 @@ gtk_cell_area_activate_cell (GtkCellArea *area, /* Signal that editing started so that callers can get * a handle on the editable_widget */ - gtk_cell_area_add_editable (area, priv->focus_cell, editable_widget, &inner_area); + gtk_cell_area_add_editable (area, priv->focus_cell, editable_widget, cell_area); /* If the signal was successfully handled start the editing */ if (gtk_widget_get_parent (GTK_WIDGET (editable_widget))) |