Bug 117895 - [v2.1.2] GTK2 build fails for undefined GDK_IS_X11_DISPLAY
Summary: [v2.1.2] GTK2 build fails for undefined GDK_IS_X11_DISPLAY
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 118980
  Show dependency treegraph
 
Reported: 2013-06-21 14:44 PDT by Dominique Leuenberger
Modified: 2013-07-22 14:32 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.33 KB, patch)
2013-06-24 11:24 PDT, Dominique Leuenberger
no flags Details | Formatted Diff | Diff
Reformatted patch (replaced tabs with spaces) (1.35 KB, patch)
2013-06-24 13:13 PDT, Dominique Leuenberger
no flags Details | Formatted Diff | Diff
New version of patch - Reworked ChangeLog - added inclusion of autotoolsconfig.h (some defines moved there) (2.21 KB, patch)
2013-07-09 10:04 PDT, Dominique Leuenberger
no flags Details | Formatted Diff | Diff
New version, hopefully translated all comments into the right snippets. Patch build-tested with webkitgtk 2.1.3 / gtk2 2.24.19 (2.07 KB, patch)
2013-07-09 13:32 PDT, Dominique Leuenberger
no flags Details | Formatted Diff | Diff
Updated patch - addresses the style issues reported (2.06 KB, patch)
2013-07-09 13:44 PDT, Dominique Leuenberger
eflews.bot: commit-queue-
Details | Formatted Diff | Diff
Another round - taking mrobinson's comment into account, that code comment should be sentences... (2.10 KB, patch)
2013-07-10 09:34 PDT, Dominique Leuenberger
no flags Details | Formatted Diff | Diff
Next iteration of patch after review by mrobinson... (2.19 KB, patch)
2013-07-10 14:08 PDT, Dominique Leuenberger
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique Leuenberger 2013-06-21 14:44:26 PDT
Trying to build webkitgtk 2.1.2 for GTK2 fails with

[ 1578s] Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp: In function 'WTF::OwnPtr<WebCore::WidgetBackingStore> WebKit::createBackingStore(GtkWidget*, const WebCore::IntSize&)':
[ 1578s] Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp:111:35: error: 'GDK_IS_X11_DISPLAY' was not declared in this scope
[ 1580s] make[1]: *** [Source/WebKit/gtk/WebCoreSupport/libwebkitgtk_1_0_la-ChromeClientGtk.lo] Error 1
[ 1580s] make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/webkitgtk-2.1.2'
[ 1580s] make: *** [all] Error 2
[ 1580s] error: Bad exit status from /var/tmp/rpm-tmp.MOddiR (%build)

