I have a GtkMenu Widget and i am adding it to screen on button click,, but it gets added at mouse location but i want to add it to end edge of button widget like,
+-------+
|BUTTON |
+-------+
+------------+
|Menu Item 1 |
|Menu Item 2 |
+------------+
I am using following code to add popup menu
// Add popup menu.
gtk_menu_popup( GTK_MENU (widget), NULL, NULL, NULL, NULL,
bevent->button, bevent->time);
Ok added this function but popup menu gets added to end of window not at the end of button widget...
void set_position (GtkMenu *menu, gint *px, gint *py, gboolean *push_in, gpointer data)
{
gint w, h;
GtkBuilder *builder = GetBuilderPointer();
GtkWidget *button = GTK_WIDGET( gtk_builder_get_object( builder, "button_presence"));
gdk_window_get_size (button->window, &w, &h);
gdk_window_get_origin (button->window, px, py);
*py = h;
printf("\n\n w[%d] h[%d] px[%d] py[%d]\n\n", w, h, *px, *py );
*push_in = TRUE;
}
Printf gives output like follows,
w[350] h[400] px[341] py[607]
i am not able to retrieve x, y, height, width of button widget...
Note: This button is a custom widget with (GtkHBox+(GtkImage+GtkLabel)) in it.
thanks unwind for your answer.