GNOME Bugzilla – Bug 108511
gtk_grab_add/remove isn't wrapped
Last modified: 2004-12-22 21:47:04 UTC
gtk_grab_add and friends aren't wrapped. In gtkmm/main.{cc,h}g they are commented out, unfortunately with no explanation. I'm a bit unsure of why? It seems removing the commentary signs would work fine.
I would expect them to be in Gtk::Widget as grab_add() and grab_remove(). Feel free to patch gtkmm 2.4. But please do grep to make sure we haven't wrapped them somewhere else.
I've grepped the source and they aren't wrapped. In fact, examples/cellrenderercustom/cellrendererpopup.cc is using gtk_grab_add. I will fix that too. I can see that it makes some sense to put grab_add/remove in Gtk::Widget, but what to do with gtk_grab_get_current? GtkWidget* gtk_grab_get_current (void); Queries the current grab. A static method in Widget that returns Widget *? BTW, as Danish translator of Gnome I do have CVS write access in case it is easier for you that way.
> but what to do with gtk_grab_get_current? > GtkWidget* gtk_grab_get_current (void); > A static method in Widget that returns Widget *? Yes, it doesn't seem perfect, but I suppose that's OK. Please post the patch here (for the gtkmm 2.4 module - "gtkmm") and then I'll probably ask you to apply it.
An example would be nice too.
Note that the latest version of Inti has something similar (I'm 99% sure that he tracks our ChangeLog and mailing lists instead of just contributing to gtkmm.) so that might help too.
OK. I do apology that I haven't provided a patch yet, but I have been extremely busy. Also, my build problem persists. But apparently I can fix that by running "autoconf" manually. However, now glibmm refused to build. :-( g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../glib -I/usr/lib/sigc++-1.2/include -I/usr/include/sigc++-1.2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -pedantic -W -Wall -Werror -c generate_defs_glib.cc cc1plus: warnings being treated as errors generate_defs_glib.cc: In function `int main(int, char**)': generate_defs_glib.cc:26: warning: unused parameter `int argc' generate_defs_glib.cc:26: warning: unused parameter `char**argv' make[3]: *** [generate_defs_glib.o] Fejl 1 make[3]: Leaving directory `/home/ole/cvs/glibmm/tools/extra_defs_gen' make[2]: *** [all-recursive] Fejl 1 make[2]: Leaving directory `/home/ole/cvs/glibmm/tools' make[1]: *** [all-recursive] Fejl 1 make[1]: Leaving directory `/home/ole/cvs/glibmm' make: *** [all-recursive-am] Fejl 2 I will try to reserve some time this week-end to get this bug closed.
> Also, my build problem persists. But apparently I can > fix that by running "autoconf" manually. If you have a build problem then please discuss it on the list. I don't where your information comes from. autogen.sh should work. > cc1plus: warnings being treated as errors > generate_defs_glib.cc: In function `int main(int, char**)': > generate_defs_glib.cc:26: warning: unused parameter `int argc' It's strange that only you see this, but I haven't built glibmm 2.4 for a while. It shoudl be easy to fix - just take away the parameter names from the main() declaration.
I'm attaching a patch that puts the grab_add/-remove and get_current functionality in Gtk::Widget and changes the cellrenderer example to use the wrapped methods. I called the methods add_modal_grab/remove_modal_grab and get_current_modal_grab in an attempt to be less confusing. There's no specific example yet. Would a window with one button that said, "Press to grab a key", and then grabbed and wrote the key in a label be fine? That is just about what I'm using the grabbing for myself.
Created attachment 15670 [details] [review] Adds wrappers of the functionality
I think my comment about Inti was about some other completely-unrelated unwrapped GTK+ methods, so don't worry about the specific example. This looks perfect, but please patch the ChangeLog so I can just mark this as approved and ready to be committed.
Forgot that. New patch attached with diff of ChangeLog also.
Created attachment 15678 [details] [review] Patch for ChangeLog too
Great. This should be applied to gtkmm 2.4.
I've committed the changes to CVS now.