[vte] widget: Remove sealed adjustment from public struct
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Remove sealed adjustment from public struct
- Date: Mon, 24 Mar 2014 21:10:51 +0000 (UTC)
commit 47e2298b7fad518ffb6092f7fa623a9fbfd9948c
Author: Christian Persch <chpe gnome org>
Date: Mon May 2 22:47:33 2011 +0200
widget: Remove sealed adjustment from public struct
src/reflect.c | 7 +----
src/vte-private.h | 1 +
src/vte.c | 70 ++++++++++++++++++++++++++--------------------------
src/vte.h | 1 -
src/vteapp.c | 2 +-
src/vteseq.c | 2 +-
6 files changed, 39 insertions(+), 44 deletions(-)
---
diff --git a/src/reflect.c b/src/reflect.c
index 8e5f94e..5ffaf51 100644
--- a/src/reflect.c
+++ b/src/reflect.c
@@ -80,11 +80,6 @@ terminal_shell_vte(GtkWidget *terminal)
NULL,
NULL);
}
-static GtkAdjustment *
-terminal_adjustment_vte(GtkWidget *terminal)
-{
- return (VTE_TERMINAL(terminal))->adjustment;
-}
#endif
/*
@@ -237,7 +232,7 @@ terminal_adjustment(GtkWidget *terminal)
return terminal_adjustment_text_view(terminal);
#endif
#ifdef USE_VTE
- return terminal_adjustment_vte(terminal);
+ return gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(terminal));
#endif
g_assert_not_reached();
}
diff --git a/src/vte-private.h b/src/vte-private.h
index 6ea4806..af68e1b 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -427,6 +427,7 @@ struct _VteTerminalPrivate {
/* GtkScrollable impl */
GtkAdjustment *hadjustment; /* unused */
+ GtkAdjustment *vadjustment;
guint hscroll_policy : 1; /* unused */
guint vscroll_policy : 1;
diff --git a/src/vte.c b/src/vte.c
index 9d1c973..edf55db 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -1713,15 +1713,15 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
glong v;
gdouble current;
- g_object_freeze_notify (G_OBJECT (terminal->adjustment));
+ g_object_freeze_notify (G_OBJECT (terminal->pvt->vadjustment));
v = _vte_ring_delta (screen->row_data);
- current = gtk_adjustment_get_lower(terminal->adjustment);
+ current = gtk_adjustment_get_lower(terminal->pvt->vadjustment);
if (current != v) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing lower bound from %.0f to %ld\n",
current, v);
- gtk_adjustment_set_lower(terminal->adjustment, v);
+ gtk_adjustment_set_lower(terminal->pvt->vadjustment, v);
changed = TRUE;
}
@@ -1729,16 +1729,16 @@ 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);
- current = gtk_adjustment_get_upper(terminal->adjustment);
+ current = gtk_adjustment_get_upper(terminal->pvt->vadjustment);
if (current != v) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing upper bound from %.0f to %ld\n",
current, v);
- gtk_adjustment_set_upper(terminal->adjustment, v);
+ gtk_adjustment_set_upper(terminal->pvt->vadjustment, v);
changed = TRUE;
}
- g_object_thaw_notify (G_OBJECT (terminal->adjustment));
+ g_object_thaw_notify (G_OBJECT (terminal->pvt->vadjustment));
if (changed)
_vte_debug_print(VTE_DEBUG_SIGNALS,
@@ -1750,7 +1750,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 (gtk_adjustment_get_value(terminal->adjustment));
+ v = round (gtk_adjustment_get_value(terminal->pvt->vadjustment));
if (v != terminal->pvt->screen->scroll_delta) {
/* this little dance is so that the scroll_delta is
* updated immediately, but we still handled scrolling
@@ -1759,7 +1759,7 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
*/
delta = terminal->pvt->screen->scroll_delta;
terminal->pvt->screen->scroll_delta = v;
- gtk_adjustment_set_value(terminal->adjustment, delta);
+ gtk_adjustment_set_value(terminal->pvt->vadjustment, delta);
}
}
}
@@ -1787,8 +1787,8 @@ vte_terminal_queue_adjustment_value_changed_clamped(VteTerminal *terminal, glong
{
gdouble lower, upper;
- lower = gtk_adjustment_get_lower(terminal->adjustment);
- upper = gtk_adjustment_get_upper(terminal->adjustment);
+ lower = gtk_adjustment_get_lower(terminal->pvt->vadjustment);
+ upper = gtk_adjustment_get_upper(terminal->pvt->vadjustment);
v = CLAMP(v, lower, MAX (lower, upper - terminal->pvt->row_count));
@@ -1836,44 +1836,44 @@ _vte_terminal_adjust_adjustments_full (VteTerminal *terminal)
_vte_terminal_adjust_adjustments(terminal);
- g_object_freeze_notify(G_OBJECT(terminal->adjustment));
+ g_object_freeze_notify(G_OBJECT(terminal->pvt->vadjustment));
/* The step increment should always be one. */
- v = gtk_adjustment_get_step_increment(terminal->adjustment);
+ v = gtk_adjustment_get_step_increment(terminal->pvt->vadjustment);
if (v != 1) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing step increment from %.0lf to %ld\n",
v, terminal->pvt->row_count);
- gtk_adjustment_set_step_increment(terminal->adjustment, 1);
+ gtk_adjustment_set_step_increment(terminal->pvt->vadjustment, 1);
changed = TRUE;
}
/* Set the number of rows the user sees to the number of rows the
* user sees. */
- v = gtk_adjustment_get_page_size(terminal->adjustment);
+ v = gtk_adjustment_get_page_size(terminal->pvt->vadjustment);
if (v != terminal->pvt->row_count) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing page size from %.0f to %ld\n",
v, terminal->pvt->row_count);
- gtk_adjustment_set_page_size(terminal->adjustment,
+ gtk_adjustment_set_page_size(terminal->pvt->vadjustment,
terminal->pvt->row_count);
changed = TRUE;
}
/* Clicking in the empty area should scroll one screen, so set the
* page size to the number of visible rows. */
- v = gtk_adjustment_get_page_increment(terminal->adjustment);
+ v = gtk_adjustment_get_page_increment(terminal->pvt->vadjustment);
if (v != terminal->pvt->row_count) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing page increment from "
"%.0f to %ld\n",
v, terminal->pvt->row_count);
- gtk_adjustment_set_page_increment(terminal->adjustment,
+ gtk_adjustment_set_page_increment(terminal->pvt->vadjustment,
terminal->pvt->row_count);
changed = TRUE;
}
- g_object_thaw_notify(G_OBJECT(terminal->adjustment));
+ g_object_thaw_notify(G_OBJECT(terminal->pvt->vadjustment));
if (changed)
_vte_debug_print(VTE_DEBUG_SIGNALS,
@@ -6811,7 +6811,7 @@ vte_terminal_autoscroll(VteTerminal *terminal)
/* Provide an immediate effect for mouse wigglers. */
if (terminal->pvt->mouse_last_y < 0) {
- if (terminal->adjustment) {
+ if (terminal->pvt->vadjustment) {
/* Try to scroll up by one line. */
adj = terminal->pvt->screen->scroll_delta - 1;
vte_terminal_queue_adjustment_value_changed_clamped (terminal, adj);
@@ -6821,7 +6821,7 @@ vte_terminal_autoscroll(VteTerminal *terminal)
}
if (terminal->pvt->mouse_last_y >=
terminal->pvt->row_count * terminal->pvt->char_height) {
- if (terminal->adjustment) {
+ if (terminal->pvt->vadjustment) {
/* Try to scroll up by one line. */
adj = terminal->pvt->screen->scroll_delta + 1;
vte_terminal_queue_adjustment_value_changed_clamped (terminal, adj);
@@ -7757,7 +7757,7 @@ vte_terminal_handle_scroll(VteTerminal *terminal)
screen = terminal->pvt->screen;
/* Read the new adjustment value and save the difference. */
- adj = round (gtk_adjustment_get_value(terminal->adjustment));
+ adj = round (gtk_adjustment_get_value(terminal->pvt->vadjustment));
dy = adj - screen->scroll_delta;
screen->scroll_delta = adj;
@@ -7798,9 +7798,9 @@ static void
vte_terminal_set_vadjustment(VteTerminal *terminal,
GtkAdjustment *adjustment)
{
- if (adjustment != NULL && adjustment == terminal->adjustment)
+ if (adjustment != NULL && adjustment == terminal->pvt->vadjustment)
return;
- if (adjustment == NULL && terminal->adjustment != NULL)
+ if (adjustment == NULL && terminal->pvt->vadjustment != NULL)
return;
if (adjustment == NULL)
@@ -7811,19 +7811,19 @@ vte_terminal_set_vadjustment(VteTerminal *terminal,
/* Add a reference to the new adjustment object. */
g_object_ref_sink(adjustment);
/* Get rid of the old adjustment object. */
- if (terminal->adjustment != NULL) {
+ if (terminal->pvt->vadjustment != NULL) {
/* Disconnect our signal handlers from this object. */
- g_signal_handlers_disconnect_by_func(terminal->adjustment,
+ g_signal_handlers_disconnect_by_func(terminal->pvt->vadjustment,
vte_terminal_handle_scroll,
terminal);
- g_object_unref(terminal->adjustment);
+ g_object_unref(terminal->pvt->vadjustment);
}
/* Set the new adjustment object. */
- terminal->adjustment = adjustment;
+ terminal->pvt->vadjustment = adjustment;
/* We care about the offset, not the top or bottom. */
- g_signal_connect_swapped(terminal->adjustment,
+ g_signal_connect_swapped(terminal->pvt->vadjustment,
"value-changed",
G_CALLBACK(vte_terminal_handle_scroll),
terminal);
@@ -8016,7 +8016,7 @@ vte_terminal_init(VteTerminal *terminal)
gtk_widget_set_redraw_on_allocate (&terminal->widget, FALSE);
/* Set an adjustment for the application to use to control scrolling. */
- terminal->adjustment = NULL;
+ terminal->pvt->vadjustment = NULL;
pvt->hadjustment = NULL;
/* GtkScrollable */
pvt->hscroll_policy = GTK_SCROLL_NATURAL;
@@ -8641,8 +8641,8 @@ vte_terminal_finalize(GObject *object)
/* Free public-facing data. */
g_free(terminal->pvt->icon_title);
- if (terminal->adjustment != NULL) {
- g_object_unref(terminal->adjustment);
+ if (terminal->pvt->vadjustment != NULL) {
+ g_object_unref(terminal->pvt->vadjustment);
}
settings = gtk_widget_get_settings (widget);
@@ -10623,7 +10623,7 @@ vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
return TRUE;
}
- adj = terminal->adjustment;
+ adj = terminal->pvt->vadjustment;
v = MAX (1., ceil (gtk_adjustment_get_page_increment (adj) / 10.));
_vte_debug_print(VTE_DEBUG_EVENTS,
"Scroll speed is %d lines per non-smooth scroll unit\n",
@@ -10726,7 +10726,7 @@ vte_terminal_get_property (GObject *object,
g_value_set_object (value, pvt->hadjustment);
break;
case PROP_VADJUSTMENT:
- g_value_set_object (value, terminal->adjustment);
+ g_value_set_object (value, terminal->pvt->vadjustment);
break;
case PROP_HSCROLL_POLICY:
g_value_set_enum (value, pvt->hscroll_policy);
@@ -14466,8 +14466,8 @@ 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);
+ value = gtk_adjustment_get_value(terminal->pvt->vadjustment);
+ page_size = gtk_adjustment_get_page_size(terminal->pvt->vadjustment);
if (backward) {
if (end_row < value || end_row >= value + page_size)
vte_terminal_queue_adjustment_value_changed_clamped (terminal, end_row - page_size +
1);
diff --git a/src/vte.h b/src/vte.h
index 8fdaffe..c7a1cdd 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -61,7 +61,6 @@ typedef struct _VteCharAttributes VteCharAttributes;
struct _VteTerminal {
GtkWidget widget;
/*< private >*/
- GtkAdjustment *_VTE_SEAL(adjustment); /* Scrolling adjustment. */
/*< private >*/
VteTerminalPrivate *pvt;
diff --git a/src/vteapp.c b/src/vteapp.c
index 3ccdf8c..07e546e 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -874,7 +874,7 @@ main(int argc, char **argv)
if (!use_scrolled_window) {
/* Create the scrollbar for the widget. */
- scrollbar = gtk_vscrollbar_new(terminal->adjustment);
+ scrollbar = gtk_vscrollbar_new(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(terminal)));
gtk_box_pack_start(GTK_BOX(hbox), scrollbar, FALSE, FALSE, 0);
}
diff --git a/src/vteseq.c b/src/vteseq.c
index d3513d4..003d246 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -920,7 +920,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
_vte_terminal_home_cursor (terminal);
}
/* Reset scrollbars and repaint everything. */
- gtk_adjustment_set_value(terminal->adjustment,
+ gtk_adjustment_set_value(terminal->pvt->vadjustment,
terminal->pvt->screen->scroll_delta);
vte_terminal_set_scrollback_lines(terminal,
terminal->pvt->scrollback_lines);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]