Hello every one,
I have added GtkMenu using following code:
// Add popup menu.
gtk_menu_popup( GTK_MENU (widget), NULL, NULL, set_position, NULL,
bevent->button, bevent->time);
And to adjust this GtkMenu under my button i have used this function:
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;
}
but popup is getting displayed at the end of the whole window not at the end of the button...
Out put of the printf:
w[350] h[400] px[341] py[607]
what is going wrong why it is not giving x, y and height, width of button correctly?
Note: The button widget used in this, is a custom composite widget with (GtkHBox+(GtkImage+GtkLabel)) in it.
I have tried same code with normal label button but still GtkMenu is getting displayed under root window not under button.
Why this might be happening... i am relay stuck on this...
thnaks,
PP