summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1999-09-03 16:51:12 +0000
committerOwen Taylor <otaylor@src.gnome.org>1999-09-03 16:51:12 +0000
commitad9263ec39f150103854061eae34f225ccdcc0bf (patch)
tree8f08f88b827d7c78c0c774f91e657004f3bc6e2c
parent501c87a65dcc19e1665ca2218cfb6ffeeb53c951 (diff)
downloadgdk-pixbuf-ad9263ec39f150103854061eae34f225ccdcc0bf.tar.gz
[ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com> [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ] * gtk/gtkmenu.c (gtk_menu_position): Make sure we never position menus with negative x, y, since gtk_widget_set_uposition() can't handle that. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Modify the positioning code a bit so that we always put the top-left corner onscreen. (This is for UI reasons, gtk_menu_position() now takes care of gtk_widet_set_uposition() brokeness.)
-rw-r--r--ChangeLog16
-rw-r--r--ChangeLog.pre-2-016
-rw-r--r--ChangeLog.pre-2-1016
-rw-r--r--ChangeLog.pre-2-216
-rw-r--r--ChangeLog.pre-2-416
-rw-r--r--ChangeLog.pre-2-616
-rw-r--r--ChangeLog.pre-2-816
-rw-r--r--gtk/gtkmenu.c21
-rw-r--r--gtk/gtkmenuitem.c23
9 files changed, 113 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 5eca4ecda..3e0e1cc8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
+
+ [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
+
+ * gtk/gtkmenu.c (gtk_menu_position): Make
+ sure we never position menus with negative x, y,
+ since gtk_widget_set_uposition() can't handle that.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
+ Modify the positioning code a bit so that we always
+ put the top-left corner onscreen. (This is for
+ UI reasons, gtk_menu_position() now takes care of
+ gtk_widet_set_uposition() brokeness.)
+
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@@ -443,7 +457,6 @@ Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
->>>>>>> 1.1061.2.110
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
@@ -500,7 +513,6 @@ Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
->>>>>>> 1.1061.2.104
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 5eca4ecda..3e0e1cc8b 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,17 @@
+Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
+
+ [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
+
+ * gtk/gtkmenu.c (gtk_menu_position): Make
+ sure we never position menus with negative x, y,
+ since gtk_widget_set_uposition() can't handle that.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
+ Modify the positioning code a bit so that we always
+ put the top-left corner onscreen. (This is for
+ UI reasons, gtk_menu_position() now takes care of
+ gtk_widet_set_uposition() brokeness.)
+
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@@ -443,7 +457,6 @@ Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
->>>>>>> 1.1061.2.110
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
@@ -500,7 +513,6 @@ Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
->>>>>>> 1.1061.2.104
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 5eca4ecda..3e0e1cc8b 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,17 @@
+Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
+
+ [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
+
+ * gtk/gtkmenu.c (gtk_menu_position): Make
+ sure we never position menus with negative x, y,
+ since gtk_widget_set_uposition() can't handle that.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
+ Modify the positioning code a bit so that we always
+ put the top-left corner onscreen. (This is for
+ UI reasons, gtk_menu_position() now takes care of
+ gtk_widet_set_uposition() brokeness.)
+
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@@ -443,7 +457,6 @@ Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
->>>>>>> 1.1061.2.110
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
@@ -500,7 +513,6 @@ Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
->>>>>>> 1.1061.2.104
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 5eca4ecda..3e0e1cc8b 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,17 @@
+Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
+
+ [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
+
+ * gtk/gtkmenu.c (gtk_menu_position): Make
+ sure we never position menus with negative x, y,
+ since gtk_widget_set_uposition() can't handle that.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
+ Modify the positioning code a bit so that we always
+ put the top-left corner onscreen. (This is for
+ UI reasons, gtk_menu_position() now takes care of
+ gtk_widet_set_uposition() brokeness.)
+
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@@ -443,7 +457,6 @@ Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
->>>>>>> 1.1061.2.110
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
@@ -500,7 +513,6 @@ Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
->>>>>>> 1.1061.2.104
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 5eca4ecda..3e0e1cc8b 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,17 @@
+Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
+
+ [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
+
+ * gtk/gtkmenu.c (gtk_menu_position): Make
+ sure we never position menus with negative x, y,
+ since gtk_widget_set_uposition() can't handle that.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
+ Modify the positioning code a bit so that we always
+ put the top-left corner onscreen. (This is for
+ UI reasons, gtk_menu_position() now takes care of
+ gtk_widet_set_uposition() brokeness.)
+
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@@ -443,7 +457,6 @@ Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
->>>>>>> 1.1061.2.110
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
@@ -500,7 +513,6 @@ Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
->>>>>>> 1.1061.2.104
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 5eca4ecda..3e0e1cc8b 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,17 @@
+Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
+
+ [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
+
+ * gtk/gtkmenu.c (gtk_menu_position): Make
+ sure we never position menus with negative x, y,
+ since gtk_widget_set_uposition() can't handle that.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
+ Modify the positioning code a bit so that we always
+ put the top-left corner onscreen. (This is for
+ UI reasons, gtk_menu_position() now takes care of
+ gtk_widet_set_uposition() brokeness.)
+
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@@ -443,7 +457,6 @@ Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
->>>>>>> 1.1061.2.110
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
@@ -500,7 +513,6 @@ Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
->>>>>>> 1.1061.2.104
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 5eca4ecda..3e0e1cc8b 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,17 @@
+Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
+
+ [ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
+
+ * gtk/gtkmenu.c (gtk_menu_position): Make
+ sure we never position menus with negative x, y,
+ since gtk_widget_set_uposition() can't handle that.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
+ Modify the positioning code a bit so that we always
+ put the top-left corner onscreen. (This is for
+ UI reasons, gtk_menu_position() now takes care of
+ gtk_widet_set_uposition() brokeness.)
+
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@@ -443,7 +457,6 @@ Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
->>>>>>> 1.1061.2.110
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
@@ -500,7 +513,6 @@ Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
->>>>>>> 1.1061.2.104
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 16d48eda1..15ac8813e 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1180,22 +1180,17 @@ gtk_menu_position (GtkMenu *menu)
screen_width = gdk_screen_width ();
screen_height = gdk_screen_height ();
- x -= 2;
- y -= 2;
-
- if ((x + requisition.width) > screen_width)
- x -= ((x + requisition.width) - screen_width);
- if (x < 0)
- x = 0;
- if ((y + requisition.height) > screen_height)
- y -= ((y + requisition.height) - screen_height);
- if (y < 0)
- y = 0;
+ x = CLAMP (x - 2, 0, MAX (0, screen_width - requisition.width));
+ y = CLAMP (y - 2, 0, MAX (0, screen_height - requisition.height));
}
-
+
+ /* FIXME: The MAX() here is because gtk_widget_set_uposition
+ * is broken. Once we provide an alternate interface that
+ * allows negative values, then we can remove them.
+ */
gtk_widget_set_uposition (GTK_MENU_SHELL (menu)->active ?
menu->toplevel : menu->tearoff_window,
- x, y);
+ MAX (x, 0), MAX (y, 0));
}
/* Reparent the menu, taking care of the refcounting
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 58c92c6a8..263159c5a 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -709,12 +709,6 @@ gtk_menu_item_position_menu (GtkMenu *menu,
else
ty += GTK_WIDGET (menu_item)->allocation.height;
- if ((tx + twidth) > screen_width)
- {
- tx -= ((tx + twidth) - screen_width);
- if (tx < 0)
- tx = 0;
- }
break;
case GTK_LEFT_RIGHT:
@@ -746,19 +740,16 @@ gtk_menu_item_position_menu (GtkMenu *menu,
break;
}
- if ((ty + GTK_WIDGET (menu_item)->allocation.height / 4 + theight) <= screen_height)
- ty += GTK_WIDGET (menu_item)->allocation.height / 4;
- else
- {
- ty -= ((ty + theight) - screen_height);
- if (ty < 0)
- ty = 0;
- }
+ ty += GTK_WIDGET (menu_item)->allocation.height / 4;
+
break;
}
- *x = tx;
- *y = ty;
+ /* If we have negative, tx, ty here it is because we can't get
+ * the menu all the way on screen. Favor the upper-left portion.
+ */
+ *x = CLAMP (tx, 0, MAX (0, screen_width - twidth));
+ *y = CLAMP (ty, 0, MAX (0, screen_height - theight));
}
void