GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Oct 01, 2014 4:03 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: gdk_event_put not working on gtkcombobox widget
PostPosted: Fri Apr 25, 2014 7:26 am 
Offline
Familiar Face

Joined: Thu Nov 01, 2012 5:48 am
Posts: 30
Hello All ,
I want to send button-press / button release event on Gtk combobox widget.
I tried with the below snippet . It is working fine on gtk button / gtk combo box bar . But it is not working on gtkcombo box list.

GdkEvent* gdkButtonEvent = gdk_event_new(GDK_BUTTON_PRESS);
int x=0 ;
int y=0;
int origin_x=0;
int origin_y=0;
gdkButtonEvent->button.type = GDK_BUTTON_PRESS ;
GdkDisplay *dpy = gdk_display_get_default();
GdkDeviceManager *mgr = gdk_display_get_device_manager(dpy);
gdkButtonEvent->button.window=gdk_device_get_window_at_position(gdk_device_manager_get_client_pointer(mgr), &x, &y);
g_object_ref(gdkButtonEvent->button.window);
gdkButtonEvent->button.time = GDK_CURRENT_TIME;
gdkButtonEvent->button.x = x;
gdkButtonEvent->button.y = y;
gdk_window_get_origin(gdkButtonEvent->button.window, &origin_x, &origin_y);
gdkButtonEvent->button.x_root = x; //+ origin_x;
gdkButtonEvent->button.y_root = y; // + origin_y;
gdkButtonEvent->button.axes = 0;//NULL;
gdkButtonEvent->button.state = (GdkModifierType)GDK_BUTTON1_MASK;
gdkButtonEvent->button.button = 1;//Button1;
gdkButtonEvent->button.device = 0;
gdkButtonEvent->button.send_event = FALSE;
gdk_event_put(gdkButtonEvent);
gdk_event_free(gdkButtonEvent);

GdkEvent* gdkButtonEvent1 = gdk_event_new(GDK_BUTTON_RELEASE);
gdkButtonEvent1->button.type = GDK_BUTTON_RELEASE ;
gdkButtonEvent1->button.window=gdk_device_get_window_at_position(gdk_device_manager_get_client_pointer(mgr), &x, &y);
g_object_ref(gdkButtonEvent1->button.window);
gdkButtonEvent1->button.time = GDK_CURRENT_TIME;
gdkButtonEvent1->button.x = x;
gdkButtonEvent1->button.y = y;
gdk_window_get_origin(gdkButtonEvent1->button.window, &origin_x, &origin_y);
gdkButtonEvent1->button.x_root = x; //+ origin_x;
gdkButtonEvent1->button.y_root = y;// + origin_y;
gdkButtonEvent1->button.axes = 0;//NULL;
gdkButtonEvent1->button.state = (GdkModifierType)GDK_BUTTON1_MASK;
gdkButtonEvent1->button.button = 1;//Button1;
gdkButtonEvent1->button.device = 0;
gdkButtonEvent1->button.send_event = FALSE;


gdk_event_put(gdkButtonEvent1);
gdk_event_free(gdkButtonEvent1);

Please tell , if I did anything wrong .

Thanks and Regards
Hkishn


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 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