Bug 33486 - Upgrade 1.1.17->1.1.18 fails: GTK_WIDGET_TOPLEVEL' was not declared in this scope
Summary: Upgrade 1.1.17->1.1.18 fails: GTK_WIDGET_TOPLEVEL' was not declared in this ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Critical
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-11 12:39 PST by David Ronis
Modified: 2010-01-15 17:13 PST (History)
2 users (show)

See Also:


Attachments
Fix deprecated symbols to allow webkitgtk+ 1.1.18 to compile against gtk+-2.19.3. (5.76 KB, patch)
2010-01-12 13:33 PST, David Ronis
xan.lopez: review-
Details | Formatted Diff | Diff
Proposed patch (7.83 KB, patch)
2010-01-15 02:47 PST, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Proposed patch (8.05 KB, patch)
2010-01-15 02:54 PST, Alejandro G. Castro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Ronis 2010-01-11 12:39:54 PST
I'm trying to upgrade as mentioned in the summary.   The build fails with errors like:

GTK_WIDGET_TOPLEVEL' was not declared in this scope
WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp: In member function 'virtual void WebKit::ChromeClient::unfocus()':
WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp:109: error: 'GTK_WIDGET_TOPLEVEL' was not declared in this scope

I'm running with gtk+-2.19.3 (1.1.17 was built against 2.19.2).
Comment 1 David Ronis 2010-01-11 12:46:43 PST
The problem is gtk+ related.  I tried rebuilding 1.1.17.  It now fails with similar errors as well as some triggered by GTK_WIDGET_CAN_FOCUS no longer being defined.

So, I'm now in a state where I can't upgrade or downgrade.   HELP!
Comment 2 David Ronis 2010-01-12 13:33:28 PST
Created attachment 46397 [details]
Fix deprecated symbols to allow webkitgtk+ 1.1.18 to compile against gtk+-2.19.3.

It turns out there were only a few places that the deprecated symbols triggered a compile error.  The patch fixes there.  Note that one of the changes required me to cast as:

-    return GTK_WIDGET_CAN_FOCUS(m_webView);
+  return gtk_widget_get_can_focus((GtkWidget*)m_webView);

It compiles but I'm not sure it's right.
Comment 3 Xan Lopez 2010-01-14 05:04:07 PST
Comment on attachment 46397 [details]
Fix deprecated symbols to allow webkitgtk+ 1.1.18 to compile against gtk+-2.19.3.

I'm going to comment about some particular issues in your code, but the overall patch is wrong. You need to check the GTK+ version with GTK_CHECK_VERSION, and only use your code if we are using 2.19.3 or newer. If you grep for that macro you'll see examples of its usage. If you don't do this WebKitGTK+ wouldn't compile with older GTK+ versions, and we don't want that.

>@@ -45,6 +45,7 @@
> #include <glib.h>
> #include <glib/gi18n-lib.h>
> #include <gtk/gtk.h>
>+#include <gtk/gtkwidget.h>

This is wrong, only the toplevel header should be included (I'm surprised this works at all, I think GTK+ should complain).

> bool ChromeClient::canTakeFocus(FocusDirection)
> {
>-    return GTK_WIDGET_CAN_FOCUS(m_webView);
>+  return gtk_widget_get_can_focus((GtkWidget*)m_webView);

You can use GTK_WIDGET here, since it's safer and C-style casts are against the style guidelines.
Comment 4 David Ronis 2010-01-14 08:52:24 PST
Hi xan,

I suspect you're right about the include.  I'd included it explicitly in the hope that I could simply modify the build to support deprecated symbols.   I wasn't able to figure that out and had forgotten to remove the include; you'll notice that the other patched files don't have the include.

As to protecting the patch's against GTK+ version and using GTK_WIDGET both suggestions make sense; however, I'm neither a webkit or GTK developer and would prefer someone who knows those codes make the change.
Comment 5 Alejandro G. Castro 2010-01-15 02:47:27 PST
Created attachment 46662 [details]
Proposed patch

Based on David patch.
Comment 6 Alejandro G. Castro 2010-01-15 02:54:29 PST
Created attachment 46663 [details]
Proposed patch

Changelog not saved :)
Comment 7 Xan Lopez 2010-01-15 13:16:52 PST
Comment on attachment 46663 [details]
Proposed patch

r=me
Comment 8 WebKit Commit Bot 2010-01-15 17:13:20 PST
Comment on attachment 46663 [details]
Proposed patch

Clearing flags on attachment: 46663

Committed r53351: <http://trac.webkit.org/changeset/53351>
Comment 9 WebKit Commit Bot 2010-01-15 17:13:24 PST
All reviewed patches have been landed.  Closing bug.