X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpspp-sheet-view.c;h=ccdbd10e9919b5d61cbc059bd6d4c7284c66e277;hb=refs%2Fbuilds%2F20140209033012%2Fpspp;hp=4572e651c12e236c381d535b2002fa3aa1b2bcc2;hpb=a927e10374e0af51d9483639dc31c6030d107946;p=pspp diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c index 4572e651c1..ccdbd10e99 100644 --- a/src/ui/gui/pspp-sheet-view.c +++ b/src/ui/gui/pspp-sheet-view.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "ui/gui/psppire-marshal.h" @@ -134,6 +135,8 @@ enum { PROP_MODEL, PROP_HADJUSTMENT, PROP_VADJUSTMENT, + PROP_HSCROLL_POLICY, + PROP_VSCROLL_POLICY, PROP_HEADERS_VISIBLE, PROP_HEADERS_CLICKABLE, PROP_REORDERABLE, @@ -170,8 +173,8 @@ static void pspp_sheet_view_size_request (GtkWidget *widget, GtkRequisition *requisition); static void pspp_sheet_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gboolean pspp_sheet_view_expose (GtkWidget *widget, - GdkEventExpose *event); +static gboolean pspp_sheet_view_draw (GtkWidget *widget, + cairo_t *cr); static gboolean pspp_sheet_view_key_press (GtkWidget *widget, GdkEventKey *event); static gboolean pspp_sheet_view_key_release (GtkWidget *widget, @@ -294,6 +297,12 @@ static void pspp_sheet_view_top_row_to_dy (PsppSheetView *tree_view); static void invalidate_empty_focus (PsppSheetView *tree_view); /* Internal functions */ +static GtkAdjustment *pspp_sheet_view_do_get_hadjustment (PsppSheetView *); +static GtkAdjustment *pspp_sheet_view_do_get_vadjustment (PsppSheetView *); +static void pspp_sheet_view_do_set_hadjustment (PsppSheetView *tree_view, + GtkAdjustment *adjustment); +static void pspp_sheet_view_do_set_vadjustment (PsppSheetView *tree_view, + GtkAdjustment *adjustment); static void pspp_sheet_view_add_move_binding (GtkBindingSet *binding_set, guint keyval, guint modmask, @@ -355,8 +364,10 @@ static void pspp_sheet_view_search_position_func (PsppSheetView *t static void pspp_sheet_view_search_disable_popdown (GtkEntry *entry, GtkMenu *menu, gpointer data); +#if GTK3_TRANSITION static void pspp_sheet_view_search_preedit_changed (GtkIMContext *im_context, PsppSheetView *tree_view); +#endif static void pspp_sheet_view_search_activate (GtkEntry *entry, PsppSheetView *tree_view); static gboolean pspp_sheet_view_real_search_enable_popdown(gpointer data); @@ -448,7 +459,32 @@ static GtkBindingSet *edit_bindings; G_DEFINE_TYPE_WITH_CODE (PsppSheetView, pspp_sheet_view, GTK_TYPE_CONTAINER, G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, - pspp_sheet_view_buildable_init)) + pspp_sheet_view_buildable_init) + G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL)) + +static void +pspp_sheet_view_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + + pspp_sheet_view_size_request (widget, &requisition); + + *minimal_width = *natural_width = requisition.width; +} + +static void +pspp_sheet_view_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + + pspp_sheet_view_size_request (widget, &requisition); + + *minimal_height = *natural_height = requisition.height; +} static void pspp_sheet_view_class_init (PsppSheetViewClass *class) @@ -478,14 +514,15 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) widget_class->map = pspp_sheet_view_map; widget_class->realize = pspp_sheet_view_realize; widget_class->unrealize = pspp_sheet_view_unrealize; - widget_class->size_request = pspp_sheet_view_size_request; + widget_class->get_preferred_width = pspp_sheet_view_get_preferred_width; + widget_class->get_preferred_height = pspp_sheet_view_get_preferred_height; widget_class->size_allocate = pspp_sheet_view_size_allocate; widget_class->button_press_event = pspp_sheet_view_button_press; widget_class->button_release_event = pspp_sheet_view_button_release; widget_class->grab_broken_event = pspp_sheet_view_grab_broken; /*widget_class->configure_event = pspp_sheet_view_configure;*/ widget_class->motion_notify_event = pspp_sheet_view_motion; - widget_class->expose_event = pspp_sheet_view_expose; + widget_class->draw = pspp_sheet_view_draw; widget_class->key_press_event = pspp_sheet_view_key_press; widget_class->key_release_event = pspp_sheet_view_key_release; widget_class->enter_notify_event = pspp_sheet_view_enter_notify; @@ -528,21 +565,10 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) GTK_TYPE_TREE_MODEL, GTK_PARAM_READWRITE)); - g_object_class_install_property (o_class, - PROP_HADJUSTMENT, - g_param_spec_object ("hadjustment", - P_("Horizontal Adjustment"), - P_("Horizontal Adjustment for the widget"), - GTK_TYPE_ADJUSTMENT, - GTK_PARAM_READWRITE)); - - g_object_class_install_property (o_class, - PROP_VADJUSTMENT, - g_param_spec_object ("vadjustment", - P_("Vertical Adjustment"), - P_("Vertical Adjustment for the widget"), - GTK_TYPE_ADJUSTMENT, - GTK_PARAM_READWRITE)); + g_object_class_override_property (o_class, PROP_HADJUSTMENT, "hadjustment"); + g_object_class_override_property (o_class, PROP_VADJUSTMENT, "vadjustment"); + g_object_class_override_property (o_class, PROP_HSCROLL_POLICY, "hscroll-policy"); + g_object_class_override_property (o_class, PROP_VSCROLL_POLICY, "vscroll-policy"); g_object_class_install_property (o_class, PROP_HEADERS_VISIBLE, @@ -751,6 +777,7 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) GTK_PARAM_READABLE)); /* Signals */ +#if GTK3_TRANSITION /** * PsppSheetView::set-scroll-adjustments * @horizontal: the horizontal #GtkAdjustment @@ -770,6 +797,7 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); +#endif /** * PsppSheetView::row-activated: @@ -1091,6 +1119,9 @@ pspp_sheet_view_init (PsppSheetView *tree_view) tree_view->priv->button_style = NULL; tree_view->dispose_has_run = FALSE; + + pspp_sheet_view_do_set_vadjustment (tree_view, NULL); + pspp_sheet_view_do_set_hadjustment (tree_view, NULL); } @@ -1114,12 +1145,20 @@ pspp_sheet_view_set_property (GObject *object, pspp_sheet_view_set_model (tree_view, g_value_get_object (value)); break; case PROP_HADJUSTMENT: - pspp_sheet_view_set_hadjustment (tree_view, g_value_get_object (value)); + pspp_sheet_view_do_set_hadjustment (tree_view, g_value_get_object (value)); break; case PROP_VADJUSTMENT: - pspp_sheet_view_set_vadjustment (tree_view, g_value_get_object (value)); + pspp_sheet_view_do_set_vadjustment (tree_view, g_value_get_object (value)); break; - case PROP_HEADERS_VISIBLE: + case PROP_HSCROLL_POLICY: + tree_view->priv->hscroll_policy = g_value_get_enum (value); + gtk_widget_queue_resize (GTK_WIDGET (tree_view)); + break; + case PROP_VSCROLL_POLICY: + tree_view->priv->vscroll_policy = g_value_get_enum (value); + gtk_widget_queue_resize (GTK_WIDGET (tree_view)); + break; + case PROP_HEADERS_VISIBLE: pspp_sheet_view_set_headers_visible (tree_view, g_value_get_boolean (value)); break; case PROP_HEADERS_CLICKABLE: @@ -1202,6 +1241,12 @@ pspp_sheet_view_get_property (GObject *object, case PROP_VADJUSTMENT: g_value_set_object (value, tree_view->priv->vadjustment); break; + case PROP_HSCROLL_POLICY: + g_value_set_enum (value, tree_view->priv->hscroll_policy); + break; + case PROP_VSCROLL_POLICY: + g_value_set_enum (value, tree_view->priv->vscroll_policy); + break; case PROP_HEADERS_VISIBLE: g_value_set_boolean (value, pspp_sheet_view_get_headers_visible (tree_view)); break; @@ -1459,10 +1504,12 @@ pspp_sheet_view_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; GtkAllocation allocation; + GtkAllocation old_allocation; gtk_widget_set_realized (widget, TRUE); gtk_widget_get_allocation (widget, &allocation); + gtk_widget_get_allocation (widget, &old_allocation); /* Make the main, clipping window */ attributes.window_type = GDK_WINDOW_CHILD; @@ -1472,10 +1519,9 @@ pspp_sheet_view_realize (GtkWidget *widget) attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; gtk_widget_set_window (widget, gdk_window_new (gtk_widget_get_parent_window (widget), @@ -1485,8 +1531,8 @@ pspp_sheet_view_realize (GtkWidget *widget) /* Make the window for the tree */ attributes.x = 0; attributes.y = TREE_VIEW_HEADER_HEIGHT (tree_view); - attributes.width = MAX (tree_view->priv->width, widget->allocation.width); - attributes.height = widget->allocation.height; + attributes.width = MAX (tree_view->priv->width, old_allocation.width); + attributes.height = old_allocation.height; attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | @@ -1503,7 +1549,7 @@ pspp_sheet_view_realize (GtkWidget *widget) /* Make the column header window */ attributes.x = 0; attributes.y = 0; - attributes.width = MAX (tree_view->priv->width, widget->allocation.width); + attributes.width = MAX (tree_view->priv->width, old_allocation.width); attributes.height = tree_view->priv->header_height; attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | @@ -1518,10 +1564,10 @@ pspp_sheet_view_realize (GtkWidget *widget) gdk_window_set_user_data (tree_view->priv->header_window, widget); /* Add them all up. */ - widget->style = gtk_style_attach (widget->style, gtk_widget_get_window (widget)); - gdk_window_set_back_pixmap (gtk_widget_get_window (widget), NULL, FALSE); - gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[gtk_widget_get_state (widget)]); - gtk_style_set_background (widget->style, tree_view->priv->header_window, GTK_STATE_NORMAL); + gtk_widget_set_style (widget, + gtk_style_attach (gtk_widget_get_style (widget), gtk_widget_get_window (widget))); + gdk_window_set_background (tree_view->priv->bin_window, >k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]); + gtk_style_set_background (gtk_widget_get_style (widget), tree_view->priv->header_window, GTK_STATE_NORMAL); tmp_list = tree_view->priv->children; while (tmp_list) @@ -1823,6 +1869,7 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, PsppSheetView *tree_view; GList *list, *first_column, *last_column; PsppSheetViewColumn *column; + GtkAllocation col_allocation; GtkAllocation allocation; gint width = 0; gint extra, extra_per_column; @@ -1837,6 +1884,7 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, last_column && !(PSPP_SHEET_VIEW_COLUMN (last_column->data)->visible); last_column = last_column->prev) ; + if (last_column == NULL) return; @@ -1845,8 +1893,8 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, first_column = first_column->next) ; - allocation.y = 0; - allocation.height = tree_view->priv->header_height; + col_allocation.y = 0; + col_allocation.height = tree_view->priv->header_height; rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); @@ -1864,7 +1912,8 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, number_of_expand_columns++; } - extra = MAX (widget->allocation.width - full_requested_width, 0); + gtk_widget_get_allocation (widget, &allocation); + extra = MAX (allocation.width - full_requested_width, 0); if (number_of_expand_columns > 0) extra_per_column = extra/number_of_expand_columns; else @@ -1900,7 +1949,7 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, real_requested_width = pspp_sheet_view_get_real_requested_width_from_column (tree_view, column); - allocation.x = width; + col_allocation.x = width; column->width = real_requested_width; if (column->expand) @@ -1922,25 +1971,25 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, if (column->width != old_width) g_object_notify (G_OBJECT (column), "width"); - allocation.width = column->width; + col_allocation.width = column->width; width += column->width; if (column->width > old_width) column_changed = TRUE; - pspp_sheet_view_column_size_allocate (column, &allocation); + pspp_sheet_view_column_size_allocate (column, &col_allocation); - if (span_intersects (allocation.x, allocation.width, + if (span_intersects (col_allocation.x, col_allocation.width, gtk_adjustment_get_value (tree_view->priv->hadjustment), - widget->allocation.width) + allocation.width) && gtk_widget_get_realized (widget)) pspp_sheet_view_column_set_need_button (column, TRUE); if (column->window) gdk_window_move_resize (column->window, - allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2, - allocation.y, - TREE_VIEW_DRAG_WIDTH, allocation.height); + col_allocation.x + (rtl ? 0 : col_allocation.width) - TREE_VIEW_DRAG_WIDTH/2, + col_allocation.y, + TREE_VIEW_DRAG_WIDTH, col_allocation.height); } /* We change the width here. The user might have been resizing columns, @@ -1954,7 +2003,6 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, gtk_widget_queue_draw (GTK_WIDGET (tree_view)); } - static void pspp_sheet_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) @@ -1962,12 +2010,14 @@ pspp_sheet_view_size_allocate (GtkWidget *widget, PsppSheetView *tree_view = PSPP_SHEET_VIEW (widget); GList *tmp_list; gboolean width_changed = FALSE; - gint old_width = widget->allocation.width; + GtkAllocation old_allocation; + gtk_widget_get_allocation (widget, &old_allocation); - if (allocation->width != widget->allocation.width) + if (allocation->width != old_allocation.width) width_changed = TRUE; - widget->allocation = *allocation; + + gtk_widget_set_allocation (widget, allocation); tmp_list = tree_view->priv->children; @@ -2006,9 +2056,9 @@ pspp_sheet_view_size_allocate (GtkWidget *widget, gtk_adjustment_set_value (tree_view->priv->hadjustment, MAX (tree_view->priv->width - allocation->width, 0)); tree_view->priv->init_hadjust_value = FALSE; } - else if (allocation->width != old_width) + else if (allocation->width != old_allocation.width) { - gtk_adjustment_set_value (tree_view->priv->hadjustment, CLAMP (gtk_adjustment_get_value (tree_view->priv->hadjustment) - allocation->width + old_width, 0, tree_view->priv->width - allocation->width)); + gtk_adjustment_set_value (tree_view->priv->hadjustment, CLAMP (gtk_adjustment_get_value (tree_view->priv->hadjustment) - allocation->width + old_allocation.width, 0, tree_view->priv->width - allocation->width)); } else gtk_adjustment_set_value (tree_view->priv->hadjustment, CLAMP (tree_view->priv->width - (tree_view->priv->prev_width - gtk_adjustment_get_value (tree_view->priv->hadjustment)), 0, tree_view->priv->width - allocation->width)); @@ -2793,6 +2843,7 @@ do_prelight (PsppSheetView *tree_view, } } + static void prelight_or_select (PsppSheetView *tree_view, int node, @@ -3514,14 +3565,16 @@ pspp_sheet_view_update_rubber_band_selection (PsppSheetView *tree_view) tree_view->priv->rubber_band_end_node = end_node; } +#define GDK_RECTANGLE_PTR(X) ((GdkRectangle *)(X)) + static void pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view) { gint x, y; - GdkRectangle old_area; - GdkRectangle new_area; - GdkRectangle common; - GdkRegion *invalid_region; + cairo_rectangle_int_t old_area; + cairo_rectangle_int_t new_area; + cairo_rectangle_int_t common; + cairo_region_t *invalid_region; PsppSheetViewColumn *column; old_area.x = MIN (tree_view->priv->press_start_x, tree_view->priv->rubber_band_x); @@ -3539,13 +3592,14 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view) new_area.width = ABS (x - tree_view->priv->press_start_x) + 1; new_area.height = ABS (y - tree_view->priv->press_start_y) + 1; - invalid_region = gdk_region_rectangle (&old_area); - gdk_region_union_with_rect (invalid_region, &new_area); + invalid_region = cairo_region_create_rectangle (&old_area); + cairo_region_union_rectangle (invalid_region, &new_area); - gdk_rectangle_intersect (&old_area, &new_area, &common); + gdk_rectangle_intersect (GDK_RECTANGLE_PTR (&old_area), + GDK_RECTANGLE_PTR (&new_area), GDK_RECTANGLE_PTR (&common)); if (common.width > 2 && common.height > 2) { - GdkRegion *common_region; + cairo_region_t *common_region; /* make sure the border is invalidated */ common.x += 1; @@ -3553,15 +3607,26 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view) common.width -= 2; common.height -= 2; - common_region = gdk_region_rectangle (&common); + common_region = cairo_region_create_rectangle (&common); - gdk_region_subtract (invalid_region, common_region); - gdk_region_destroy (common_region); + cairo_region_subtract (invalid_region, common_region); + cairo_region_destroy (common_region); } - gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE); +#if GTK_MAJOR_VERSION == 3 + gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE); +#else + { + cairo_rectangle_int_t extents; + GdkRegion *ereg; + cairo_region_get_extents (invalid_region, &extents); + ereg = gdk_region_rectangle (GDK_RECTANGLE_PTR (&extents)); + gdk_window_invalidate_region (tree_view->priv->bin_window, ereg, TRUE); + gdk_region_destroy (ereg); + } +#endif - gdk_region_destroy (invalid_region); + cairo_region_destroy (invalid_region); tree_view->priv->rubber_band_x = x; tree_view->priv->rubber_band_y = y; @@ -3577,6 +3642,7 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view) pspp_sheet_view_update_rubber_band_selection (tree_view); } +#if GTK3_TRANSITION static void pspp_sheet_view_paint_rubber_band (PsppSheetView *tree_view, GdkRectangle *area) @@ -3584,6 +3650,7 @@ pspp_sheet_view_paint_rubber_band (PsppSheetView *tree_view, cairo_t *cr; GdkRectangle rect; GdkRectangle rubber_rect; + GtkStyle *style; return; rubber_rect.x = MIN (tree_view->priv->press_start_x, tree_view->priv->rubber_band_x); @@ -3597,10 +3664,11 @@ pspp_sheet_view_paint_rubber_band (PsppSheetView *tree_view, cr = gdk_cairo_create (tree_view->priv->bin_window); cairo_set_line_width (cr, 1.0); + style = gtk_widget_get_style (GTK_WIDGET (tree_view)); cairo_set_source_rgba (cr, - GTK_WIDGET (tree_view)->style->fg[GTK_STATE_NORMAL].red / 65535., - GTK_WIDGET (tree_view)->style->fg[GTK_STATE_NORMAL].green / 65535., - GTK_WIDGET (tree_view)->style->fg[GTK_STATE_NORMAL].blue / 65535., + style->fg[GTK_STATE_NORMAL].red / 65535., + style->fg[GTK_STATE_NORMAL].green / 65535., + style->fg[GTK_STATE_NORMAL].blue / 65535., .25); gdk_cairo_rectangle (cr, &rect); @@ -3608,9 +3676,9 @@ pspp_sheet_view_paint_rubber_band (PsppSheetView *tree_view, cairo_paint (cr); cairo_set_source_rgb (cr, - GTK_WIDGET (tree_view)->style->fg[GTK_STATE_NORMAL].red / 65535., - GTK_WIDGET (tree_view)->style->fg[GTK_STATE_NORMAL].green / 65535., - GTK_WIDGET (tree_view)->style->fg[GTK_STATE_NORMAL].blue / 65535.); + style->fg[GTK_STATE_NORMAL].red / 65535., + style->fg[GTK_STATE_NORMAL].green / 65535., + style->fg[GTK_STATE_NORMAL].blue / 65535.); cairo_rectangle (cr, rubber_rect.x + 0.5, rubber_rect.y + 0.5, @@ -3619,6 +3687,8 @@ pspp_sheet_view_paint_rubber_band (PsppSheetView *tree_view, cairo_destroy (cr); } +#endif + static gboolean pspp_sheet_view_motion_bin_window (GtkWidget *widget, @@ -3720,10 +3790,11 @@ invalidate_empty_focus (PsppSheetView *tree_view) * is empty. */ static void -draw_empty_focus (PsppSheetView *tree_view, GdkRectangle *clip_area) +draw_empty_focus (PsppSheetView *tree_view) { GtkWidget *widget = GTK_WIDGET (tree_view); gint w, h; + cairo_t *cr = gdk_cairo_create (tree_view->priv->bin_window); if (!gtk_widget_has_focus (widget)) return; @@ -3736,20 +3807,20 @@ draw_empty_focus (PsppSheetView *tree_view, GdkRectangle *clip_area) if (w > 0 && h > 0) gtk_paint_focus (gtk_widget_get_style (widget), - tree_view->priv->bin_window, + cr, gtk_widget_get_state (widget), - clip_area, widget, NULL, 1, 1, w, h); + cairo_destroy (cr); } static void pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView *tree_view, - GdkEventExpose *event, - gint n_visible_columns, - gint min_y, - gint max_y) + cairo_t *cr, + gint n_visible_columns, + gint min_y, + gint max_y) { GList *list = tree_view->priv->columns; gint i = 0; @@ -3763,36 +3834,25 @@ pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView *tree_view, for (list = tree_view->priv->columns; list; list = list->next, i++) { PsppSheetViewColumn *column = list->data; - - /* We don't want a line for the last column */ - if (i == n_visible_columns - 1) - break; + gint x; if (! column->visible) continue; current_x += column->width; - if (current_x - 1 >= event->area.x - && current_x - 1 < event->area.x + event->area.width) - { -#if GTK3_TRANSITION - gdk_draw_line (event->window, - tree_view->priv->grid_line_gc[GTK_WIDGET(tree_view)->state], - current_x - 1, min_y, - current_x - 1, max_y - min_y); -#else - - cairo_t *cr = gdk_cairo_create (event->window); - cairo_set_line_width (cr, 1.0); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); - cairo_move_to (cr, current_x - 0.5, min_y); - cairo_line_to (cr, current_x - 0.5 , max_y - min_y); + /* Generally the grid lines should fit within the column, but for the + last visible column we put it just past the end of the column. + (Otherwise horizontal grid lines sometimes stick out by one pixel.) */ + x = current_x; + if (i != n_visible_columns - 1) + x--; - cairo_stroke (cr); - cairo_destroy (cr); -#endif - } + cairo_set_line_width (cr, 1.0); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); + cairo_move_to (cr, x + 0.5, min_y); + cairo_line_to (cr, x + 0.5, max_y - min_y); + cairo_stroke (cr); } } @@ -3804,7 +3864,7 @@ pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView *tree_view, */ static gboolean pspp_sheet_view_bin_expose (GtkWidget *widget, - GdkEventExpose *event) + cairo_t *cr) { PsppSheetView *tree_view = PSPP_SHEET_VIEW (widget); GtkTreePath *path; @@ -3836,6 +3896,14 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, gboolean draw_vgrid_lines, draw_hgrid_lines; gint min_y, max_y; + GdkRectangle Zarea; + GtkAllocation allocation; + gtk_widget_get_allocation (widget, &allocation); + + Zarea.x = 0; + Zarea.y = 0; + Zarea.height = allocation.height; + rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); gtk_widget_style_get (widget, @@ -3848,17 +3916,19 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, if (tree_view->priv->row_count == 0) { - draw_empty_focus (tree_view, &event->area); + draw_empty_focus (tree_view); return TRUE; } +#if GTK3_TRANSITION /* clip event->area to the visible area */ - if (event->area.height < 0.5) + if (Zarea.height < 0.5) return TRUE; +#endif validate_visible_area (tree_view); - new_y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, event->area.y); + new_y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, Zarea.y); if (new_y < 0) new_y = 0; @@ -3873,10 +3943,9 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, if (tree_view->priv->height < bin_window_height) { gtk_paint_flat_box (gtk_widget_get_style (widget), - event->window, + cr, gtk_widget_get_state (widget), GTK_SHADOW_NONE, - &event->area, widget, "cell_even", 0, tree_view->priv->height, @@ -3958,7 +4027,7 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, cell_offset = 0; - background_area.y = y_offset + event->area.y; + background_area.y = y_offset + Zarea.y; background_area.height = max_height; max_y = background_area.y + max_height; @@ -4009,12 +4078,14 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, else selected_column = TRUE; - if (cell_offset > event->area.x + event->area.width || - cell_offset + column->width < event->area.x) +#if GTK3_TRANSITION + if (cell_offset > Zarea.x + Zarea.width || + cell_offset + column->width < Zarea.x) { cell_offset += column->width; continue; } +#endif if (selected && selected_column) flags |= GTK_CELL_RENDERER_SELECTED; @@ -4064,11 +4135,13 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, cell_area.height -= grid_line_width; } +#if GTK3_TRANSITION if (gdk_region_rect_in (event->region, &background_area) == GDK_OVERLAP_RECTANGLE_OUT) { cell_offset += column->width; continue; } +#endif pspp_sheet_view_column_cell_set_cell_data (column, tree_view->priv->model, @@ -4145,10 +4218,9 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, g_snprintf (new_detail, 128, "%s_middle", detail); gtk_paint_flat_box (gtk_widget_get_style (widget), - event->window, + cr, state, GTK_SHADOW_NONE, - &event->area, widget, new_detail, background_area.x, @@ -4159,10 +4231,9 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, else { gtk_paint_flat_box (gtk_widget_get_style (widget), - event->window, + cr, state, GTK_SHADOW_NONE, - &event->area, widget, detail, background_area.x, @@ -4173,7 +4244,6 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, if (draw_hgrid_lines) { - cairo_t *cr = gdk_cairo_create (event->window); cairo_set_line_width (cr, 1.0); cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); @@ -4192,7 +4262,7 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, #endif } - if (y_offset + max_height >= event->area.height - 0.5) + if (y_offset + max_height <= Zarea.height - 0.5) { #if GTK3_TRANSITION gdk_draw_line (event->window, @@ -4208,14 +4278,12 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, #endif } cairo_stroke (cr); - cairo_destroy (cr); } _pspp_sheet_view_column_cell_render (column, - event->window, + cr, &background_area, &cell_area, - &event->area, flags); if (node == cursor && has_special_cell && @@ -4225,28 +4293,26 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, (column == tree_view->priv->edited_column))) { _pspp_sheet_view_column_cell_draw_focus (column, - event->window, + cr, &background_area, &cell_area, - &event->area, flags); } cell_offset += column->width; } - if (cell_offset < event->area.x) + if (cell_offset < Zarea.x) { gtk_paint_flat_box (gtk_widget_get_style (widget), - event->window, + cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, - &event->area, widget, "base", cell_offset, background_area.y, - event->area.x - cell_offset, + Zarea.x - cell_offset, background_area.height); } @@ -4280,9 +4346,8 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, if (row_ending_details) gtk_paint_focus (gtk_widget_get_style (widget), - tree_view->priv->bin_window, + cr, gtk_widget_get_state (widget), - &event->area, widget, (is_first ? (is_last ? "treeview-drop-indicator" : "treeview-drop-indicator-left" ) @@ -4293,9 +4358,8 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, - focus_line_width + 1); else gtk_paint_focus (gtk_widget_get_style (widget), - tree_view->priv->bin_window, + cr, gtk_widget_get_state (widget), - &event->area, widget, "treeview-drop-indicator", 0, BACKGROUND_FIRST_PIXEL (tree_view, node) @@ -4348,9 +4412,8 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, if (row_ending_details) gtk_paint_focus (gtk_widget_get_style (widget), - tree_view->priv->bin_window, + cr, focus_rect_state, - &event->area, widget, (is_first ? (is_last ? "treeview" : "treeview-left" ) @@ -4359,9 +4422,8 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, width, tmp_height); else gtk_paint_focus (gtk_widget_get_style (widget), - tree_view->priv->bin_window, + cr, focus_rect_state, - &event->area, widget, "treeview", 0, tmp_y, @@ -4386,12 +4448,13 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, } while (!done); } - while (y_offset < event->area.height); + while (y_offset < Zarea.height); done: - pspp_sheet_view_draw_vertical_grid_lines (tree_view, event, n_visible_columns, + pspp_sheet_view_draw_vertical_grid_lines (tree_view, cr, n_visible_columns, min_y, max_y); +#if GTK3_TRANSITION if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE) { GdkRectangle *rectangles; @@ -4406,6 +4469,7 @@ done: g_free (rectangles); } +#endif if (cursor_path) gtk_tree_path_free (cursor_path); @@ -4416,18 +4480,24 @@ done: return FALSE; } + static gboolean -pspp_sheet_view_expose (GtkWidget *widget, - GdkEventExpose *event) +pspp_sheet_view_draw (GtkWidget *widget, + cairo_t *cr) { PsppSheetView *tree_view = PSPP_SHEET_VIEW (widget); - - if (event->window == tree_view->priv->bin_window) + GtkAllocation allocation; + gtk_widget_get_allocation (widget, &allocation); + + if (gtk_cairo_should_draw_window (cr, tree_view->priv->bin_window)) { gboolean retval; GList *tmp_list; - retval = pspp_sheet_view_bin_expose (widget, event); + cairo_save (cr); + cairo_translate (cr, 0, gdk_window_get_height (tree_view->priv->header_window)); + retval = pspp_sheet_view_bin_expose (widget, cr); + cairo_restore (cr); /* We can't just chain up to Container::expose as it will try to send the * event to the headers, so we handle propagating it to our children @@ -4439,27 +4509,27 @@ pspp_sheet_view_expose (GtkWidget *widget, PsppSheetViewChild *child = tmp_list->data; tmp_list = tmp_list->next; - gtk_container_propagate_expose (GTK_CONTAINER (tree_view), child->widget, event); + gtk_container_propagate_draw (GTK_CONTAINER (tree_view), child->widget, cr); } return retval; } - else if (event->window == tree_view->priv->header_window) + else if (gtk_cairo_should_draw_window (cr, tree_view->priv->header_window)) { gint n_visible_columns; GList *list; gtk_paint_flat_box (gtk_widget_get_style (widget), - event->window, + cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, - &event->area, widget, "cell_odd", - event->area.x, - event->area.y, - event->area.width, - event->area.height); + allocation.x, + allocation.y, + allocation.width, + allocation.height + ); for (list = tree_view->priv->columns; list != NULL; list = list->next) { @@ -4469,10 +4539,10 @@ pspp_sheet_view_expose (GtkWidget *widget, continue; if (span_intersects (column->allocation.x, column->allocation.width, - event->area.x, event->area.width) + allocation.x, allocation.width) && column->button != NULL) - gtk_container_propagate_expose (GTK_CONTAINER (tree_view), - column->button, event); + gtk_container_propagate_draw (GTK_CONTAINER (tree_view), + column->button, cr); } n_visible_columns = 0; @@ -4483,18 +4553,23 @@ pspp_sheet_view_expose (GtkWidget *widget, n_visible_columns ++; } pspp_sheet_view_draw_vertical_grid_lines (tree_view, - event, - n_visible_columns, - event->area.y, - event->area.height); + cr, + n_visible_columns, + allocation.y, + allocation.height); + + return TRUE; } - else if (event->window == tree_view->priv->drag_window) + else if (gtk_cairo_should_draw_window (cr, tree_view->priv->drag_window)) { - gtk_container_propagate_expose (GTK_CONTAINER (tree_view), - tree_view->priv->drag_column->button, - event); + gtk_container_propagate_draw (GTK_CONTAINER (tree_view), + tree_view->priv->drag_column->button, + cr); + + return TRUE; } - return TRUE; + + return FALSE; } enum @@ -6130,10 +6205,12 @@ pspp_sheet_view_maybe_begin_dragging_row (PsppSheetView *tree_view, } + static void pspp_sheet_view_drag_begin (GtkWidget *widget, GdkDragContext *context) { +#if GTK3_TRANSITION PsppSheetView *tree_view; GtkTreePath *path = NULL; gint cell_x, cell_y; @@ -6171,8 +6248,10 @@ pspp_sheet_view_drag_begin (GtkWidget *widget, g_object_unref (row_pix); gtk_tree_path_free (path); +#endif } + static void pspp_sheet_view_drag_end (GtkWidget *widget, GdkDragContext *context) @@ -6901,9 +6980,8 @@ pspp_sheet_view_style_set (GtkWidget *widget, if (gtk_widget_get_realized (widget)) { - gdk_window_set_back_pixmap (gtk_widget_get_window (widget), NULL, FALSE); - gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[gtk_widget_get_state (widget)]); - gtk_style_set_background (widget->style, tree_view->priv->header_window, GTK_STATE_NORMAL); + gdk_window_set_background (tree_view->priv->bin_window, >k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]); + gtk_style_set_background (gtk_widget_get_style (widget), tree_view->priv->header_window, GTK_STATE_NORMAL); pspp_sheet_view_set_grid_lines (tree_view, tree_view->priv->grid_lines); } @@ -7669,9 +7747,8 @@ _pspp_sheet_view_column_start_drag (PsppSheetView *tree_view, attributes.width = column->allocation.width; attributes.height = column->allocation.height; attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view)); - attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view)); attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL ; tree_view->priv->drag_window = gdk_window_new (tree_view->priv->bin_window, &attributes, @@ -7703,7 +7780,9 @@ _pspp_sheet_view_column_start_drag (PsppSheetView *tree_view, send_event->button.axes = NULL; send_event->button.state = 0; send_event->button.button = 1; - send_event->button.device = gdk_display_get_core_pointer (display); + send_event->button.device = + gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display)); + send_event->button.x_root = 0; send_event->button.y_root = 0; @@ -7748,12 +7827,14 @@ _pspp_sheet_view_queue_draw_node (PsppSheetView *tree_view, const GdkRectangle *clip_rect) { GdkRectangle rect; + GtkAllocation allocation; if (!gtk_widget_get_realized (GTK_WIDGET (tree_view))) return; + gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation); rect.x = 0; - rect.width = MAX (tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.width); + rect.width = MAX (tree_view->priv->width, allocation.width); rect.y = BACKGROUND_FIRST_PIXEL (tree_view, node); rect.height = ROW_HEIGHT (tree_view); @@ -8654,10 +8735,14 @@ pspp_sheet_view_ensure_interactive_directory (PsppSheetView *tree_view) g_signal_connect (tree_view->priv->search_entry, "activate", G_CALLBACK (pspp_sheet_view_search_activate), tree_view); + +#if GTK3_TRANSITION g_signal_connect (GTK_ENTRY (tree_view->priv->search_entry)->im_context, "preedit-changed", G_CALLBACK (pspp_sheet_view_search_preedit_changed), tree_view); +#endif + gtk_container_add (GTK_CONTAINER (vbox), tree_view->priv->search_entry); @@ -8811,7 +8896,8 @@ adjust_allocation_recurse (GtkWidget *widget, gpointer data) { ScrollData *scroll_data = data; - + GtkAllocation allocation; + gtk_widget_get_allocation (widget, &allocation); /* Need to really size allocate instead of just poking * into widget->allocation if the widget is not realized. * FIXME someone figure out why this was. @@ -8820,7 +8906,7 @@ adjust_allocation_recurse (GtkWidget *widget, { if (gtk_widget_get_visible (widget)) { - GdkRectangle tmp_rectangle = widget->allocation; + GdkRectangle tmp_rectangle = allocation; tmp_rectangle.x += scroll_data->dx; tmp_rectangle.y += scroll_data->dy; @@ -8831,8 +8917,8 @@ adjust_allocation_recurse (GtkWidget *widget, { if (ALLOCATION_WINDOW (widget) == scroll_data->window) { - widget->allocation.x += scroll_data->dx; - widget->allocation.y += scroll_data->dy; + allocation.x += scroll_data->dx; + allocation.y += scroll_data->dy; if (GTK_IS_CONTAINER (widget)) gtk_container_forall (GTK_CONTAINER (widget), @@ -9146,9 +9232,12 @@ pspp_sheet_view_get_hadjustment (PsppSheetView *tree_view) { g_return_val_if_fail (PSPP_IS_SHEET_VIEW (tree_view), NULL); - if (tree_view->priv->hadjustment == NULL) - pspp_sheet_view_set_hadjustment (tree_view, NULL); + return pspp_sheet_view_do_get_hadjustment (tree_view); +} +static GtkAdjustment * +pspp_sheet_view_do_get_hadjustment (PsppSheetView *tree_view) +{ return tree_view->priv->hadjustment; } @@ -9172,23 +9261,60 @@ pspp_sheet_view_set_hadjustment (PsppSheetView *tree_view, g_object_notify (G_OBJECT (tree_view), "hadjustment"); } +static void +pspp_sheet_view_do_set_hadjustment (PsppSheetView *tree_view, + GtkAdjustment *adjustment) +{ + PsppSheetViewPrivate *priv = tree_view->priv; + + if (adjustment && priv->hadjustment == adjustment) + return; + + if (priv->hadjustment != NULL) + { + g_signal_handlers_disconnect_by_func (priv->hadjustment, + pspp_sheet_view_adjustment_changed, + tree_view); + g_object_unref (priv->hadjustment); + } + + if (adjustment == NULL) + adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, + 0.0, 0.0, 0.0); + + g_signal_connect (adjustment, "value-changed", + G_CALLBACK (pspp_sheet_view_adjustment_changed), tree_view); + priv->hadjustment = g_object_ref_sink (adjustment); + /* FIXME: Adjustment should probably be populated here with fresh values, but + * internal details are too complicated for me to decipher right now. + */ + pspp_sheet_view_adjustment_changed (NULL, tree_view); + + g_object_notify (G_OBJECT (tree_view), "hadjustment"); +} + /** * pspp_sheet_view_get_vadjustment: * @tree_view: A #PsppSheetView * * Gets the #GtkAdjustment currently being used for the vertical aspect. * - * Return value: A #GtkAdjustment object, or %NULL if none is currently being - * used. + * Return value: (transfer none): A #GtkAdjustment object, or %NULL + * if none is currently being used. + * + * Deprecated: 3.0: Use gtk_scrollable_get_vadjustment() **/ GtkAdjustment * pspp_sheet_view_get_vadjustment (PsppSheetView *tree_view) { g_return_val_if_fail (PSPP_IS_SHEET_VIEW (tree_view), NULL); - if (tree_view->priv->vadjustment == NULL) - pspp_sheet_view_set_vadjustment (tree_view, NULL); + return pspp_sheet_view_do_get_vadjustment (tree_view); +} +static GtkAdjustment * +pspp_sheet_view_do_get_vadjustment (PsppSheetView *tree_view) +{ return tree_view->priv->vadjustment; } @@ -9198,17 +9324,47 @@ pspp_sheet_view_get_vadjustment (PsppSheetView *tree_view) * @adjustment: (allow-none): The #GtkAdjustment to set, or %NULL * * Sets the #GtkAdjustment for the current vertical aspect. + * + * Deprecated: 3.0: Use gtk_scrollable_set_vadjustment() **/ void pspp_sheet_view_set_vadjustment (PsppSheetView *tree_view, - GtkAdjustment *adjustment) + GtkAdjustment *adjustment) { g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view)); + g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment)); - pspp_sheet_view_set_adjustments (tree_view, - tree_view->priv->hadjustment, - adjustment); + pspp_sheet_view_do_set_vadjustment (tree_view, adjustment); +} + +static void +pspp_sheet_view_do_set_vadjustment (PsppSheetView *tree_view, + GtkAdjustment *adjustment) +{ + PsppSheetViewPrivate *priv = tree_view->priv; + if (adjustment && priv->vadjustment == adjustment) + return; + + if (priv->vadjustment != NULL) + { + g_signal_handlers_disconnect_by_func (priv->vadjustment, + pspp_sheet_view_adjustment_changed, + tree_view); + g_object_unref (priv->vadjustment); + } + + if (adjustment == NULL) + adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, + 0.0, 0.0, 0.0); + + g_signal_connect (adjustment, "value-changed", + G_CALLBACK (pspp_sheet_view_adjustment_changed), tree_view); + priv->vadjustment = g_object_ref_sink (adjustment); + /* FIXME: Adjustment should probably be populated here with fresh values, but + * internal details are too complicated for me to decipher right now. + */ + pspp_sheet_view_adjustment_changed (NULL, tree_view); g_object_notify (G_OBJECT (tree_view), "vadjustment"); } @@ -9244,9 +9400,12 @@ pspp_sheet_view_set_headers_visible (PsppSheetView *tree_view, gint x, y; GList *list; PsppSheetViewColumn *column; + GtkAllocation allocation; g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view)); + gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation); + headers_visible = !! headers_visible; if (PSPP_SHEET_VIEW_FLAG_SET (tree_view, PSPP_SHEET_VIEW_HEADERS_VISIBLE) == headers_visible) @@ -9262,7 +9421,8 @@ pspp_sheet_view_set_headers_visible (PsppSheetView *tree_view, gdk_window_get_position (tree_view->priv->bin_window, &x, &y); if (headers_visible) { - gdk_window_move_resize (tree_view->priv->bin_window, x, y + TREE_VIEW_HEADER_HEIGHT (tree_view), tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.height - + TREE_VIEW_HEADER_HEIGHT (tree_view)); + gdk_window_move_resize (tree_view->priv->bin_window, x, y + TREE_VIEW_HEADER_HEIGHT (tree_view), + tree_view->priv->width, allocation.height - + TREE_VIEW_HEADER_HEIGHT (tree_view)); if (gtk_widget_get_mapped (GTK_WIDGET (tree_view))) pspp_sheet_view_map_buttons (tree_view); @@ -9281,8 +9441,8 @@ pspp_sheet_view_set_headers_visible (PsppSheetView *tree_view, } } - gtk_adjustment_set_page_size (tree_view->priv->vadjustment, GTK_WIDGET (tree_view)->allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view)); - gtk_adjustment_set_page_increment (tree_view->priv->vadjustment, (GTK_WIDGET (tree_view)->allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view)) / 2); + gtk_adjustment_set_page_size (tree_view->priv->vadjustment, allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view)); + gtk_adjustment_set_page_increment (tree_view->priv->vadjustment, (allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view)) / 2); gtk_adjustment_set_lower (tree_view->priv->vadjustment, 0); gtk_adjustment_set_upper (tree_view->priv->vadjustment, tree_view->priv->height); gtk_adjustment_changed (tree_view->priv->vadjustment); @@ -11276,7 +11436,7 @@ pspp_sheet_view_get_dest_row_at_pos (PsppSheetView *tree_view, } - +#if GTK3_TRANSITION /* KEEP IN SYNC WITH PSPP_SHEET_VIEW_BIN_EXPOSE */ /** * pspp_sheet_view_create_row_drag_icon: @@ -11399,7 +11559,7 @@ pspp_sheet_view_create_row_drag_icon (PsppSheetView *tree_view, return drawable; } - +#endif /** * pspp_sheet_view_set_destroy_count_func: @@ -11790,6 +11950,7 @@ pspp_sheet_view_search_disable_popdown (GtkEntry *entry, G_CALLBACK (pspp_sheet_view_search_enable_popdown), data); } +#if GTK3_TRANSITION /* Because we're visible but offscreen, we just set a flag in the preedit * callback. */ @@ -11808,6 +11969,7 @@ pspp_sheet_view_search_preedit_changed (GtkIMContext *im_context, } } +#endif static void pspp_sheet_view_search_activate (GtkEntry *entry, @@ -12490,7 +12652,7 @@ pspp_sheet_view_event (GtkWidget *widget, gtk_tree_path_free (path); handled = gtk_binding_set_activate (edit_bindings, keyval, event->state, - GTK_OBJECT (tree_view)); + G_OBJECT (tree_view)); if (handled) g_signal_stop_emission_by_name (widget, "event"); @@ -12758,8 +12920,8 @@ pspp_sheet_view_state_changed (GtkWidget *widget, if (gtk_widget_get_realized (widget)) { - gdk_window_set_back_pixmap (gtk_widget_get_window (widget), NULL, FALSE); - gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[gtk_widget_get_state (widget)]); + GtkStyle *style = gtk_widget_get_style (widget); + gdk_window_set_background (tree_view->priv->bin_window, &style->base[gtk_widget_get_state (widget)]); } gtk_widget_queue_draw (widget);