GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Nov 28, 2014 8:30 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: gtk_menu_popup problem
PostPosted: Tue Jun 24, 2008 9:32 am 
Offline
Familiar Face

Joined: Sun May 06, 2007 12:12 pm
Posts: 14
Hi all,

I have a application wish load plugin into it, the plugin when "button-press-event" is received they call a function of the main window and then the main window should popup a menu, but it doesn't, i have to click very fast on the plugin many times in order for the menu to be shown.

i call gtk_menu_popup like that

gtk_menu_popup(GTK_MENU(menu),NULL,NULL,
NULL,NULL,0,GDK_CURRENT_TIME);

or like this

gtk_menu_popup(GTK_MENU(menu),NULL,NULL,
NULL,NULL,0,gtk_get_current_event_time());


Any help please.

Best Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 24, 2008 8:59 pm 
Offline
Never Seen the Sunlight

Joined: Thu Jun 14, 2007 11:02 pm
Posts: 923
Location: Falun, WI USA
if it's in response to a button-press-event, try doing this:
Code:
gboolean button_press_cb(GtkWidget *wi, GdkEventButton *ev, gpointer data)
{
    /* ...initialize menu... */
    gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, ev->button, ev->time);
    return TRUE; /* this will stop the event, have it return FALSE to allow the click to go further */
}

the key difference here is that ev->time is used.
quoting from http://library.gnome.org/devel/gtk/stab ... menu-popup
Quote:
The activate_time parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the time stamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, gtk_get_current_event_time() can be used instead.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 25, 2008 8:26 am 
Offline
Familiar Face

Joined: Sun May 06, 2007 12:12 pm
Posts: 14
Thanks for the reply, actually i did that already and seems to be working fine, but i thought that passing gtk_get_current_event_time was enought.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot], Yahoo [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group