Add remaining accessors
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 15 Jul 2010 12:24:16 +0000 (08:24 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 15 Jul 2010 12:24:36 +0000 (08:24 -0400)
All that remains now is the adjustment accessors.

src/vte.c
src/vteaccess.c
src/vteapp.c
src/vtedraw.c
src/vteseq.c

index e006452..75be025 100644 (file)
--- a/src/vte.c
+++ b/src/vte.c
@@ -10786,7 +10786,7 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
        }
 
        _VTE_DEBUG_IF (VTE_DEBUG_UPDATES) {
-               GdkRectangle clip;
+               VteRegionRectangle clip;
                gdk_region_get_clipbox (region, &clip);
                g_printerr ("vte_terminal_paint"
                                "       (%d,%d)x(%d,%d) pixels\n",
@@ -10794,17 +10794,19 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
        }
 
        _vte_draw_clip(terminal->pvt->draw, region);
-       _vte_draw_clear (terminal->pvt->draw, 0, 0, terminal->widget.allocation.width, terminal->widget.allocation.height);
+       gtk_widget_get_allocation(&terminal->widget, &allocation);
+       _vte_draw_clear (terminal->pvt->draw, 0, 0,
+                        allocation.width, allocation.height);
 
        /* Calculate the bounding rectangle. */
        {
-               GdkRectangle *rectangles;
+               VteRegionRectangle *rectangles;
                gint n, n_rectangles;
                gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
                /* don't bother to enlarge an invalidate all */
                if (!(n_rectangles == 1
-                     && rectangles[0].width == terminal->widget.allocation.width
-                     && rectangles[0].height == terminal->widget.allocation.height)) {
+                     && rectangles[0].width == allocation.width
+                     && rectangles[0].height == allocation.height)) {
                        GdkRegion *rr = gdk_region_new ();
                        /* convert pixels into whole cells */
                        for (n = 0; n < n_rectangles; n++) {
@@ -10835,6 +10837,8 @@ static gint
 vte_terminal_expose(GtkWidget *widget, GdkEventExpose *event)
 {
        VteTerminal *terminal = VTE_TERMINAL (widget);
+       GtkAllocation allocation;
+
        /* Beware the out of order events -
         *   do not even think about skipping exposes! */
        _vte_debug_print (VTE_DEBUG_WORK, "+");
@@ -10853,12 +10857,9 @@ vte_terminal_expose(GtkWidget *widget, GdkEventExpose *event)
                /* if we expect to redraw the widget soon,
                 * just add this event to the list */
                if (!terminal->pvt->invalidated_all) {
-                       GtkAllocation allocation;
-
                        gtk_widget_get_allocation (widget, &allocation);
-
                        if (event->area.width >= allocation.width &&
-                                       event->area.height >= allocation.height) {
+                           event->area.height >= allocation.height) {
                                _vte_invalidate_all (terminal);
                        } else {
                                terminal->pvt->update_regions =
index 2720da1..91a98fe 100644 (file)
@@ -278,7 +278,7 @@ vte_terminal_accessible_update_private_data_if_needed(AtkObject *text,
        }
 
        /* Re-read the contents of the widget if the contents have changed. */
-       terminal = VTE_TERMINAL((GTK_ACCESSIBLE(text))->widget);
+       terminal = VTE_TERMINAL(gtk_accessible_get_widget(GTK_ACCESSIBLE(text)));
        if (priv->snapshot_contents_invalid) {
                /* Free the outdated snapshot data, unless the caller
                 * wants it. */
@@ -748,7 +748,7 @@ vte_terminal_accessible_visibility_notify(VteTerminal *terminal,
                if (widget == NULL) {
                        break;
                }
-               visible = visible && (GTK_WIDGET_VISIBLE(widget));
+               visible = visible && (gtk_widget_get_visible(widget));
                widget = gtk_widget_get_parent(widget);
        }
        /* The SHOWING state indicates that this widget, and all of its
@@ -817,8 +817,8 @@ vte_terminal_initialize (AtkObject *obj, gpointer data)
                         G_CALLBACK(vte_terminal_accessible_selection_changed),
                         obj);
 
-       if (GTK_IS_WIDGET((GTK_WIDGET(terminal))->parent)) {
-               parent = gtk_widget_get_accessible((GTK_WIDGET(terminal))->parent);
+       if (GTK_IS_WIDGET(gtk_widget_get_parent(GTK_WIDGET(terminal)))) {
+               parent = gtk_widget_get_accessible(gtk_widget_get_parent ((GTK_WIDGET(terminal))));
                if (ATK_IS_OBJECT(parent)) {
                        atk_object_set_parent(obj, parent);
                }
@@ -867,52 +867,54 @@ vte_terminal_accessible_finalize(GObject *object)
 {
        VteTerminalAccessiblePrivate *priv;
        GtkAccessible *accessible = NULL;
+        GtkWidget *widget;
 
        _vte_debug_print(VTE_DEBUG_ALLY, "Finalizing accessible peer.\n");
 
        g_assert(VTE_IS_TERMINAL_ACCESSIBLE(object));
        accessible = GTK_ACCESSIBLE(object);
+        widget = gtk_accessible_get_widget (accessible);
 
-       if (accessible->widget != NULL) {
-               g_object_remove_weak_pointer(G_OBJECT(accessible->widget),
-                                            (gpointer*)(gpointer)&accessible->widget);
-               g_signal_handlers_disconnect_matched(accessible->widget,
+       if (widget != NULL) {
+               g_object_remove_weak_pointer(G_OBJECT(widget),
+                                            (gpointer*)(gpointer)&widget);
+               g_signal_handlers_disconnect_matched(widget,
                                                     G_SIGNAL_MATCH_FUNC |
                                                     G_SIGNAL_MATCH_DATA,
                                                     0, 0, NULL,
                                                     vte_terminal_accessible_text_modified,
                                                     object);
-               g_signal_handlers_disconnect_matched(accessible->widget,
+               g_signal_handlers_disconnect_matched(widget,
                                                     G_SIGNAL_MATCH_FUNC |
                                                     G_SIGNAL_MATCH_DATA,
                                                     0, 0, NULL,
                                                     vte_terminal_accessible_text_scrolled,
                                                     object);
-               g_signal_handlers_disconnect_matched(accessible->widget,
+               g_signal_handlers_disconnect_matched(widget,
                                                     G_SIGNAL_MATCH_FUNC |
                                                     G_SIGNAL_MATCH_DATA,
                                                     0, 0, NULL,
                                                     vte_terminal_accessible_invalidate_cursor,
                                                     object);
-               g_signal_handlers_disconnect_matched(accessible->widget,
+               g_signal_handlers_disconnect_matched(widget,
                                                     G_SIGNAL_MATCH_FUNC |
                                                     G_SIGNAL_MATCH_DATA,
                                                     0, 0, NULL,
                                                     vte_terminal_accessible_title_changed,
                                                     object);
-               g_signal_handlers_disconnect_matched(accessible->widget,
+               g_signal_handlers_disconnect_matched(widget,
                                                     G_SIGNAL_MATCH_FUNC |
                                                     G_SIGNAL_MATCH_DATA,
                                                     0, 0, NULL,
                                                     vte_terminal_accessible_focus_in,
                                                     object);
-               g_signal_handlers_disconnect_matched(accessible->widget,
+               g_signal_handlers_disconnect_matched(widget,
                                                     G_SIGNAL_MATCH_FUNC |
                                                     G_SIGNAL_MATCH_DATA,
                                                     0, 0, NULL,
                                                     vte_terminal_accessible_focus_out,
                                                     object);
-               g_signal_handlers_disconnect_matched(accessible->widget,
+               g_signal_handlers_disconnect_matched(widget,
                                                     G_SIGNAL_MATCH_FUNC |
                                                     G_SIGNAL_MATCH_DATA,
                                                     0, 0, NULL,
@@ -1007,7 +1009,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
 
        priv = g_object_get_data(G_OBJECT(text),
                                 VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
-       terminal = VTE_TERMINAL((GTK_ACCESSIBLE(text))->widget);
+       terminal = VTE_TERMINAL(gtk_accessible_get_widget (GTK_ACCESSIBLE(text)));
 
        _vte_debug_print(VTE_DEBUG_ALLY,
                        "Getting %s %s at %d of %d.\n",
@@ -1435,7 +1437,7 @@ vte_terminal_accessible_get_character_extents(AtkText *text, gint offset,
                                                              NULL, NULL);
        priv = g_object_get_data(G_OBJECT(text),
                                 VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
-       terminal = VTE_TERMINAL (GTK_ACCESSIBLE (text)->widget);
+       terminal = VTE_TERMINAL (gtk_accessible_get_widget (GTK_ACCESSIBLE (text)));
 
        atk_component_get_position (ATK_COMPONENT (text), &base_x, &base_y, coords);
        xy_from_offset (priv, offset, x, y);
@@ -1479,7 +1481,7 @@ vte_terminal_accessible_get_offset_at_point(AtkText *text,
                                                              NULL, NULL);
        priv = g_object_get_data(G_OBJECT(text),
                                 VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
-       terminal = VTE_TERMINAL (GTK_ACCESSIBLE (text)->widget);
+       terminal = VTE_TERMINAL (gtk_accessible_get_widget (GTK_ACCESSIBLE (text)));
 
        atk_component_get_position (ATK_COMPONENT (text), &base_x, &base_y, coords);
        char_width = vte_terminal_get_char_width (terminal);
@@ -1501,7 +1503,7 @@ vte_terminal_accessible_get_n_selections(AtkText *text)
        vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
                                                              NULL, NULL);
 
-       widget = GTK_ACCESSIBLE(text)->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
        if (widget == NULL) {
                /* State is defunct */
                return -1;
@@ -1523,7 +1525,7 @@ vte_terminal_accessible_get_selection(AtkText *text, gint selection_number,
        g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
        vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
                                                              NULL, NULL);
-       widget = GTK_ACCESSIBLE(text)->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
        if (widget == NULL) {
                /* State is defunct */
                return NULL;
@@ -1558,7 +1560,7 @@ vte_terminal_accessible_add_selection(AtkText *text,
        g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
        vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
                                                              NULL, NULL);
-       widget = GTK_ACCESSIBLE(text)->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
        if (widget == NULL) {
                /* State is defunct */
                return FALSE;
@@ -1584,7 +1586,7 @@ vte_terminal_accessible_remove_selection(AtkText *text,
        g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
        vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
                                                              NULL, NULL);
-       widget = GTK_ACCESSIBLE(text)->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
        if (widget == NULL) {
                /* State is defunct */
                return FALSE;
@@ -1609,7 +1611,7 @@ vte_terminal_accessible_set_selection(AtkText *text, gint selection_number,
        g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
        vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
                                                              NULL, NULL);
-       widget = GTK_ACCESSIBLE(text)->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
        if (widget == NULL) {
                /* State is defunct */
                return FALSE;
@@ -1707,19 +1709,19 @@ vte_terminal_accessible_get_position(AtkComponent *component,
        GtkWidget *widget;
        *x = 0;
        *y = 0;
-       widget = (GTK_ACCESSIBLE(component))->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(component));
        if (widget == NULL) {
                return;
        }
-       if (!GTK_WIDGET_REALIZED(widget)) {
+       if (!gtk_widget_get_realized(widget)) {
                return;
        }
        switch (coord_type) {
        case ATK_XY_SCREEN:
-               gdk_window_get_origin(widget->window, x, y);
+               gdk_window_get_origin(gtk_widget_get_window (widget), x, y);
                break;
        case ATK_XY_WINDOW:
-               gdk_window_get_position(widget->window, x, y);
+               gdk_window_get_position(gtk_widget_get_window (widget), x, y);
                break;
        default:
                g_assert_not_reached();
@@ -1734,14 +1736,14 @@ vte_terminal_accessible_get_size(AtkComponent *component,
        GtkWidget *widget;
        *width = 0;
        *height = 0;
-       widget = (GTK_ACCESSIBLE(component))->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(component));
        if (widget == NULL) {
                return;
        }
-       if (!GTK_WIDGET_REALIZED(widget)) {
+       if (!gtk_widget_get_realized(widget)) {
                return;
        }
-       gdk_drawable_get_size(widget->window, width, height);
+       gdk_drawable_get_size(gtk_widget_get_window (widget), width, height);
 }
 
 static gboolean
@@ -1773,7 +1775,7 @@ vte_terminal_accessible_set_size(AtkComponent *component,
        GtkWidget *widget;
         GtkBorder *inner_border;
 
-       widget = GTK_ACCESSIBLE(component)->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(component));
        if (widget == NULL) {
                return FALSE;
        }
@@ -1865,7 +1867,7 @@ vte_terminal_accessible_do_action (AtkAction *accessible, int i)
 
        g_return_val_if_fail (i < LAST_ACTION, FALSE);
 
-       widget = GTK_ACCESSIBLE (accessible)->widget;
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
        if (!widget) {
                return FALSE;
        }
index 8ec3152..5a5a2c2 100644 (file)
@@ -78,7 +78,7 @@ char_size_changed(GtkWidget *widget, guint width, guint height, gpointer data)
 
        terminal = VTE_TERMINAL(widget);
        window = GTK_WINDOW(data);
-       if (!GTK_WIDGET_REALIZED (window))
+       if (!gtk_widget_get_realized (GTK_WIDGET (window)))
                return;
 
         gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
@@ -110,7 +110,7 @@ char_size_realized(GtkWidget *widget, gpointer data)
 
        terminal = VTE_TERMINAL(widget);
        window = GTK_WINDOW(data);
-       if (!GTK_WIDGET_REALIZED (window))
+       if (!gtk_widget_get_realized (GTK_WIDGET(window)))
                return;
 
         gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
@@ -222,29 +222,24 @@ button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer data)
 static void
 iconify_window(GtkWidget *widget, gpointer data)
 {
-       if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
-                       gdk_window_iconify((GTK_WIDGET(data))->window);
-               }
-       }
+       gtk_window_iconify(data);
 }
 
 static void
 deiconify_window(GtkWidget *widget, gpointer data)
 {
-       if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
-                       gdk_window_deiconify((GTK_WIDGET(data))->window);
-               }
-       }
+       gtk_window_deiconify(data);
 }
 
 static void
 raise_window(GtkWidget *widget, gpointer data)
 {
+       GdkWindow *window;
+
        if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
-                       gdk_window_raise((GTK_WIDGET(data))->window);
+               window = gtk_widget_get_window(GTK_WIDGET(data));
+               if (window) {
+                       gdk_window_raise(window);
                }
        }
 }
@@ -252,9 +247,12 @@ raise_window(GtkWidget *widget, gpointer data)
 static void
 lower_window(GtkWidget *widget, gpointer data)
 {
+       GdkWindow *window;
+
        if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
-                       gdk_window_lower((GTK_WIDGET(data))->window);
+               window = gtk_widget_get_window(GTK_WIDGET(data));
+               if (window) {
+                       gdk_window_lower(window);
                }
        }
 }
@@ -262,9 +260,12 @@ lower_window(GtkWidget *widget, gpointer data)
 static void
 maximize_window(GtkWidget *widget, gpointer data)
 {
+       GdkWindow *window;
+
        if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
-                       gdk_window_maximize((GTK_WIDGET(data))->window);
+               window = gtk_widget_get_window(GTK_WIDGET(data));
+               if (window) {
+                       gdk_window_maximize(window);
                }
        }
 }
@@ -272,9 +273,12 @@ maximize_window(GtkWidget *widget, gpointer data)
 static void
 restore_window(GtkWidget *widget, gpointer data)
 {
+       GdkWindow *window;
+
        if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
-                       gdk_window_unmaximize((GTK_WIDGET(data))->window);
+               window = gtk_widget_get_window(GTK_WIDGET(data));
+               if (window) {
+                       gdk_window_unmaximize(window);
                }
        }
 }
@@ -282,14 +286,18 @@ restore_window(GtkWidget *widget, gpointer data)
 static void
 refresh_window(GtkWidget *widget, gpointer data)
 {
+       GdkWindow *window;
+       GtkAllocation allocation;
        GdkRectangle rect;
+
        if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
+               window = gtk_widget_get_window(widget);
+               if (window) {
+                       gtk_widget_get_allocation(widget, &allocation);
                        rect.x = rect.y = 0;
-                       rect.width = (GTK_WIDGET(data))->allocation.width;
-                       rect.height = (GTK_WIDGET(data))->allocation.height;
-                       gdk_window_invalidate_rect((GTK_WIDGET(data))->window,
-                                                  &rect, TRUE);
+                       rect.width = allocation.width;
+                       rect.height = allocation.height;
+                       gdk_window_invalidate_rect(window, &rect, TRUE);
                }
        }
 }
@@ -329,9 +337,12 @@ resize_window(GtkWidget *widget, guint width, guint height, gpointer data)
 static void
 move_window(GtkWidget *widget, guint x, guint y, gpointer data)
 {
+       GdkWindow *window;
+
        if (GTK_IS_WIDGET(data)) {
-               if ((GTK_WIDGET(data))->window) {
-                       gdk_window_move((GTK_WIDGET(data))->window, x, y);
+               window = gtk_widget_get_window(GTK_WIDGET(data));
+               if (window) {
+                       gdk_window_move(window, x, y);
                }
        }
 }
index 3c1a13c..07fda00 100644 (file)
@@ -836,13 +836,16 @@ _vte_draw_free (struct _vte_draw *draw)
 void
 _vte_draw_start (struct _vte_draw *draw)
 {
-       g_return_if_fail (GTK_WIDGET_REALIZED (draw->widget));
+       GdkWindow *window;
+
+       g_return_if_fail (gtk_widget_get_realized (draw->widget));
 
        _vte_debug_print (VTE_DEBUG_DRAW, "draw_start\n");
 
        if (draw->started == 0) {
-               g_object_ref (draw->widget->window);
-               draw->cr = gdk_cairo_create (draw->widget->window);
+               window = gtk_widget_get_window(draw->widget);
+               g_object_ref (window);
+               draw->cr = gdk_cairo_create (window);
        }
 
        draw->started++;
@@ -857,7 +860,7 @@ _vte_draw_end (struct _vte_draw *draw)
        if (draw->started == 0) {
                cairo_destroy (draw->cr);
                draw->cr = NULL;
-               g_object_unref (draw->widget->window);
+               g_object_unref (gtk_widget_get_window(draw->widget));
        }
 
        _vte_debug_print (VTE_DEBUG_DRAW, "draw_end\n");
index 44de8b2..811b326 100644 (file)
@@ -835,8 +835,8 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
                        _vte_terminal_home_cursor (terminal);
                }
                /* Reset scrollbars and repaint everything. */
-               terminal->adjustment->value =
-                       terminal->pvt->screen->scroll_delta;
+               gtk_adjustment_set_value(terminal->adjustment,
+                                        terminal->pvt->screen->scroll_delta);
                vte_terminal_set_scrollback_lines(terminal,
                                terminal->pvt->scrollback_lines);
                _vte_terminal_queue_contents_changed(terminal);
@@ -3038,6 +3038,7 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
        long param, arg1, arg2;
        gint width, height;
        guint i;
+       GtkAllocation allocation;
 
        widget = &terminal->widget;
        screen = terminal->pvt->screen;
@@ -3149,16 +3150,16 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
                        /* If we're unmapped, then we're iconified. */
                        g_snprintf(buf, sizeof(buf),
                                   _VTE_CAP_CSI "%dt",
-                                  1 + !GTK_WIDGET_MAPPED(widget));
+                                  1 + !gtk_widget_get_mapped(widget));
                        _vte_debug_print(VTE_DEBUG_PARSE,
                                        "Reporting window state %s.\n",
-                                       GTK_WIDGET_MAPPED(widget) ?
+                                       gtk_widget_get_mapped(widget) ?
                                        "non-iconified" : "iconified");
                        vte_terminal_feed_child(terminal, buf, -1);
                        break;
                case 13:
                        /* Send window location, in pixels. */
-                       gdk_window_get_origin(widget->window,
+                       gdk_window_get_origin(gtk_widget_get_window(widget),
                                              &width, &height);
                        g_snprintf(buf, sizeof(buf),
                                   _VTE_CAP_CSI "3;%d;%dt",
@@ -3172,12 +3173,13 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
                        break;
                case 14:
                        /* Send window size, in pixels. */
+                       gtk_widget_get_allocation(widget, &allocation);
                        g_snprintf(buf, sizeof(buf),
                                   _VTE_CAP_CSI "4;%d;%dt",
-                                  widget->allocation.height -
+                                  allocation.height -
                                        (terminal->pvt->inner_border.top +
                                         terminal->pvt->inner_border.bottom),
-                                  widget->allocation.width -
+                                  allocation.width -
                                        (terminal->pvt->inner_border.left +
                                         terminal->pvt->inner_border.right));
                        _vte_debug_print(VTE_DEBUG_PARSE,