(A full build log can be found at https://build.opensuse.org/package/live_build_log?arch=x86_64&package=webkitgtk&project=home%3Adimstar%3Abranches%3AGNOME%3AFactory&repository=openSUSE_Factory )

GDK_IS_X11_DISPLAY is not defined in GTK+ 2.x.
Comment 1 Dominique Leuenberger 2013-06-24 11:24:57 PDT
Created attachment 205313 [details]
Patch
Comment 2 WebKit Commit Bot 2013-06-24 11:26:09 PDT
Attachment 205313 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit/gtk/ChangeLog', u'Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp']" exit_code: 1
Source/WebKit/gtk/ChangeLog:4:  Line contains tab character.  [whitespace/tab] [5]
Source/WebKit/gtk/ChangeLog:5:  Line contains tab character.  [whitespace/tab] [5]
Source/WebKit/gtk/ChangeLog:6:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 3 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Dominique Leuenberger 2013-06-24 13:13:37 PDT
Created attachment 205319 [details]
Reformatted patch (replaced tabs with spaces)
Comment 4 Alberto Garcia 2013-07-01 09:22:26 PDT
Thanks for the patch!

Can you please rework a bit the ChangeLog entry? I should be
something like this:

   Bug Title
   Bug URL

   Reviewed by NOBODY (OOPS!).

   Long description.

   * WebCoreSupport/ChromeClientGtk.cpp:

About the change itself, I think it's fine. As a minor thing, you can
also put everything in one line, e.g.

   #if defined(GDK_WINDOWING_X11) && !defined(GDK_IS_X11_DISPLAY)
   ...

I think it would be a good idea to have all the compatibility code
together in the same file, but we don't have that at the moment.
Comment 5 Dominique Leuenberger 2013-07-09 10:04:58 PDT
Created attachment 206333 [details]
New version of patch - Reworked ChangeLog - added inclusion of autotoolsconfig.h (some defines moved there)
Comment 6 Martin Robinson 2013-07-09 10:11:25 PDT
Comment on attachment 206333 [details]
New version of patch - Reworked ChangeLog - added inclusion of autotoolsconfig.h (some defines moved there)

View in context: https://bugs.webkit.org/attachment.cgi?id=206333&action=review

> Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp:106
> +// GTK 2.0 compatibility
> +#ifdef GDK_WINDOWING_X11 && !defined(GDK_IS_X11_DISPLAY)
> +#define GDK_IS_X11_DISPLAY(dpy) 1
> +#endif

This should probably go into GtkVersioning.h.
Comment 7 Alberto Garcia 2013-07-09 10:14:54 PDT
Why do you need to include autotoolsconfig.h ? You shouldn't include
it directly anyway, use config.h instead.
Comment 8 Alberto Garcia 2013-07-09 10:16:10 PDT
(In reply to comment #6)
> This should probably go into GtkVersioning.h.

You're right, I overlooked that file.
Comment 9 Dominique Leuenberger 2013-07-09 10:28:24 PDT
Thanks for your comments guys...

anyway, version 2.1.3 (recently released) has now even more issues... so this patch has been rendered useless already :)

I'll try to fix up the build of 2.1.3... then we can try to fixup 'formatting' for inclusion into the svn tree. I'll work based on your comments.
Comment 10 Dominique Leuenberger 2013-07-09 13:32:20 PDT
Created attachment 206349 [details]
New version, hopefully translated all comments into the right snippets. Patch build-tested with  webkitgtk 2.1.3 / gtk2 2.24.19

Build failures addressed in new patch:

1)
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp:749:58: error: 'gtk_widget_get_preferred_size' was not declared in this scope
     gtk_widget_get_preferred_size(widget, &requisition, 0);


2)
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp: In function 'WTF::PassOwnPtr<WebCore::WidgetBackingStore> WebKit::createBackingStore(GtkWidget*, const WebCore::IntSize&)':
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp:111:35: error: 'GDK_IS_X11_DISPLAY' was not declared in this scope
     if (GDK_IS_X11_DISPLAY(display))

3)
In file included from Source/WebCore/plugins/gtk/gtk2xtbin.c:47:0:
Source/WebCore/plugins/gtk/gtk2xtbin.h:45:22: fatal error: gtk/gtkx.h: No such file or directory
 #include <gtk/gtkx.h>
                      ^
