]> Pileus Git - ~andy/gtk/commitdiff
Move the repositioning logic from _gtk_entry_completion() popup over here.
authorMatthias Clasen <maclas@gmx.de>
Wed, 17 Mar 2004 00:17:07 +0000 (00:17 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 17 Mar 2004 00:17:07 +0000 (00:17 +0000)
Wed Mar 17 01:20:28 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
Move the repositioning logic from _gtk_entry_completion() popup
over here. Fixes #137355, reported by Niklas Knutsson.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkentrycompletion.c

index e7b2c9518cb1c8203b3904894bfcb2a8267b73f2..b31a6ee6e68d2b0f65d0e4eb5e3d8e52ee00223f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Mar 17 01:20:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Move the repositioning logic from _gtk_entry_completion() popup
+       over here. Fixes #137355, reported by Niklas Knutsson.
+
 Tue Mar 16 13:29:58 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.4.0 ===
index e7b2c9518cb1c8203b3904894bfcb2a8267b73f2..b31a6ee6e68d2b0f65d0e4eb5e3d8e52ee00223f 100644 (file)
@@ -1,3 +1,9 @@
+Wed Mar 17 01:20:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Move the repositioning logic from _gtk_entry_completion() popup
+       over here. Fixes #137355, reported by Niklas Knutsson.
+
 Tue Mar 16 13:29:58 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.4.0 ===
index e7b2c9518cb1c8203b3904894bfcb2a8267b73f2..b31a6ee6e68d2b0f65d0e4eb5e3d8e52ee00223f 100644 (file)
@@ -1,3 +1,9 @@
+Wed Mar 17 01:20:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Move the repositioning logic from _gtk_entry_completion() popup
+       over here. Fixes #137355, reported by Niklas Knutsson.
+
 Tue Mar 16 13:29:58 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.4.0 ===
index e7b2c9518cb1c8203b3904894bfcb2a8267b73f2..b31a6ee6e68d2b0f65d0e4eb5e3d8e52ee00223f 100644 (file)
@@ -1,3 +1,9 @@
+Wed Mar 17 01:20:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Move the repositioning logic from _gtk_entry_completion() popup
+       over here. Fixes #137355, reported by Niklas Knutsson.
+
 Tue Mar 16 13:29:58 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.4.0 ===
index e7b2c9518cb1c8203b3904894bfcb2a8267b73f2..b31a6ee6e68d2b0f65d0e4eb5e3d8e52ee00223f 100644 (file)
@@ -1,3 +1,9 @@
+Wed Mar 17 01:20:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): 
+       Move the repositioning logic from _gtk_entry_completion() popup
+       over here. Fixes #137355, reported by Niklas Knutsson.
+
 Tue Mar 16 13:29:58 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.4.0 ===
index 6cdc07584e8fd14c48151310f9ae38b1171d70ec..3ce0ac07adba4942ce56f713ca65b069446f93bb 100644 (file)
@@ -1089,10 +1089,19 @@ get_borders (GtkEntry *entry,
 gint
 _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
 {
+  gint x, y;
   gint items, height, x_border, y_border;
+  GdkScreen *screen;
+  gint monitor_num;
+  GdkRectangle monitor;
+  GtkRequisition popup_req;
 
+  gdk_window_get_origin (completion->priv->entry->window, &x, &y);
   get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border);
 
+  x += x_border;
+  y += 2 * y_border;
+
   items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
 
   items = MIN (items, 15);
@@ -1129,18 +1138,31 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
   else
     gtk_widget_hide (completion->priv->action_view);
 
+  gtk_widget_size_request (completion->priv->popup_window, &popup_req);
+
+  screen = gtk_widget_get_screen (GTK_WIDGET (completion->priv->entry));
+  monitor_num = gdk_screen_get_monitor_at_window (screen, 
+                                                 GTK_WIDGET (completion->priv->entry)->window);
+  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+  
+  if (x < monitor.x)
+    x = monitor.x;
+  else if (x + popup_req.width > monitor.x + monitor.width)
+    x = monitor.x + monitor.width - popup_req.width;
+  
+  if (y + height + popup_req.height <= monitor.y + monitor.height)
+    y += height;
+  else
+    y -= popup_req.height;
+
+  gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y);
+
   return height;
 }
 
 void
 _gtk_entry_completion_popup (GtkEntryCompletion *completion)
 {
-  gint x, y, x_border, y_border;
-  gint height;
-  GdkScreen *screen;
-  gint monitor_num;
-  GdkRectangle monitor;
-  GtkRequisition popup_req;
   GtkTreeViewColumn *column;
   GList *renderers;
 
@@ -1157,32 +1179,7 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
 
   gtk_widget_show_all (completion->priv->vbox);
 
-  gdk_window_get_origin (completion->priv->entry->window, &x, &y);
-  get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border);
-
-  x += x_border;
-  y += 2 * y_border;
-
-  height = _gtk_entry_completion_resize_popup (completion);
-
-  gtk_widget_size_request (completion->priv->popup_window, &popup_req);
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (completion->priv->entry));
-  monitor_num = gdk_screen_get_monitor_at_window (screen, 
-                                                 GTK_WIDGET (completion->priv->entry)->window);
-  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-  
-  if (x < monitor.x)
-    x = monitor.x;
-  else if (x + popup_req.width > monitor.x + monitor.width)
-    x = monitor.x + monitor.width - popup_req.width;
-  
-  if (y + height + popup_req.height <= monitor.y + monitor.height)
-    y += height;
-  else
-    y -= popup_req.height;
-
-  gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y);
+  _gtk_entry_completion_resize_popup (completion);
 
   gtk_widget_show (completion->priv->popup_window);