[gtk/wip/otte/paintable] entry: Remove cursor adjustment APIs



commit 9a0bc847e98a2eff93c8d8977922f9715a0a3635
Author: Benjamin Otte <otte redhat com>
Date:   Mon Feb 26 14:01:29 2018 +0100

    entry: Remove cursor adjustment APIs

 docs/reference/gtk/gtk4-sections.txt |  2 -
 gtk/gtkentry.c                       | 86 ------------------------------------
 gtk/gtkentry.h                       |  8 ----
 3 files changed, 96 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 2fb35e2220..7f0456dafb 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -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
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 6170ba35e2..ce96f30d8d 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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,
@@ -834,7 +832,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");
@@ -5450,7 +5447,6 @@ gtk_entry_set_positions (GtkEntry *entry,
 
   if (changed)
     {
-      gtk_entry_move_adjustments (entry);
       gtk_entry_recompute (entry);
     }
 }
@@ -6235,39 +6231,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,
@@ -9227,55 +9190,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)
 {
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
index a43f704e85..f68fe9eb08 100644
--- a/gtk/gtkentry.h
+++ b/gtk/gtkentry.h
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]