entry: Remove cursor adjustment APIs

This commit is contained in:
Benjamin Otte
2018-02-26 14:01:29 +01:00
parent 4ac3f916d0
commit 88de098711
3 changed files with 0 additions and 96 deletions

View File

@@ -902,8 +902,6 @@ gtk_entry_set_attributes
gtk_entry_get_attributes
gtk_entry_set_completion
gtk_entry_get_completion
gtk_entry_set_cursor_hadjustment
gtk_entry_get_cursor_hadjustment
gtk_entry_set_progress_fraction
gtk_entry_get_progress_fraction
gtk_entry_set_progress_pulse_step

View File

@@ -175,7 +175,6 @@
(pos) == GTK_ENTRY_ICON_SECONDARY)
static GQuark quark_password_hint = 0;
static GQuark quark_cursor_hadjustment = 0;
static GQuark quark_capslock_feedback = 0;
static GQuark quark_gtk_signal = 0;
static GQuark quark_entry_completion = 0;
@@ -608,7 +607,6 @@ static void gtk_entry_grab_notify (GtkWidget *widget,
static void gtk_entry_check_cursor_blink (GtkEntry *entry);
static void gtk_entry_pend_cursor_blink (GtkEntry *entry);
static void gtk_entry_reset_blink_time (GtkEntry *entry);
static void gtk_entry_move_adjustments (GtkEntry *entry);
static void gtk_entry_update_cached_style_values(GtkEntry *entry);
static gboolean get_middle_click_paste (GtkEntry *entry);
static void gtk_entry_get_scroll_limits (GtkEntry *entry,
@@ -833,7 +831,6 @@ gtk_entry_class_init (GtkEntryClass *class)
class->activate = gtk_entry_real_activate;
quark_password_hint = g_quark_from_static_string ("gtk-entry-password-hint");
quark_cursor_hadjustment = g_quark_from_static_string ("gtk-hadjustment");
quark_capslock_feedback = g_quark_from_static_string ("gtk-entry-capslock-feedback");
quark_gtk_signal = g_quark_from_static_string ("gtk-signal");
quark_entry_completion = g_quark_from_static_string ("gtk-entry-completion-key");
@@ -5421,7 +5418,6 @@ gtk_entry_set_positions (GtkEntry *entry,
if (changed)
{
gtk_entry_move_adjustments (entry);
gtk_entry_recompute (entry);
}
}
@@ -6206,39 +6202,6 @@ gtk_entry_adjust_scroll (GtkEntry *entry)
}
}
static void
gtk_entry_move_adjustments (GtkEntry *entry)
{
GtkWidget *widget = GTK_WIDGET (entry);
GtkAdjustment *adjustment;
PangoContext *context;
PangoFontMetrics *metrics;
gint x, layout_x;
gint char_width;
adjustment = g_object_get_qdata (G_OBJECT (entry), quark_cursor_hadjustment);
if (!adjustment)
return;
/* Cursor/char position, layout offset and border width*/
gtk_entry_get_cursor_locations (entry, &x, NULL);
get_layout_position (entry, &layout_x, NULL);
x += layout_x;
/* Approximate width of a char, so user can see what is ahead/behind */
context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics) / PANGO_SCALE;
/* Scroll it */
gtk_adjustment_clamp_page (adjustment,
x - (char_width + 1), /* one char + one pixel before */
x + (char_width + 2)); /* one char + cursor + one pixel after */
}
static gint
gtk_entry_move_visually (GtkEntry *entry,
gint start,
@@ -9191,55 +9154,6 @@ gtk_entry_get_completion (GtkEntry *entry)
return completion;
}
/**
* gtk_entry_set_cursor_hadjustment:
* @entry: a #GtkEntry
* @adjustment: (nullable): an adjustment which should be adjusted when the cursor
* is moved, or %NULL
*
* Hooks up an adjustment to the cursor position in an entry, so that when
* the cursor is moved, the adjustment is scrolled to show that position.
* See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining
* the adjustment.
*
* The adjustment has to be in pixel units and in the same coordinate system
* as the entry.
*/
void
gtk_entry_set_cursor_hadjustment (GtkEntry *entry,
GtkAdjustment *adjustment)
{
g_return_if_fail (GTK_IS_ENTRY (entry));
if (adjustment)
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
if (adjustment)
g_object_ref (adjustment);
g_object_set_qdata_full (G_OBJECT (entry),
quark_cursor_hadjustment,
adjustment,
g_object_unref);
}
/**
* gtk_entry_get_cursor_hadjustment:
* @entry: a #GtkEntry
*
* Retrieves the horizontal cursor adjustment for the entry.
* See gtk_entry_set_cursor_hadjustment().
*
* Returns: (transfer none) (nullable): the horizontal cursor adjustment, or %NULL
* if none has been set.
*/
GtkAdjustment*
gtk_entry_get_cursor_hadjustment (GtkEntry *entry)
{
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
return g_object_get_qdata (G_OBJECT (entry), quark_cursor_hadjustment);
}
static void
gtk_entry_ensure_progress_widget (GtkEntry *entry)
{

View File

@@ -250,14 +250,6 @@ GDK_AVAILABLE_IN_ALL
gint gtk_entry_text_index_to_layout_index (GtkEntry *entry,
gint text_index);
/* For scrolling cursor appropriately
*/
GDK_AVAILABLE_IN_ALL
void gtk_entry_set_cursor_hadjustment (GtkEntry *entry,
GtkAdjustment *adjustment);
GDK_AVAILABLE_IN_ALL
GtkAdjustment* gtk_entry_get_cursor_hadjustment (GtkEntry *entry);
/* Progress API
*/
GDK_AVAILABLE_IN_ALL