new function gdisplay_origin_menu_position() which positions the menu

2000-09-14  Michael Natterer  <mitch@gimp.org>

	* app/disp_callbacks.c: new function gdisplay_origin_menu_position()
	which positions the menu right of the arrow instead of underneath
	the mouse (where you always have the first entry selected, which
	is annoying).
This commit is contained in:
Michael Natterer 2000-09-14 14:53:06 +00:00 committed by Michael Natterer
parent 13a1ac6f3d
commit 9d4e8b7d27
4 changed files with 70 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2000-09-14 Michael Natterer <mitch@gimp.org>
* app/disp_callbacks.c: new function gdisplay_origin_menu_position()
which positions the menu right of the arrow instead of underneath
the mouse (where you always have the first entry selected, which
is annoying).
2000-09-07 Tor Lillqvist <tml@iki.fi>
* plug-ins/common/ps.c: Use fopen (xxx, "rb") on all systems. It

View File

@ -672,6 +672,24 @@ gdisplay_vruler_button_press (GtkWidget *widget,
return FALSE;
}
static void
gdisplay_origin_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gpointer data)
{
GtkWidget *origin;
gint origin_x;
gint origin_y;
origin = (GtkWidget *) data;
gdk_window_get_origin (origin->window, &origin_x, &origin_y);
*x = origin_x + origin->allocation.x + origin->allocation.width;
*y = origin_y + origin->allocation.y + origin->allocation.height / 2;
}
gint
gdisplay_origin_button_press (GtkWidget *widget,
GdkEventButton *event,
@ -683,7 +701,9 @@ gdisplay_origin_button_press (GtkWidget *widget,
{
gdisp = data;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL, NULL, NULL, 1, event->time);
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
}
/* Stop the signal emission so the button doesn't grab the

View File

@ -672,6 +672,24 @@ gdisplay_vruler_button_press (GtkWidget *widget,
return FALSE;
}
static void
gdisplay_origin_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gpointer data)
{
GtkWidget *origin;
gint origin_x;
gint origin_y;
origin = (GtkWidget *) data;
gdk_window_get_origin (origin->window, &origin_x, &origin_y);
*x = origin_x + origin->allocation.x + origin->allocation.width;
*y = origin_y + origin->allocation.y + origin->allocation.height / 2;
}
gint
gdisplay_origin_button_press (GtkWidget *widget,
GdkEventButton *event,
@ -683,7 +701,9 @@ gdisplay_origin_button_press (GtkWidget *widget,
{
gdisp = data;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL, NULL, NULL, 1, event->time);
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
}
/* Stop the signal emission so the button doesn't grab the

View File

@ -672,6 +672,24 @@ gdisplay_vruler_button_press (GtkWidget *widget,
return FALSE;
}
static void
gdisplay_origin_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gpointer data)
{
GtkWidget *origin;
gint origin_x;
gint origin_y;
origin = (GtkWidget *) data;
gdk_window_get_origin (origin->window, &origin_x, &origin_y);
*x = origin_x + origin->allocation.x + origin->allocation.width;
*y = origin_y + origin->allocation.y + origin->allocation.height / 2;
}
gint
gdisplay_origin_button_press (GtkWidget *widget,
GdkEventButton *event,
@ -683,7 +701,9 @@ gdisplay_origin_button_press (GtkWidget *widget,
{
gdisp = data;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL, NULL, NULL, 1, event->time);
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
}
/* Stop the signal emission so the button doesn't grab the