summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-03-02 22:20:04 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-03-02 22:20:04 +0000
commitf2cc9ae8a1cc4768e4e3e5d2913a9d794c58a0f3 (patch)
treec2192e85cea3998efcdb3e90ce5fad5cf6744ffb
parentce52e0776ee98cfed42e565ca2a006bff5a1ce88 (diff)
downloadgdk-pixbuf-f2cc9ae8a1cc4768e4e3e5d2913a9d794c58a0f3.tar.gz
Avoid popping up the completions across the edge of the monitor. Part of
Tue Mar 2 23:08:12 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Avoid popping up the completions across the edge of the monitor. Part of #135561.
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-2-106
-rw-r--r--ChangeLog.pre-2-46
-rw-r--r--ChangeLog.pre-2-66
-rw-r--r--ChangeLog.pre-2-86
-rw-r--r--gtk/gtkentrycompletion.c23
6 files changed, 52 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 50de61757..a9ce5212b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Mar 2 23:08:12 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Avoid
+ popping up the completions across the edge of the monitor.
+ Part of #135561.
+
Tue Mar 2 16:47:40 2004 Owen Taylor <otaylor@redhat.com>
* tests/testfilechooser.c (set_filename_existing_nonexistent_cb):
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 50de61757..a9ce5212b 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,9 @@
+Tue Mar 2 23:08:12 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Avoid
+ popping up the completions across the edge of the monitor.
+ Part of #135561.
+
Tue Mar 2 16:47:40 2004 Owen Taylor <otaylor@redhat.com>
* tests/testfilechooser.c (set_filename_existing_nonexistent_cb):
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 50de61757..a9ce5212b 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,9 @@
+Tue Mar 2 23:08:12 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Avoid
+ popping up the completions across the edge of the monitor.
+ Part of #135561.
+
Tue Mar 2 16:47:40 2004 Owen Taylor <otaylor@redhat.com>
* tests/testfilechooser.c (set_filename_existing_nonexistent_cb):
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 50de61757..a9ce5212b 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,9 @@
+Tue Mar 2 23:08:12 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Avoid
+ popping up the completions across the edge of the monitor.
+ Part of #135561.
+
Tue Mar 2 16:47:40 2004 Owen Taylor <otaylor@redhat.com>
* tests/testfilechooser.c (set_filename_existing_nonexistent_cb):
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 50de61757..a9ce5212b 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,9 @@
+Tue Mar 2 23:08:12 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Avoid
+ popping up the completions across the edge of the monitor.
+ Part of #135561.
+
Tue Mar 2 16:47:40 2004 Owen Taylor <otaylor@redhat.com>
* tests/testfilechooser.c (set_filename_existing_nonexistent_cb):
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index c1ee65a58..8b81c3bc0 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -1112,6 +1112,10 @@ _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;
if (GTK_WIDGET_MAPPED (completion->priv->popup_window))
return;
@@ -1126,7 +1130,24 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
height = _gtk_entry_completion_resize_popup (completion);
- gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y + height);
+ 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_widget_show (completion->priv->popup_window);