Fwd: Simulate button press events
Sorry but the discussion was accidentally become private. -- Forwarded message -- From: Matteo Landi Date: Sat, Dec 26, 2009 at 4:51 PM Subject: Re: Simulate button press events To: Michael Libby On Sat, Dec 26, 2009 at 3:22 PM, Michael Libby wrote: > On Thu, Dec 24, 2009 at 6:39 PM, Matteo Landi wrote: > >> as the subject says, I'm trying to synthesize mouse clicks over the >> focused window (which is now owned by my application). Looking around >> it seems that gtk offers only a way to move the cursor >> (gdk_display_warp_pointer) but there is anything related to button >> press. For the moment I'm using xlib for such a purpose, but I was >> wondering if I could accompish my task only making use of gtk. > > For testing? There might be less fragile ways to interact with your UI > for testing purposes. Setting specific x,y coordinates in your test > code for mouse clicks may break if the layout of the UI changes. > > Simulating user interaction visually? Still fragile, but more worth > the effort since you will already be computing the path the mouse > needs to travel. Well I'am creating to create a game sovler. Once my window is placed over the grid of the game, the application starts to take shots of the display, and move the mouse and clicks over the grid depending on the content of the shot. > > In any case: Did you look at gdk_display_put_event () with a > GdkEventButton? This has the ability to send type of mouse click, > modifier keys, and x,y coords. I'm reading its documentation right now, but it seems not work even tought it's possible I'm using it wrong. Indeed when I create an event I should insert the window which is going to receive the event: what is it in my particular case? is the gdk_display_put_event going to override this field inside my event object? Here is the code I'm trying (python): def fake_button_press_event(self, x, y): event = gdk.Event(gdk.BUTTON_PRESS) event.x = 500. event.y = 500. event.button = 1 gtk.gdk.display_get_default().put_event(event) Thanks in advance. > -- > Michael C. Libby > www.mikelibby.com > -- Matteo Landi http://www.matteolandi.net/ -- Matteo Landi http://www.matteolandi.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Random memory allocation error
At what appears to be random locations in a program which runs thought 24000 components, and breaking out the formulas in to there raw material components (formulations table of about 200,000 formulation lines, I see this error message: malloc: *** error for object 0xe41074: incorrect checksum for freed object - object was probably modified after being freed.*** set a breakpoint in malloc_error_break to debug so far I have only found some obscure references, and this is happening randomly: IE #0 0x95f95072 in malloc_error_break ()#1 0x95f96218 in szone_error ()#2 0x95f9638b in free_list_checksum_botch ()#3 0x95ea2985 in tiny_malloc_from_free_list ()#4 0x95ea1b03 in szone_malloc_should_clear ()#5 0x95ea1988 in malloc_zone_malloc ()#6 0x95e9fa58 in malloc ()#7 0x00c2a799 in g_malloc ()#8 0x00ba774d in g_object_newv ()#9 0x00ba7ef7 in g_object_new_valist ()#10 0x00ba758f in g_object_new ()#11 0x000a8468 in isi_database_get_component_simple (self=0x101c000, aid=0x2008030 "ZH", nid=90005) at isidatabase.c:4296 but it has run through the same piece of code with no problems for 30 times before it hits this. continue, and it will go past this part and break , #0 0x95f95072 in malloc_error_break ()#1 0x95f96218 in szone_error ()#2 0x95f9638b in free_list_checksum_botch ()#3 0x95ea2985 in tiny_malloc_from_free_list ()#4 0x95ea1b03 in szone_malloc_should_clear ()#5 0x95ea386b in malloc_zone_calloc ()#6 0x95ea37fa in calloc ()#7 0x00c2a82a in g_malloc0 ()#8 0x00053030 in isi_list_instance_init (instance=0x185f190, g_class=0xe1a850) at isilist.c:96#9 0x00bc196c in g_type_create_instance ()#10 0x00ba832a in g_object_constructor ()#11 0x00ba7726 in g_object_newv ()#12 0x00ba7ef7 in g_object_new_valist ()#13 0x00ba758f in g_object_new ()#14 0x0005b647 in isi_component_instance_init (instance=0x180e020, g_class=0x13a12070) at isicomponent.c:156#15 0x00bc196c in g_type_create_instance ()#16 0x00ba832a in g_object_constructor ()#17 0x00ba7a5e in g_object_newv ()#18 0x00ba7ef7 in g_object_new_valist ()#19 0x00ba758f in g_object_new ()#20 0x000a8468 in isi_database_get_component_simple (self=0x101c000, aid=0x20081b0 "ZH", nid=90004) at isidatabase.c:4296#21 0xcd36 in isi_util_normalize_formuals (theApp=0x1016010, prompt=1) at isiutil.c:368#22 0xd67f in main (argc=1, argv=0xbfffe848) at isiutil.c:764 EMAILING FOR THE GREATER GOOD Join me ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Random memory allocation error
On Sat, 26 Dec 2009, Shawn Bakhtiar wrote: > At what appears to be random locations in a program which runs > thought 24000 components, and breaking out the formulas in to > there raw material components (formulations table of about > 200,000 formulation lines, I see this error message: > > malloc: *** error for object 0xe41074: incorrect checksum for > freed object - object was probably modified after being > freed.*** Your code is buggy. Run it under valgrind and you'll see where the bugs are. Allin Cottrell ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: Random memory allocation error
Nailed it on the head. bad programing. I forgot how wonderful valgrind is, thanks. EMAILING FOR THE GREATER GOOD Join me > Date: Sat, 26 Dec 2009 13:52:06 -0500 > From: cottr...@wfu.edu > To: shashan...@hotmail.com > CC: gtk-app-devel-list@gnome.org; gtk-osx-us...@lists.sourceforge.net > Subject: Re: Random memory allocation error > > > On Sat, 26 Dec 2009, Shawn Bakhtiar wrote: > > > At what appears to be random locations in a program which runs > > thought 24000 components, and breaking out the formulas in to > > there raw material components (formulations table of about > > 200,000 formulation lines, I see this error message: > > > > malloc: *** error for object 0xe41074: incorrect checksum for > > freed object - object was probably modified after being > > freed.*** > > Your code is buggy. Run it under valgrind and you'll see where > the bugs are. > > Allin Cottrell ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list