[ 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.)
This commit is contained in:
Owen Taylor
1999-09-03 16:51:12 +00:00
committed by Owen Taylor
parent 501c87a65d
commit ad9263ec39
9 changed files with 113 additions and 43 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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