GNOME Bugzilla – Bug 707254
X11 dependencies do not allow for compilation in a gtk3-quartz backend environment
Last modified: 2015-02-14 15:17:40 UTC
The current version of yelp available for testing on MacPorts is 3.8.1, and it includes the following code that prevents compilation in an environment where gtk3 has been configured to use the native quartz backend, rather than X11. To my knowledge, it compiles and runs fine under the default X11 gtk3 configuration though. I was able to make a patch that allows yelp to build, install and run on gtk3-quartz, and I hope that you will review it and consider integrating it into the yelp source if you are able to do so. The first build failure is in libyelp/yelp-view.c, which specifies #include <gdk/gdkx.h>, yet simply removing the header for gtk3-quartz is sufficient to compile without further error. The second failure is in src/yelp-application.c, which specifies the following code, and has done so since the 2.x series: gtk_widget_show_all (GTK_WIDGET (window)); /* Metacity no longer does anything useful with gtk_window_present */ gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); if (gdk_window) gdk_x11_window_move_to_current_desktop (gdk_window); /* Ensure we actually present the window when invoked from the command * line. This is somewhat evil, but the minor evil of Yelp stealing * focus (after you requested it) is outweighed for me by the major * evil of no help window appearing when you click Help. */ if (data->timestamp == 0) data->timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window))); gtk_window_present_with_time (GTK_WINDOW (window), data->timestamp); However, since the gtk3-quartz environment does not use X11 it fails, and does not need metacity. The following line gets the app to compile and run on OS X: gtk_widget_show_all (GTK_WIDGET (window)); gtk_window_present (GTK_WIDGET (window)); I have included both changes in .diff format. I hope that you will be able to incorporate these changes quickly in a manner not disruptive to the needs of people using X11.
Created attachment 253798 [details] [review] fixes gtk_window_present for gtk3-quartz
Created attachment 253800 [details] [review] removes gdk header
If it helps, webkit-gtk uses a preprocessor directive, #if PLATFORM(X11), to get around the fact that webkit-gtk and gtk3 can be compiled on OS X to use either the native quartz backend, or the x11 environment.
Actually, I was browsing through the gdk source, and came across the fact that gdk/gdkx.h is specifically in the X11 backend directory, with gdk/gdkquartz.h, in the Quartz backend and so forth. There is also a generic gdk/gdk.h that seems to define more generally the same things in the backend specific ones. I am not versed at all in gtk+ coding, but my question/point is, is it possible to use the gdk.h header in place of gdkx.h? Or if it is not actually necessary, just remove them from the source?
Additionally, I came across this in the GTK documentation: https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-present-with-time They recommend using GTimer instead of X11 timestamps, which would also be good, as it gets rid of the direct X11 references. The currently supplied patches that I gave work, but it again puts the yelp window behind the current app window. Perhaps GTimer would fix it.
My humble appologies, I had the wrong page for the documentation regarding gtk_window_present_with_time, it is supposed to be: https://developer.gnome.org/gtk3/stable/ch25s02.html#id-1.6.3.4.9
Finally, the code still exists in the latest publicly available xz bundles.
Created attachment 255004 [details] [review] fixes gtk_window_present for gtk3-quartz Ok, I think I have a real solution now. I replaced the X11 timestamp code with a call to gtk_window_present_with_time (GTK_WIDGET (window), GDK_CURRENT_TIME). It seems to work fine for me now, I hope that you will find so as well.
This is the same type of bug as 708181
The patch in bu 708181 was applied some time ago, so this should be fixed. *** This bug has been marked as a duplicate of bug 708181 ***