diff --git a/src/Makefile.am b/src/Makefile.am
index 4c47565..8479453 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -150,7 +150,7 @@ vteseq-list.h: vteseq-2.gperf vteseq-n.gperf
 bin_PROGRAMS = vte@VTE_LIBRARY_SUFFIX_U@
 
 vte@VTE_LIBRARY_SUFFIX_U@_SOURCES = vteapp.c
-vte@VTE_LIBRARY_SUFFIX_U@_CFLAGS = $(VTE_CFLAGS)
+vte@VTE_LIBRARY_SUFFIX_U@_CFLAGS = $(VTE_CFLAGS) -DVTE_COMPILATION
 vte@VTE_LIBRARY_SUFFIX_U@_LDADD = libvte@VTE_LIBRARY_SUFFIX_U@.la $(VTE_LIBS)
 
 # introspection
diff --git a/src/vte.c b/src/vte.c
index 26870a5..d2d9f4b 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -426,7 +426,7 @@ _vte_invalidate_cells(VteTerminal *terminal,
 		 * case updates are coming in really soon. */
 		add_update_timeout (terminal);
 	} else {
-		gdk_window_invalidate_rect (terminal->widget.window,
+		gdk_window_invalidate_rect (gtk_widget_get_window (&terminal->widget),
 				&rect, FALSE);
 	}
 
@@ -463,6 +463,7 @@ void
 _vte_invalidate_all(VteTerminal *terminal)
 {
 	GdkRectangle rect;
+        GtkAllocation allocation;
 
 	g_assert(VTE_IS_TERMINAL(terminal));
 
@@ -478,9 +479,10 @@ _vte_invalidate_all(VteTerminal *terminal)
 
 	/* replace invalid regions with one covering the whole terminal */
 	reset_update_regions (terminal);
+        gtk_widget_get_allocation (&terminal->widget, &allocation);
 	rect.x = rect.y = 0;
-	rect.width = terminal->widget.allocation.width;
-	rect.height = terminal->widget.allocation.height;
+	rect.width = allocation.width;
+	rect.height = allocation.height;
 	terminal->pvt->invalidated_all = TRUE;
 
 	if (terminal->pvt->active != NULL) {
@@ -490,7 +492,7 @@ _vte_invalidate_all(VteTerminal *terminal)
 		 * case updates are coming in really soon. */
 		add_update_timeout (terminal);
 	} else {
-		gdk_window_invalidate_rect (terminal->widget.window,
+		gdk_window_invalidate_rect (gtk_widget_get_window (&terminal->widget),
 				&rect, FALSE);
 	}
 }
@@ -647,7 +649,7 @@ _vte_invalidate_cell(VteTerminal *terminal, glong col, glong row)
 	const VteRowData *row_data;
 	int columns;
 
-	if (G_UNLIKELY (!gtk_widget_is_drawable(terminal) || terminal->pvt->invalidated_all)) {
+	if (G_UNLIKELY (!gtk_widget_is_drawable(&terminal->widget) || terminal->pvt->invalidated_all)) {
 		return;
 	}
 
@@ -700,7 +702,7 @@ _vte_invalidate_cursor_once(VteTerminal *terminal, gboolean periodic)
 		}
 	}
 
-	if (terminal->pvt->cursor_visible && gtk_widget_is_drawable(terminal)) {
+	if (terminal->pvt->cursor_visible && gtk_widget_is_drawable(&terminal->widget)) {
 		preedit_width = vte_terminal_preedit_width(terminal, FALSE);
 
 		screen = terminal->pvt->screen;
@@ -1153,7 +1155,7 @@ vte_terminal_set_cursor_from_regex_match(VteTerminal *terminal, struct vte_match
 {
         GdkCursor *cursor = NULL;
 
-        if (!gtk_widget_get_realized(terminal))
+        if (!gtk_widget_get_realized(&terminal->widget))
                 return;
         switch (regex->cursor_mode) {
                 case VTE_REGEX_CURSOR_GDKCURSOR:
@@ -1172,7 +1174,7 @@ vte_terminal_set_cursor_from_regex_match(VteTerminal *terminal, struct vte_match
 			return;
         }
 
-        gdk_window_set_cursor(GTK_WIDGET(terminal)->window, cursor);
+        gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(terminal)), cursor);
         if (cursor)
                 gdk_cursor_unref(cursor);
 }
@@ -1988,10 +1990,10 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
 		glong v;
 
 		v = _vte_ring_delta (screen->row_data);
-		if (terminal->adjustment->lower != v) {
+		if (gtk_adjustment_get_lower (terminal->adjustment) != v) {
 			_vte_debug_print(VTE_DEBUG_ADJ,
 					"Changing lower bound from %.0f to %ld\n",
-					terminal->adjustment->lower,
+					gtk_adjustment_get_lower (terminal->adjustment),
 					v);
 			gtk_adjustment_set_lower (terminal->adjustment, v);
 			changed = TRUE;
@@ -2001,10 +2003,10 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
 		 * one to the cursor offset because it's zero-based.) */
 		v = MAX(_vte_ring_next(screen->row_data),
 				screen->cursor_current.row + 1);
-		if (terminal->adjustment->upper != v) {
+		if (gtk_adjustment_get_upper (terminal->adjustment) != v) {
 			_vte_debug_print(VTE_DEBUG_ADJ,
 					"Changing upper bound from %.0f to %ld\n",
-					terminal->adjustment->upper,
+					gtk_adjustment_get_upper (terminal->adjustment),
 					v);
 			gtk_adjustment_set_upper (terminal->adjustment, v);
 			changed = TRUE;
@@ -2022,7 +2024,7 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
 		_vte_debug_print(VTE_DEBUG_SIGNALS,
 				"Emitting adjustment_value_changed.\n");
 		terminal->pvt->adjustment_value_changed_pending = FALSE;
-		v = round (terminal->adjustment->value);
+		v = round (gtk_adjustment_get_value (terminal->adjustment));
 		if (v != terminal->pvt->screen->scroll_delta) {
 			/* this little dance is so that the scroll_delta is
 			 * updated immediately, but we still handled scrolling
@@ -2058,10 +2060,11 @@ vte_terminal_queue_adjustment_value_changed(VteTerminal *terminal, glong v)
 static void
 vte_terminal_queue_adjustment_value_changed_clamped(VteTerminal *terminal, glong v)
 {
-	v = CLAMP(v,
-		  terminal->adjustment->lower,
-		  MAX (terminal->adjustment->lower,
-		       terminal->adjustment->upper - terminal->row_count));
+        gdouble lower, upper;
+
+        lower = gtk_adjustment_get_lower (terminal->adjustment);
+        upper = gtk_adjustment_get_upper (terminal->adjustment);
+	v = CLAMP(v, lower, MAX (lower, upper - terminal->row_count));
 
 	vte_terminal_queue_adjustment_value_changed (terminal, v);
 }
@@ -2107,10 +2110,10 @@ _vte_terminal_adjust_adjustments_full (VteTerminal *terminal)
 	_vte_terminal_adjust_adjustments(terminal);
 
 	/* The step increment should always be one. */
-	if (terminal->adjustment->step_increment != 1) {
+	if (gtk_adjustment_get_step_increment (terminal->adjustment) != 1) {
 		_vte_debug_print(VTE_DEBUG_ADJ,
 				"Changing step increment from %.0lf to %ld\n",
-				terminal->adjustment->step_increment,
+				gtk_adjustment_get_step_increment (terminal->adjustment),
 				terminal->row_count);
 		gtk_adjustment_set_step_increment (terminal->adjustment, 1);
 		changed = TRUE;
@@ -2118,10 +2121,10 @@ _vte_terminal_adjust_adjustments_full (VteTerminal *terminal)
 
 	/* Set the number of rows the user sees to the number of rows the
 	 * user sees. */
-	if (terminal->adjustment->page_size != terminal->row_count) {
+	if (gtk_adjustment_get_page_size (terminal->adjustment) != terminal->row_count) {
 		_vte_debug_print(VTE_DEBUG_ADJ,
 				"Changing page size from %.0f to %ld\n",
-				terminal->adjustment->page_size,
+				gtk_adjustment_get_page_size (terminal->adjustment),
 				terminal->row_count);
 		gtk_adjustment_set_page_size (terminal->adjustment, terminal->row_count);
 		changed = TRUE;
@@ -2129,11 +2132,11 @@ _vte_terminal_adjust_adjustments_full (VteTerminal *terminal)
 
 	/* Clicking in the empty area should scroll one screen, so set the
 	 * page size to the number of visible rows. */
-	if (terminal->adjustment->page_increment != terminal->row_count) {
+	if (gtk_adjustment_get_page_increment (terminal->adjustment) != terminal->row_count) {
 		_vte_debug_print(VTE_DEBUG_ADJ,
 				"Changing page increment from "
 				"%.0f to %ld\n",
-				terminal->adjustment->page_increment,
+				gtk_adjustment_get_page_increment (terminal->adjustment),
 				terminal->row_count);
 		gtk_adjustment_set_page_increment (terminal->adjustment, terminal->row_count);
 		changed = TRUE;
@@ -2400,14 +2403,14 @@ _vte_terminal_set_pointer_visible(VteTerminal *terminal, gboolean visible)
 	struct vte_match_regex *regex = NULL;
 	terminal->pvt->mouse_cursor_visible = visible;
 
-        if (!gtk_widget_get_realized(terminal))
+        if (!gtk_widget_get_realized(&terminal->widget))
                 return;
 
 	if (visible || !terminal->pvt->mouse_autohide) {
 		if (terminal->pvt->mouse_tracking_mode) {
 			_vte_debug_print(VTE_DEBUG_CURSOR,
 					"Setting mousing cursor.\n");
-			gdk_window_set_cursor(terminal->widget.window, terminal->pvt->mouse_mousing_cursor);
+			gdk_window_set_cursor(gtk_widget_get_window (&terminal->widget), terminal->pvt->mouse_mousing_cursor);
 		} else
 		if ( (guint)terminal->pvt->match_tag < terminal->pvt->match_regexes->len) {
 			regex = &g_array_index(terminal->pvt->match_regexes,
@@ -2417,12 +2420,12 @@ _vte_terminal_set_pointer_visible(VteTerminal *terminal, gboolean visible)
 		} else {
 			_vte_debug_print(VTE_DEBUG_CURSOR,
 					"Setting default mouse cursor.\n");
-			gdk_window_set_cursor(terminal->widget.window, terminal->pvt->mouse_default_cursor);
+			gdk_window_set_cursor(gtk_widget_get_window (&terminal->widget), terminal->pvt->mouse_default_cursor);
 		}
 	} else {
 		_vte_debug_print(VTE_DEBUG_CURSOR,
 				"Setting to invisible cursor.\n");
-		gdk_window_set_cursor(terminal->widget.window, terminal->pvt->mouse_inviso_cursor);
+		gdk_window_set_cursor(gtk_widget_get_window (&terminal->widget), terminal->pvt->mouse_inviso_cursor);
 	}
 }
 
@@ -2464,7 +2467,7 @@ vte_terminal_set_color_internal(VteTerminal *terminal, int entry,
 	color->blue = proposed->blue;
 
 	/* If we're not realized yet, there's nothing else to do. */
-	if (!gtk_widget_get_realized(terminal)) {
+	if (!gtk_widget_get_realized(&terminal->widget)) {
 		return;
 	}
 
@@ -3733,7 +3736,7 @@ vte_terminal_eof(GIOChannel *channel, VteTerminal *terminal)
 static void
 vte_terminal_im_reset(VteTerminal *terminal)
 {
-	if (gtk_widget_get_realized(terminal)) {
+	if (gtk_widget_get_realized(&terminal->widget)) {
 		gtk_im_context_reset(terminal->pvt->im_context);
 		if (terminal->pvt->im_preedit != NULL) {
 			g_free(terminal->pvt->im_preedit);
@@ -4185,7 +4188,7 @@ next_match:
 	}
 
 	/* Tell the input method where the cursor is. */
-	if (gtk_widget_get_realized(terminal)) {
+	if (gtk_widget_get_realized(&terminal->widget)) {
 		GdkRectangle rect;
 		rect.x = terminal->pvt->screen->cursor_current.col *
 			 terminal->char_width + terminal->pvt->inner_border.left;
@@ -4821,16 +4824,22 @@ void
 _vte_terminal_visible_beep(VteTerminal *terminal)
 {
 	GtkWidget *widget;
+        GdkWindow *window;
+        GtkStyle *style;
+        GtkAllocation allocation;
 
 	widget = &terminal->widget;
 	if (gtk_widget_get_realized(widget)) {
 		/* Fill the screen with the default foreground color, and then
 		 * repaint everything, to provide visual bell. */
-		gdk_draw_rectangle(widget->window,
-				   widget->style->fg_gc[gtk_widget_get_state(widget)],
+                window = gtk_widget_get_window (widget);
+                style = gtk_widget_get_style (widget);
+                gtk_widget_get_allocation (widget, &allocation);
+		gdk_draw_rectangle(window,
+				   style->fg_gc[gtk_widget_get_state(widget)],
 				   TRUE,
 				   0, 0,
-				   widget->allocation.width, widget->allocation.height);
+				   allocation.width, allocation.height);
 		gdk_flush();
 		/* Force the repaint. */
 		_vte_invalidate_all(terminal); /* max delay of UPDATE_REPEAT_TIMEOUT */
@@ -5004,7 +5013,7 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
 
 	/* Let the input method at this one first. */
 	if (!steal) {
-		if (gtk_widget_get_realized(terminal) &&
+		if (gtk_widget_get_realized(&terminal->widget) &&
 		    gtk_im_context_filter_keypress(terminal->pvt->im_context,
 						   event)) {
 			_vte_debug_print(VTE_DEBUG_EVENTS,
@@ -5313,7 +5322,7 @@ vte_terminal_key_release(GtkWidget *widget, GdkEventKey *event)
 
 	vte_terminal_read_modifiers (terminal, (GdkEvent*) event);
 
-	return gtk_widget_get_realized(terminal) &&
+	return gtk_widget_get_realized(&terminal->widget) &&
 	       gtk_im_context_filter_keypress(terminal->pvt->im_context, event);
 }
 
@@ -5856,13 +5865,15 @@ static void
 vte_terminal_match_hilite(VteTerminal *terminal, long x, long y)
 {
 	int width, height;
+        GtkAllocation allocation;
 
 	width = terminal->char_width;
 	height = terminal->char_height;
 
+        gtk_widget_get_allocation (&terminal->widget, &allocation);
 	/* if the cursor is not above a cell, skip */
-	if (x < 0 || x > terminal->widget.allocation.width
-			|| y < 0 || y > terminal->widget.allocation.height) {
+	if (x < 0 || x > allocation.width
+		|| y < 0 || y > allocation.height) {
 		return;
 	}
 
@@ -7266,7 +7277,7 @@ vte_terminal_focus_in(GtkWidget *widget, GdkEventFocus *event)
 	_vte_debug_print(VTE_DEBUG_EVENTS, "Focus in.\n");
 
 	terminal = VTE_TERMINAL(widget);
-	GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
+	//GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
 	/* Read the keyboard modifiers, though they're probably garbage. */
 	vte_terminal_read_modifiers (terminal, (GdkEvent*) event);
 
@@ -7293,7 +7304,7 @@ vte_terminal_focus_out(GtkWidget *widget, GdkEventFocus *event)
 	VteTerminal *terminal;
 	_vte_debug_print(VTE_DEBUG_EVENTS, "Focus out.\n");
 	terminal = VTE_TERMINAL(widget);
-	GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
+	//GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
 	/* Read the keyboard modifiers, though they're probably garbage. */
 	vte_terminal_read_modifiers (terminal, (GdkEvent*) event);
 	/* We only have an IM context when we're realized, and there's not much
@@ -7454,7 +7465,7 @@ vte_terminal_apply_metrics(VteTerminal *terminal,
 
 	/* Queue a resize if anything's changed. */
 	if (resize) {
-		if (gtk_widget_get_realized(terminal)) {
+		if (gtk_widget_get_realized(&terminal->widget)) {
 			gtk_widget_queue_resize_no_redraw(&terminal->widget);
 		}
 	}
@@ -7535,7 +7546,7 @@ vte_terminal_set_font_full_internal(VteTerminal *terminal,
 
 	/* Create an owned font description. */
 	gtk_widget_ensure_style (&terminal->widget);
-	desc = pango_font_description_copy (terminal->widget.style->font_desc);
+	desc = pango_font_description_copy (gtk_widget_get_style (&terminal->widget)->font_desc);
 	pango_font_description_set_family_static (desc, "monospace");
 	if (font_desc != NULL) {
 		pango_font_description_merge (desc, font_desc, TRUE);
@@ -7575,7 +7586,7 @@ vte_terminal_set_font_full_internal(VteTerminal *terminal,
                 g_object_notify(object, "font-desc");
 
 	/* Set the drawing font. */
-	if (gtk_widget_get_realized(terminal)) {
+	if (gtk_widget_get_realized(&terminal->widget)) {
 		vte_terminal_ensure_font (terminal);
 	}
 
@@ -7754,12 +7765,12 @@ vte_terminal_handle_scroll(VteTerminal *terminal)
 	screen = terminal->pvt->screen;
 
 	/* Read the new adjustment value and save the difference. */
-	adj = round (terminal->adjustment->value);
+	adj = round (gtk_adjustment_get_value (terminal->adjustment));
 	dy = adj - screen->scroll_delta;
 	screen->scroll_delta = adj;
 
 	/* Sanity checks. */
-	if (!gtk_widget_is_drawable(terminal) ||
+	if (!gtk_widget_is_drawable(&terminal->widget) ||
 			terminal->pvt->visibility_state == GDK_VISIBILITY_FULLY_OBSCURED) {
 		return;
 	}
@@ -8017,7 +8028,7 @@ vte_terminal_init(VteTerminal *terminal)
 	/* Initialize private data. */
 	pvt = terminal->pvt = G_TYPE_INSTANCE_GET_PRIVATE (terminal, VTE_TYPE_TERMINAL, VteTerminalPrivate);
 
-	GTK_WIDGET_SET_FLAGS(terminal, GTK_CAN_FOCUS);
+        gtk_widget_set_can_focus (&terminal->widget, TRUE);
 
 	gtk_widget_set_app_paintable (&terminal->widget, TRUE);
 
@@ -8188,6 +8199,7 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
 	VteTerminal *terminal;
 	glong width, height;
 	gboolean repaint, update_scrollback;
+        GtkAllocation alloc;
 
 	_vte_debug_print(VTE_DEBUG_LIFECYCLE,
 			"vte_terminal_size_allocate()\n");
@@ -8206,12 +8218,13 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
                         terminal,
 			allocation->width, allocation->height,
 			width, height);
-	repaint = widget->allocation.width != allocation->width ||
-		widget->allocation.height != allocation->height;
-	update_scrollback = widget->allocation.height != allocation->height;
+        gtk_widget_get_allocation (widget, &alloc);
+	repaint = alloc.width != allocation->width ||
+		alloc.height != allocation->height;
+	update_scrollback = alloc.height != allocation->height;
 
 	/* Set our allocation to match the structure. */
-	widget->allocation = *allocation;
+        gtk_widget_set_allocation (widget, allocation);
 
 	if (width != terminal->column_count
 			|| height != terminal->row_count
@@ -8247,7 +8260,7 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
 
 	/* Resize the GDK window. */
 	if (gtk_widget_get_realized (widget)) {
-		gdk_window_move_resize(widget->window,
+		gdk_window_move_resize(gtk_widget_get_window (widget),
 				       allocation->x,
 				       allocation->y,
 				       allocation->width,
@@ -8275,6 +8288,7 @@ static void
 vte_terminal_unrealize(GtkWidget *widget)
 {
 	VteTerminal *terminal;
+        GdkWindow *window;
 
 	_vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_unrealize()\n");
 
@@ -8335,13 +8349,14 @@ vte_terminal_unrealize(GtkWidget *widget)
 	}
 
 	/* Remove the GDK window. */
-	if (widget->window != NULL) {
+        window = gtk_widget_get_window (widget);
+	if (window != NULL) {
 		/* detach style */
-		gtk_style_detach(widget->style);
+		gtk_style_detach(gtk_widget_get_style (widget));
 
-		gdk_window_set_user_data(widget->window, NULL);
-		gdk_window_destroy(widget->window);
-		widget->window = NULL;
+		gdk_window_set_user_data(window, NULL);
+		gdk_window_destroy(window);
+                gtk_widget_set_window (widget, NULL);
 	}
 
 	/* Remove the blink timeout function. */
@@ -8365,7 +8380,7 @@ vte_terminal_unrealize(GtkWidget *widget)
 	terminal->pvt->modifiers = 0;
 
 	/* Mark that we no longer have a GDK window. */
-	GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);
+        gtk_widget_set_realized (widget, FALSE);
 }
 
 static void
@@ -8615,8 +8630,10 @@ vte_terminal_realize(GtkWidget *widget)
 {
 	VteTerminal *terminal;
 	GdkWindowAttr attributes;
+        GdkWindow *window;
         GdkColor color;
 	guint attributes_mask = 0, i;
+        GtkAllocation allocation;
 
 	_vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_realize()\n");
 
@@ -8635,11 +8652,12 @@ vte_terminal_realize(GtkWidget *widget)
 		vte_terminal_cursor_new(terminal, VTE_MOUSING_CURSOR);
 
 	/* Create a GDK window for the widget. */
+        gtk_widget_get_allocation (widget, &allocation);
 	attributes.window_type = GDK_WINDOW_CHILD;
-	attributes.x = widget->allocation.x;
-	attributes.y = widget->allocation.y;
-	attributes.width = widget->allocation.width;
-	attributes.height = widget->allocation.height;
+	attributes.x = allocation.x;
+	attributes.y = allocation.y;
+	attributes.width = allocation.width;
+	attributes.height = allocation.height;
 	attributes.wclass = GDK_INPUT_OUTPUT;
 	attributes.visual = gtk_widget_get_visual (widget);
 	attributes.colormap = gtk_widget_get_colormap (widget);
@@ -8661,14 +8679,15 @@ vte_terminal_realize(GtkWidget *widget)
 			  (attributes.visual ? GDK_WA_VISUAL : 0) |
 			  (attributes.colormap ? GDK_WA_COLORMAP : 0) |
 			  GDK_WA_CURSOR;
-	widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
-					&attributes,
-					attributes_mask);
+	window = gdk_window_new(gtk_widget_get_parent_window(widget),
+				&attributes,
+				attributes_mask);
 	_VTE_DEBUG_IF(VTE_DEBUG_UPDATES) gdk_window_set_debug_updates(TRUE);
-	gdk_window_set_user_data(widget->window, widget);
+        gtk_widget_set_window (widget, window);
+	gdk_window_set_user_data (window, widget);
 
 	/* Set the realized flag. */
-	GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+        gtk_widget_set_realized (widget, TRUE);
 
 	/* Set up the desired palette. */
 	if (!terminal->pvt->palette_initialized) {
@@ -8694,7 +8713,7 @@ vte_terminal_realize(GtkWidget *widget)
 	terminal->pvt->im_preedit_active = FALSE;
 	terminal->pvt->im_context = gtk_im_multicontext_new();
 	gtk_im_context_set_client_window(terminal->pvt->im_context,
-					 widget->window);
+					 gtk_widget_get_window (widget));
 	g_signal_connect(terminal->pvt->im_context, "commit",
 			 G_CALLBACK(vte_terminal_im_commit), terminal);
 	g_signal_connect(terminal->pvt->im_context, "preedit-start",
@@ -8729,7 +8748,7 @@ vte_terminal_realize(GtkWidget *widget)
     }
 #endif /* GTK >= 2.15.1 */
 
-	widget->style = gtk_style_attach(widget->style, widget->window);
+	gtk_widget_style_attach(widget);
 
 	vte_terminal_ensure_font (terminal);
 
@@ -10521,7 +10540,7 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
 	    (CLAMP(row, 0, terminal->row_count    - 1) != row))
 		return;
 
-	focus = gtk_widget_has_focus(terminal);
+	focus = gtk_widget_has_focus(&terminal->widget);
 	blink = terminal->pvt->cursor_blink_state;
 	reverse = terminal->pvt->screen->reverse_mode;
 
@@ -10724,6 +10743,7 @@ static void
 vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
 {
 	VteTerminal *terminal;
+        GtkAllocation allocation;
 
 	_vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_paint()\n");
 	_vte_debug_print(VTE_DEBUG_WORK, "=");
@@ -10734,7 +10754,7 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
 	_vte_draw_start(terminal->pvt->draw);
 	if (terminal->pvt->bg_transparent) {
 		int x, y;
-		gdk_window_get_origin(widget->window, &x, &y);
+		gdk_window_get_origin(gtk_widget_get_window (widget), &x, &y);
 		_vte_draw_set_background_scroll(terminal->pvt->draw, x, y);
 	} else {
 		if (terminal->pvt->scroll_background) {
@@ -10755,8 +10775,9 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
 				clip.x, clip.y, clip.width, clip.height);
 	}
 
+        gtk_widget_get_allocation (&terminal->widget, &allocation);
 	_vte_draw_clip(terminal->pvt->draw, region);
-	_vte_draw_clear (terminal->pvt->draw, 0, 0, terminal->widget.allocation.width, terminal->widget.allocation.height);
+	_vte_draw_clear (terminal->pvt->draw, 0, 0, allocation.width, allocation.height);
 
 	/* Calculate the bounding rectangle. */
 	{
@@ -10765,8 +10786,8 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
 		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++) {
@@ -10797,6 +10818,7 @@ 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, "+");
@@ -10815,8 +10837,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) {
-			if (event->area.width >= widget->allocation.width &&
-					event->area.height >= widget->allocation.height) {
+                        gtk_widget_get_allocation (widget, &allocation);
+			if (event->area.width >= allocation.width &&
+					event->area.height >= allocation.height) {
 				_vte_invalidate_all (terminal);
 			} else {
 				terminal->pvt->update_regions =
@@ -10835,9 +10858,9 @@ vte_terminal_expose(GtkWidget *widget, GdkEventExpose *event)
 static gboolean
 vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
 {
-	GtkAdjustment *adj;
 	VteTerminal *terminal;
 	gdouble v;
+        gdouble page_increment;
 	int button;
 
 	terminal = VTE_TERMINAL(widget);
@@ -10880,8 +10903,8 @@ vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
 		return TRUE;
 	}
 
-	adj = terminal->adjustment;
-	v = MAX (1., ceil (adj->page_increment / 10.));
+        page_increment = gtk_adjustment_get_page_increment (terminal->adjustment);
+	v = MAX (1., ceil (page_increment / 10.));
 	switch (event->direction) {
 	case GDK_SCROLL_UP:
 		v = -v;
@@ -12571,7 +12594,7 @@ vte_terminal_im_append_menuitems(VteTerminal *terminal, GtkMenuShell *menushell)
 {
 	GtkIMMulticontext *context;
 	g_return_if_fail(VTE_IS_TERMINAL(terminal));
-	g_return_if_fail(gtk_widget_get_realized(terminal));
+	g_return_if_fail(gtk_widget_get_realized(&terminal->widget));
         g_return_if_fail(GTK_IS_MENU_SHELL(menushell));
 	context = GTK_IM_MULTICONTEXT(terminal->pvt->im_context);
 	gtk_im_multicontext_append_menuitems(context, menushell);
@@ -12587,7 +12610,7 @@ vte_terminal_background_update(VteTerminal *terminal)
 
 	/* If we're not realized yet, don't worry about it, because we get
 	 * called when we realize. */
-	if (!gtk_widget_get_realized(terminal)) {
+	if (!gtk_widget_get_realized(&terminal->widget)) {
 		_vte_debug_print(VTE_DEBUG_MISC,
 				"Can not set background image without "
 				"window.\n");
@@ -12961,8 +12984,8 @@ vte_terminal_set_cursor_blinks_internal(VteTerminal *terminal, gboolean blink)
 
 	pvt->cursor_blinks = blink;
 
-	if (!gtk_widget_get_realized (terminal) ||
-	    !gtk_widget_has_focus (terminal))
+	if (!gtk_widget_get_realized (&terminal->widget) ||
+	    !gtk_widget_has_focus (&terminal->widget))
 		return;
 
 	if (blink)
@@ -14147,8 +14170,8 @@ vte_terminal_emit_pending_signals(VteTerminal *terminal)
 		terminal->window_title = terminal->pvt->window_title_changed;
 		terminal->pvt->window_title_changed = NULL;
 
-		if (terminal->widget.window)
-			gdk_window_set_title (terminal->widget.window,
+		if (gtk_widget_get_window (&terminal->widget))
+			gdk_window_set_title (gtk_widget_get_window (&terminal->widget),
 					terminal->window_title);
 		vte_terminal_emit_window_title_changed(terminal);
                 g_object_notify(object, "window-title");
@@ -14159,8 +14182,8 @@ vte_terminal_emit_pending_signals(VteTerminal *terminal)
 		terminal->icon_title = terminal->pvt->icon_title_changed;
 		terminal->pvt->icon_title_changed = NULL;
 
-		if (terminal->widget.window)
-			gdk_window_set_icon_name (terminal->widget.window,
+		if (gtk_widget_get_window (&terminal->widget))
+			gdk_window_set_icon_name (gtk_widget_get_window (&terminal->widget),
 					terminal->icon_title);
 		vte_terminal_emit_icon_title_changed(terminal);
                 g_object_notify(object, "icon-title");
@@ -14280,7 +14303,7 @@ update_regions (VteTerminal *terminal)
 	GSList *l;
 	GdkRegion *region;
 
-	if (G_UNLIKELY (!gtk_widget_is_drawable(terminal) ||
+	if (G_UNLIKELY (!gtk_widget_is_drawable (&terminal->widget) ||
 				terminal->pvt->visibility_state == GDK_VISIBILITY_FULLY_OBSCURED)) {
 		reset_update_regions (terminal);
 		return FALSE;
@@ -14306,8 +14329,8 @@ update_regions (VteTerminal *terminal)
 	terminal->pvt->invalidated_all = FALSE;
 
 	/* and perform the merge with the window visible area */
-	gdk_window_invalidate_region (terminal->widget.window, region, FALSE);
-	gdk_window_process_updates (terminal->widget.window, FALSE);
+	gdk_window_invalidate_region (gtk_widget_get_window (&terminal->widget), region, FALSE);
+	gdk_window_process_updates (gtk_widget_get_window (&terminal->widget), FALSE);
 	gdk_region_destroy (region);
 
 	_vte_debug_print (VTE_DEBUG_WORK, "-");
@@ -14595,6 +14618,7 @@ vte_terminal_search_rows (VteTerminal *terminal,
 	gchar *word;
 	VteCharAttributes *ca;
 	GArray *attrs;
+        gdouble value, page_size;
 
 	pvt = terminal->pvt;
 
@@ -14640,13 +14664,13 @@ vte_terminal_search_rows (VteTerminal *terminal,
 
 	_vte_terminal_select_text (terminal, start_col, start_row, end_col, end_row, 0, 0);
 	/* Quite possibly the math here should not access adjustment directly... */
+        value = gtk_adjustment_get_value (terminal->adjustment);
+        page_size = gtk_adjustment_get_page_size (terminal->adjustment);
 	if (backward) {
-		if (end_row < terminal->adjustment->value ||
-		    end_row >= terminal->adjustment->value + terminal->adjustment->page_size)
-			vte_terminal_queue_adjustment_value_changed_clamped (terminal, end_row - terminal->adjustment->page_size + 1);
+		if (end_row < value || end_row >= value + page_size)
+			vte_terminal_queue_adjustment_value_changed_clamped (terminal, end_row - page_size + 1);
 	} else {
-		if (start_row < terminal->adjustment->value ||
-		    start_row >= terminal->adjustment->value + terminal->adjustment->page_size)
+		if (start_row < value || start_row >= value + page_size)
 			vte_terminal_queue_adjustment_value_changed_clamped (terminal, start_row);
 	}
 
diff --git a/src/vte.h b/src/vte.h
index 9b32459..7f3e10e 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -34,7 +34,7 @@
 
 G_BEGIN_DECLS
 
-#ifdef GSEAL_ENABLE
+#if defined(GSEAL_ENABLE) && !defined(VTE_COMPILATION)
 #define _VTE_SEAL(name) _vte_sealed__ ## name
 #else
 #define _VTE_SEAL(name) name
diff --git a/src/vteaccess.c b/src/vteaccess.c
index 639bce9..91a98fe 100644
--- a/src/vteaccess.c
+++ b/src/vteaccess.c
@@ -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. */
@@ -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,7 +1709,7 @@ 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;
 	}
@@ -1716,10 +1718,10 @@ vte_terminal_accessible_get_position(AtkComponent *component,
 	}
 	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_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;
 	}
diff --git a/src/vteapp.c b/src/vteapp.c
index 556b274..c0ac4b8 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -110,7 +110,7 @@ char_size_realized(GtkWidget *widget, gpointer data)
 
 	terminal = VTE_TERMINAL(widget);
 	window = GTK_WINDOW(data);
-	if (!gtk_widget_get_realized (window))
+	if (!gtk_widget_get_realized (GTK_WIDGET (window)))
 		return;
 
         gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
@@ -223,8 +223,8 @@ 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);
+		if (gtk_widget_get_window ((GTK_WIDGET(data)))) {
+			gdk_window_iconify(gtk_widget_get_window(GTK_WIDGET(data)));
 		}
 	}
 }
@@ -233,8 +233,8 @@ 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);
+		if (gtk_widget_get_window(GTK_WIDGET(data))) {
+			gdk_window_deiconify(gtk_widget_get_window(GTK_WIDGET(data)));
 		}
 	}
 }
@@ -243,8 +243,8 @@ static void
 raise_window(GtkWidget *widget, gpointer data)
 {
 	if (GTK_IS_WIDGET(data)) {
-		if ((GTK_WIDGET(data))->window) {
-			gdk_window_raise((GTK_WIDGET(data))->window);
+		if (gtk_widget_get_window(GTK_WIDGET(data))) {
+			gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(data)));
 		}
 	}
 }
@@ -253,8 +253,8 @@ static void
 lower_window(GtkWidget *widget, gpointer data)
 {
 	if (GTK_IS_WIDGET(data)) {
-		if ((GTK_WIDGET(data))->window) {
-			gdk_window_lower((GTK_WIDGET(data))->window);
+		if (gtk_widget_get_window(GTK_WIDGET(data))) {
+			gdk_window_lower(gtk_widget_get_window(GTK_WIDGET(data)));
 		}
 	}
 }
@@ -263,8 +263,8 @@ static void
 maximize_window(GtkWidget *widget, gpointer data)
 {
 	if (GTK_IS_WIDGET(data)) {
-		if ((GTK_WIDGET(data))->window) {
-			gdk_window_maximize((GTK_WIDGET(data))->window);
+		if (gtk_widget_get_window(GTK_WIDGET(data))) {
+			gdk_window_maximize(gtk_widget_get_window(GTK_WIDGET(data)));
 		}
 	}
 }
@@ -273,8 +273,8 @@ static void
 restore_window(GtkWidget *widget, gpointer data)
 {
 	if (GTK_IS_WIDGET(data)) {
-		if ((GTK_WIDGET(data))->window) {
-			gdk_window_unmaximize((GTK_WIDGET(data))->window);
+		if (gtk_widget_get_window(GTK_WIDGET(data))) {
+			gdk_window_unmaximize(gtk_widget_get_window(GTK_WIDGET(data)));
 		}
 	}
 }
@@ -283,13 +283,16 @@ static void
 refresh_window(GtkWidget *widget, gpointer data)
 {
 	GdkRectangle rect;
+        GdkWindow *window;
+        GtkAllocation allocation;
 	if (GTK_IS_WIDGET(data)) {
-		if ((GTK_WIDGET(data))->window) {
+                window = gtk_widget_get_window(GTK_WIDGET(data));
+		if (window) {
+                        gtk_widget_get_allocation (GTK_WIDGET (data), &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 +332,11 @@ 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);
 		}
 	}
 }
diff --git a/src/vtedraw.c b/src/vtedraw.c
index dc51072..69c1590 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -841,8 +841,8 @@ _vte_draw_start (struct _vte_draw *draw)
 	_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);
+		g_object_ref (gtk_widget_get_window (draw->widget));
+		draw->cr = gdk_cairo_create (gtk_widget_get_window (draw->widget));
 	}
 
 	draw->started++;
@@ -857,7 +857,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");
diff --git a/src/vteseq.c b/src/vteseq.c
index 4bfa097..f2508b8 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -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;
@@ -3158,7 +3159,7 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
 			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,
