GNOME Bugzilla – Bug 754631
test-integration example not working out-of-the-box
Last modified: 2019-02-22 05:14:17 UTC
Created attachment 310743 [details] [review] logs icon change and set it at boot http://www.gtk.org/download/macos.php told me to report this bug for component mac-integration but since it does not exist I will report it there. If this is wrong, gtk-macosx-integration main page should be updated. test-integration.c is a great program to check what integration looks like on MacOSX. However; it does not work fully by default, not giving a good impression of Gtk. Here are few issues I encountered, with a patch attached. - using standard build chain: ./autogen.sh && make && ./src/test-integration-gtk2, dock icon is not working. First, because none is set by default. Secondly even when typing "change icon" button, it will not work because PREFIX is set to "None", so that when we search for a new icon it cannot find it. I attached a patch to: 1) log the new icon path when clicking the button so one can see "Setting dock icon to None/share/gtk-2.0/demo/gnome-calendar.png"... clearly stating that something is wrong 2) set icon when building the UI To make this work, you have to use ./autogen.sh --prefix <gtk prefix>... which is very poor UX imo. Either a png should be versioned directly in gtk-macosx-integration repository and use this one, OR gtk stock icons path should be automatically detected in configure.ac by default so that it **just** works. - when launching test-integration-gtk2, window do not grab the focus and one has to select it in the dock. Again, it's a bit poor UX here but I'm not sure about the fix so no patch. - if one clicks "Edit -> Emoji symbols", application freezes. - if one clicks "Edit -> start dictation", nothing happens. - if one clicks "Edit -> Copy" or "Edit -> Paste", nothing happens. - there is a "File -> Quit" option while it should not on macosx (already in "test-integration-gtk3 -> Quit test-integration-gtk3") - instead of logging action in console, it would be better to change the text label "Some window content here" so that users now what's going on... (for bounce action mainly) I would have loved a button "new notification" which trigger a notification + update the application badge count, but it seems latest part is not implemented yet. I will give it a try though. Since test-integration-gtk.c is the starting place to begin integration on macosx, it's too bad that it is not working properly/polished totally to give a nice overview of gtk on macosx (which works great actually).
Re-assigning to the gtk-mac-integration product.
Comment on attachment 310743 [details] [review] logs icon change and set it at boot In the first hunk, what's the point of exit(1), and having called exit() why any code after that? You're leaking pixbufs. Since every press of the button loads a new pixbuf you need to gdk_pixbuf_unref() the old one first... which you can't do because you don't have a pointer to it because you made it local. BTW, declaring variables in the middle of functions is a C11 feature, and Gtk+ needs to support C98. Calling a callback function outside of a signal handler is bad form.
Yeah actually the patch is made quickly to test that things worked on gtk mac integration - just skip the patch, it does not fix any issue properly. In the same time I do not think it's really worth than storing a static pixbuf for a code of demo; many people (at least me) will code their own software using the same techniques... except if this is not the aim in this program?
The aim of the program is primarily to test the functions in the library; it also serves as a simple example for developers. It's absolutely not a demo. PREFIX is set to $prefix in configure and it defaults to /usr/local. Dunno how you got "None". Since libgtkmacintegration supplements libgtk, it doen't really make sense that you'd use a different prefix from libgtk's. The Emoji & Symbols seems to work only in a bundled application, but when I tested it it did nothing, it didn't freeze. Start dictation brought up the "enable dictation" dialog box. Copy and Paste wrote their messages to the terminal just like they should. The focus after launch is normal Mac behavior. See bug 745931.
- OK, it's not a demo but it's still a good overview of how to code with Gtk - if this is standard to use static pixbuf when there are used only once, then let's keep the code like it is today - PREFIX is not set to $prefix in my case; ./configure shows me that configure is '/usr/local' but config.h contains '#define PREFIX "None"' so I guess this is the default value for both of them? I'm building with brew standards packets; do you reproduce this issue or should I investigate this more? - Emoji & Symbols hanging and all non-working Edit menu... I will investigate this a bit more, but can you confirm me that this should work even in non-bundled application (except for Emoji)? - Ok for focus, it makes sense actually. - Concerning "File -> Quit" option, do we agree this should be removed? - If I do a patch concerning: 'instead of logging action in console, it would be better to change the text label "Some window content here" so that users now what's going on... (for bounce action mainly)', will you consider it or this should stay as currently? I should have spitted this bug in multiples bugs actually. My bad.
(In reply to Gautier Pelloux-Prayer from comment #5) > - OK, it's not a demo but it's still a good overview of how to code with Gtk > - if this is standard to use static pixbuf when there are used only once, > then let's keep the code like it is today There's no standard, but since we're dealing with only one pixbuf ever it doesn't make a lot of sense to go get it from the filesystem every time you push the button... but if you do, you need to make sure to unref it when you're done with it so that it doesn't leak. > > - PREFIX is not set to $prefix in my case; ./configure shows me that > configure is '/usr/local' but config.h contains '#define PREFIX "None"' so I > guess this is the default value for both of them? I'm building with brew > standards packets; do you reproduce this issue or should I investigate this > more? That's an actual bug: I didn't realize that configure doesn't set $prefix = $ac_default_prefix until AC_OUTPUT(), which is of course too late for setting variables. Fixed in git. > > - Emoji & Symbols hanging and all non-working Edit menu... I will > investigate this a bit more, but can you confirm me that this should work > even in non-bundled application (except for Emoji)? I couldn't find anything on this in the Apple docs, so I have to assume that it works only in bundled apps. > > - Ok for focus, it makes sense actually. > > - Concerning "File -> Quit" option, do we agree this should be removed? No, it's useful when one doesn't want to engage the NSApplicationShouldQuit handler which makes you quit twice. > > - If I do a patch concerning: 'instead of logging action in console, it > would be better to change the text label "Some window content here" so that > users now what's going on... (for bounce action mainly)', will you consider > it or this should stay as currently? No. test-integration is for developers only -- and principally for developers of gtk-mac-integration itself. It's simple on purpose, and in particular the bounce action has proven brittle in the past and it's important that it's a live test. > > > I should have spitted this bug in multiples bugs actually. My bad. Since you've actually only found two bugs, most of the rest of your complaints would have just been closed as "not a bug". You've saved both of us time by keeping it all in one. Emmanuele beat me to fixing the obsolete bug link in the www.gtk.org page and I've fixed the configure bug in git, so I'll mark this resolved now. Please subscribe to gtk-osx-users-list@gnome.org and ask any further questions there.