After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707254 - X11 dependencies do not allow for compilation in a gtk3-quartz backend environment
X11 dependencies do not allow for compilation in a gtk3-quartz backend enviro...
Status: RESOLVED DUPLICATE of bug 708181
Product: yelp
Classification: Applications
Component: General
git master
Other Mac OS
: Normal normal
: ---
Assigned To: Yelp maintainers
Yelp maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-02 01:53 UTC by c.herbig
Modified: 2015-02-14 15:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fixes gtk_window_present for gtk3-quartz (1.21 KB, patch)
2013-09-02 01:54 UTC, c.herbig
none Details | Review
removes gdk header (291 bytes, patch)
2013-09-02 01:57 UTC, c.herbig
none Details | Review
fixes gtk_window_present for gtk3-quartz (1.26 KB, patch)
2013-09-16 07:38 UTC, c.herbig
none Details | Review

Description c.herbig 2013-09-02 01:53:57 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.
Comment 1 c.herbig 2013-09-02 01:54:41 UTC
Created attachment 253798 [details] [review]
fixes gtk_window_present for gtk3-quartz
Comment 2 c.herbig 2013-09-02 01:57:28 UTC
Created attachment 253800 [details] [review]
removes gdk header
Comment 3 c.herbig 2013-09-08 01:22:53 UTC
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.
Comment 4 c.herbig 2013-09-10 00:29:56 UTC
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?
Comment 5 c.herbig 2013-09-14 05:09:38 UTC
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.
Comment 6 c.herbig 2013-09-14 06:21:21 UTC
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
Comment 7 c.herbig 2013-09-14 06:23:15 UTC
Finally, the code still exists in the latest publicly available xz bundles.
Comment 8 c.herbig 2013-09-16 07:38:03 UTC
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.
Comment 9 c.herbig 2013-09-23 03:39:16 UTC
This is the same type of bug as 708181
Comment 10 David King 2015-02-14 15:17:40 UTC
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 ***