Comment 11 WebKit Commit Bot 2013-07-09 13:33:16 PDT
Attachment 206349 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/gtk/GtkVersioning.h', u'Source/WebCore/plugins/gtk/gtk2xtbin.h']" exit_code: 1
Source/WebCore/platform/gtk/GtkVersioning.h:44:  Missing space after ,  [whitespace/comma] [3]
Source/WebCore/platform/gtk/GtkVersioning.h:46:  Tab found; better to use spaces  [whitespace/tab] [1]
Source/WebCore/platform/gtk/GtkVersioning.h:46:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WebCore/plugins/gtk/gtk2xtbin.h:43:  Header file should not contain WebCore config.h. Should be: alphabetically sorted.  [build/include_order] [4]
Total errors found: 4 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Dominique Leuenberger 2013-07-09 13:37:20 PDT
(In reply to comment #11)
> Attachment 206349 [details] did not pass style-queue:
> 
> Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/gtk/GtkVersioning.h', u'Source/WebCore/plugins/gtk/gtk2xtbin.h']" exit_code: 1
> Source/WebCore/platform/gtk/GtkVersioning.h:44:  Missing space after ,  [whitespace/comma] [3]
> Source/WebCore/platform/gtk/GtkVersioning.h:46:  Tab found; better to use spaces  [whitespace/tab] [1]
> Source/WebCore/platform/gtk/GtkVersioning.h:46:  Extra space before ( in function call  [whitespace/parens] [4]

Ok, those three I can easily address

> Source/WebCore/plugins/gtk/gtk2xtbin.h:43:  Header file should not contain WebCore config.h. Should be: alphabetically sorted.  [build/include_order] [4]
> Total errors found: 4 in 3 files

??? That contradicts what was said earlier
Comment 13 Dominique Leuenberger 2013-07-09 13:44:29 PDT
Created attachment 206350 [details]
Updated patch - addresses the style issues reported

Sorry for the many iterations.
Comment 14 EFL EWS Bot 2013-07-09 13:48:39 PDT
Comment on attachment 206350 [details]
Updated patch - addresses the style issues reported

Attachment 206350 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/984271
Comment 15 Dominique Leuenberger 2013-07-10 09:34:15 PDT
Created attachment 206394 [details]
Another round - taking mrobinson's comment into account, that code comment should be sentences...

Let's see what else we can fix :)
Comment 16 Martin Robinson 2013-07-10 10:11:28 PDT
Comment on attachment 206394 [details]
Another round - taking mrobinson's comment into account, that code comment should be sentences...

View in context: https://bugs.webkit.org/attachment.cgi?id=206394&action=review

> Source/WebCore/platform/gtk/GtkVersioning.h:53
> +#if defined(GDK_WINDOWING_X11) && !defined(GDK_IS_X11_DISPLAY)
> +#define GDK_IS_X11_DISPLAY(dpy) 1
> +#endif
> +

Perhaps this should be 
#if defined(GDK_WINDOWING_X11) && !defined(GDK_IS_X11_DISPLAY)
#define GDK_IS_X11_DISPLAY(display) 1
#else
#define GDK_IS_X11_DISPLAY(display) 0
#endif

for Windows and Mac?
Comment 17 Dominique Leuenberger 2013-07-10 12:45:49 PDT
(In reply to comment #16)
> (From update of attachment 206394 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=206394&action=review
> 
> > Source/WebCore/platform/gtk/GtkVersioning.h:53
> > +#if defined(GDK_WINDOWING_X11) && !defined(GDK_IS_X11_DISPLAY)
> > +#define GDK_IS_X11_DISPLAY(dpy) 1
> > +#endif
> > +
> 
> Perhaps this should be 
> #if defined(GDK_WINDOWING_X11) && !defined(GDK_IS_X11_DISPLAY)
> #define GDK_IS_X11_DISPLAY(display) 1
> #else
> #define GDK_IS_X11_DISPLAY(display) 0
> #endif
> 
> for Windows and Mac?

Maybe... I honestly would not know if that's the right behavior or what the consequences are in this case :(

Question would probably be: are there webkit2/gtk2 windows/mac builds (I guess yes.. but then, seeing on how long and how often Gtk2 builds fail, I'm not sure)
Comment 18 Martin Robinson 2013-07-10 12:51:21 PDT
(In reply to comment #17)

> Question would probably be: are there webkit2/gtk2 windows/mac builds (I guess yes.. but then, seeing on how long and how often Gtk2 builds fail, I'm not sure)


Well for sure there's no WebKit2 support for GTK+ 2 at all. WebKit1 works on both Windows and Mac (at various points in time). There is a small group of people who actively fix problems with Windows. I've pointed them here.
Comment 19 Kalev Lember 2013-07-10 13:58:42 PDT
(In reply to comment #17)
> (In reply to comment #16)
> > Perhaps this should be 
> > #if defined(GDK_WINDOWING_X11) && !defined(GDK_IS_X11_DISPLAY)
> > #define GDK_IS_X11_DISPLAY(display) 1
> > #else
> > #define GDK_IS_X11_DISPLAY(display) 0
> > #endif
> > 
> > for Windows and Mac?
> 
> Maybe... I honestly would not know if that's the right behavior or what the consequences are in this case :(

It should be fine to leave it undefined for other platforms.

In all the places that use it [1], GDK_IS_X11_DISPLAY() calls are always guarded with #ifdef GDK_WINDOWING_X11. As GTK+ 2 doesn't support multiple GDK backends, we can be sure that when GDK_WINDOWING_X11 is defined, it's an X11 build.

[1] ChromeClientGtk.cpp and BackingStoreCairo.cpp
Comment 20 Kalev Lember 2013-07-10 14:06:44 PDT
Perhaps it would make sense to surround the GTK+ 2 workarounds with

#ifdef GTK_API_VERSION_2
...
#endif

to make sure it's easy to find them when GTK+ 2 support gets removed in the future?
Comment 21 Dominique Leuenberger 2013-07-10 14:08:24 PDT
Created attachment 206413 [details]
Next iteration of patch after review by mrobinson...
Comment 22 WebKit Commit Bot 2013-07-10 15:39:59 PDT
Comment on attachment 206413 [details]
Next iteration of patch after review by mrobinson...

Clearing flags on attachment: 206413

Committed r152552: <http://trac.webkit.org/changeset/152552>
Comment 23 WebKit Commit Bot 2013-07-10 15:40:02 PDT
All reviewed patches have been landed.  Closing bug.
Comment 24 Carlos Garcia Campos 2013-07-15 10:18:07 PDT
Comment on attachment 206413 [details]
Next iteration of patch after review by mrobinson...

View in context: https://bugs.webkit.org/attachment.cgi?id=206413&action=review

> Source/WebCore/platform/gtk/GtkVersioning.h:56
> +// Define GDK_IS_X11_DISPLAY dummy for GTK+ 2.0 compatibility.
> +#ifndef GDK_IS_X11_DISPLAY
> +  #ifdef GDK_WINDOWING_X11
> +    #define GDK_IS_X11_DISPLAY(display) 1
> +  #else
> +    #define GDK_IS_X11_DISPLAY(display) 0
> +  #endif
> +#endif

I don't think this is the right fix, this depends on whether GDK_IS_X11_DISPLAY is defined at this point. GDK_IS_X11_DISPLAY is defined in gdk/gdkx.h in GTK+3 and that header is included in GtkVersioning.cpp. I think we should either check for a explicit version here or use GTK_API_VERSION_2 macro. This is causing compile warnings, see:

In file included from /home/cgarcia/src/git/WebKit/WebKitBuild/Dependencies/Root/include/gtk-3.0/gdk/gdkx.h:43:0,
                 from ../../Source/WebCore/platform/gtk/GtkVersioning.c:28:
/home/cgarcia/src/git/WebKit/WebKitBuild/Dependencies/Root/include/gtk-3.0/gdk/x11/gdkx11display.h:49:0: warning: "GDK_IS_X11_DISPLAY" redefined [enabled by default]
In file included from ../../Source/WebCore/platform/gtk/GtkVersioning.c:22:0:
../../Source/WebCore/platform/gtk/GtkVersioning.h:52:0: note: this is the location of the previous definition
Comment 25 Zan Dobersek 2013-07-22 13:27:22 PDT
(In reply to comment #24)
> (From update of attachment 206413 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=206413&action=review
> 
> > Source/WebCore/platform/gtk/GtkVersioning.h:56
> > +// Define GDK_IS_X11_DISPLAY dummy for GTK+ 2.0 compatibility.
> > +#ifndef GDK_IS_X11_DISPLAY
> > +  #ifdef GDK_WINDOWING_X11
> > +    #define GDK_IS_X11_DISPLAY(display) 1
> > +  #else
> > +    #define GDK_IS_X11_DISPLAY(display) 0
> > +  #endif
> > +#endif
> 
> I don't think this is the right fix, this depends on whether GDK_IS_X11_DISPLAY is defined at this point. GDK_IS_X11_DISPLAY is defined in gdk/gdkx.h in GTK+3 and that header is included in GtkVersioning.cpp. I think we should either check for a explicit version here or use GTK_API_VERSION_2 macro. This is causing compile warnings, see:
> 
> In file included from /home/cgarcia/src/git/WebKit/WebKitBuild/Dependencies/Root/include/gtk-3.0/gdk/gdkx.h:43:0,
>                  from ../../Source/WebCore/platform/gtk/GtkVersioning.c:28:
> /home/cgarcia/src/git/WebKit/WebKitBuild/Dependencies/Root/include/gtk-3.0/gdk/x11/gdkx11display.h:49:0: warning: "GDK_IS_X11_DISPLAY" redefined [enabled by default]
> In file included from ../../Source/WebCore/platform/gtk/GtkVersioning.c:22:0:
> ../../Source/WebCore/platform/gtk/GtkVersioning.h:52:0: note: this is the location of the previous definition

Bug #118980.