If we don't do the move-selected-item below pointer thingie, do the

2004-05-10  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): If we don't
	do the move-selected-item below pointer thingie, do the
	place-below-or-above one.
This commit is contained in:
Matthias Clasen 2004-05-10 18:17:47 +00:00 committed by Matthias Clasen
parent d5136747a4
commit 8dbc511070
5 changed files with 44 additions and 10 deletions

View File

@ -1,5 +1,9 @@
2004-05-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): If we don't
do the move-selected-item below pointer thingie, do the
place-below-or-above one.
* tests/testentrycompletion.c: Make the second example use the
::match-selected signal to make it actually work.

View File

@ -1,5 +1,9 @@
2004-05-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): If we don't
do the move-selected-item below pointer thingie, do the
place-below-or-above one.
* tests/testentrycompletion.c: Make the second example use the
::match-selected signal to make it actually work.

View File

@ -1,5 +1,9 @@
2004-05-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): If we don't
do the move-selected-item below pointer thingie, do the
place-below-or-above one.
* tests/testentrycompletion.c: Make the second example use the
::match-selected signal to make it actually work.

View File

@ -1,5 +1,9 @@
2004-05-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): If we don't
do the move-selected-item below pointer thingie, do the
place-below-or-above one.
* tests/testentrycompletion.c: Make the second example use the
::match-selected signal to make it actually work.

View File

@ -948,30 +948,48 @@ gtk_combo_box_menu_position_below (GtkMenu *menu,
gint *push_in,
gpointer user_data)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
gint sx, sy;
GtkWidget *child;
GtkRequisition req;
GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
GdkScreen *screen;
gint monitor_num;
GdkRectangle monitor;
/* FIXME: is using the size request here broken? */
child = GTK_BIN (combo_box)->child;
gdk_window_get_origin (child->window, &sx, &sy);
if (GTK_WIDGET_NO_WINDOW (child))
{
sx += child->allocation.x;
sy += child->allocation.y;
}
gtk_widget_size_request (GTK_WIDGET (menu), &req);
if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_LTR)
*x = sx;
else
*x = sx + child->allocation.width - req.width;
*y = sy + child->allocation.height;
if (GTK_WIDGET_NO_WINDOW (child))
{
*x += child->allocation.x;
*y += child->allocation.y;
}
*y = sy;
screen = gtk_widget_get_screen (GTK_WIDGET (combo_box));
monitor_num = gdk_screen_get_monitor_at_window (screen,
GTK_WIDGET (combo_box)->window);
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
if (*x < monitor.x)
*x = monitor.x;
else if (*x + req.width > monitor.x + monitor.width)
*x = monitor.x + monitor.width - req.width;
if (*y + child->allocation.height + req.height <= monitor.y + monitor.height)
*y += child->allocation.height;
else
*y -= req.height;
*push_in = TRUE;
}