Gentoo Archives: gentoo-commits

From: Jan Psota <jasiupsota@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/user/bleeding-edge:master commit in: app-i18n/poedit/, x11-libs/wxGTK/, /, x11-libs/wxGTK/files/
Date: Wed, 25 Oct 2017 07:17:53
Message-Id: 1508915780.f764f14bd80ced141cc8212062be03fcbe41ef12.jasiupsota@gentoo
1 commit: f764f14bd80ced141cc8212062be03fcbe41ef12
2 Author: layman <layman <AT> localhost>
3 AuthorDate: Wed Oct 25 07:16:20 2017 +0000
4 Commit: Jan Psota <jasiupsota <AT> gmail <DOT> com>
5 CommitDate: Wed Oct 25 07:16:20 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/user/bleeding-edge.git/commit/?id=f764f14b
7
8 new app-i18n/poedit-2.0.4 needed x11-libs/wxGTK-3.0.3.1-r301 from pg_overlay - thanks!
9
10 .ch | 0
11 app-i18n/poedit/Manifest | 1 +
12 app-i18n/poedit/metadata.xml | 12 +
13 app-i18n/poedit/poedit-2.0.4.ebuild | 63 +
14 x11-libs/wxGTK/Manifest | 7 +
15 x11-libs/wxGTK/files/wxGTK-3.0.3.1-abicheck.patch | 14 +
16 .../wxGTK-3.0.3.1-avoid-tlw-destroy-assert.patch | 29 +
17 x11-libs/wxGTK/files/wxGTK-3.0.3.1-webkit2.patch | 2495 ++++++++++++++++++++
18 x11-libs/wxGTK/metadata.xml | 28 +
19 x11-libs/wxGTK/wxGTK-3.0.3.1-r301.ebuild | 194 ++
20 10 files changed, 2843 insertions(+)
21
22 diff --git a/.ch b/.ch
23 new file mode 100644
24 index 0000000..e69de29
25
26 diff --git a/app-i18n/poedit/Manifest b/app-i18n/poedit/Manifest
27 new file mode 100644
28 index 0000000..3b3bae2
29 --- /dev/null
30 +++ b/app-i18n/poedit/Manifest
31 @@ -0,0 +1 @@
32 +DIST poedit-2.0.4.tar.gz 2495814 SHA256 3887ab76dfa4607f77be00073277a8c5f060006a014b97d8fe05ebd99aadc61d SHA512 18133cd9f19ced71e3184a58123111478f6597aecda189b1dc647f67313fb140b109b4da91c83e03ca6c8fb93712627dbeb74ea2aa16ce7b340ef30474eeffa2 WHIRLPOOL 978e996eb84dc3fe9ec2294bb40ea0870b365697f60017bb55f02d17385e8284409ef2852b92c2ecf4cebbc7b746492381842c9c3a21a3ead57d442c68f473e5
33
34 diff --git a/app-i18n/poedit/metadata.xml b/app-i18n/poedit/metadata.xml
35 new file mode 100644
36 index 0000000..ce23bed
37 --- /dev/null
38 +++ b/app-i18n/poedit/metadata.xml
39 @@ -0,0 +1,12 @@
40 +<?xml version="1.0" encoding="UTF-8"?>
41 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
42 +<pkgmetadata>
43 + <maintainer type="project">
44 + <email>wxwidgets@g.o</email>
45 + <name>Gentoo wxWidgets Project</name>
46 + </maintainer>
47 + <upstream>
48 + <remote-id type="github">vslavik/poedit</remote-id>
49 + <remote-id type="sourceforge">poedit</remote-id>
50 + </upstream>
51 +</pkgmetadata>
52
53 diff --git a/app-i18n/poedit/poedit-2.0.4.ebuild b/app-i18n/poedit/poedit-2.0.4.ebuild
54 new file mode 100644
55 index 0000000..1fe152b
56 --- /dev/null
57 +++ b/app-i18n/poedit/poedit-2.0.4.ebuild
58 @@ -0,0 +1,63 @@
59 +# Copyright 1999-2017 Gentoo Foundation
60 +# Distributed under the terms of the GNU General Public License v2
61 +
62 +EAPI=6
63 +WX_GTK_VER=3.0-gtk3
64 +
65 +PLOCALES="an ar az be be@latin bg bs ca ckb co cs da de el en_GB es et eu fa fi fr ga gl he hr hu hy id is it ja ka kab kk ko lt lv ms nb nl oc pa pl pt_BR pt_PT ro ru sk sl sq sr sv tg th tr uk uz vi zh_CN zh_TW"
66 +
67 +inherit fdo-mime l10n wxwidgets
68 +
69 +DESCRIPTION="GUI editor for gettext translations files"
70 +HOMEPAGE="https://poedit.net"
71 +SRC_URI="https://github.com/vslavik/${PN}/releases/download/v${PV}-oss/${P}.tar.gz"
72 +
73 +LICENSE="MIT"
74 +SLOT="0"
75 +KEYWORDS="~amd64 ~hppa ~ppc64 ~x86"
76 +IUSE=""
77 +
78 +# db/expat req for legacytm (backwards support for pre 1.6)
79 +# we currently have 1.5.5 in stable so this is enabled
80 +RDEPEND="
81 + app-text/gtkspell:3
82 + dev-cpp/lucene++
83 + dev-libs/boost:=[nls]
84 + dev-libs/expat
85 + dev-libs/icu:=
86 + sys-libs/db[cxx]
87 + x11-libs/gtk+:3
88 + x11-libs/wxGTK:${WX_GTK_VER}[X]
89 + "
90 +
91 +DEPEND="${RDEPEND}
92 + virtual/pkgconfig"
93 +
94 +src_prepare() {
95 + my_rm_loc() {
96 + sed -i -e "/^POEDIT_LINGUAS = /s: ${1}::" locales/Makefile.in || die
97 + rm "locales/${1}.mo" || die
98 + }
99 + l10n_find_plocales_changes 'locales' '' '.mo'
100 + l10n_for_each_disabled_locale_do my_rm_loc
101 +
102 + setup-wxwidgets
103 + default
104 +}
105 +
106 +src_configure() {
107 + econf --without-cpprest --without-cld2
108 +}
109 +
110 +src_install() {
111 + emake DESTDIR="${D}" install
112 + dodoc AUTHORS NEWS README
113 +}
114 +
115 +pkg_postinst() {
116 + fdo-mime_desktop_database_update
117 +}
118 +
119 +pkg_postrm() {
120 + fdo-mime_desktop_database_update
121 +}
122
123 diff --git a/x11-libs/wxGTK/Manifest b/x11-libs/wxGTK/Manifest
124 new file mode 100644
125 index 0000000..313c2f8
126 --- /dev/null
127 +++ b/x11-libs/wxGTK/Manifest
128 @@ -0,0 +1,7 @@
129 +AUX wxGTK-3.0.3.1-abicheck.patch 568 SHA256 97743c6ca47aedef361e942a266028d4b8598518904d69cf11e235953c390709 SHA512 549ce1b104ce8b8fef53f09dc5ac7129fa1d29ea95873edb8463b11ab8aed805aee9ba3126862287f5f8e2421f635ac5073f222604c074d97b842353def4049f WHIRLPOOL 124ce2b1b688bb54db5f7d030a3fcfcb9bb88ad067324cddd678981f4f2ef05380640d45a26c1f86c5c3030353c2833e86b42006e2d57819c82ba9b0b6e9e1c7
130 +AUX wxGTK-3.0.3.1-avoid-tlw-destroy-assert.patch 1187 SHA256 168deb2e76e21bcd46c3a1efd86c0f3e1354e9511cf12a9dc54b7dc82c0e3d63 SHA512 492def0b499291eb64ec9c9804e06631e1362af0df4fa12589cd86c68b7cc84b9a5523f575437fd39e2a8de45be3eb783a6a484695694ca100ec99e0aa5b90c1 WHIRLPOOL 26bd81f97a3147648d11c133af45b79d57db240241fd10984dfe22ae35669dfc613ef2e680a9191617ff53a73c326efcb72e1d555a4de209b0b1eeb3dbecdbc9
131 +AUX wxGTK-3.0.3.1-webkit2.patch 99427 SHA256 4dfd274f2e908485f3b39010a75b0228e4199ecb878e6de2de5e8815a91a5488 SHA512 ac6602b36dfdc90a5f5453d940d4ca880dc357b067a4bc079d25028a51dd94a544e7ac28205d96b4ae18a2b776111a3fd5914bf2690f762ddba678a3132c2540 WHIRLPOOL 96bed6add44820cad9e101b910805eadf75ff08d0720de4d0f50d6d49e3e7f577dccd6576d4cc073ed079358ad30fd638cbf185d4ae0175aa770885ffe0488dc
132 +DIST wxWidgets-3.0.3-docs-html.tar.bz2 23803675 SHA256 72f6a7dc5b3c949ee5cea0e35c6a91534f3a081850dcce94f951e1a56b10287a SHA512 655efde42e467d1d48d8adb95e2394d90cedca8eb6a54a7d53771d3d2d4d5f72637aea6ea12a4c1f570c3905a458aebea067cd74e184c4c85ca73e49e04282cb WHIRLPOOL ba1b1c88b29b9c0bad8d48dfa2a7a9b5e42cf7b8051387b8de8cae04ed5e30e113b6f4c464be22210e8079efe89b58ed8de76ba327bdf8dd3947c3cc9ad61269
133 +DIST wxWidgets-3.0.3.1.tar.bz2 20042110 SHA256 3164ad6bc5f61c48d2185b39065ddbe44283eb834a5f62beb13f1d0923e366e4 SHA512 d22cc0acdbb285952b0f58afcf8394f3c71be32b9e35a33eed98d5a7a4b4bd6200c047e3e4de5aded8e627141a38862ee6f7a380f114ede647b07599f52ceb7b WHIRLPOOL a58cc03a455c72d5b2a6a103dfb392731d3089ee148f761109a98cb899e045a2e8d34e54842cf6f146fe5b1dd37ca55da3c85bdbe67cce2ecef48b21d371389d
134 +EBUILD wxGTK-3.0.3.1-r301.ebuild 5380 SHA256 6b8bc31f86a46b2a6363d824b692ac6e9072ddb533741ed0d7daaf942e06aa17 SHA512 da7e76638cc5fb6e0f0c69fb97732a69a7cf7ccf87471960a5d3180c7f1a42bf68e13a0daf89e48e42aebd2a4daa943a00bcbc853343bbf6923dc729f67e7d43 WHIRLPOOL d70b5a7db3b3865cdd590eeacdfd1815442f85eb364f660fed7c875bf0b5483316c9d24da3aba8f46da9d4b174f433e6af50d52872632efda64b25bc9964fbf9
135 +MISC metadata.xml 856 SHA256 e0404abad32321aea90893545bbb40c0ca1958b1cc05ba9b761d290af8de130d SHA512 f5308ab2b8d9d1964c23b175b30c6e728b16522a09a9cf907789a72296b4703f1da9a7b4d116d14cfffb8b38513d4c2830a70acb98b2df62a5dc67ed4e069abb WHIRLPOOL 50f33b82303e32f48001139070c4412b8c4b5b2aa0772e707dc25dff0235fbc2c0f4a2e0d601d067c4924f56f013739f4cb5e382b83b1482ffd405e1c257c27d
136
137 diff --git a/x11-libs/wxGTK/files/wxGTK-3.0.3.1-abicheck.patch b/x11-libs/wxGTK/files/wxGTK-3.0.3.1-abicheck.patch
138 new file mode 100644
139 index 0000000..03ddcd5
140 --- /dev/null
141 +++ b/x11-libs/wxGTK/files/wxGTK-3.0.3.1-abicheck.patch
142 @@ -0,0 +1,14 @@
143 +--- wxWidgets-3.0.2/src/common/appbase.cpp.abicheck 2015-05-28 12:36:40.697163073 +0900
144 ++++ wxWidgets-3.0.2/src/common/appbase.cpp 2015-05-28 12:38:30.597154298 +0900
145 +@@ -762,10 +762,7 @@
146 + msg.Printf(wxT("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."),
147 + lib.c_str(), progName.c_str(), prog.c_str());
148 +
149 +- wxLogFatalError(msg.c_str());
150 +-
151 +- // normally wxLogFatalError doesn't return
152 +- return false;
153 ++ wxLogWarning(msg.c_str());
154 + }
155 +
156 + return true;
157
158 diff --git a/x11-libs/wxGTK/files/wxGTK-3.0.3.1-avoid-tlw-destroy-assert.patch b/x11-libs/wxGTK/files/wxGTK-3.0.3.1-avoid-tlw-destroy-assert.patch
159 new file mode 100644
160 index 0000000..ea5cae3
161 --- /dev/null
162 +++ b/x11-libs/wxGTK/files/wxGTK-3.0.3.1-avoid-tlw-destroy-assert.patch
163 @@ -0,0 +1,29 @@
164 +From ce1dce113c5eda42f49ba3278bb21c61872ca37d Mon Sep 17 00:00:00 2001
165 +From: Paul Cornett <paulcor@××××××××××××××××××××.com>
166 +Date: Mon, 28 Aug 2017 20:31:47 -0700
167 +Subject: [PATCH] Avoid delayed destruction if TLW was never created. See
168 + #17942
169 +
170 +(cherry picked from commit 4a71ba820f085a3d5a7233e9fd0e23ae4e45af58)
171 +---
172 + src/common/toplvcmn.cpp | 6 +++---
173 + 1 file changed, 3 insertions(+), 3 deletions(-)
174 +
175 +diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp
176 +index ef693690c5d..6a722f8be48 100644
177 +--- a/src/common/toplvcmn.cpp
178 ++++ b/src/common/toplvcmn.cpp
179 +@@ -105,10 +105,10 @@ bool wxTopLevelWindowBase::Destroy()
180 + // as we will be deleted anyhow during its destruction and the pointer
181 + // stored in wxPendingDelete would become invalid, so just delete ourselves
182 + // immediately in this case.
183 +- if ( wxWindow* parent = GetParent() )
184 ++ wxWindow* parent = GetParent();
185 ++ if ( (parent && parent->IsBeingDeleted()) || !GetHandle() )
186 + {
187 +- if ( parent->IsBeingDeleted() )
188 +- return wxNonOwnedWindow::Destroy();
189 ++ return wxNonOwnedWindow::Destroy();
190 + }
191 +
192 + // delayed destruction: the frame will be deleted during the next idle
193
194 diff --git a/x11-libs/wxGTK/files/wxGTK-3.0.3.1-webkit2.patch b/x11-libs/wxGTK/files/wxGTK-3.0.3.1-webkit2.patch
195 new file mode 100644
196 index 0000000..53883f1
197 --- /dev/null
198 +++ b/x11-libs/wxGTK/files/wxGTK-3.0.3.1-webkit2.patch
199 @@ -0,0 +1,2495 @@
200 +From ec6e54bc893fb7516731ca9c71e0d0bbc5ae9ff7 Mon Sep 17 00:00:00 2001
201 +From: Scott Talbert <swt@××××××.net>
202 +Date: Thu, 30 Mar 2017 21:34:24 -0400
203 +Subject: [PATCH] Add support for WebKit2GTK+ in wxWebView
204 +
205 +Closes https://github.com/wxWidgets/wxWidgets/pull/469
206 +---
207 + Makefile.in | 58 +-
208 + autoconf_inc.m4 | 6 +
209 + build/bakefiles/config.bkl | 1 +
210 + build/bakefiles/files.bkl | 5 +
211 + build/bakefiles/multilib.bkl | 1 +
212 + build/bakefiles/plugins.bkl | 5 +
213 + configure | 108 ++-
214 + configure.in | 42 +-
215 + docs/changes.txt | 8 +
216 + include/wx/android/setup.h | 13 +-
217 + include/wx/chkconf.h | 2 +-
218 + include/wx/gtk/setup0.h | 13 +-
219 + include/wx/gtk/webview_webkit.h | 18 +-
220 + include/wx/gtk/webview_webkit2_extension.h | 15 +
221 + include/wx/gtk/webviewhistoryitem_webkit.h | 2 +-
222 + include/wx/motif/setup0.h | 13 +-
223 + include/wx/msw/setup0.h | 13 +-
224 + include/wx/msw/wince/setup.h | 13 +-
225 + include/wx/os2/setup0.h | 13 +-
226 + include/wx/osx/setup0.h | 13 +-
227 + include/wx/setup_inc.h | 13 +-
228 + include/wx/univ/setup0.h | 13 +-
229 + interface/wx/webview.h | 4 +
230 + samples/webview/webview.cpp | 2 +-
231 + setup.h.in | 8 +-
232 + src/gtk/webview_webkit2.cpp | 1261 ++++++++++++++++++++++++++++
233 + src/gtk/webview_webkit2_extension.cpp | 421 ++++++++++
234 + 27 files changed, 2046 insertions(+), 38 deletions(-)
235 + create mode 100644 include/wx/gtk/webview_webkit2_extension.h
236 + create mode 100644 src/gtk/webview_webkit2.cpp
237 + create mode 100644 src/gtk/webview_webkit2_extension.cpp
238 +
239 +diff --git a/Makefile.in b/Makefile.in
240 +index 7a10765..f032587 100644
241 +--- a/Makefile.in
242 ++++ b/Makefile.in
243 +@@ -1655,12 +1655,14 @@ WEBVIEWDLL_CXXFLAGS = $(__webviewdll_PCH_INC) -D__WX$(TOOLKIT)__ \
244 + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \
245 + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
246 + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW \
247 ++ -DWX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\" \
248 + $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS)
249 + WEBVIEWDLL_OBJCXXFLAGS = $(__webviewdll_PCH_INC) -D__WX$(TOOLKIT)__ \
250 + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
251 + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \
252 + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
253 + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW \
254 ++ -DWX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\" \
255 + $(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS)
256 + WEBVIEWDLL_OBJECTS = \
257 + $(__webviewdll___win32rc) \
258 +@@ -2078,6 +2080,10 @@ SOUND_SDL_CXXFLAGS = -DWXUSINGDLL -DwxUSE_GUI=0 $(PIC_FLAG) $(CPPFLAGS) \
259 + $(CXXFLAGS)
260 + SOUND_SDL_OBJECTS = \
261 + sound_sdl_sound_sdl.o
262 ++WEBKIT2_EXT_CXXFLAGS = -DWXUSINGDLL -DwxUSE_GUI=0 $(PIC_FLAG) $(CPPFLAGS) \
263 ++ $(CXXFLAGS)
264 ++WEBKIT2_EXT_OBJECTS = \
265 ++ webkit2_ext_webview_webkit2_extension.o
266 + LOCALE_LINGUAS = ca cs da de el es fi fr hu id it ja nl pl ru sl sv tr uk zh zh_CN zh_TW
267 + LOCALE_MSW_LINGUAS = it
268 +
269 +@@ -6754,6 +6760,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
270 + @COND_PLATFORM_MACOSX_1@ = monodll_osx_webview_webkit.o
271 + @COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS = \
272 + @COND_TOOLKIT_GTK@ monodll_gtk_webview_webkit.o
273 ++@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS = \
274 ++@COND_TOOLKIT_GTK@ monodll_webview_webkit2.o
275 + @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS = monodll_webview_ie.o
276 + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS \
277 + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monodll_tabartgtk.o
278 +@@ -9009,6 +9017,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
279 + @COND_PLATFORM_MACOSX_1@ = monolib_osx_webview_webkit.o
280 + @COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = \
281 + @COND_TOOLKIT_GTK@ monolib_gtk_webview_webkit.o
282 ++@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = \
283 ++@COND_TOOLKIT_GTK@ monolib_webview_webkit2.o
284 + @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = monolib_webview_ie.o
285 + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS_1 \
286 + @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monolib_tabartgtk.o
287 +@@ -13765,6 +13775,8 @@ COND_USE_SOVERSOLARIS_1___webviewdll___so_symlinks_uninst_cmd = rm -f \
288 + @COND_PLATFORM_MACOSX_1@ = webviewdll_osx_webview_webkit.o
289 + @COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_2 = \
290 + @COND_TOOLKIT_GTK@ webviewdll_gtk_webview_webkit.o
291 ++@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_2 = \
292 ++@COND_TOOLKIT_GTK@ webviewdll_webview_webkit2.o
293 + @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_2 = \
294 + @COND_TOOLKIT_MSW@ webviewdll_webview_ie.o
295 + COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_WEBVIEW_1___webviewlib___depname = \
296 +@@ -13784,6 +13796,8 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_WEBVIEW_1___webviewlib___depname = \
297 + @COND_PLATFORM_MACOSX_1@ = webviewlib_osx_webview_webkit.o
298 + @COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_3 = \
299 + @COND_TOOLKIT_GTK@ webviewlib_gtk_webview_webkit.o
300 ++@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_3 = \
301 ++@COND_TOOLKIT_GTK@ webviewlib_webview_webkit2.o
302 + @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_3 = \
303 + @COND_TOOLKIT_MSW@ webviewlib_webview_ie.o
304 + @COND_SHARED_1@____wxwebview_namedll_DEP = $(__webviewdll___depname)
305 +@@ -14586,6 +14600,13 @@ COND_WITH_PLUGIN_SDL_1___sound_sdl___depname = \
306 + @COND_WITH_PLUGIN_SDL_1@__install_sound_sdl___depname = install_sound_sdl
307 + @COND_WITH_PLUGIN_SDL_1@__uninstall_sound_sdl___depname \
308 + @COND_WITH_PLUGIN_SDL_1@ = uninstall_sound_sdl
309 ++COND_USE_WEBVIEW_WEBKIT2_1___webkit2_ext___depname = \
310 ++ $(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
311 ++@COND_USE_WEBVIEW_WEBKIT2_1@__webkit2_ext___depname = $(COND_USE_WEBVIEW_WEBKIT2_1___webkit2_ext___depname)
312 ++@COND_USE_WEBVIEW_WEBKIT2_1@__install_webkit2_ext___depname \
313 ++@COND_USE_WEBVIEW_WEBKIT2_1@ = install_webkit2_ext
314 ++@COND_USE_WEBVIEW_WEBKIT2_1@__uninstall_webkit2_ext___depname \
315 ++@COND_USE_WEBVIEW_WEBKIT2_1@ = uninstall_webkit2_ext
316 + @COND_USE_XRC_1@__wxrc___depname = wxrc
317 + @COND_USE_XRC_1@__clean_wxrc___depname = clean-wxrc
318 + @COND_USE_XRC_1@__install_wxrc___depname = install-wxrc
319 +@@ -15255,9 +15276,9 @@ COND_wxUSE_REGEX_builtin___LIB_REGEX_p = \
320 +
321 + ### Targets: ###
322 +
323 +-all: $(__wxregex___depname) $(__wxzlib___depname) $(__wxpng___depname) $(__wxjpeg___depname) $(__wxtiff___depname) $(__wxexpat___depname) $(__wxscintilla___depname) $(__monodll___depname) $(__monolib___depname) $(__basedll___depname) $(__baselib___depname) $(__netdll___depname) $(__netlib___depname) $(__coredll___depname) $(__corelib___depname) $(__advdll___depname) $(__advlib___depname) $(__mediadll___depname) $(__medialib___depname) $(__htmldll___depname) $(__htmllib___depname) $(__webviewdll___depname) $(__webviewlib___depname) $(__qadll___depname) $(__qalib___depname) $(__xmldll___depname) $(__xmllib___depname) $(__xrcdll___depname) $(__xrclib___depname) $(__auidll___depname) $(__auilib___depname) $(__ribbondll___depname) $(__ribbonlib___depname) $(__propgriddll___depname) $(__propgridlib___depname) $(__richtextdll___depname) $(__richtextlib___depname) $(__stcdll___depname) $(__stclib___depname) $(__gldll___depname) $(__gllib___depname) $(__sound_sdl___depname) $(__wxrc___depna
324 me) $(__cocoa_res___depname)
325 ++all: $(__wxregex___depname) $(__wxzlib___depname) $(__wxpng___depname) $(__wxjpeg___depname) $(__wxtiff___depname) $(__wxexpat___depname) $(__wxscintilla___depname) $(__monodll___depname) $(__monolib___depname) $(__basedll___depname) $(__baselib___depname) $(__netdll___depname) $(__netlib___depname) $(__coredll___depname) $(__corelib___depname) $(__advdll___depname) $(__advlib___depname) $(__mediadll___depname) $(__medialib___depname) $(__htmldll___depname) $(__htmllib___depname) $(__webviewdll___depname) $(__webviewlib___depname) $(__qadll___depname) $(__qalib___depname) $(__xmldll___depname) $(__xmllib___depname) $(__xrcdll___depname) $(__xrclib___depname) $(__auidll___depname) $(__auilib___depname) $(__ribbondll___depname) $(__ribbonlib___depname) $(__propgriddll___depname) $(__propgridlib___depname) $(__richtextdll___depname) $(__richtextlib___depname) $(__stcdll___depname) $(__stclib___depname) $(__gldll___depname) $(__gllib___depname) $(__sound_sdl___depname) $(__webkit2_ext_
326 __depname) $(__wxrc___depname) $(__cocoa_res___depname)
327 +
328 +-install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__install_wxpng___depname) $(__install_wxjpeg___depname) $(__install_wxtiff___depname) $(__install_wxexpat___depname) $(__install_wxscintilla___depname) $(__install_monodll___depname) $(__install_monolib___depname) $(__install_basedll___depname) $(__install_baselib___depname) $(__install_netdll___depname) $(__install_netlib___depname) $(__install_coredll___depname) $(__install_corelib___depname) $(__install_advdll___depname) $(__install_advlib___depname) $(__install_mediadll___depname) $(__install_medialib___depname) $(__install_htmldll___depname) $(__install_htmllib___depname) $(__install_webviewdll___depname) $(__install_webviewlib___depname) $(__install_qadll___depname) $(__install_qalib___depname) $(__install_xmldll___depname) $(__install_xmllib___depname) $(__install_xrcdll___depname) $(__install_xrclib___depname) $(__install_auidll___depname) $(__install_auilib___depname) $(__install_ribbondll___depname)
329 $(__install_ribbonlib___depname) $(__install_propgriddll___depname) $(__install_propgridlib___depname) $(__install_richtextdll___depname) $(__install_richtextlib___depname) $(__install_stcdll___depname) $(__install_stclib___depname) $(__install_gldll___depname) $(__install_gllib___depname) $(__install_sound_sdl___depname) $(__install_wxrc___depname) install-wxconfig locale_install locale_msw_install $(__cocoa_res_install___depname)
330 ++install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__install_wxpng___depname) $(__install_wxjpeg___depname) $(__install_wxtiff___depname) $(__install_wxexpat___depname) $(__install_wxscintilla___depname) $(__install_monodll___depname) $(__install_monolib___depname) $(__install_basedll___depname) $(__install_baselib___depname) $(__install_netdll___depname) $(__install_netlib___depname) $(__install_coredll___depname) $(__install_corelib___depname) $(__install_advdll___depname) $(__install_advlib___depname) $(__install_mediadll___depname) $(__install_medialib___depname) $(__install_htmldll___depname) $(__install_htmllib___depname) $(__install_webviewdll___depname) $(__install_webviewlib___depname) $(__install_qadll___depname) $(__install_qalib___depname) $(__install_xmldll___depname) $(__install_xmllib___depname) $(__install_xrcdll___depname) $(__install_xrclib___depname) $(__install_auidll___depname) $(__install_auilib___depname) $(__install_ribbondll___depname)
331 $(__install_ribbonlib___depname) $(__install_propgriddll___depname) $(__install_propgridlib___depname) $(__install_richtextdll___depname) $(__install_richtextlib___depname) $(__install_stcdll___depname) $(__install_stclib___depname) $(__install_gldll___depname) $(__install_gllib___depname) $(__install_sound_sdl___depname) $(__install_webkit2_ext___depname) $(__install_wxrc___depname) install-wxconfig locale_install locale_msw_install $(__cocoa_res_install___depname)
332 + $(INSTALL_DIR) $(DESTDIR)$(datadir)/aclocal
333 + (cd $(srcdir) ; $(INSTALL_DATA) wxwin.m4 $(DESTDIR)$(datadir)/aclocal)
334 + $(INSTALL_DIR) $(DESTDIR)$(datadir)/bakefile/presets
335 +@@ -15293,7 +15314,7 @@ install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__instal
336 + @echo " ------------------------------------------------------"
337 + @echo " "
338 +
339 +-uninstall: $(__uninstall_wxregex___depname) $(__uninstall_wxzlib___depname) $(__uninstall_wxpng___depname) $(__uninstall_wxjpeg___depname) $(__uninstall_wxtiff___depname) $(__uninstall_wxexpat___depname) $(__uninstall_wxscintilla___depname) $(__uninstall_monodll___depname) $(__uninstall_monolib___depname) $(__uninstall_basedll___depname) $(__uninstall_baselib___depname) $(__uninstall_netdll___depname) $(__uninstall_netlib___depname) $(__uninstall_coredll___depname) $(__uninstall_corelib___depname) $(__uninstall_advdll___depname) $(__uninstall_advlib___depname) $(__uninstall_mediadll___depname) $(__uninstall_medialib___depname) $(__uninstall_htmldll___depname) $(__uninstall_htmllib___depname) $(__uninstall_webviewdll___depname) $(__uninstall_webviewlib___depname) $(__uninstall_qadll___depname) $(__uninstall_qalib___depname) $(__uninstall_xmldll___depname) $(__uninstall_xmllib___depname) $(__uninstall_xrcdll___depname) $(__uninstall_xrclib___depname) $(__uninstall_auidll___depname) $
340 (__uninstall_auilib___depname) $(__uninstall_ribbondll___depname) $(__uninstall_ribbonlib___depname) $(__uninstall_propgriddll___depname) $(__uninstall_propgridlib___depname) $(__uninstall_richtextdll___depname) $(__uninstall_richtextlib___depname) $(__uninstall_stcdll___depname) $(__uninstall_stclib___depname) $(__uninstall_gldll___depname) $(__uninstall_gllib___depname) $(__uninstall_sound_sdl___depname) locale_uninstall locale_msw_uninstall
341 ++uninstall: $(__uninstall_wxregex___depname) $(__uninstall_wxzlib___depname) $(__uninstall_wxpng___depname) $(__uninstall_wxjpeg___depname) $(__uninstall_wxtiff___depname) $(__uninstall_wxexpat___depname) $(__uninstall_wxscintilla___depname) $(__uninstall_monodll___depname) $(__uninstall_monolib___depname) $(__uninstall_basedll___depname) $(__uninstall_baselib___depname) $(__uninstall_netdll___depname) $(__uninstall_netlib___depname) $(__uninstall_coredll___depname) $(__uninstall_corelib___depname) $(__uninstall_advdll___depname) $(__uninstall_advlib___depname) $(__uninstall_mediadll___depname) $(__uninstall_medialib___depname) $(__uninstall_htmldll___depname) $(__uninstall_htmllib___depname) $(__uninstall_webviewdll___depname) $(__uninstall_webviewlib___depname) $(__uninstall_qadll___depname) $(__uninstall_qalib___depname) $(__uninstall_xmldll___depname) $(__uninstall_xmllib___depname) $(__uninstall_xrcdll___depname) $(__uninstall_xrclib___depname) $(__uninstall_auidll___depname) $
342 (__uninstall_auilib___depname) $(__uninstall_ribbondll___depname) $(__uninstall_ribbonlib___depname) $(__uninstall_propgriddll___depname) $(__uninstall_propgridlib___depname) $(__uninstall_richtextdll___depname) $(__uninstall_richtextlib___depname) $(__uninstall_stcdll___depname) $(__uninstall_stclib___depname) $(__uninstall_gldll___depname) $(__uninstall_gllib___depname) $(__uninstall_sound_sdl___depname) $(__uninstall_webkit2_ext___depname) locale_uninstall locale_msw_uninstall
343 + (cd $(DESTDIR)$(datadir)/aclocal ; rm -f wxwin.m4)
344 + (cd $(DESTDIR)$(datadir)/bakefile/presets ; rm -f wx.bkl wx_unix.bkl wx_win32.bkl wx_xrc.bkl wx_presets.py)
345 + for f in setup.h $(RCDEFS_H); do \
346 +@@ -15322,6 +15343,7 @@ install-strip: install
347 + $(STRIP) $(DESTDIR)$(libdir)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3)
348 + $(STRIP) $(DESTDIR)$(libdir)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3)
349 + $(STRIP) $(DESTDIR)$(PLUGINS_INST_DIR)/$(DLLPREFIX_MODULE)sound_sdl$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
350 ++ $(STRIP) $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions/$(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
351 +
352 + clean: $(__clean_wxrc___depname)
353 + rm -rf ./.deps ./.pch
354 +@@ -15402,6 +15424,7 @@ clean: $(__clean_wxrc___depname)
355 + rm -f $(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX) $(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf2)
356 + rm -f $(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX)$(LIBEXT)
357 + rm -f $(DLLPREFIX_MODULE)sound_sdl$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
358 ++ rm -f $(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
359 + -(cd samples && $(MAKE) clean)
360 + rm -f lib/libwx_$(TOOLCHAIN_NAME).0.rsrc lib/libwx_$(TOOLCHAIN_NAME).0.r
361 +
362 +@@ -16130,6 +16153,16 @@ distclean: clean
363 + @COND_WITH_PLUGIN_SDL_1@uninstall_sound_sdl:
364 + @COND_WITH_PLUGIN_SDL_1@ rm -f $(DESTDIR)$(PLUGINS_INST_DIR)/$(DLLPREFIX_MODULE)sound_sdl$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
365 +
366 ++@COND_USE_WEBVIEW_WEBKIT2_1@$(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE): $(WEBKIT2_EXT_OBJECTS)
367 ++@COND_USE_WEBVIEW_WEBKIT2_1@ $(SHARED_LD_MODULE_CXX) $@ $(WEBKIT2_EXT_OBJECTS) $(LDFLAGS) $(EXTRALIBS_WEBVIEW) $(LIBS)
368 ++
369 ++@COND_USE_WEBVIEW_WEBKIT2_1@install_webkit2_ext: $(__webkit2_ext___depname)
370 ++@COND_USE_WEBVIEW_WEBKIT2_1@ $(INSTALL_DIR) $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions
371 ++@COND_USE_WEBVIEW_WEBKIT2_1@ $(INSTALL_PROGRAM) $(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE) $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions
372 ++
373 ++@COND_USE_WEBVIEW_WEBKIT2_1@uninstall_webkit2_ext:
374 ++@COND_USE_WEBVIEW_WEBKIT2_1@ rm -f $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions/$(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
375 ++
376 + samples:
377 + (cd samples && $(MAKE) all)
378 +
379 +@@ -18563,6 +18596,9 @@ monodll_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(MONODLL_ODEP)
380 + monodll_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(MONODLL_ODEP)
381 + $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
382 +
383 ++monodll_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(MONODLL_ODEP)
384 ++ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
385 ++
386 + monodll_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(MONODLL_ODEP)
387 + $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
388 +
389 +@@ -24440,6 +24476,9 @@ monolib_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(MONOLIB_ODEP)
390 + monolib_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(MONOLIB_ODEP)
391 + $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
392 +
393 ++monolib_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(MONOLIB_ODEP)
394 ++ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
395 ++
396 + monolib_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(MONOLIB_ODEP)
397 + $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
398 +
399 +@@ -39792,7 +39831,7 @@ htmllib_htmllbox.o: $(srcdir)/src/generic/htmllbox.cpp $(HTMLLIB_ODEP)
400 + @COND_PLATFORM_MACOSX_1@ $(CXXC) -c -o $@ $(HTMLLIB_CXXFLAGS) $(srcdir)/src/html/chm.cpp
401 +
402 + webviewdll_version_rc.o: $(srcdir)/src/msw/version.rc $(WEBVIEWDLL_ODEP)
403 +- $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include $(__INC_TIFF_BUILD_p_66) $(__INC_TIFF_p_66) $(__INC_JPEG_p_66) $(__INC_PNG_p_65) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW
404 ++ $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include $(__INC_TIFF_BUILD_p_66) $(__INC_TIFF_p_66) $(__INC_JPEG_p_66) $(__INC_PNG_p_65) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW --define WX_WEB_EXTENSIONS_DIRECTORY="$(PLUGINS_INST_DIR)/web-extensions"
405 +
406 + webviewdll_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWDLL_ODEP)
407 + $(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/msw/webview_ie.cpp
408 +@@ -39800,6 +39839,9 @@ webviewdll_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWDLL_ODEP)
409 + webviewdll_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(WEBVIEWDLL_ODEP)
410 + $(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
411 +
412 ++webviewdll_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(WEBVIEWDLL_ODEP)
413 ++ $(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
414 ++
415 + webviewdll_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(WEBVIEWDLL_ODEP)
416 + $(CXXC) -c -o $@ $(WEBVIEWDLL_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
417 +
418 +@@ -39818,6 +39860,9 @@ webviewlib_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWLIB_ODEP)
419 + webviewlib_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(WEBVIEWLIB_ODEP)
420 + $(CXXC) -c -o $@ $(WEBVIEWLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
421 +
422 ++webviewlib_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(WEBVIEWLIB_ODEP)
423 ++ $(CXXC) -c -o $@ $(WEBVIEWLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
424 ++
425 + webviewlib_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(WEBVIEWLIB_ODEP)
426 + $(CXXC) -c -o $@ $(WEBVIEWLIB_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
427 +
428 +@@ -40658,6 +40703,9 @@ gllib_os2_glcanvas.o: $(srcdir)/src/os2/glcanvas.cpp $(GLLIB_ODEP)
429 + sound_sdl_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp
430 + $(CXXC) -c -o $@ $(SOUND_SDL_CXXFLAGS) $(srcdir)/src/unix/sound_sdl.cpp
431 +
432 ++webkit2_ext_webview_webkit2_extension.o: $(srcdir)/src/gtk/webview_webkit2_extension.cpp
433 ++ $(CXXC) -c -o $@ $(WEBKIT2_EXT_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2_extension.cpp
434 ++
435 +
436 + @COND_PYTHON@@COND_USE_STC_1@$(srcdir)/include/wx/stc/stc.h: \
437 + @COND_PYTHON@@COND_USE_STC_1@$(srcdir)/src/stc/scintilla/include/Scintilla.iface \
438 +@@ -41569,4 +41617,4 @@ win-dist: MSW_ZIP_TEXT_DIST SAMPLES_DIST DEMOS_DIST UTILS_DIST MISC_DIST INTL_DI
439 + uninstall_richtextlib wxrichtext install_stcdll uninstall_stcdll \
440 + install_stclib uninstall_stclib wxstc install_gldll uninstall_gldll \
441 + install_gllib uninstall_gllib wxgl install_sound_sdl uninstall_sound_sdl \
442 +- samples
443 ++ install_webkit2_ext uninstall_webkit2_ext samples
444 +diff --git a/autoconf_inc.m4 b/autoconf_inc.m4
445 +index 76cea6a..6bc6a0c 100644
446 +--- a/autoconf_inc.m4
447 ++++ b/autoconf_inc.m4
448 +@@ -1088,6 +1088,12 @@ dnl ### begin block 20_COND_USE_THREADS_1[../../demos/bombs/bombs.bkl,../../demo
449 + COND_USE_THREADS_1=""
450 + fi
451 + AC_SUBST(COND_USE_THREADS_1)
452 ++dnl ### begin block 20_COND_USE_WEBVIEW_WEBKIT2_1[wx.bkl] ###
453 ++ COND_USE_WEBVIEW_WEBKIT2_1="#"
454 ++ if test "x$USE_WEBVIEW_WEBKIT2" = "x1" ; then
455 ++ COND_USE_WEBVIEW_WEBKIT2_1=""
456 ++ fi
457 ++ AC_SUBST(COND_USE_WEBVIEW_WEBKIT2_1)
458 + dnl ### begin block 20_COND_USE_XRC_1[../../utils/execmon/execmon.bkl,../../utils/wxrc/wxrc.bkl,wx.bkl] ###
459 + COND_USE_XRC_1="#"
460 + if test "x$USE_XRC" = "x1" ; then
461 +diff --git a/build/bakefiles/config.bkl b/build/bakefiles/config.bkl
462 +index a43afb49..a95b405 100644
463 +--- a/build/bakefiles/config.bkl
464 ++++ b/build/bakefiles/config.bkl
465 +@@ -429,6 +429,7 @@ to run the tests, include CppUnit library here.
466 + <option name="DYLIB_RPATH_INSTALL"/>
467 + <option name="DYLIB_RPATH_POSTLINK"/>
468 + <option name="SAMPLES_RPATH_FLAG"/>
469 ++ <option name="USE_WEBVIEW_WEBKIT2"/>
470 +
471 + <!-- see configure.in; it's required by some samples on Mac OS X -->
472 + <option name="HEADER_PAD_OPTION"/>
473 +diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl
474 +index 6c32a7b..956a808 100644
475 +--- a/build/bakefiles/files.bkl
476 ++++ b/build/bakefiles/files.bkl
477 +@@ -3418,6 +3418,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
478 + <set var="WEBVIEW_SRC_PLATFORM">
479 + <if cond="TOOLKIT=='MSW'">src/msw/webview_ie.cpp</if>
480 + <if cond="TOOLKIT=='GTK'">src/gtk/webview_webkit.cpp</if>
481 ++ <if cond="TOOLKIT=='GTK'">src/gtk/webview_webkit2.cpp</if>
482 + <if cond="PLATFORM_MACOSX=='1'">src/osx/webview_webkit.mm</if>
483 + </set>
484 + <set var="WEBVIEW_SRC" hints="files">
485 +@@ -3449,6 +3450,10 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
486 + wx/webviewfshandler.h
487 + </set>
488 +
489 ++<set var="WEBVIEW_WEBKIT2_EXTENSION_SRC" hints="files">
490 ++ src/gtk/webview_webkit2_extension.cpp
491 ++</set>
492 ++
493 + <!-- ====================================================================== -->
494 + <!-- wxXRC -->
495 + <!-- ====================================================================== -->
496 +diff --git a/build/bakefiles/multilib.bkl b/build/bakefiles/multilib.bkl
497 +index cf2d4eb..aa811b9 100644
498 +--- a/build/bakefiles/multilib.bkl
499 ++++ b/build/bakefiles/multilib.bkl
500 +@@ -180,6 +180,7 @@
501 + cond="SHARED=='1' and USE_GUI=='1' and USE_WEBVIEW=='1' and MONOLITHIC=='0'">
502 + <define>WXUSINGDLL</define>
503 + <define>WXMAKINGDLL_WEBVIEW</define>
504 ++ <define>WX_WEB_EXTENSIONS_DIRECTORY="$(PLUGINS_INST_DIR)/web-extensions"</define>
505 + <sources>$(WEBVIEW_SRC)</sources>
506 + <library>coredll</library>
507 + <library>basedll</library>
508 +diff --git a/build/bakefiles/plugins.bkl b/build/bakefiles/plugins.bkl
509 +index 2034f8c..cbf4ddb 100644
510 +--- a/build/bakefiles/plugins.bkl
511 ++++ b/build/bakefiles/plugins.bkl
512 +@@ -11,5 +11,10 @@
513 + <ldlibs>$(EXTRALIBS_SDL)</ldlibs>
514 + </wx-base-plugin>
515 +
516 ++ <wx-base-plugin id="webkit2_ext" cond="USE_WEBVIEW_WEBKIT2=='1'">
517 ++ <sources>$(WEBVIEW_WEBKIT2_EXTENSION_SRC)</sources>
518 ++ <ldlibs>$(EXTRALIBS_WEBVIEW)</ldlibs>
519 ++ <install-to>$(PLUGINS_INST_DIR)/web-extensions</install-to>
520 ++ </wx-base-plugin>
521 +
522 + </makefile>
523 +diff --git a/configure b/configure
524 +index b01f393..3fa466a 100755
525 +--- a/configure
526 ++++ b/configure
527 +@@ -675,6 +675,7 @@ COND_WXUNIV_0
528 + COND_WITH_PLUGIN_SDL_1
529 + COND_WINDOWS_IMPLIB_1
530 + COND_USE_XRC_1
531 ++COND_USE_WEBVIEW_WEBKIT2_1
532 + COND_USE_THREADS_1
533 + COND_USE_THREADS_0
534 + COND_USE_STC_1
535 +@@ -37295,12 +37296,95 @@ fi
536 +
537 + if test "$wxUSE_WEBVIEW" = "yes"; then
538 + USE_WEBVIEW_WEBKIT=0
539 ++ USE_WEBVIEW_WEBKIT2=0
540 + if test "$wxUSE_WEBVIEW_WEBKIT" = "yes"; then
541 + if test "$wxUSE_GTK" = 1; then
542 +- webkitgtk=webkit-1.0
543 + if test "$WXGTK3" = 1; then
544 +- webkitgtk=webkitgtk-3.0
545 ++
546 ++pkg_failed=no
547 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
548 ++$as_echo_n "checking for WEBKIT... " >&6; }
549 ++
550 ++if test -n "$PKG_CONFIG"; then
551 ++ if test -n "$WEBKIT_CFLAGS"; then
552 ++ pkg_cv_WEBKIT_CFLAGS="$WEBKIT_CFLAGS"
553 ++ else
554 ++ if test -n "$PKG_CONFIG" && \
555 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"webkit2gtk-4.0\""; } >&5
556 ++ ($PKG_CONFIG --exists --print-errors "webkit2gtk-4.0") 2>&5
557 ++ ac_status=$?
558 ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
559 ++ test $ac_status = 0; }; then
560 ++ pkg_cv_WEBKIT_CFLAGS=`$PKG_CONFIG --cflags "webkit2gtk-4.0" 2>/dev/null`
561 ++else
562 ++ pkg_failed=yes
563 ++fi
564 ++ fi
565 ++else
566 ++ pkg_failed=untried
567 ++fi
568 ++if test -n "$PKG_CONFIG"; then
569 ++ if test -n "$WEBKIT_LIBS"; then
570 ++ pkg_cv_WEBKIT_LIBS="$WEBKIT_LIBS"
571 ++ else
572 ++ if test -n "$PKG_CONFIG" && \
573 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"webkit2gtk-4.0\""; } >&5
574 ++ ($PKG_CONFIG --exists --print-errors "webkit2gtk-4.0") 2>&5
575 ++ ac_status=$?
576 ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
577 ++ test $ac_status = 0; }; then
578 ++ pkg_cv_WEBKIT_LIBS=`$PKG_CONFIG --libs "webkit2gtk-4.0" 2>/dev/null`
579 ++else
580 ++ pkg_failed=yes
581 ++fi
582 ++ fi
583 ++else
584 ++ pkg_failed=untried
585 ++fi
586 ++
587 ++
588 ++
589 ++if test $pkg_failed = yes; then
590 ++
591 ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
592 ++ _pkg_short_errors_supported=yes
593 ++else
594 ++ _pkg_short_errors_supported=no
595 ++fi
596 ++ if test $_pkg_short_errors_supported = yes; then
597 ++ WEBKIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "webkit2gtk-4.0"`
598 ++ else
599 ++ WEBKIT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "webkit2gtk-4.0"`
600 ++ fi
601 ++ # Put the nasty error message in config.log where it belongs
602 ++ echo "$WEBKIT_PKG_ERRORS" >&5
603 ++
604 ++
605 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk not found, falling back to webkitgtk" >&5
606 ++$as_echo "$as_me: WARNING: webkit2gtk not found, falling back to webkitgtk" >&2;}
607 ++
608 ++elif test $pkg_failed = untried; then
609 ++
610 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk not found, falling back to webkitgtk" >&5
611 ++$as_echo "$as_me: WARNING: webkit2gtk not found, falling back to webkitgtk" >&2;}
612 ++
613 ++else
614 ++ WEBKIT_CFLAGS=$pkg_cv_WEBKIT_CFLAGS
615 ++ WEBKIT_LIBS=$pkg_cv_WEBKIT_LIBS
616 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
617 ++$as_echo "yes" >&6; }
618 ++
619 ++ USE_WEBVIEW_WEBKIT2=1
620 ++ CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
621 ++ EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
622 ++
623 ++fi
624 + fi
625 ++ if test "$USE_WEBVIEW_WEBKIT2" = 0; then
626 ++ webkitgtk=webkit-1.0
627 ++ if test "$WXGTK3" = 1; then
628 ++ webkitgtk=webkitgtk-3.0
629 ++ fi
630 +
631 + pkg_failed=no
632 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
633 +@@ -37361,12 +37445,12 @@ fi
634 + echo "$WEBKIT_PKG_ERRORS" >&5
635 +
636 +
637 +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkitgtk not found." >&5
638 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkitgtk not found." >&5
639 + $as_echo "$as_me: WARNING: webkitgtk not found." >&2;}
640 +
641 + elif test $pkg_failed = untried; then
642 +
643 +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkitgtk not found." >&5
644 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkitgtk not found." >&5
645 + $as_echo "$as_me: WARNING: webkitgtk not found." >&2;}
646 +
647 + else
648 +@@ -37375,11 +37459,12 @@ else
649 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
650 + $as_echo "yes" >&6; }
651 +
652 +- USE_WEBVIEW_WEBKIT=1
653 +- CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
654 +- EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
655 ++ USE_WEBVIEW_WEBKIT=1
656 ++ CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
657 ++ EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
658 +
659 + fi
660 ++ fi
661 + elif test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
662 + old_CPPFLAGS="$CPPFLAGS"
663 + CPPFLAGS="-x objective-c++ $CPPFLAGS"
664 +@@ -37411,6 +37496,10 @@ fi
665 + wxUSE_WEBVIEW="yes"
666 + $as_echo "#define wxUSE_WEBVIEW_WEBKIT 1" >>confdefs.h
667 +
668 ++ elif test "$USE_WEBVIEW_WEBKIT2" = 1; then
669 ++ wxUSE_WEBVIEW="yes"
670 ++ $as_echo "#define wxUSE_WEBVIEW_WEBKIT2 1" >>confdefs.h
671 ++
672 + else
673 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: WebKit not available, disabling wxWebView" >&5
674 + $as_echo "$as_me: WARNING: WebKit not available, disabling wxWebView" >&2;}
675 +@@ -41665,6 +41754,11 @@ EOF
676 + COND_USE_THREADS_1=""
677 + fi
678 +
679 ++ COND_USE_WEBVIEW_WEBKIT2_1="#"
680 ++ if test "x$USE_WEBVIEW_WEBKIT2" = "x1" ; then
681 ++ COND_USE_WEBVIEW_WEBKIT2_1=""
682 ++ fi
683 ++
684 + COND_USE_XRC_1="#"
685 + if test "x$USE_XRC" = "x1" ; then
686 + COND_USE_XRC_1=""
687 +diff --git a/configure.in b/configure.in
688 +index 20d3eff..632fd70 100644
689 +--- a/configure.in
690 ++++ b/configure.in
691 +@@ -7252,22 +7252,37 @@ fi
692 +
693 + if test "$wxUSE_WEBVIEW" = "yes"; then
694 + USE_WEBVIEW_WEBKIT=0
695 ++ USE_WEBVIEW_WEBKIT2=0
696 + if test "$wxUSE_WEBVIEW_WEBKIT" = "yes"; then
697 + if test "$wxUSE_GTK" = 1; then
698 +- webkitgtk=webkit-1.0
699 + if test "$WXGTK3" = 1; then
700 +- webkitgtk=webkitgtk-3.0
701 ++ PKG_CHECK_MODULES([WEBKIT],
702 ++ [webkit2gtk-4.0],
703 ++ [
704 ++ USE_WEBVIEW_WEBKIT2=1
705 ++ CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
706 ++ EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
707 ++ ],
708 ++ [
709 ++ AC_MSG_WARN([webkit2gtk not found, falling back to webkitgtk])
710 ++ ])
711 ++ fi
712 ++ if test "$USE_WEBVIEW_WEBKIT2" = 0; then
713 ++ webkitgtk=webkit-1.0
714 ++ if test "$WXGTK3" = 1; then
715 ++ webkitgtk=webkitgtk-3.0
716 ++ fi
717 ++ PKG_CHECK_MODULES([WEBKIT],
718 ++ [$webkitgtk >= 1.3.1],
719 ++ [
720 ++ USE_WEBVIEW_WEBKIT=1
721 ++ CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
722 ++ EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
723 ++ ],
724 ++ [
725 ++ AC_MSG_WARN([webkitgtk not found.])
726 ++ ])
727 + fi
728 +- PKG_CHECK_MODULES([WEBKIT],
729 +- [$webkitgtk >= 1.3.1],
730 +- [
731 +- USE_WEBVIEW_WEBKIT=1
732 +- CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
733 +- EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
734 +- ],
735 +- [
736 +- AC_MSG_WARN([webkitgtk not found.])
737 +- ])
738 + elif test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
739 + dnl Under Mac we always have the libraries but check for the
740 + dnl headers
741 +@@ -7294,6 +7309,9 @@ if test "$wxUSE_WEBVIEW" = "yes"; then
742 + if test "$USE_WEBVIEW_WEBKIT" = 1; then
743 + wxUSE_WEBVIEW="yes"
744 + AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
745 ++ elif test "$USE_WEBVIEW_WEBKIT2" = 1; then
746 ++ wxUSE_WEBVIEW="yes"
747 ++ AC_DEFINE(wxUSE_WEBVIEW_WEBKIT2)
748 + else
749 + AC_MSG_WARN([WebKit not available, disabling wxWebView])
750 + fi
751 +diff --git a/docs/changes.txt b/docs/changes.txt
752 +index 0565bca..75158a5 100644
753 +--- a/docs/changes.txt
754 ++++ b/docs/changes.txt
755 +@@ -580,6 +580,14 @@ Major new features in this release
756 +
757 +
758 +
759 ++3.0.4: (released 2017-??-??)
760 ++----------------------------
761 ++
762 ++wxGTK:
763 ++
764 ++- Allow using more recent WebKit2GTK+ in wxWebView (Scott Talbert).
765 ++
766 ++
767 + 3.0.3: (released 2017-05-02)
768 + ----------------------------
769 +
770 +diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h
771 +index 3b9ab29..2bbbdaa 100644
772 +--- a/include/wx/android/setup.h
773 ++++ b/include/wx/android/setup.h
774 +@@ -726,12 +726,23 @@
775 + // Default is 1 on GTK and OSX
776 + //
777 + // Recommended setting: 1
778 +-#if defined(__WXGTK__) || defined(__WXOSX__)
779 ++#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
780 + #define wxUSE_WEBVIEW_WEBKIT 1
781 + #else
782 + #define wxUSE_WEBVIEW_WEBKIT 0
783 + #endif
784 +
785 ++// Use the WebKit2 wxWebView backend
786 ++//
787 ++// Default is 1 on GTK3
788 ++//
789 ++// Recommended setting: 1
790 ++#if defined(__WXGTK3__)
791 ++#define wxUSE_WEBVIEW_WEBKIT2 1
792 ++#else
793 ++#define wxUSE_WEBVIEW_WEBKIT2 0
794 ++#endif
795 ++
796 + // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced
797 + // 2D drawing API. (Still somewhat experimental)
798 + //
799 +diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h
800 +index 47fa8ee..0c73823 100644
801 +--- a/include/wx/chkconf.h
802 ++++ b/include/wx/chkconf.h
803 +@@ -2190,7 +2190,7 @@
804 + # endif
805 + #endif /* wxUSE_TREELISTCTRL */
806 +
807 +-#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_IE)
808 ++#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2 || wxUSE_WEBVIEW_IE)
809 + # ifdef wxABORT_ON_CONFIG_ERROR
810 + # error "wxUSE_WEBVIEW requires at least one backend"
811 + # else
812 +diff --git a/include/wx/gtk/webview_webkit.h b/include/wx/gtk/webview_webkit.h
813 +index e1a01bf..046554e 100644
814 +--- a/include/wx/gtk/webview_webkit.h
815 ++++ b/include/wx/gtk/webview_webkit.h
816 +@@ -11,10 +11,15 @@
817 +
818 + #include "wx/defs.h"
819 +
820 +-#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
821 ++// NOTE: this header is used for both the WebKit1 and WebKit2 implementations
822 ++#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2) && defined(__WXGTK__)
823 +
824 + #include "wx/sharedptr.h"
825 + #include "wx/webview.h"
826 ++#if wxUSE_WEBVIEW_WEBKIT2
827 ++#include <glib.h>
828 ++#include <gio/gio.h>
829 ++#endif
830 +
831 + typedef struct _WebKitWebView WebKitWebView;
832 +
833 +@@ -152,6 +157,11 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
834 + // focus event handler: calls GTKUpdateBitmap()
835 + void GTKOnFocus(wxFocusEvent& event);
836 +
837 ++#if wxUSE_WEBVIEW_WEBKIT2
838 ++ bool CanExecuteEditingCommand(const gchar* command) const;
839 ++ void SetupWebExtensionServer();
840 ++#endif
841 ++
842 + WebKitWebView *m_web_view;
843 + int m_historyLimit;
844 +
845 +@@ -163,6 +173,12 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
846 + int m_findPosition;
847 + int m_findCount;
848 +
849 ++#if wxUSE_WEBVIEW_WEBKIT2
850 ++ //Used for webkit2 extension
851 ++ GDBusServer *m_dbusServer;
852 ++ GDBusProxy *m_extension;
853 ++#endif
854 ++
855 + wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
856 + };
857 +
858 +diff --git a/include/wx/gtk/webview_webkit2_extension.h b/include/wx/gtk/webview_webkit2_extension.h
859 +new file mode 100644
860 +index 0000000..f554d69
861 +--- /dev/null
862 ++++ b/include/wx/gtk/webview_webkit2_extension.h
863 +@@ -0,0 +1,15 @@
864 ++/////////////////////////////////////////////////////////////////////////////
865 ++// Name: include/gtk/wx/webview_webkit2_extension.h
866 ++// Purpose: Common elements for webview webkit2 extension
867 ++// Author: Scott Talbert
868 ++// Copyright: (c) 2017 Scott Talbert
869 ++// Licence: wxWindows licence
870 ++/////////////////////////////////////////////////////////////////////////////
871 ++
872 ++#ifndef _WX_GTK_WEBVIEW_WEBKIT2_EXTENSION_H_
873 ++#define _WX_GTK_WEBVIEW_WEBKIT2_EXTENSION_H_
874 ++
875 ++#define WXGTK_WEB_EXTENSION_OBJECT_PATH "/org/wxwidgets/wxGTK/WebExtension"
876 ++#define WXGTK_WEB_EXTENSION_INTERFACE "org.wxwidgets.wxGTK.WebExtension"
877 ++
878 ++#endif
879 +diff --git a/include/wx/gtk/webviewhistoryitem_webkit.h b/include/wx/gtk/webviewhistoryitem_webkit.h
880 +index a798efd..3137b3a 100644
881 +--- a/include/wx/gtk/webviewhistoryitem_webkit.h
882 ++++ b/include/wx/gtk/webviewhistoryitem_webkit.h
883 +@@ -11,7 +11,7 @@
884 +
885 + #include "wx/setup.h"
886 +
887 +-#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
888 ++#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2) && defined(__WXGTK__)
889 +
890 + class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem
891 + {
892 +diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h
893 +index 692445c..7044250 100644
894 +--- a/include/wx/msw/wince/setup.h
895 ++++ b/include/wx/msw/wince/setup.h
896 +@@ -745,12 +745,23 @@
897 + // Default is 1 on GTK and OSX
898 + //
899 + // Recommended setting: 1
900 +-#if defined(__WXGTK__) || defined(__WXOSX__)
901 ++#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
902 + #define wxUSE_WEBVIEW_WEBKIT 1
903 + #else
904 + #define wxUSE_WEBVIEW_WEBKIT 0
905 + #endif
906 +
907 ++// Use the WebKit2 wxWebView backend
908 ++//
909 ++// Default is 1 on GTK3
910 ++//
911 ++// Recommended setting: 1
912 ++#if defined(__WXGTK3__)
913 ++#define wxUSE_WEBVIEW_WEBKIT2 1
914 ++#else
915 ++#define wxUSE_WEBVIEW_WEBKIT2 0
916 ++#endif
917 ++
918 + // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced
919 + // 2D drawing API. (Still somewhat experimental)
920 + //
921 +diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h
922 +index dbca6a4..f87b39d 100644
923 +--- a/include/wx/setup_inc.h
924 ++++ b/include/wx/setup_inc.h
925 +@@ -741,12 +741,23 @@
926 + // Default is 1 on GTK and OSX
927 + //
928 + // Recommended setting: 1
929 +-#if defined(__WXGTK__) || defined(__WXOSX__)
930 ++#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
931 + #define wxUSE_WEBVIEW_WEBKIT 1
932 + #else
933 + #define wxUSE_WEBVIEW_WEBKIT 0
934 + #endif
935 +
936 ++// Use the WebKit2 wxWebView backend
937 ++//
938 ++// Default is 1 on GTK3
939 ++//
940 ++// Recommended setting: 1
941 ++#if defined(__WXGTK3__)
942 ++#define wxUSE_WEBVIEW_WEBKIT2 1
943 ++#else
944 ++#define wxUSE_WEBVIEW_WEBKIT2 0
945 ++#endif
946 ++
947 + // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced
948 + // 2D drawing API. (Still somewhat experimental)
949 + //
950 +diff --git a/interface/wx/webview.h b/interface/wx/webview.h
951 +index 694eba7..e7ff2e9 100644
952 +--- a/interface/wx/webview.h
953 ++++ b/interface/wx/webview.h
954 +@@ -571,11 +571,15 @@ class wxWebView : public wxControl
955 +
956 + /**
957 + Clear the history, this will also remove the visible page.
958 ++
959 ++ @note This is not implemented on the WebKit2GTK+ backend.
960 + */
961 + virtual void ClearHistory() = 0;
962 +
963 + /**
964 + Enable or disable the history. This will also clear the history.
965 ++
966 ++ @note This is not implemented on the WebKit2GTK+ backend.
967 + */
968 + virtual void EnableHistory(bool enable = true) = 0;
969 +
970 +diff --git a/samples/webview/webview.cpp b/samples/webview/webview.cpp
971 +index a1c6217..0c135c7 100644
972 +--- a/samples/webview/webview.cpp
973 ++++ b/samples/webview/webview.cpp
974 +@@ -21,7 +21,7 @@
975 + #include "wx/wx.h"
976 + #endif
977 +
978 +-#if !wxUSE_WEBVIEW_WEBKIT && !wxUSE_WEBVIEW_IE
979 ++#if !wxUSE_WEBVIEW_WEBKIT && !wxUSE_WEBVIEW_WEBKIT2 && !wxUSE_WEBVIEW_IE
980 + #error "A wxWebView backend is required by this sample"
981 + #endif
982 +
983 +diff --git a/setup.h.in b/setup.h.in
984 +index 86a162c..b1c630b 100644
985 +--- a/setup.h.in
986 ++++ b/setup.h.in
987 +@@ -340,12 +340,18 @@
988 + #define wxUSE_WEBVIEW_IE 0
989 + #endif
990 +
991 +-#if defined(__WXGTK__) || defined(__WXOSX__)
992 ++#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
993 + #define wxUSE_WEBVIEW_WEBKIT 0
994 + #else
995 + #define wxUSE_WEBVIEW_WEBKIT 0
996 + #endif
997 +
998 ++#if defined(__WXGTK3__)
999 ++#define wxUSE_WEBVIEW_WEBKIT2 0
1000 ++#else
1001 ++#define wxUSE_WEBVIEW_WEBKIT2 0
1002 ++#endif
1003 ++
1004 +
1005 + #ifdef _MSC_VER
1006 + # if _MSC_VER >= 1310
1007 +diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp
1008 +new file mode 100644
1009 +index 0000000..3e3393f
1010 +--- /dev/null
1011 ++++ b/src/gtk/webview_webkit2.cpp
1012 +@@ -0,0 +1,1261 @@
1013 ++/////////////////////////////////////////////////////////////////////////////
1014 ++// Name: src/gtk/webview_webkit2.cpp
1015 ++// Purpose: GTK WebKit2 backend for web view component
1016 ++// Author: Scott Talbert
1017 ++// Copyright: (c) 2017 Scott Talbert
1018 ++// Licence: wxWindows licence
1019 ++/////////////////////////////////////////////////////////////////////////////
1020 ++
1021 ++// For compilers that support precompilation, includes "wx.h".
1022 ++#include "wx/wxprec.h"
1023 ++
1024 ++#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT2
1025 ++
1026 ++#include "wx/stockitem.h"
1027 ++#include "wx/gtk/webview_webkit.h"
1028 ++#include "wx/gtk/control.h"
1029 ++#include "wx/gtk/private.h"
1030 ++#include "wx/filesys.h"
1031 ++#include "wx/base64.h"
1032 ++#include "wx/log.h"
1033 ++#include "wx/gtk/webview_webkit2_extension.h"
1034 ++#include <webkit2/webkit2.h>
1035 ++
1036 ++// ----------------------------------------------------------------------------
1037 ++// GTK callbacks
1038 ++// ----------------------------------------------------------------------------
1039 ++
1040 ++extern "C"
1041 ++{
1042 ++
1043 ++static void
1044 ++wxgtk_webview_webkit_load_changed(GtkWidget *,
1045 ++ WebKitLoadEvent load_event,
1046 ++ wxWebViewWebKit *webKitCtrl)
1047 ++{
1048 ++ wxString url = webKitCtrl->GetCurrentURL();
1049 ++
1050 ++ wxString target; // TODO: get target (if possible)
1051 ++
1052 ++ if (load_event == WEBKIT_LOAD_FINISHED)
1053 ++ {
1054 ++ webKitCtrl->m_busy = false;
1055 ++ wxWebViewEvent event(wxEVT_WEBVIEW_LOADED,
1056 ++ webKitCtrl->GetId(),
1057 ++ url, target);
1058 ++
1059 ++ if (webKitCtrl && webKitCtrl->GetEventHandler())
1060 ++ webKitCtrl->GetEventHandler()->ProcessEvent(event);
1061 ++ }
1062 ++ else if (load_event == WEBKIT_LOAD_COMMITTED)
1063 ++ {
1064 ++ webKitCtrl->m_busy = true;
1065 ++ wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATED,
1066 ++ webKitCtrl->GetId(),
1067 ++ url, target);
1068 ++
1069 ++ if (webKitCtrl && webKitCtrl->GetEventHandler())
1070 ++ webKitCtrl->GetEventHandler()->ProcessEvent(event);
1071 ++ }
1072 ++}
1073 ++
1074 ++static gboolean
1075 ++wxgtk_webview_webkit_navigation(WebKitWebView *web_view,
1076 ++ WebKitPolicyDecision *decision,
1077 ++ wxWebViewWebKit *webKitCtrl)
1078 ++{
1079 ++ WebKitNavigationPolicyDecision* navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION(decision);
1080 ++ WebKitNavigationAction* action = webkit_navigation_policy_decision_get_navigation_action(navigation_decision);
1081 ++ WebKitURIRequest* request = webkit_navigation_action_get_request(action);
1082 ++ const gchar* uri = webkit_uri_request_get_uri(request);
1083 ++ wxString target = webkit_navigation_policy_decision_get_frame_name(navigation_decision);
1084 ++
1085 ++ //If m_creating is true then we are the result of a new window
1086 ++ //and so we need to send the event and veto the load
1087 ++ if(webKitCtrl->m_creating)
1088 ++ {
1089 ++ webKitCtrl->m_creating = false;
1090 ++ wxWebViewEvent event(wxEVT_WEBVIEW_NEWWINDOW,
1091 ++ webKitCtrl->GetId(),
1092 ++ wxString(uri, wxConvUTF8),
1093 ++ target);
1094 ++
1095 ++ if(webKitCtrl && webKitCtrl->GetEventHandler())
1096 ++ webKitCtrl->GetEventHandler()->ProcessEvent(event);
1097 ++
1098 ++ webkit_policy_decision_ignore(decision);
1099 ++ return TRUE;
1100 ++ }
1101 ++
1102 ++ if(webKitCtrl->m_guard)
1103 ++ {
1104 ++ webKitCtrl->m_guard = false;
1105 ++ //We set this to make sure that we don't try to load the page again from
1106 ++ //the resource request callback
1107 ++ webKitCtrl->m_vfsurl = webkit_web_view_get_uri(web_view);
1108 ++ webkit_policy_decision_use(decision);
1109 ++ return FALSE;
1110 ++ }
1111 ++
1112 ++ webKitCtrl->m_busy = true;
1113 ++
1114 ++ wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATING,
1115 ++ webKitCtrl->GetId(),
1116 ++ wxString( uri, wxConvUTF8 ),
1117 ++ target);
1118 ++
1119 ++ if (webKitCtrl && webKitCtrl->GetEventHandler())
1120 ++ webKitCtrl->GetEventHandler()->ProcessEvent(event);
1121 ++
1122 ++ if (!event.IsAllowed())
1123 ++ {
1124 ++ webKitCtrl->m_busy = false;
1125 ++ webkit_policy_decision_ignore(decision);
1126 ++ return TRUE;
1127 ++ }
1128 ++ else
1129 ++ {
1130 ++ wxString wxuri = uri;
1131 ++ wxSharedPtr<wxWebViewHandler> handler;
1132 ++ wxVector<wxSharedPtr<wxWebViewHandler> > handlers = webKitCtrl->GetHandlers();
1133 ++ //We are not vetoed so see if we match one of the additional handlers
1134 ++ for(wxVector<wxSharedPtr<wxWebViewHandler> >::iterator it = handlers.begin();
1135 ++ it != handlers.end(); ++it)
1136 ++ {
1137 ++ if(wxuri.substr(0, (*it)->GetName().length()) == (*it)->GetName())
1138 ++ {
1139 ++ handler = (*it);
1140 ++ }
1141 ++ }
1142 ++ //If we found a handler we can then use it to load the file directly
1143 ++ //ourselves
1144 ++ if(handler)
1145 ++ {
1146 ++ webKitCtrl->m_guard = true;
1147 ++ wxFSFile* file = handler->GetFile(wxuri);
1148 ++ if(file)
1149 ++ {
1150 ++ webKitCtrl->SetPage(*file->GetStream(), wxuri);
1151 ++ }
1152 ++ //We need to throw some sort of error here if file is NULL
1153 ++ webkit_policy_decision_ignore(decision);
1154 ++ return TRUE;
1155 ++ }
1156 ++ return FALSE;
1157 ++ }
1158 ++}
1159 ++
1160 ++static gboolean
1161 ++wxgtk_webview_webkit_load_failed(WebKitWebView *,
1162 ++ WebKitLoadEvent,
1163 ++ gchar *uri,
1164 ++ GError *error,
1165 ++ wxWebViewWebKit* webKitWindow)
1166 ++{
1167 ++ webKitWindow->m_busy = false;
1168 ++ wxWebViewNavigationError type = wxWEBVIEW_NAV_ERR_OTHER;
1169 ++
1170 ++ wxString description(error->message, wxConvUTF8);
1171 ++
1172 ++ if (strcmp(g_quark_to_string(error->domain), "soup_http_error_quark") == 0)
1173 ++ {
1174 ++ switch (error->code)
1175 ++ {
1176 ++ case SOUP_STATUS_CANCELLED:
1177 ++ type = wxWEBVIEW_NAV_ERR_USER_CANCELLED;
1178 ++ break;
1179 ++
1180 ++ case SOUP_STATUS_CANT_RESOLVE:
1181 ++ case SOUP_STATUS_NOT_FOUND:
1182 ++ type = wxWEBVIEW_NAV_ERR_NOT_FOUND;
1183 ++ break;
1184 ++
1185 ++ case SOUP_STATUS_CANT_RESOLVE_PROXY:
1186 ++ case SOUP_STATUS_CANT_CONNECT:
1187 ++ case SOUP_STATUS_CANT_CONNECT_PROXY:
1188 ++ case SOUP_STATUS_SSL_FAILED:
1189 ++ case SOUP_STATUS_IO_ERROR:
1190 ++ type = wxWEBVIEW_NAV_ERR_CONNECTION;
1191 ++ break;
1192 ++
1193 ++ case SOUP_STATUS_MALFORMED:
1194 ++ type = wxWEBVIEW_NAV_ERR_REQUEST;
1195 ++ break;
1196 ++
1197 ++ case SOUP_STATUS_BAD_REQUEST:
1198 ++ type = wxWEBVIEW_NAV_ERR_REQUEST;
1199 ++ break;
1200 ++
1201 ++ case SOUP_STATUS_UNAUTHORIZED:
1202 ++ case SOUP_STATUS_FORBIDDEN:
1203 ++ type = wxWEBVIEW_NAV_ERR_AUTH;
1204 ++ break;
1205 ++
1206 ++ case SOUP_STATUS_METHOD_NOT_ALLOWED:
1207 ++ case SOUP_STATUS_NOT_ACCEPTABLE:
1208 ++ type = wxWEBVIEW_NAV_ERR_SECURITY;
1209 ++ break;
1210 ++
1211 ++ case SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED:
1212 ++ type = wxWEBVIEW_NAV_ERR_AUTH;
1213 ++ break;
1214 ++
1215 ++ case SOUP_STATUS_REQUEST_TIMEOUT:
1216 ++ type = wxWEBVIEW_NAV_ERR_CONNECTION;
1217 ++ break;
1218 ++
1219 ++ case SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE:
1220 ++ case SOUP_STATUS_REQUEST_URI_TOO_LONG:
1221 ++ case SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE:
1222 ++ type = wxWEBVIEW_NAV_ERR_REQUEST;
1223 ++ break;
1224 ++
1225 ++ case SOUP_STATUS_BAD_GATEWAY:
1226 ++ case SOUP_STATUS_SERVICE_UNAVAILABLE:
1227 ++ case SOUP_STATUS_GATEWAY_TIMEOUT:
1228 ++ type = wxWEBVIEW_NAV_ERR_CONNECTION;
1229 ++ break;
1230 ++
1231 ++ case SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED:
1232 ++ type = wxWEBVIEW_NAV_ERR_REQUEST;
1233 ++ break;
1234 ++ }
1235 ++ }
1236 ++ else if (strcmp(g_quark_to_string(error->domain),
1237 ++ "webkit-network-error-quark") == 0)
1238 ++ {
1239 ++ switch (error->code)
1240 ++ {
1241 ++ case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL:
1242 ++ type = wxWEBVIEW_NAV_ERR_REQUEST;
1243 ++ break;
1244 ++
1245 ++ case WEBKIT_NETWORK_ERROR_CANCELLED:
1246 ++ type = wxWEBVIEW_NAV_ERR_USER_CANCELLED;
1247 ++ break;
1248 ++
1249 ++ case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST:
1250 ++ type = wxWEBVIEW_NAV_ERR_NOT_FOUND;
1251 ++ break;
1252 ++ }
1253 ++ }
1254 ++ else if (strcmp(g_quark_to_string(error->domain),
1255 ++ "webkit-policy-error-quark") == 0)
1256 ++ {
1257 ++ switch (error->code)
1258 ++ {
1259 ++ case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT:
1260 ++ type = wxWEBVIEW_NAV_ERR_SECURITY;
1261 ++ break;
1262 ++ }
1263 ++ }
1264 ++
1265 ++ wxWebViewEvent event(wxEVT_WEBVIEW_ERROR,
1266 ++ webKitWindow->GetId(),
1267 ++ uri, "");
1268 ++ event.SetString(description);
1269 ++ event.SetInt(type);
1270 ++
1271 ++ if (webKitWindow && webKitWindow->GetEventHandler())
1272 ++ {
1273 ++ webKitWindow->GetEventHandler()->ProcessEvent(event);
1274 ++ }
1275 ++
1276 ++ return FALSE;
1277 ++}
1278 ++
1279 ++static gboolean
1280 ++wxgtk_webview_webkit_new_window(WebKitPolicyDecision *decision,
1281 ++ wxWebViewWebKit *webKitCtrl)
1282 ++{
1283 ++ WebKitNavigationPolicyDecision* navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION(decision);
1284 ++ WebKitNavigationAction* action = webkit_navigation_policy_decision_get_navigation_action(navigation_decision);
1285 ++ WebKitURIRequest* request = webkit_navigation_action_get_request(action);
1286 ++ const gchar* uri = webkit_uri_request_get_uri(request);
1287 ++
1288 ++ wxString target = webkit_navigation_policy_decision_get_frame_name(navigation_decision);
1289 ++ wxWebViewEvent event(wxEVT_WEBVIEW_NEWWINDOW,
1290 ++ webKitCtrl->GetId(),
1291 ++ wxString( uri, wxConvUTF8 ),
1292 ++ target);
1293 ++
1294 ++ if (webKitCtrl && webKitCtrl->GetEventHandler())
1295 ++ webKitCtrl->GetEventHandler()->ProcessEvent(event);
1296 ++
1297 ++ //We always want the user to handle this themselves
1298 ++ webkit_policy_decision_ignore(decision);
1299 ++ return TRUE;
1300 ++}
1301 ++
1302 ++static gboolean
1303 ++wxgtk_webview_webkit_decide_policy(WebKitWebView *web_view,
1304 ++ WebKitPolicyDecision *decision,
1305 ++ WebKitPolicyDecisionType type,
1306 ++ wxWebViewWebKit *webKitCtrl)
1307 ++{
1308 ++ switch (type)
1309 ++ {
1310 ++ case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
1311 ++ return wxgtk_webview_webkit_navigation(web_view, decision, webKitCtrl);
1312 ++ case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
1313 ++ return wxgtk_webview_webkit_new_window(decision, webKitCtrl);
1314 ++ default:
1315 ++ return FALSE;
1316 ++ }
1317 ++}
1318 ++
1319 ++static void
1320 ++wxgtk_webview_webkit_title_changed(GtkWidget* widget,
1321 ++ GParamSpec *,
1322 ++ wxWebViewWebKit *webKitCtrl)
1323 ++{
1324 ++ gchar *title;
1325 ++ g_object_get(G_OBJECT(widget), "title", &title, NULL);
1326 ++
1327 ++ wxWebViewEvent event(wxEVT_WEBVIEW_TITLE_CHANGED,
1328 ++ webKitCtrl->GetId(),
1329 ++ webKitCtrl->GetCurrentURL(),
1330 ++ "");
1331 ++ event.SetString(wxString(title, wxConvUTF8));
1332 ++
1333 ++ if (webKitCtrl && webKitCtrl->GetEventHandler())
1334 ++ webKitCtrl->GetEventHandler()->ProcessEvent(event);
1335 ++
1336 ++ g_free(title);
1337 ++}
1338 ++
1339 ++static void
1340 ++wxgtk_webview_webkit_resource_req(WebKitWebView *,
1341 ++ WebKitWebResource *,
1342 ++ WebKitURIRequest *request,
1343 ++ wxWebViewWebKit *webKitCtrl)
1344 ++{
1345 ++ wxString uri = webkit_uri_request_get_uri(request);
1346 ++
1347 ++ wxSharedPtr<wxWebViewHandler> handler;
1348 ++ wxVector<wxSharedPtr<wxWebViewHandler> > handlers = webKitCtrl->GetHandlers();
1349 ++
1350 ++ //We are not vetoed so see if we match one of the additional handlers
1351 ++ for(wxVector<wxSharedPtr<wxWebViewHandler> >::iterator it = handlers.begin();
1352 ++ it != handlers.end(); ++it)
1353 ++ {
1354 ++ if(uri.substr(0, (*it)->GetName().length()) == (*it)->GetName())
1355 ++ {
1356 ++ handler = (*it);
1357 ++ }
1358 ++ }
1359 ++ //If we found a handler we can then use it to load the file directly
1360 ++ //ourselves
1361 ++ if(handler)
1362 ++ {
1363 ++ //If it is requsting the page itself then return as we have already
1364 ++ //loaded it from the archive
1365 ++ if(webKitCtrl->m_vfsurl == uri)
1366 ++ return;
1367 ++
1368 ++ wxFSFile* file = handler->GetFile(uri);
1369 ++ if(file)
1370 ++ {
1371 ++ //We load the data into a data url to save it being written out again
1372 ++ size_t size = file->GetStream()->GetLength();
1373 ++ char *buffer = new char[size];
1374 ++ file->GetStream()->Read(buffer, size);
1375 ++ wxString data = wxBase64Encode(buffer, size);
1376 ++ delete[] buffer;
1377 ++ wxString mime = file->GetMimeType();
1378 ++ wxString path = "data:" + mime + ";base64," + data;
1379 ++ //Then we can redirect the call
1380 ++ webkit_uri_request_set_uri(request, path.utf8_str());
1381 ++ }
1382 ++
1383 ++ }
1384 ++}
1385 ++
1386 ++static gboolean
1387 ++wxgtk_webview_webkit_context_menu(WebKitWebView *,
1388 ++ WebKitContextMenu *,
1389 ++ GdkEvent *,
1390 ++ WebKitHitTestResult *,
1391 ++ wxWebViewWebKit *webKitCtrl)
1392 ++{
1393 ++ if(webKitCtrl->IsContextMenuEnabled())
1394 ++ return FALSE;
1395 ++ else
1396 ++ return TRUE;
1397 ++}
1398 ++
1399 ++static WebKitWebView*
1400 ++wxgtk_webview_webkit_create_webview(WebKitWebView *web_view,
1401 ++ WebKitNavigationAction *,
1402 ++ wxWebViewWebKit *webKitCtrl)
1403 ++{
1404 ++ //As we do not know the uri being loaded at this point allow the load to
1405 ++ //continue and catch it in navigation-policy-decision-requested
1406 ++ webKitCtrl->m_creating = true;
1407 ++ return web_view;
1408 ++}
1409 ++
1410 ++static void
1411 ++wxgtk_webview_webkit_counted_matches(WebKitFindController *,
1412 ++ guint match_count,
1413 ++ int *findCount)
1414 ++{
1415 ++ *findCount = match_count;
1416 ++}
1417 ++
1418 ++static void
1419 ++wxgtk_initialize_web_extensions(WebKitWebContext *context,
1420 ++ GDBusServer *dbusServer)
1421 ++{
1422 ++ const char *address = g_dbus_server_get_client_address(dbusServer);
1423 ++ GVariant *user_data = g_variant_new("(s)", address);
1424 ++ webkit_web_context_set_web_extensions_directory(context,
1425 ++ WX_WEB_EXTENSIONS_DIRECTORY);
1426 ++ webkit_web_context_set_web_extensions_initialization_user_data(context,
1427 ++ user_data);
1428 ++}
1429 ++
1430 ++static gboolean
1431 ++wxgtk_new_connection_cb(GDBusServer *,
1432 ++ GDBusConnection *connection,
1433 ++ GDBusProxy **proxy)
1434 ++{
1435 ++ GError *error = NULL;
1436 ++ GDBusProxyFlags flags = static_cast<GDBusProxyFlags>(static_cast<int>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES) | static_cast<int>(G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS));
1437 ++ *proxy = g_dbus_proxy_new_sync(connection,
1438 ++ flags,
1439 ++ NULL,
1440 ++ NULL,
1441 ++ WXGTK_WEB_EXTENSION_OBJECT_PATH,
1442 ++ WXGTK_WEB_EXTENSION_INTERFACE,
1443 ++ NULL,
1444 ++ &error);
1445 ++ if (error)
1446 ++ {
1447 ++ g_warning("Failed to create dbus proxy: %s", error->message);
1448 ++ g_error_free(error);
1449 ++ }
1450 ++
1451 ++ return TRUE;
1452 ++}
1453 ++
1454 ++gboolean
1455 ++wxgtk_dbus_peer_is_authorized(GCredentials *peer_credentials)
1456 ++{
1457 ++ static GCredentials *own_credentials = g_credentials_new();
1458 ++ GError *error = NULL;
1459 ++
1460 ++ if (peer_credentials && g_credentials_is_same_user(peer_credentials, own_credentials, &error))
1461 ++ {
1462 ++ return TRUE;
1463 ++ }
1464 ++
1465 ++ if (error)
1466 ++ {
1467 ++ g_warning("Failed to authorize web extension connection: %s", error->message);
1468 ++ g_error_free(error);
1469 ++ }
1470 ++ return FALSE;
1471 ++}
1472 ++
1473 ++static gboolean
1474 ++wxgtk_authorize_authenticated_peer_cb(GDBusAuthObserver *,
1475 ++ GIOStream *,
1476 ++ GCredentials *credentials,
1477 ++ wxWebViewWebKit *)
1478 ++{
1479 ++ return wxgtk_dbus_peer_is_authorized(credentials);
1480 ++}
1481 ++
1482 ++} // extern "C"
1483 ++
1484 ++//-----------------------------------------------------------------------------
1485 ++// wxWebViewWebKit
1486 ++//-----------------------------------------------------------------------------
1487 ++
1488 ++wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView);
1489 ++
1490 ++wxWebViewWebKit::wxWebViewWebKit()
1491 ++{
1492 ++ m_web_view = NULL;
1493 ++ m_dbusServer = NULL;
1494 ++ m_extension = NULL;
1495 ++}
1496 ++
1497 ++bool wxWebViewWebKit::Create(wxWindow *parent,
1498 ++ wxWindowID id,
1499 ++ const wxString &url,
1500 ++ const wxPoint& pos,
1501 ++ const wxSize& size,
1502 ++ long style,
1503 ++ const wxString& name)
1504 ++{
1505 ++ m_busy = false;
1506 ++ m_guard = false;
1507 ++ m_creating = false;
1508 ++ FindClear();
1509 ++
1510 ++ // We currently unconditionally impose scrolling in both directions as it's
1511 ++ // necessary to show arbitrary pages.
1512 ++ style |= wxHSCROLL | wxVSCROLL;
1513 ++
1514 ++ if (!PreCreation( parent, pos, size ) ||
1515 ++ !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
1516 ++ {
1517 ++ wxFAIL_MSG( wxT("wxWebViewWebKit creation failed") );
1518 ++ return false;
1519 ++ }
1520 ++
1521 ++ SetupWebExtensionServer();
1522 ++ g_signal_connect_after(webkit_web_context_get_default(),
1523 ++ "initialize-web-extensions",
1524 ++ G_CALLBACK(wxgtk_initialize_web_extensions),
1525 ++ m_dbusServer);
1526 ++
1527 ++ m_web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
1528 ++ GTKCreateScrolledWindowWith(GTK_WIDGET(m_web_view));
1529 ++ g_object_ref(m_widget);
1530 ++
1531 ++ g_signal_connect_after(m_web_view, "decide-policy",
1532 ++ G_CALLBACK(wxgtk_webview_webkit_decide_policy),
1533 ++ this);
1534 ++
1535 ++ g_signal_connect_after(m_web_view, "load-failed",
1536 ++ G_CALLBACK(wxgtk_webview_webkit_load_failed), this);
1537 ++
1538 ++ g_signal_connect_after(m_web_view, "notify::title",
1539 ++ G_CALLBACK(wxgtk_webview_webkit_title_changed), this);
1540 ++
1541 ++ g_signal_connect_after(m_web_view, "resource-load-started",
1542 ++ G_CALLBACK(wxgtk_webview_webkit_resource_req), this);
1543 ++
1544 ++ g_signal_connect_after(m_web_view, "context-menu",
1545 ++ G_CALLBACK(wxgtk_webview_webkit_context_menu), this);
1546 ++
1547 ++ g_signal_connect_after(m_web_view, "create",
1548 ++ G_CALLBACK(wxgtk_webview_webkit_create_webview), this);
1549 ++
1550 ++ WebKitFindController* findctrl = webkit_web_view_get_find_controller(m_web_view);
1551 ++ g_signal_connect_after(findctrl, "counted-matches",
1552 ++ G_CALLBACK(wxgtk_webview_webkit_counted_matches),
1553 ++ &m_findCount);
1554 ++
1555 ++ m_parent->DoAddChild( this );
1556 ++
1557 ++ PostCreation(size);
1558 ++
1559 ++ /* Open a webpage */
1560 ++ webkit_web_view_load_uri(m_web_view, url.utf8_str());
1561 ++
1562 ++ // last to avoid getting signal too early
1563 ++ g_signal_connect_after(m_web_view, "load-changed",
1564 ++ G_CALLBACK(wxgtk_webview_webkit_load_changed),
1565 ++ this);
1566 ++
1567 ++ return true;
1568 ++}
1569 ++
1570 ++wxWebViewWebKit::~wxWebViewWebKit()
1571 ++{
1572 ++ if (m_web_view)
1573 ++ GTKDisconnect(m_web_view);
1574 ++ if (m_dbusServer)
1575 ++ g_dbus_server_stop(m_dbusServer);
1576 ++ g_clear_object(&m_dbusServer);
1577 ++ g_clear_object(&m_extension);
1578 ++}
1579 ++
1580 ++bool wxWebViewWebKit::Enable( bool enable )
1581 ++{
1582 ++ if (!wxControl::Enable(enable))
1583 ++ return false;
1584 ++
1585 ++ gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
1586 ++
1587 ++ return true;
1588 ++}
1589 ++
1590 ++GdkWindow*
1591 ++wxWebViewWebKit::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
1592 ++{
1593 ++ GdkWindow* window = gtk_widget_get_parent_window(m_widget);
1594 ++ return window;
1595 ++}
1596 ++
1597 ++void wxWebViewWebKit::ZoomIn()
1598 ++{
1599 ++ SetWebkitZoom(GetWebkitZoom() + 0.1);
1600 ++}
1601 ++
1602 ++void wxWebViewWebKit::ZoomOut()
1603 ++{
1604 ++ SetWebkitZoom(GetWebkitZoom() - 0.1);
1605 ++}
1606 ++
1607 ++void wxWebViewWebKit::SetWebkitZoom(float level)
1608 ++{
1609 ++ webkit_web_view_set_zoom_level(m_web_view, level);
1610 ++}
1611 ++
1612 ++float wxWebViewWebKit::GetWebkitZoom() const
1613 ++{
1614 ++ return webkit_web_view_get_zoom_level(m_web_view);
1615 ++}
1616 ++
1617 ++void wxWebViewWebKit::Stop()
1618 ++{
1619 ++ webkit_web_view_stop_loading(m_web_view);
1620 ++}
1621 ++
1622 ++void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags)
1623 ++{
1624 ++ if (flags & wxWEBVIEW_RELOAD_NO_CACHE)
1625 ++ {
1626 ++ webkit_web_view_reload_bypass_cache(m_web_view);
1627 ++ }
1628 ++ else
1629 ++ {
1630 ++ webkit_web_view_reload(m_web_view);
1631 ++ }
1632 ++}
1633 ++
1634 ++void wxWebViewWebKit::LoadURL(const wxString& url)
1635 ++{
1636 ++ webkit_web_view_load_uri(m_web_view, wxGTK_CONV(url));
1637 ++}
1638 ++
1639 ++
1640 ++void wxWebViewWebKit::GoBack()
1641 ++{
1642 ++ webkit_web_view_go_back(m_web_view);
1643 ++}
1644 ++
1645 ++void wxWebViewWebKit::GoForward()
1646 ++{
1647 ++ webkit_web_view_go_forward(m_web_view);
1648 ++}
1649 ++
1650 ++
1651 ++bool wxWebViewWebKit::CanGoBack() const
1652 ++{
1653 ++ return webkit_web_view_can_go_back(m_web_view);
1654 ++}
1655 ++
1656 ++
1657 ++bool wxWebViewWebKit::CanGoForward() const
1658 ++{
1659 ++ return webkit_web_view_can_go_forward(m_web_view);
1660 ++}
1661 ++
1662 ++void wxWebViewWebKit::ClearHistory()
1663 ++{
1664 ++ // In WebKit2GTK+, the BackForwardList can't be cleared so do nothing.
1665 ++}
1666 ++
1667 ++void wxWebViewWebKit::EnableHistory(bool)
1668 ++{
1669 ++ // In WebKit2GTK+, history can't be disabled so do nothing here.
1670 ++}
1671 ++
1672 ++wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewWebKit::GetBackwardHistory()
1673 ++{
1674 ++ wxVector<wxSharedPtr<wxWebViewHistoryItem> > backhist;
1675 ++ WebKitBackForwardList* history =
1676 ++ webkit_web_view_get_back_forward_list(m_web_view);
1677 ++ GList* list = webkit_back_forward_list_get_back_list_with_limit(history,
1678 ++ m_historyLimit);
1679 ++ //We need to iterate in reverse to get the order we desire
1680 ++ for(int i = g_list_length(list) - 1; i >= 0 ; i--)
1681 ++ {
1682 ++ WebKitBackForwardListItem* gtkitem = (WebKitBackForwardListItem*)g_list_nth_data(list, i);
1683 ++ wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem(
1684 ++ webkit_back_forward_list_item_get_uri(gtkitem),
1685 ++ webkit_back_forward_list_item_get_title(gtkitem));
1686 ++ wxitem->m_histItem = gtkitem;
1687 ++ wxSharedPtr<wxWebViewHistoryItem> item(wxitem);
1688 ++ backhist.push_back(item);
1689 ++ }
1690 ++ return backhist;
1691 ++}
1692 ++
1693 ++wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewWebKit::GetForwardHistory()
1694 ++{
1695 ++ wxVector<wxSharedPtr<wxWebViewHistoryItem> > forwardhist;
1696 ++ WebKitBackForwardList* history =
1697 ++ webkit_web_view_get_back_forward_list(m_web_view);
1698 ++ GList* list = webkit_back_forward_list_get_forward_list_with_limit(history,
1699 ++ m_historyLimit);
1700 ++ for(guint i = 0; i < g_list_length(list); i++)
1701 ++ {
1702 ++ WebKitBackForwardListItem* gtkitem = (WebKitBackForwardListItem*)g_list_nth_data(list, i);
1703 ++ wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem(
1704 ++ webkit_back_forward_list_item_get_uri(gtkitem),
1705 ++ webkit_back_forward_list_item_get_title(gtkitem));
1706 ++ wxitem->m_histItem = gtkitem;
1707 ++ wxSharedPtr<wxWebViewHistoryItem> item(wxitem);
1708 ++ forwardhist.push_back(item);
1709 ++ }
1710 ++ return forwardhist;
1711 ++}
1712 ++
1713 ++void wxWebViewWebKit::LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item)
1714 ++{
1715 ++ WebKitBackForwardListItem* gtkitem = (WebKitBackForwardListItem*)item->m_histItem;
1716 ++ if(gtkitem)
1717 ++ {
1718 ++ webkit_web_view_go_to_back_forward_list_item(m_web_view,
1719 ++ WEBKIT_BACK_FORWARD_LIST_ITEM(gtkitem));
1720 ++ }
1721 ++}
1722 ++
1723 ++static void wxgtk_can_execute_editing_command_cb(WebKitWebView *,
1724 ++ GAsyncResult *res,
1725 ++ GAsyncResult **res_out)
1726 ++{
1727 ++ *res_out = (GAsyncResult*)g_object_ref(res);
1728 ++}
1729 ++
1730 ++bool wxWebViewWebKit::CanExecuteEditingCommand(const gchar* command) const
1731 ++{
1732 ++ GAsyncResult *result = NULL;
1733 ++ webkit_web_view_can_execute_editing_command(m_web_view,
1734 ++ command,
1735 ++ NULL,
1736 ++ (GAsyncReadyCallback)wxgtk_can_execute_editing_command_cb,
1737 ++ &result);
1738 ++
1739 ++ GMainContext *main_context = g_main_context_get_thread_default();
1740 ++ while (!result)
1741 ++ {
1742 ++ g_main_context_iteration(main_context, TRUE);
1743 ++ }
1744 ++
1745 ++ gboolean can_execute = webkit_web_view_can_execute_editing_command_finish(m_web_view,
1746 ++ result,
1747 ++ NULL);
1748 ++ g_object_unref(result);
1749 ++
1750 ++ return can_execute;
1751 ++}
1752 ++
1753 ++bool wxWebViewWebKit::CanCut() const
1754 ++{
1755 ++ return CanExecuteEditingCommand(WEBKIT_EDITING_COMMAND_CUT);
1756 ++}
1757 ++
1758 ++bool wxWebViewWebKit::CanCopy() const
1759 ++{
1760 ++ return CanExecuteEditingCommand(WEBKIT_EDITING_COMMAND_COPY);
1761 ++}
1762 ++
1763 ++bool wxWebViewWebKit::CanPaste() const
1764 ++{
1765 ++ return CanExecuteEditingCommand(WEBKIT_EDITING_COMMAND_PASTE);
1766 ++}
1767 ++
1768 ++void wxWebViewWebKit::Cut()
1769 ++{
1770 ++ webkit_web_view_execute_editing_command(m_web_view,
1771 ++ WEBKIT_EDITING_COMMAND_CUT);
1772 ++}
1773 ++
1774 ++void wxWebViewWebKit::Copy()
1775 ++{
1776 ++ webkit_web_view_execute_editing_command(m_web_view,
1777 ++ WEBKIT_EDITING_COMMAND_COPY);
1778 ++}
1779 ++
1780 ++void wxWebViewWebKit::Paste()
1781 ++{
1782 ++ webkit_web_view_execute_editing_command(m_web_view,
1783 ++ WEBKIT_EDITING_COMMAND_PASTE);
1784 ++}
1785 ++
1786 ++bool wxWebViewWebKit::CanUndo() const
1787 ++{
1788 ++ return CanExecuteEditingCommand(WEBKIT_EDITING_COMMAND_UNDO);
1789 ++}
1790 ++
1791 ++bool wxWebViewWebKit::CanRedo() const
1792 ++{
1793 ++ return CanExecuteEditingCommand(WEBKIT_EDITING_COMMAND_REDO);
1794 ++}
1795 ++
1796 ++void wxWebViewWebKit::Undo()
1797 ++{
1798 ++ webkit_web_view_execute_editing_command(m_web_view,
1799 ++ WEBKIT_EDITING_COMMAND_UNDO);
1800 ++}
1801 ++
1802 ++void wxWebViewWebKit::Redo()
1803 ++{
1804 ++ webkit_web_view_execute_editing_command(m_web_view,
1805 ++ WEBKIT_EDITING_COMMAND_REDO);
1806 ++}
1807 ++
1808 ++wxString wxWebViewWebKit::GetCurrentURL() const
1809 ++{
1810 ++ // FIXME: check which encoding the web kit control uses instead of
1811 ++ // assuming UTF8 (here and elsewhere too)
1812 ++ return wxString::FromUTF8(webkit_web_view_get_uri(m_web_view));
1813 ++}
1814 ++
1815 ++
1816 ++wxString wxWebViewWebKit::GetCurrentTitle() const
1817 ++{
1818 ++ return wxString::FromUTF8(webkit_web_view_get_title(m_web_view));
1819 ++}
1820 ++
1821 ++
1822 ++static void wxgtk_web_resource_get_data_cb(WebKitWebResource *,
1823 ++ GAsyncResult *res,
1824 ++ GAsyncResult **res_out)
1825 ++{
1826 ++ *res_out = (GAsyncResult*)g_object_ref(res);
1827 ++}
1828 ++
1829 ++wxString wxWebViewWebKit::GetPageSource() const
1830 ++{
1831 ++ WebKitWebResource *resource = webkit_web_view_get_main_resource(m_web_view);
1832 ++ if (!resource)
1833 ++ {
1834 ++ return wxString();
1835 ++ }
1836 ++
1837 ++ GAsyncResult *result = NULL;
1838 ++ webkit_web_resource_get_data(resource, NULL,
1839 ++ (GAsyncReadyCallback)wxgtk_web_resource_get_data_cb,
1840 ++ &result);
1841 ++
1842 ++ GMainContext *main_context = g_main_context_get_thread_default();
1843 ++ while (!result)
1844 ++ {
1845 ++ g_main_context_iteration(main_context, TRUE);
1846 ++ }
1847 ++
1848 ++ guchar *source = webkit_web_resource_get_data_finish(resource, result,
1849 ++ NULL, NULL);
1850 ++ if (result)
1851 ++ {
1852 ++ g_object_unref(result);
1853 ++ }
1854 ++
1855 ++ if (source)
1856 ++ {
1857 ++ wxString wxs = wxString(source, wxConvUTF8);
1858 ++ free(source);
1859 ++ return wxs;
1860 ++ }
1861 ++ return wxString();
1862 ++}
1863 ++
1864 ++
1865 ++wxWebViewZoom wxWebViewWebKit::GetZoom() const
1866 ++{
1867 ++ float zoom = GetWebkitZoom();
1868 ++
1869 ++ // arbitrary way to map float zoom to our common zoom enum
1870 ++ if (zoom <= 0.65)
1871 ++ {
1872 ++ return wxWEBVIEW_ZOOM_TINY;
1873 ++ }
1874 ++ else if (zoom > 0.65 && zoom <= 0.90)
1875 ++ {
1876 ++ return wxWEBVIEW_ZOOM_SMALL;
1877 ++ }
1878 ++ else if (zoom > 0.90 && zoom <= 1.15)
1879 ++ {
1880 ++ return wxWEBVIEW_ZOOM_MEDIUM;
1881 ++ }
1882 ++ else if (zoom > 1.15 && zoom <= 1.45)
1883 ++ {
1884 ++ return wxWEBVIEW_ZOOM_LARGE;
1885 ++ }
1886 ++ else if (zoom > 1.45)
1887 ++ {
1888 ++ return wxWEBVIEW_ZOOM_LARGEST;
1889 ++ }
1890 ++
1891 ++ // to shut up compilers, this can never be reached logically
1892 ++ wxFAIL;
1893 ++ return wxWEBVIEW_ZOOM_MEDIUM;
1894 ++}
1895 ++
1896 ++
1897 ++void wxWebViewWebKit::SetZoom(wxWebViewZoom zoom)
1898 ++{
1899 ++ // arbitrary way to map our common zoom enum to float zoom
1900 ++ switch (zoom)
1901 ++ {
1902 ++ case wxWEBVIEW_ZOOM_TINY:
1903 ++ SetWebkitZoom(0.6f);
1904 ++ break;
1905 ++
1906 ++ case wxWEBVIEW_ZOOM_SMALL:
1907 ++ SetWebkitZoom(0.8f);
1908 ++ break;
1909 ++
1910 ++ case wxWEBVIEW_ZOOM_MEDIUM:
1911 ++ SetWebkitZoom(1.0f);
1912 ++ break;
1913 ++
1914 ++ case wxWEBVIEW_ZOOM_LARGE:
1915 ++ SetWebkitZoom(1.3);
1916 ++ break;
1917 ++
1918 ++ case wxWEBVIEW_ZOOM_LARGEST:
1919 ++ SetWebkitZoom(1.6);
1920 ++ break;
1921 ++
1922 ++ default:
1923 ++ wxFAIL;
1924 ++ }
1925 ++}
1926 ++
1927 ++void wxWebViewWebKit::SetZoomType(wxWebViewZoomType type)
1928 ++{
1929 ++ WebKitSettings* settings = webkit_web_view_get_settings(m_web_view);
1930 ++ webkit_settings_set_zoom_text_only(settings,
1931 ++ (type == wxWEBVIEW_ZOOM_TYPE_TEXT ?
1932 ++ TRUE : FALSE));
1933 ++}
1934 ++
1935 ++wxWebViewZoomType wxWebViewWebKit::GetZoomType() const
1936 ++{
1937 ++ WebKitSettings* settings = webkit_web_view_get_settings(m_web_view);
1938 ++ gboolean tozoom = webkit_settings_get_zoom_text_only(settings);
1939 ++
1940 ++ if (tozoom)
1941 ++ return wxWEBVIEW_ZOOM_TYPE_TEXT;
1942 ++ else
1943 ++ return wxWEBVIEW_ZOOM_TYPE_LAYOUT;
1944 ++}
1945 ++
1946 ++bool wxWebViewWebKit::CanSetZoomType(wxWebViewZoomType) const
1947 ++{
1948 ++ // this port supports all zoom types
1949 ++ return true;
1950 ++}
1951 ++
1952 ++void wxWebViewWebKit::DoSetPage(const wxString& html, const wxString& baseUri)
1953 ++{
1954 ++ webkit_web_view_load_html(m_web_view,
1955 ++ html.mb_str(wxConvUTF8),
1956 ++ baseUri.mb_str(wxConvUTF8));
1957 ++}
1958 ++
1959 ++void wxWebViewWebKit::Print()
1960 ++{
1961 ++ WebKitPrintOperation* printop = webkit_print_operation_new(m_web_view);
1962 ++ webkit_print_operation_run_dialog(printop, NULL);
1963 ++ g_object_unref(printop);
1964 ++}
1965 ++
1966 ++
1967 ++bool wxWebViewWebKit::IsBusy() const
1968 ++{
1969 ++ return m_busy;
1970 ++}
1971 ++
1972 ++void wxWebViewWebKit::SetEditable(bool enable)
1973 ++{
1974 ++ webkit_web_view_set_editable(m_web_view, enable);
1975 ++}
1976 ++
1977 ++bool wxWebViewWebKit::IsEditable() const
1978 ++{
1979 ++ gboolean editable;
1980 ++ g_object_get(m_web_view, "editable", &editable, NULL);
1981 ++ return editable;
1982 ++}
1983 ++
1984 ++void wxWebViewWebKit::DeleteSelection()
1985 ++{
1986 ++ if (m_extension)
1987 ++ {
1988 ++ guint64 page_id = webkit_web_view_get_page_id(m_web_view);
1989 ++ GVariant *retval = g_dbus_proxy_call_sync(m_extension,
1990 ++ "DeleteSelection",
1991 ++ g_variant_new("(t)", page_id),
1992 ++ G_DBUS_CALL_FLAGS_NONE, -1,
1993 ++ NULL, NULL);
1994 ++ if (retval)
1995 ++ {
1996 ++ g_variant_unref(retval);
1997 ++ }
1998 ++ }
1999 ++}
2000 ++
2001 ++bool wxWebViewWebKit::HasSelection() const
2002 ++{
2003 ++ if (m_extension)
2004 ++ {
2005 ++ guint64 page_id = webkit_web_view_get_page_id(m_web_view);
2006 ++ GVariant *retval = g_dbus_proxy_call_sync(m_extension,
2007 ++ "HasSelection",
2008 ++ g_variant_new("(t)", page_id),
2009 ++ G_DBUS_CALL_FLAGS_NONE, -1,
2010 ++ NULL, NULL);
2011 ++ if (retval)
2012 ++ {
2013 ++ gboolean has_selection = FALSE;
2014 ++ g_variant_get(retval, "(b)", &has_selection);
2015 ++ g_variant_unref(retval);
2016 ++ return has_selection;
2017 ++ }
2018 ++ }
2019 ++ return false;
2020 ++}
2021 ++
2022 ++void wxWebViewWebKit::SelectAll()
2023 ++{
2024 ++ webkit_web_view_execute_editing_command(m_web_view,
2025 ++ WEBKIT_EDITING_COMMAND_SELECT_ALL);
2026 ++}
2027 ++
2028 ++wxString wxWebViewWebKit::GetSelectedText() const
2029 ++{
2030 ++ if (m_extension)
2031 ++ {
2032 ++ guint64 page_id = webkit_web_view_get_page_id(m_web_view);
2033 ++ GVariant *retval = g_dbus_proxy_call_sync(m_extension,
2034 ++ "GetSelectedText",
2035 ++ g_variant_new("(t)", page_id),
2036 ++ G_DBUS_CALL_FLAGS_NONE, -1,
2037 ++ NULL, NULL);
2038 ++ if (retval)
2039 ++ {
2040 ++ char *text;
2041 ++ g_variant_get(retval, "(s)", &text);
2042 ++ g_variant_unref(retval);
2043 ++ return wxString(text, wxConvUTF8);
2044 ++ }
2045 ++ }
2046 ++ return wxString();
2047 ++}
2048 ++
2049 ++wxString wxWebViewWebKit::GetSelectedSource() const
2050 ++{
2051 ++ if (m_extension)
2052 ++ {
2053 ++ guint64 page_id = webkit_web_view_get_page_id(m_web_view);
2054 ++ GVariant *retval = g_dbus_proxy_call_sync(m_extension,
2055 ++ "GetSelectedSource",
2056 ++ g_variant_new("(t)", page_id),
2057 ++ G_DBUS_CALL_FLAGS_NONE, -1,
2058 ++ NULL, NULL);
2059 ++ if (retval)
2060 ++ {
2061 ++ char *source;
2062 ++ g_variant_get(retval, "(s)", &source);
2063 ++ g_variant_unref(retval);
2064 ++ return wxString(source, wxConvUTF8);
2065 ++ }
2066 ++ }
2067 ++ return wxString();
2068 ++}
2069 ++
2070 ++void wxWebViewWebKit::ClearSelection()
2071 ++{
2072 ++ if (m_extension)
2073 ++ {
2074 ++ guint64 page_id = webkit_web_view_get_page_id(m_web_view);
2075 ++ GVariant *retval = g_dbus_proxy_call_sync(m_extension,
2076 ++ "ClearSelection",
2077 ++ g_variant_new("(t)", page_id),
2078 ++ G_DBUS_CALL_FLAGS_NONE, -1,
2079 ++ NULL, NULL);
2080 ++ if (retval)
2081 ++ {
2082 ++ g_variant_unref(retval);
2083 ++ }
2084 ++ }
2085 ++}
2086 ++
2087 ++wxString wxWebViewWebKit::GetPageText() const
2088 ++{
2089 ++ if (m_extension)
2090 ++ {
2091 ++ guint64 page_id = webkit_web_view_get_page_id(m_web_view);
2092 ++ GVariant *retval = g_dbus_proxy_call_sync(m_extension,
2093 ++ "GetPageText",
2094 ++ g_variant_new("(t)", page_id),
2095 ++ G_DBUS_CALL_FLAGS_NONE, -1,
2096 ++ NULL, NULL);
2097 ++ if (retval)
2098 ++ {
2099 ++ char *text;
2100 ++ g_variant_get(retval, "(s)", &text);
2101 ++ g_variant_unref(retval);
2102 ++ return wxString(text, wxConvUTF8);
2103 ++ }
2104 ++ }
2105 ++ return wxString();
2106 ++}
2107 ++
2108 ++void wxWebViewWebKit::RunScript(const wxString& javascript)
2109 ++{
2110 ++ webkit_web_view_run_javascript(m_web_view,
2111 ++ javascript.mb_str(wxConvUTF8),
2112 ++ NULL,
2113 ++ NULL,
2114 ++ NULL);
2115 ++}
2116 ++
2117 ++void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
2118 ++{
2119 ++ m_handlerList.push_back(handler);
2120 ++}
2121 ++
2122 ++void wxWebViewWebKit::EnableContextMenu(bool enable)
2123 ++{
2124 ++ wxWebView::EnableContextMenu(enable);
2125 ++}
2126 ++
2127 ++long wxWebViewWebKit::Find(const wxString& text, int flags)
2128 ++{
2129 ++ WebKitFindController* findctrl = webkit_web_view_get_find_controller(m_web_view);
2130 ++ bool newSearch = false;
2131 ++ if(text != m_findText ||
2132 ++ (flags & wxWEBVIEW_FIND_MATCH_CASE) != (m_findFlags & wxWEBVIEW_FIND_MATCH_CASE))
2133 ++ {
2134 ++ newSearch = true;
2135 ++ //If it is a new search we need to clear existing highlights
2136 ++ webkit_find_controller_search_finish(findctrl);
2137 ++ }
2138 ++
2139 ++ m_findFlags = flags;
2140 ++ m_findText = text;
2141 ++
2142 ++ //If the search string is empty then we clear any selection and highlight
2143 ++ if(text.empty())
2144 ++ {
2145 ++ webkit_find_controller_search_finish(findctrl);
2146 ++ ClearSelection();
2147 ++ return wxNOT_FOUND;
2148 ++ }
2149 ++
2150 ++ bool wrap = false, forward = true;
2151 ++ guint32 options = WEBKIT_FIND_OPTIONS_NONE;
2152 ++ if(flags & wxWEBVIEW_FIND_WRAP)
2153 ++ {
2154 ++ wrap = true;
2155 ++ options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
2156 ++ }
2157 ++ if(!(flags & wxWEBVIEW_FIND_MATCH_CASE))
2158 ++ {
2159 ++ options |= WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE;
2160 ++ }
2161 ++ if(flags & wxWEBVIEW_FIND_BACKWARDS)
2162 ++ {
2163 ++ forward = false;
2164 ++ options |= WEBKIT_FIND_OPTIONS_BACKWARDS;
2165 ++ }
2166 ++
2167 ++ if(newSearch)
2168 ++ {
2169 ++ //Initially we count the matches to know how many we have
2170 ++ m_findCount = -1;
2171 ++ webkit_find_controller_count_matches(findctrl,
2172 ++ wxGTK_CONV(text),
2173 ++ options,
2174 ++ G_MAXUINT);
2175 ++ GMainContext *main_context = g_main_context_get_thread_default();
2176 ++ while (m_findCount == -1)
2177 ++ {
2178 ++ g_main_context_iteration(main_context, TRUE);
2179 ++ }
2180 ++ //Highlight them if needed
2181 ++ if(flags & wxWEBVIEW_FIND_HIGHLIGHT_RESULT)
2182 ++ {
2183 ++ webkit_find_controller_search(findctrl,
2184 ++ wxGTK_CONV(text),
2185 ++ options,
2186 ++ G_MAXUINT);
2187 ++ }
2188 ++ //In this case we return early to match IE behaviour
2189 ++ m_findPosition = -1;
2190 ++ return m_findCount;
2191 ++ }
2192 ++ else
2193 ++ {
2194 ++ if(forward)
2195 ++ m_findPosition++;
2196 ++ else
2197 ++ m_findPosition--;
2198 ++ if(m_findPosition < 0)
2199 ++ m_findPosition += m_findCount;
2200 ++ if(m_findPosition > m_findCount)
2201 ++ m_findPosition -= m_findCount;
2202 ++ }
2203 ++
2204 ++ if(forward)
2205 ++ {
2206 ++ webkit_find_controller_search_next(findctrl);
2207 ++ if(m_findPosition == m_findCount && !wrap)
2208 ++ {
2209 ++ return wxNOT_FOUND;
2210 ++ }
2211 ++ }
2212 ++ else
2213 ++ {
2214 ++ webkit_find_controller_search_previous(findctrl);
2215 ++ if(m_findPosition == -1 && !wrap)
2216 ++ {
2217 ++ return wxNOT_FOUND;
2218 ++ }
2219 ++ }
2220 ++
2221 ++ return newSearch ? m_findCount : m_findPosition;
2222 ++}
2223 ++
2224 ++void wxWebViewWebKit::FindClear()
2225 ++{
2226 ++ m_findCount = 0;
2227 ++ m_findFlags = 0;
2228 ++ m_findText.clear();
2229 ++ m_findPosition = -1;
2230 ++}
2231 ++
2232 ++// static
2233 ++wxVisualAttributes
2234 ++wxWebViewWebKit::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
2235 ++{
2236 ++ return GetDefaultAttributesFromGTKWidget(webkit_web_view_new());
2237 ++}
2238 ++
2239 ++void wxWebViewWebKit::SetupWebExtensionServer()
2240 ++{
2241 ++ char *address = g_strdup_printf("unix:tmpdir=%s", g_get_tmp_dir());
2242 ++ char *guid = g_dbus_generate_guid();
2243 ++ GDBusAuthObserver *observer = g_dbus_auth_observer_new();
2244 ++ GError *error = NULL;
2245 ++
2246 ++ g_signal_connect(observer, "authorize-authenticated-peer",
2247 ++ G_CALLBACK(wxgtk_authorize_authenticated_peer_cb), this);
2248 ++
2249 ++ m_dbusServer = g_dbus_server_new_sync(address,
2250 ++ G_DBUS_SERVER_FLAGS_NONE,
2251 ++ guid,
2252 ++ observer,
2253 ++ NULL,
2254 ++ &error);
2255 ++
2256 ++ if (error)
2257 ++ {
2258 ++ g_warning("Failed to start web extension server on %s: %s", address, error->message);
2259 ++ g_error_free(error);
2260 ++ }
2261 ++ else
2262 ++ {
2263 ++ g_signal_connect(m_dbusServer, "new-connection",
2264 ++ G_CALLBACK(wxgtk_new_connection_cb), &m_extension);
2265 ++ g_dbus_server_start(m_dbusServer);
2266 ++ }
2267 ++
2268 ++ g_free(address);
2269 ++ g_free(guid);
2270 ++ g_object_unref(observer);
2271 ++}
2272 ++
2273 ++#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT2
2274 +diff --git a/src/gtk/webview_webkit2_extension.cpp b/src/gtk/webview_webkit2_extension.cpp
2275 +new file mode 100644
2276 +index 0000000..ddd0d94
2277 +--- /dev/null
2278 ++++ b/src/gtk/webview_webkit2_extension.cpp
2279 +@@ -0,0 +1,421 @@
2280 ++/////////////////////////////////////////////////////////////////////////////
2281 ++// Name: src/gtk/webview_webkit2_extension.cpp
2282 ++// Purpose: GTK WebKit2 extension for web view component
2283 ++// Author: Scott Talbert
2284 ++// Copyright: (c) 2017 Scott Talbert
2285 ++// Licence: wxWindows licence
2286 ++/////////////////////////////////////////////////////////////////////////////
2287 ++
2288 ++#include "wx/defs.h"
2289 ++#include "wx/gtk/webview_webkit2_extension.h"
2290 ++#include <webkit2/webkit-web-extension.h>
2291 ++#define WEBKIT_DOM_USE_UNSTABLE_API
2292 ++#include <webkitdom/WebKitDOMDOMSelection.h>
2293 ++#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
2294 ++
2295 ++static const char introspection_xml[] =
2296 ++ "<node>"
2297 ++ " <interface name='org.wxwidgets.wxGTK.WebExtension'>"
2298 ++ " <method name='ClearSelection'>"
2299 ++ " <arg type='t' name='page_id' direction='in'/>"
2300 ++ " </method>"
2301 ++ " <method name='DeleteSelection'>"
2302 ++ " <arg type='t' name='page_id' direction='in'/>"
2303 ++ " </method>"
2304 ++ " <method name='GetPageSource'>"
2305 ++ " <arg type='t' name='page_id' direction='in'/>"
2306 ++ " <arg type='s' name='source' direction='out'/>"
2307 ++ " </method>"
2308 ++ " <method name='GetPageText'>"
2309 ++ " <arg type='t' name='page_id' direction='in'/>"
2310 ++ " <arg type='s' name='text' direction='out'/>"
2311 ++ " </method>"
2312 ++ " <method name='GetSelectedSource'>"
2313 ++ " <arg type='t' name='page_id' direction='in'/>"
2314 ++ " <arg type='s' name='source' direction='out'/>"
2315 ++ " </method>"
2316 ++ " <method name='GetSelectedText'>"
2317 ++ " <arg type='t' name='page_id' direction='in'/>"
2318 ++ " <arg type='s' name='text' direction='out'/>"
2319 ++ " </method>"
2320 ++ " <method name='HasSelection'>"
2321 ++ " <arg type='t' name='page_id' direction='in'/>"
2322 ++ " <arg type='b' name='has_selection' direction='out'/>"
2323 ++ " </method>"
2324 ++ " </interface>"
2325 ++ "</node>";
2326 ++
2327 ++class wxWebViewWebKitExtension;
2328 ++
2329 ++static gboolean
2330 ++wxgtk_webview_authorize_authenticated_peer_cb(GDBusAuthObserver *observer,
2331 ++ GIOStream *stream,
2332 ++ GCredentials *credentials,
2333 ++ wxWebViewWebKitExtension *extension);
2334 ++static void
2335 ++wxgtk_webview_dbus_connection_created_cb(GObject *source_object,
2336 ++ GAsyncResult *result,
2337 ++ wxWebViewWebKitExtension *extension);
2338 ++
2339 ++static wxWebViewWebKitExtension *gs_extension = NULL;
2340 ++
2341 ++class wxWebViewWebKitExtension
2342 ++{
2343 ++public:
2344 ++ wxWebViewWebKitExtension(WebKitWebExtension *webkit_extension, const char* server_address);
2345 ++ void ClearSelection(GVariant *parameters, GDBusMethodInvocation *invocation);
2346 ++ void DeleteSelection(GVariant *parameters, GDBusMethodInvocation *invocation);
2347 ++ void GetPageSource(GVariant *parameters, GDBusMethodInvocation *invocation);
2348 ++ void GetPageText(GVariant *parameters, GDBusMethodInvocation *invocation);
2349 ++ void GetSelectedSource(GVariant *parameters, GDBusMethodInvocation *invocation);
2350 ++ void GetSelectedText(GVariant *parameters, GDBusMethodInvocation *invocation);
2351 ++ void HasSelection(GVariant *parameters, GDBusMethodInvocation *invocation);
2352 ++ void SetDBusConnection(GDBusConnection *dbusConnection);
2353 ++
2354 ++private:
2355 ++ WebKitWebPage* GetWebPageOrReturnError(GVariant *parameters, GDBusMethodInvocation *invocation);
2356 ++ void ReturnDBusStringValue(GDBusMethodInvocation *invocation, gchar *value);
2357 ++
2358 ++ GDBusConnection *m_dbusConnection;
2359 ++ WebKitWebExtension *m_webkitExtension;
2360 ++};
2361 ++
2362 ++wxWebViewWebKitExtension::wxWebViewWebKitExtension(WebKitWebExtension *extension, const char* server_address)
2363 ++{
2364 ++ m_webkitExtension = (WebKitWebExtension*)g_object_ref(extension);
2365 ++
2366 ++ GDBusAuthObserver *observer = g_dbus_auth_observer_new();
2367 ++ g_signal_connect(observer, "authorize-authenticated-peer",
2368 ++ G_CALLBACK(wxgtk_webview_authorize_authenticated_peer_cb),
2369 ++ this);
2370 ++
2371 ++ g_dbus_connection_new_for_address(server_address,
2372 ++ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
2373 ++ observer,
2374 ++ NULL,
2375 ++ (GAsyncReadyCallback)wxgtk_webview_dbus_connection_created_cb,
2376 ++ this);
2377 ++ g_object_unref(observer);
2378 ++}
2379 ++
2380 ++WebKitWebPage* wxWebViewWebKitExtension::GetWebPageOrReturnError(GVariant *parameters, GDBusMethodInvocation *invocation)
2381 ++{
2382 ++ guint64 page_id;
2383 ++ g_variant_get(parameters, "(t)", &page_id);
2384 ++ WebKitWebPage *web_page = webkit_web_extension_get_page(m_webkitExtension,
2385 ++ page_id);
2386 ++ if (!web_page)
2387 ++ {
2388 ++ g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,
2389 ++ G_DBUS_ERROR_INVALID_ARGS,
2390 ++ "Invalid page ID: %" G_GUINT64_FORMAT, page_id);
2391 ++ }
2392 ++ return web_page;
2393 ++}
2394 ++
2395 ++void wxWebViewWebKitExtension::GetSelectedSource(GVariant *parameters,
2396 ++ GDBusMethodInvocation *invocation)
2397 ++{
2398 ++ WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
2399 ++ if (!web_page)
2400 ++ {
2401 ++ return;
2402 ++ }
2403 ++
2404 ++ WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
2405 ++ WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
2406 ++ WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
2407 ++ g_object_unref(win);
2408 ++ if (!sel)
2409 ++ {
2410 ++ ReturnDBusStringValue(invocation, NULL);
2411 ++ return;
2412 ++ }
2413 ++ WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
2414 ++ if (!range)
2415 ++ {
2416 ++ ReturnDBusStringValue(invocation, NULL);
2417 ++ return;
2418 ++ }
2419 ++ WebKitDOMElement *div = webkit_dom_document_create_element(doc, "div",
2420 ++ NULL);
2421 ++ WebKitDOMDocumentFragment *clone = webkit_dom_range_clone_contents(range,
2422 ++ NULL);
2423 ++ webkit_dom_node_append_child(&div->parent_instance,
2424 ++ &clone->parent_instance, NULL);
2425 ++ WebKitDOMElement *html = (WebKitDOMElement*)div;
2426 ++ gchar *text = webkit_dom_element_get_inner_html(html);
2427 ++ g_object_unref(range);
2428 ++
2429 ++ ReturnDBusStringValue(invocation, text);
2430 ++}
2431 ++
2432 ++void wxWebViewWebKitExtension::GetPageSource(GVariant *parameters,
2433 ++ GDBusMethodInvocation *invocation)
2434 ++{
2435 ++ WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
2436 ++ if (!web_page)
2437 ++ {
2438 ++ return;
2439 ++ }
2440 ++
2441 ++ WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
2442 ++ WebKitDOMElement *body = webkit_dom_document_get_document_element(doc);
2443 ++ gchar *source = webkit_dom_element_get_outer_html(body);
2444 ++ g_dbus_method_invocation_return_value(invocation,
2445 ++ g_variant_new("(s)", source ? source : ""));
2446 ++}
2447 ++
2448 ++void wxWebViewWebKitExtension::GetPageText(GVariant *parameters,
2449 ++ GDBusMethodInvocation *invocation)
2450 ++{
2451 ++ WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
2452 ++ if (!web_page)
2453 ++ {
2454 ++ return;
2455 ++ }
2456 ++
2457 ++ WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
2458 ++ WebKitDOMHTMLElement *body = webkit_dom_document_get_body(doc);
2459 ++ gchar *text = webkit_dom_html_element_get_inner_text(body);
2460 ++ g_dbus_method_invocation_return_value(invocation,
2461 ++ g_variant_new("(s)", text));
2462 ++}
2463 ++
2464 ++void wxWebViewWebKitExtension::GetSelectedText(GVariant *parameters,
2465 ++ GDBusMethodInvocation *invocation)
2466 ++{
2467 ++ WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
2468 ++ if (!web_page)
2469 ++ {
2470 ++ return;
2471 ++ }
2472 ++
2473 ++ WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
2474 ++ WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
2475 ++ WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
2476 ++ g_object_unref(win);
2477 ++ if (!sel)
2478 ++ {
2479 ++ ReturnDBusStringValue(invocation, NULL);
2480 ++ return;
2481 ++ }
2482 ++ WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
2483 ++ if (!range)
2484 ++ {
2485 ++ ReturnDBusStringValue(invocation, NULL);
2486 ++ return;
2487 ++ }
2488 ++ gchar *text = webkit_dom_range_get_text(range);
2489 ++ g_object_unref(range);
2490 ++
2491 ++ ReturnDBusStringValue(invocation, text);
2492 ++}
2493 ++
2494 ++void wxWebViewWebKitExtension::ClearSelection(GVariant *parameters,
2495 ++ GDBusMethodInvocation *invocation)
2496 ++{
2497 ++ WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
2498 ++ if (!web_page)
2499 ++ {
2500 ++ return;
2501 ++ }
2502 ++
2503 ++ WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
2504 ++ WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
2505 ++ WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
2506 ++ g_object_unref(win);
2507 ++ if (sel)
2508 ++ {
2509 ++ webkit_dom_dom_selection_remove_all_ranges(sel);
2510 ++ }
2511 ++
2512 ++ g_dbus_method_invocation_return_value(invocation, NULL);
2513 ++}
2514 ++
2515 ++void wxWebViewWebKitExtension::HasSelection(GVariant *parameters,
2516 ++ GDBusMethodInvocation *invocation)
2517 ++{
2518 ++ WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
2519 ++ if (!web_page)
2520 ++ {
2521 ++ return;
2522 ++ }
2523 ++
2524 ++ WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
2525 ++ WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
2526 ++ WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
2527 ++ g_object_unref(win);
2528 ++ gboolean has_selection = FALSE;
2529 ++ if (WEBKIT_DOM_IS_DOM_SELECTION(sel))
2530 ++ {
2531 ++ if (!webkit_dom_dom_selection_get_is_collapsed(sel))
2532 ++ {
2533 ++ has_selection = TRUE;
2534 ++ }
2535 ++ }
2536 ++ g_dbus_method_invocation_return_value(invocation,
2537 ++ g_variant_new("(b)", has_selection));
2538 ++}
2539 ++
2540 ++void wxWebViewWebKitExtension::DeleteSelection(GVariant *parameters,
2541 ++ GDBusMethodInvocation *invocation)
2542 ++{
2543 ++ WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
2544 ++ if (!web_page)
2545 ++ {
2546 ++ return;
2547 ++ }
2548 ++
2549 ++ WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
2550 ++ WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
2551 ++ WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
2552 ++ g_object_unref(win);
2553 ++ if (sel)
2554 ++ {
2555 ++ webkit_dom_dom_selection_delete_from_document(sel);
2556 ++ }
2557 ++
2558 ++ g_dbus_method_invocation_return_value(invocation, NULL);
2559 ++}
2560 ++
2561 ++void wxWebViewWebKitExtension::ReturnDBusStringValue(GDBusMethodInvocation *invocation, gchar *value)
2562 ++{
2563 ++ g_dbus_method_invocation_return_value(invocation,
2564 ++ g_variant_new("(s)", value ? value : ""));
2565 ++}
2566 ++
2567 ++void wxWebViewWebKitExtension::SetDBusConnection(GDBusConnection *dbusConnection)
2568 ++{
2569 ++ m_dbusConnection = dbusConnection;
2570 ++}
2571 ++
2572 ++static void
2573 ++wxgtk_webview_handle_method_call(GDBusConnection *connection,
2574 ++ const char *sender,
2575 ++ const char *object_path,
2576 ++ const char *interface_name,
2577 ++ const char *method_name,
2578 ++ GVariant *parameters,
2579 ++ GDBusMethodInvocation *invocation,
2580 ++ gpointer user_data)
2581 ++{
2582 ++ if (g_strcmp0(interface_name, WXGTK_WEB_EXTENSION_INTERFACE) != 0)
2583 ++ {
2584 ++ return;
2585 ++ }
2586 ++
2587 ++ wxWebViewWebKitExtension *extension = (wxWebViewWebKitExtension*)user_data;
2588 ++
2589 ++ if (g_strcmp0(method_name, "ClearSelection") == 0)
2590 ++ {
2591 ++ extension->ClearSelection(parameters, invocation);
2592 ++ }
2593 ++ else if (g_strcmp0(method_name, "DeleteSelection") == 0)
2594 ++ {
2595 ++ extension->DeleteSelection(parameters, invocation);
2596 ++ }
2597 ++ else if (g_strcmp0(method_name, "GetPageSource") == 0)
2598 ++ {
2599 ++ extension->GetPageSource(parameters, invocation);
2600 ++ }
2601 ++ else if (g_strcmp0(method_name, "GetPageText") == 0)
2602 ++ {
2603 ++ extension->GetPageText(parameters, invocation);
2604 ++ }
2605 ++ else if (g_strcmp0(method_name, "GetSelectedSource") == 0)
2606 ++ {
2607 ++ extension->GetSelectedSource(parameters, invocation);
2608 ++ }
2609 ++ else if (g_strcmp0(method_name, "GetSelectedText") == 0)
2610 ++ {
2611 ++ extension->GetSelectedText(parameters, invocation);
2612 ++ }
2613 ++ else if (g_strcmp0(method_name, "HasSelection") == 0)
2614 ++ {
2615 ++ extension->HasSelection(parameters, invocation);
2616 ++ }
2617 ++}
2618 ++
2619 ++static const GDBusInterfaceVTable interface_vtable = {
2620 ++ wxgtk_webview_handle_method_call,
2621 ++ NULL,
2622 ++ NULL
2623 ++};
2624 ++
2625 ++gboolean
2626 ++wxgtk_webview_dbus_peer_is_authorized(GCredentials *peer_credentials)
2627 ++{
2628 ++ static GCredentials *own_credentials = g_credentials_new();
2629 ++ GError *error = NULL;
2630 ++
2631 ++ if (peer_credentials && g_credentials_is_same_user(peer_credentials, own_credentials, &error))
2632 ++ {
2633 ++ return TRUE;
2634 ++ }
2635 ++
2636 ++ if (error)
2637 ++ {
2638 ++ g_warning("Failed to authorize web extension connection: %s", error->message);
2639 ++ g_error_free(error);
2640 ++ }
2641 ++ return FALSE;
2642 ++}
2643 ++
2644 ++static gboolean
2645 ++wxgtk_webview_authorize_authenticated_peer_cb(GDBusAuthObserver *observer,
2646 ++ GIOStream *stream,
2647 ++ GCredentials *credentials,
2648 ++ wxWebViewWebKitExtension *extension)
2649 ++{
2650 ++ return wxgtk_webview_dbus_peer_is_authorized(credentials);
2651 ++}
2652 ++
2653 ++static void
2654 ++wxgtk_webview_dbus_connection_created_cb(GObject *source_object,
2655 ++ GAsyncResult *result,
2656 ++ wxWebViewWebKitExtension *extension)
2657 ++{
2658 ++ static GDBusNodeInfo *introspection_data =
2659 ++ g_dbus_node_info_new_for_xml(introspection_xml, NULL);
2660 ++
2661 ++ GError *error = NULL;
2662 ++ GDBusConnection *connection =
2663 ++ g_dbus_connection_new_for_address_finish(result, &error);
2664 ++ if (error)
2665 ++ {
2666 ++ g_warning("Failed to connect to UI process: %s", error->message);
2667 ++ g_error_free(error);
2668 ++ return;
2669 ++ }
2670 ++
2671 ++ guint registration_id =
2672 ++ g_dbus_connection_register_object(connection,
2673 ++ WXGTK_WEB_EXTENSION_OBJECT_PATH,
2674 ++ introspection_data->interfaces[0],
2675 ++ &interface_vtable,
2676 ++ extension,
2677 ++ NULL,
2678 ++ &error);
2679 ++ if (!registration_id)
2680 ++ {
2681 ++ g_warning ("Failed to register web extension object: %s\n", error->message);
2682 ++ g_error_free (error);
2683 ++ g_object_unref (connection);
2684 ++ return;
2685 ++ }
2686 ++
2687 ++ extension->SetDBusConnection(connection);
2688 ++}
2689 ++
2690 ++extern "C" WXEXPORT void
2691 ++webkit_web_extension_initialize_with_user_data (WebKitWebExtension *webkit_extension,
2692 ++ GVariant *user_data)
2693 ++{
2694 ++ const char *server_address;
2695 ++
2696 ++ g_variant_get (user_data, "(&s)", &server_address);
2697 ++
2698 ++ gs_extension = new wxWebViewWebKitExtension(webkit_extension,
2699 ++ server_address);
2700 ++}
2701
2702 diff --git a/x11-libs/wxGTK/metadata.xml b/x11-libs/wxGTK/metadata.xml
2703 new file mode 100644
2704 index 0000000..e8b0e72
2705 --- /dev/null
2706 +++ b/x11-libs/wxGTK/metadata.xml
2707 @@ -0,0 +1,28 @@
2708 +<?xml version="1.0" encoding="UTF-8"?>
2709 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
2710 +<pkgmetadata>
2711 + <maintainer type="project">
2712 + <email>wxwidgets@g.o</email>
2713 + <description>All modifications to this package must be approved by the wxwidgets herd.</description>
2714 + </maintainer>
2715 + <use>
2716 + <flag name="gstreamer">
2717 + Enable the wxMediaCtrl class for playing audio and video through
2718 + gstreamer.
2719 + </flag>
2720 + <flag name="gnome">
2721 + Use <pkg>gnome-base/libgnomeprintui</pkg> for printing tasks.
2722 + </flag>
2723 + <flag name="sdl">
2724 + Use Simple Directmedia Layer (<pkg>media-libs/libsdl</pkg>) for
2725 + audio.
2726 + </flag>
2727 + </use>
2728 + <upstream>
2729 + <remote-id type="sourceforge">wxpython</remote-id>
2730 + </upstream>
2731 + <slots>
2732 + <slot name="*">Slots reflect MAJOR.MINOR versions which can
2733 + be installed in parallel.</slot>
2734 + </slots>
2735 +</pkgmetadata>
2736
2737 diff --git a/x11-libs/wxGTK/wxGTK-3.0.3.1-r301.ebuild b/x11-libs/wxGTK/wxGTK-3.0.3.1-r301.ebuild
2738 new file mode 100644
2739 index 0000000..fa83bc1
2740 --- /dev/null
2741 +++ b/x11-libs/wxGTK/wxGTK-3.0.3.1-r301.ebuild
2742 @@ -0,0 +1,194 @@
2743 +# Copyright 1999-2017 Gentoo Foundation
2744 +# Distributed under the terms of the GNU General Public License v2
2745 +
2746 +EAPI="6"
2747 +
2748 +inherit autotools multilib-minimal
2749 +
2750 +DESCRIPTION="GTK+ version of wxWidgets, a cross-platform C++ GUI toolkit"
2751 +HOMEPAGE="http://wxwidgets.org/"
2752 +
2753 +# we use the wxPython tarballs because they include the full wxGTK sources and
2754 +# docs, and are released more frequently than wxGTK.
2755 +SRC_URI="https://github.com/wxWidgets/wxWidgets/releases/download/v${PV}/wxWidgets-${PV}.tar.bz2
2756 + doc? ( https://github.com/wxWidgets/wxWidgets/releases/download/v${PV%.*}/wxWidgets-${PV%.*}-docs-html.tar.bz2 )"
2757 +
2758 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
2759 +IUSE="+X aqua doc debug gstreamer libnotify opengl sdl tiff webkit"
2760 +
2761 +WXSUBVERSION=${PV}-gtk3 # 3.0.2.0-gtk3
2762 +WXVERSION=${WXSUBVERSION%.*} # 3.0.2
2763 +WXRELEASE=${WXVERSION%.*}-gtk3 # 3.0-gtk3
2764 +WXRELEASE_NODOT=${WXRELEASE//./} # 30-gtk3
2765 +
2766 +SLOT="${WXRELEASE}"
2767 +
2768 +RDEPEND="
2769 + dev-libs/expat[${MULTILIB_USEDEP}]
2770 + sdl? ( media-libs/libsdl[${MULTILIB_USEDEP}] )
2771 + X? (
2772 + >=dev-libs/glib-2.22:2[${MULTILIB_USEDEP}]
2773 + media-libs/libpng:0=[${MULTILIB_USEDEP}]
2774 + sys-libs/zlib[${MULTILIB_USEDEP}]
2775 + virtual/jpeg:0=[${MULTILIB_USEDEP}]
2776 + x11-libs/cairo[${MULTILIB_USEDEP}]
2777 + x11-libs/gtk+:3[${MULTILIB_USEDEP}]
2778 + x11-libs/gdk-pixbuf[${MULTILIB_USEDEP}]
2779 + x11-libs/libSM[${MULTILIB_USEDEP}]
2780 + x11-libs/libX11[${MULTILIB_USEDEP}]
2781 + x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
2782 + x11-libs/pango[${MULTILIB_USEDEP}]
2783 + gstreamer? (
2784 + media-libs/gstreamer:0.10[${MULTILIB_USEDEP}]
2785 + media-libs/gst-plugins-base:0.10[${MULTILIB_USEDEP}] )
2786 + libnotify? ( x11-libs/libnotify[${MULTILIB_USEDEP}] )
2787 + opengl? ( virtual/opengl[${MULTILIB_USEDEP}] )
2788 + tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
2789 + webkit? ( net-libs/webkit-gtk:3 )
2790 + )
2791 + aqua? (
2792 + x11-libs/gtk+:3[aqua=,${MULTILIB_USEDEP}]
2793 + virtual/jpeg:0=[${MULTILIB_USEDEP}]
2794 + tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
2795 + )"
2796 +
2797 +DEPEND="${RDEPEND}
2798 + virtual/pkgconfig[${MULTILIB_USEDEP}]
2799 + opengl? ( virtual/glu[${MULTILIB_USEDEP}] )
2800 + X? (
2801 + x11-proto/xproto[${MULTILIB_USEDEP}]
2802 + x11-proto/xineramaproto[${MULTILIB_USEDEP}]
2803 + x11-proto/xf86vidmodeproto[${MULTILIB_USEDEP}]
2804 + )"
2805 +
2806 +PDEPEND=">=app-eselect/eselect-wxwidgets-20131230"
2807 +
2808 +LICENSE="wxWinLL-3
2809 + GPL-2
2810 + doc? ( wxWinFDL-3 )"
2811 +
2812 +S="${WORKDIR}/wxWidgets-${PV}"
2813 +PATCHES=(
2814 + "${FILESDIR}"/${P}-abicheck.patch
2815 + "${FILESDIR}"/${P}-avoid-tlw-destroy-assert.patch
2816 +)
2817 +
2818 +src_prepare() {
2819 + default
2820 +
2821 + local f
2822 + for f in $(find "${S}" -name configure.in); do
2823 + mv "${f}" "${f/in/ac}" || die
2824 + done
2825 + AT_M4DIR="${S}/build/aclocal" eautoreconf
2826 +
2827 + # Versionating
2828 + sed -i \
2829 + -e "s:\(WX_RELEASE = \).*:\1${WXRELEASE}:"\
2830 + -e "s:\(WX_RELEASE_NODOT = \).*:\1${WXRELEASE_NODOT}:"\
2831 + -e "s:\(WX_VERSION = \).*:\1${WXVERSION}:"\
2832 + -e "s:aclocal):aclocal/wxwin${WXRELEASE_NODOT}.m4):" \
2833 + -e "s:wxstd.mo:wxstd${WXRELEASE_NODOT}:" \
2834 + -e "s:wxmsw.mo:wxmsw${WXRELEASE_NODOT}:" \
2835 + Makefile.in || die
2836 +
2837 + sed -i \
2838 + -e "s:\(WX_RELEASE = \).*:\1${WXRELEASE}:"\
2839 + utils/wxrc/Makefile.in || die
2840 +
2841 + sed -i \
2842 + -e "s:\(WX_VERSION=\).*:\1${WXVERSION}:" \
2843 + -e "s:\(WX_RELEASE=\).*:\1${WXRELEASE}:" \
2844 + -e "s:\(WX_SUBVERSION=\).*:\1${WXSUBVERSION}:" \
2845 + -e '/WX_VERSION_TAG=/ s:${WX_RELEASE}:3.0:' \
2846 + configure || die
2847 +}
2848 +
2849 +multilib_src_configure() {
2850 + local myconf
2851 +
2852 + # X independent options
2853 + myconf="
2854 + --with-zlib=sys
2855 + --with-expat=sys
2856 + --enable-compat28
2857 + $(use_with sdl)"
2858 +
2859 + # debug in >=2.9
2860 + # there is no longer separate debug libraries (gtk2ud)
2861 + # wxDEBUG_LEVEL=1 is the default and we will leave it enabled
2862 + # wxDEBUG_LEVEL=2 enables assertions that have expensive runtime costs.
2863 + # apps can disable these features by building w/ -NDEBUG or wxDEBUG_LEVEL_0.
2864 + # http://docs.wxwidgets.org/3.0/overview_debugging.html
2865 + # https://groups.google.com/group/wx-dev/browse_thread/thread/c3c7e78d63d7777f/05dee25410052d9c
2866 + use debug \
2867 + && myconf="${myconf} --enable-debug=max"
2868 +
2869 + # wxGTK options
2870 + # --enable-graphics_ctx - needed for webkit, editra
2871 + # --without-gnomevfs - bug #203389
2872 + use X && \
2873 + myconf="${myconf}
2874 + --enable-graphics_ctx
2875 + --with-gtkprint
2876 + --enable-gui
2877 + --with-gtk=3
2878 + --with-libpng=sys
2879 + --with-libjpeg=sys
2880 + --without-gnomevfs
2881 + $(use_enable gstreamer mediactrl)
2882 + $(multilib_native_use_enable webkit webview)
2883 + $(use_with libnotify)
2884 + $(use_with opengl)
2885 + $(use_with tiff libtiff sys)"
2886 +
2887 + use aqua && \
2888 + myconf="${myconf}
2889 + --enable-graphics_ctx
2890 + --enable-gui
2891 + --with-libpng=sys
2892 + --with-libxpm=sys
2893 + --with-libjpeg=sys
2894 + --with-mac
2895 + --with-opengl"
2896 + # cocoa toolkit seems to be broken
2897 +
2898 + # wxBase options
2899 + if use !X && use !aqua ; then
2900 + myconf="${myconf}
2901 + --disable-gui"
2902 + fi
2903 +
2904 + ECONF_SOURCE="${S}" econf ${myconf}
2905 +}
2906 +
2907 +multilib_src_install_all() {
2908 + cd "${S}"/docs || die
2909 + dodoc changes.txt readme.txt
2910 + newdoc base/readme.txt base_readme.txt
2911 + newdoc gtk/readme.txt gtk_readme.txt
2912 +
2913 + if use doc; then
2914 + dodoc -r "${S}"/docs/doxygen/out/html
2915 + fi
2916 +
2917 + # Unversioned links
2918 + rm "${D}"/usr/bin/wx{-config,rc}
2919 +
2920 + # version bakefile presets
2921 + pushd "${D}"usr/share/bakefile/presets/ > /dev/null
2922 + for f in wx*; do
2923 + mv "${f}" "${f/wx/wx30gtk3}"
2924 + done
2925 + popd > /dev/null
2926 +}
2927 +
2928 +pkg_postinst() {
2929 + has_version app-eselect/eselect-wxwidgets \
2930 + && eselect wxwidgets update
2931 +}
2932 +
2933 +pkg_postrm() {
2934 + has_version app-eselect/eselect-wxwidgets \
2935 + && eselect wxwidgets update
2936 +}