Dom, 2006-05-28 às 21:01 +0100, Magnus Therning escreveu: > On Sun, May 28, 2006 at 12:31:14PM +0100, Gustavo J. A. M. Carneiro wrote: > >Sáb, 2006-05-27 às 21:56 +0100, Magnus Therning escreveu: > >> I can't figure out why wnck.Window.get_geometry isn't in the python > >> bindings. > >> > >> wnck.defs contains the following > >> > >> (define-method get_geometry > >> (of-object "WnckWindow") > >> (c-name "wnck_window_get_geometry") > >> (return-type "none") > >> (parameters > >> '("int*" "xp") > >> '("int*" "yp") > >> '("int*" "widthp") > >> '("int*" "heightp") > >> ) > >> ) > >> > >> But that doesn't seem to result in the function turning up :-( > >> > >> I've only tested this on Debian Sid but I can't see any reason for it to > >> be distro specific. The following would check if it's there: > >> > >> import wnck, gtk > >> s = wnck.screen_get_default() > >> while gtk.events_pending(): gtk.main_iteration() > >> w = s.get_active_window() > >> print [f for f in dir(w) if f == 'get_geometry'] > >> > >> On my system that results in the printing of an empty list. > >> > >> Any pointers on how to fix this (I've not managed to find any docs on > >> pygtk-codegen-2.0 at all) would be much appreciated. > > > > You can start by opening a bug report on gnome bugzilla, product > >gnome-python-desktop. Thanks. > > Not really the hands on answer I was hoping for ;-) I was hoping to get > some pointers so I can file the bug report with a patch... I'll just go > ahead and report it and then look into making a patch.
Ok, ok... Here's how I'd solve it: 1. comment out the int* parameters in the defs; 2. compile; it's going to fail, of course; 3. go to the generated C file, look for the wrapper, copy it 4. go to the .override file, add something like %% override wnck_window_get_geometry noargs <paste the wrapper here> 5. Edit the wrapper a) declare a few int variables, pass the missing arguments by taking a reference to the variables, like &x, &y, &width, &height b) replace the Py_None return block with return Py_BuildValue("iiii", x, y, width, height); 6. Uncomment back the parameters in the .defs 7. Compile, test, submit the patch Good luck :-) -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> The universe is always one step beyond logic _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/