diff options
| author | Leo Ufimtsev | 2017-03-14 20:08:52 +0000 |
|---|---|---|
| committer | Alexander Kurtakov | 2017-03-16 07:36:50 +0000 |
| commit | d68bb8bb075234615d04458d0be65d874f9a722a (patch) | |
| tree | 30f1c7fe89aa4a5889f20281e62cf23b7c113ca2 | |
| parent | a073f1ce9eead5631efd0fce8dc53b4c63f54fb8 (diff) | |
| download | eclipse.platform.swt-d68bb8bb075234615d04458d0be65d874f9a722a.tar.gz eclipse.platform.swt-d68bb8bb075234615d04458d0be65d874f9a722a.tar.xz eclipse.platform.swt-d68bb8bb075234615d04458d0be65d874f9a722a.zip | |
Bug 513492: [webkit2] Port VisibilityWindow event details
Implemented/ported Visibility event for webkit2.
Before Snippet270, when you click on "try it", nothing happened on
webkit2. Now a popup correctly opens.
This also *improves* Browser5 test, in so far as it almost passes.
(Currently fails due to another cause thou, to be fixed in another
patch).
Architecture note: I copied GdkRectangle from OS instead of linking to
it, because otherwise all of gdk/gtk dependencies are bought into
webkit.
It didn't seem that all of those dependencies are needed just for
GdkRectangle.
Change-Id: I3e8ff3d007d6eabe183b9734eb6adc2020e4e8fc
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=513492
Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
9 files changed, 244 insertions, 45 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c index 9da1995e2b..4155731302 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c @@ -24,6 +24,18 @@ #define WebKitGTK_NATIVE(func) Java_org_eclipse_swt_internal_webkit_WebKitGTK_##func #endif +#ifndef NO_GdkRectangle_1sizeof +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(GdkRectangle_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, GdkRectangle_1sizeof_FUNC); + rc = (jint)GdkRectangle_sizeof(); + WebKitGTK_NATIVE_EXIT(env, that, GdkRectangle_1sizeof_FUNC); + return rc; +} +#endif + #ifndef NO_JSClassDefinition_1sizeof JNIEXPORT jint JNICALL WebKitGTK_NATIVE(JSClassDefinition_1sizeof) (JNIEnv *env, jclass that) @@ -2726,6 +2738,26 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1window_1fe } #endif +#ifndef NO__1webkit_1web_1view_1get_1window_1properties +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1window_1properties) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1window_1properties_FUNC); +/* + rc = (jintLong)webkit_web_view_get_window_properties(arg0); +*/ + { + WebKitGTK_LOAD_FUNCTION(fp, webkit_web_view_get_window_properties) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1window_1properties_FUNC); + return rc; +} +#endif + #ifndef NO__1webkit_1web_1view_1go_1back JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1go_1back) (JNIEnv *env, jclass that, jintLong arg0) @@ -2980,6 +3012,28 @@ JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1stop_1loading) } #endif +#ifndef NO__1webkit_1window_1properties_1get_1geometry +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1window_1properties_1get_1geometry) + (JNIEnv *env, jclass that, jintLong arg0, jobject arg1) +{ + GdkRectangle _arg1, *lparg1=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1window_1properties_1get_1geometry_FUNC); + if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail; +/* + webkit_window_properties_get_geometry(arg0, (GdkRectangle *)lparg1); +*/ + { + WebKitGTK_LOAD_FUNCTION(fp, webkit_window_properties_get_geometry) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, GdkRectangle *))fp)(arg0, (GdkRectangle *)lparg1); + } + } +fail: + if (arg1 && lparg1) setGdkRectangleFields(env, arg1, lparg1); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1window_1properties_1get_1geometry_FUNC); +} +#endif + #ifndef NO_memmove JNIEXPORT void JNICALL WebKitGTK_NATIVE(memmove) (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h index 8441867eb8..7fae854c03 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h @@ -144,6 +144,16 @@ typedef struct { void* response_body; void* response_headers; } SoupMessage; + +// To avoid adding hard Gdk dependency and maintain dynamic nature of webkit calls, we re-define Gdk's struct here: +// Alternativley one could include at the top: +// #include <gdk/gdk.h> +// and add GTKCFLAGS and GTKLIBS to WEBKITCFLAGS and WEBKITLIBS respectively in make_linux.mak. +typedef struct { + int x, y; + int width, height; +} GdkRectangle; + #endif /*WEBKIT_DEBUG*/ diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c index 90ae168ced..4de8d3f6ad 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c @@ -22,6 +22,7 @@ #ifdef NATIVE_STATS char * WebKitGTK_nativeFunctionNames[] = { + "GdkRectangle_1sizeof", "JSClassDefinition_1sizeof", "_1JSClassCreate", "_1JSContextGetGlobalObject", @@ -157,6 +158,7 @@ char * WebKitGTK_nativeFunctionNames[] = { "_1webkit_1web_1view_1get_1type", "_1webkit_1web_1view_1get_1uri", "_1webkit_1web_1view_1get_1window_1features", + "_1webkit_1web_1view_1get_1window_1properties", "_1webkit_1web_1view_1go_1back", "_1webkit_1web_1view_1go_1forward", "_1webkit_1web_1view_1load_1html", @@ -169,6 +171,7 @@ char * WebKitGTK_nativeFunctionNames[] = { "_1webkit_1web_1view_1run_1javascript", "_1webkit_1web_1view_1run_1javascript_1finish", "_1webkit_1web_1view_1stop_1loading", + "_1webkit_1window_1properties_1get_1geometry", "memmove", }; #define NATIVE_FUNCTION_COUNT sizeof(WebKitGTK_nativeFunctionNames) / sizeof(char*) diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h index c9f1783896..e5ca96d8ad 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h @@ -32,6 +32,7 @@ extern char* WebKitGTK_nativeFunctionNames[]; #endif typedef enum { + GdkRectangle_1sizeof_FUNC, JSClassDefinition_1sizeof_FUNC, _1JSClassCreate_FUNC, _1JSContextGetGlobalObject_FUNC, @@ -167,6 +168,7 @@ typedef enum { _1webkit_1web_1view_1get_1type_FUNC, _1webkit_1web_1view_1get_1uri_FUNC, _1webkit_1web_1view_1get_1window_1features_FUNC, + _1webkit_1web_1view_1get_1window_1properties_FUNC, _1webkit_1web_1view_1go_1back_FUNC, _1webkit_1web_1view_1go_1forward_FUNC, _1webkit_1web_1view_1load_1html_FUNC, @@ -179,5 +181,6 @@ typedef enum { _1webkit_1web_1view_1run_1javascript_FUNC, _1webkit_1web_1view_1run_1javascript_1finish_FUNC, _1webkit_1web_1view_1stop_1loading_FUNC, + _1webkit_1window_1properties_1get_1geometry_FUNC, memmove_FUNC, } WebKitGTK_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.c index aa87ae8dea..7a3a3ead58 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.c +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.c @@ -19,6 +19,46 @@ #include "swt.h" #include "webkitgtk_structs.h" +#ifndef NO_GdkRectangle +typedef struct GdkRectangle_FID_CACHE { + int cached; + jclass clazz; + jfieldID x, y, width, height; +} GdkRectangle_FID_CACHE; + +GdkRectangle_FID_CACHE GdkRectangleFc; + +void cacheGdkRectangleFields(JNIEnv *env, jobject lpObject) +{ + if (GdkRectangleFc.cached) return; + GdkRectangleFc.clazz = (*env)->GetObjectClass(env, lpObject); + GdkRectangleFc.x = (*env)->GetFieldID(env, GdkRectangleFc.clazz, "x", "I"); + GdkRectangleFc.y = (*env)->GetFieldID(env, GdkRectangleFc.clazz, "y", "I"); + GdkRectangleFc.width = (*env)->GetFieldID(env, GdkRectangleFc.clazz, "width", "I"); + GdkRectangleFc.height = (*env)->GetFieldID(env, GdkRectangleFc.clazz, "height", "I"); + GdkRectangleFc.cached = 1; +} + +GdkRectangle *getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpStruct) +{ + if (!GdkRectangleFc.cached) cacheGdkRectangleFields(env, lpObject); + lpStruct->x = (gint)(*env)->GetIntField(env, lpObject, GdkRectangleFc.x); + lpStruct->y = (gint)(*env)->GetIntField(env, lpObject, GdkRectangleFc.y); + lpStruct->width = (gint)(*env)->GetIntField(env, lpObject, GdkRectangleFc.width); + lpStruct->height = (gint)(*env)->GetIntField(env, lpObject, GdkRectangleFc.height); + return lpStruct; +} + +void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpStruct) +{ + if (!GdkRectangleFc.cached) cacheGdkRectangleFields(env, lpObject); + (*env)->SetIntField(env, lpObject, GdkRectangleFc.x, (jint)lpStruct->x); + (*env)->SetIntField(env, lpObject, GdkRectangleFc.y, (jint)lpStruct->y); + (*env)->SetIntField(env, lpObject, GdkRectangleFc.width, (jint)lpStruct->width); + (*env)->SetIntField(env, lpObject, GdkRectangleFc.height, (jint)lpStruct->height); +} +#endif + #ifndef NO_JSClassDefinition typedef struct JSClassDefinition_FID_CACHE { int cached; diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.h index 2b932d38ed..6f76f55a3f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.h +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.h @@ -18,6 +18,18 @@ #include "webkitgtk.h" +#ifndef NO_GdkRectangle +void cacheGdkRectangleFields(JNIEnv *env, jobject lpObject); +GdkRectangle *getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpStruct); +void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpStruct); +#define GdkRectangle_sizeof() sizeof(GdkRectangle) +#else +#define cacheGdkRectangleFields(a,b) +#define getGdkRectangleFields(a,b,c) NULL +#define setGdkRectangleFields(a,b,c) +#define GdkRectangle_sizeof() 0 +#endif + #ifndef NO_JSClassDefinition void cacheJSClassDefinitionFields(JNIEnv *env, jobject lpObject); JSClassDefinition *getJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct); diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java index 310ede062e..87db67bd31 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -23,6 +23,7 @@ import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.webkit.*; +import org.eclipse.swt.internal.webkit.GdkRectangle; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; @@ -2752,38 +2753,45 @@ long /*int*/ webkit_web_view_ready (long /*int*/ web_view) { newEvent.display = browser.getDisplay (); newEvent.widget = browser; - long /*int*/ settings = WebKitGTK.webkit_web_view_get_window_features (webView); - int[] result = new int[1]; - OS.g_object_get (settings, WebKitGTK.locationbar_visible, result, 0); - newEvent.addressBar = result[0] != 0; - result[0] = 0; - OS.g_object_get (settings, WebKitGTK.menubar_visible, result, 0); - newEvent.menuBar = result[0] != 0; - result[0] = 0; - OS.g_object_get (settings, WebKitGTK.statusbar_visible, result, 0); - newEvent.statusBar = result[0] != 0; - result[0] = 0; - OS.g_object_get (settings, WebKitGTK.toolbar_visible, result, 0); - newEvent.toolBar = result[0] != 0; - result[0] = 0; - OS.g_object_get (settings, WebKitGTK.x, result, 0); - int x = result[0]; - result[0] = 0; - OS.g_object_get (settings, WebKitGTK.y, result, 0); - int y = result[0]; - result[0] = 0; - OS.g_object_get (settings, WebKitGTK.width, result, 0); - int width = result[0]; - result[0] = 0; - OS.g_object_get (settings, WebKitGTK.height, result, 0); - int height = result[0]; - result[0] = 0; - if (x != -1 && y != -1) { - newEvent.location = new Point (x,y); - } - if (width != -1 && height != -1) { - newEvent.size = new Point (width,height); + if (!WEBKIT2) { + long /*int*/ settings = WebKitGTK.webkit_web_view_get_window_features (webView); + newEvent.addressBar = webkit_settings_get(settings, WebKitGTK.locationbar_visible) != 0; + newEvent.menuBar = webkit_settings_get(settings, WebKitGTK.menubar_visible) != 0; + newEvent.statusBar = webkit_settings_get(settings, WebKitGTK.statusbar_visible) != 0; + newEvent.addressBar = webkit_settings_get(settings, WebKitGTK.toolbar_visible) != 0; + int x = webkit_settings_get(settings, WebKitGTK.x); + int y = webkit_settings_get(settings, WebKitGTK.x); + int width = webkit_settings_get(settings, WebKitGTK.width); + int height = webkit_settings_get(settings, WebKitGTK.height); + if (x != -1 && y != -1) + newEvent.location = new Point (x,y); + if (width != -1 && height != -1) + newEvent.size = new Point (width,height); + } else { // Webkit2 + long /*int*/ properties = WebKitGTK.webkit_web_view_get_window_properties(webView); + newEvent.addressBar = webkit_settings_get(properties, WebKitGTK.locationbar_visible) != 0; + newEvent.menuBar = webkit_settings_get(properties, WebKitGTK.menubar_visible) != 0; + newEvent.statusBar = webkit_settings_get(properties, WebKitGTK.statusbar_visible) != 0; + newEvent.toolBar = webkit_settings_get(properties, WebKitGTK.toolbar_visible) != 0; + GdkRectangle rect = new GdkRectangle(); + WebKitGTK.webkit_window_properties_get_geometry(properties, rect); + + newEvent.location = new Point(Math.max(0, rect.x),Math.max(0, rect.y)); + + int width = rect.width; + int height = rect.height; + if (height == 100 && width == 100) { + // On Webkit1, if no height/width is specified, reasonable defaults are given. + // On Webkit2, if no height/width is specified, then minimum (which is 100) is allocated to popus. + // This makes popups very small. + // For better cross-platform consistency (Win/Cocoa/Gtk), we give more reasonable defaults (2/3 the size of a screen). + Rectangle primaryMonitorBounds = browser.getDisplay ().getPrimaryMonitor().getBounds(); + height = (int) (primaryMonitorBounds.height * 0.66); + width = (int) (primaryMonitorBounds.width * 0.66); + } + newEvent.size = new Point(width, height); } + Runnable fireVisibilityListeners = () -> { if (browser.isDisposed()) return; for (int i = 0; i < visibilityWindowListeners.length; i++) { @@ -2824,6 +2832,12 @@ long /*int*/ webkit_window_object_cleared (long /*int*/ web_view, long /*int*/ f * @return An integer value for the property is returned. For boolean settings, 0 indicates false, 1 indicates true */ private int webkit_settings_get(byte [] property) { long /*int*/ settings = WebKitGTK.webkit_web_view_get_settings (webView); + return webkit_settings_get(settings, property); +} + +/** Webkit1 & Webkit2 + * @return An integer value for the property is returned. For boolean settings, 0 indicates false, 1 indicates true */ +private int webkit_settings_get(long /*int*/ settings, byte[] property) { int[] result = new int[1]; OS.g_object_get (settings, property, result, 0); return result[0]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/GdkRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/GdkRectangle.java new file mode 100644 index 0000000000..f714aa5b3e --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/GdkRectangle.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2017 Red Hat Inc. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + *******************************************************************************/ +package org.eclipse.swt.internal.webkit; + + +public class GdkRectangle { + /** @field cast=(gint) */ + public int x; + /** @field cast=(gint) */ + public int y; + /** @field cast=(gint) */ + public int width; + /** @field cast=(gint) */ + public int height; + public static final int sizeof = WebKitGTK.GdkRectangle_sizeof(); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java index 4d77d619c0..29496e406e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java @@ -78,8 +78,10 @@ public class WebKitGTK extends C { /** Webkit1 only. On webkit2 & newer browsers 'window.status=txt' has no effect anymore. * Status bar only updated when you hover mouse over hyperlink.*/ public static final byte[] status_bar_text_changed = ascii ("status-bar-text-changed"); // $NON-NLS-1$ - public static final byte[] web_view_ready = ascii ("web-view-ready"); // $NON-NLS-1$ - public static final byte[] ready_to_show = ascii ("ready-to-show"); // $NON-NLS-1$ + + public static final byte[] web_view_ready = ascii ("web-view-ready"); // $NON-NLS-1$ // Webkit1 + public static final byte[] ready_to_show = ascii ("ready-to-show"); // $NON-NLS-1$ // Webkit2 + /** Webkit1 only. On Webkit2 this is found in a webextension. Instead 'load_changed' is used on webkit2 **/ public static final byte[] window_object_cleared = ascii ("window-object-cleared"); // $NON-NLS-1$ @@ -108,17 +110,22 @@ public class WebKitGTK extends C { public static final byte[] enable_universal_access_from_file_uris = ascii ("enable-universal-access-from-file-uris"); // $NON-NLS-1$ // Webkit1 public static final byte[] allow_universal_access_from_file_urls = ascii ("allow-universal-access-from-file-urls"); // $NON-NLS-1$ // Webkit2 - public static final byte[] height = ascii ("height"); // $NON-NLS-1$ - public static final byte[] javascript_can_open_windows_automatically = ascii ("javascript-can-open-windows-automatically"); // $NON-NLS-1$ - public static final byte[] locationbar_visible = ascii ("locationbar-visible"); // $NON-NLS-1$ - public static final byte[] menubar_visible = ascii ("menubar-visible"); // $NON-NLS-1$ - public static final byte[] SOUP_SESSION_PROXY_URI = ascii ("proxy-uri"); // $NON-NLS-1$ - public static final byte[] statusbar_visible = ascii ("statusbar-visible"); // $NON-NLS-1$ - public static final byte[] toolbar_visible = ascii ("toolbar-visible"); // $NON-NLS-1$ - public static final byte[] user_agent = ascii ("user-agent"); // $NON-NLS-1$ - public static final byte[] width = ascii ("width"); // $NON-NLS-1$ - public static final byte[] x = ascii ("x"); // $NON-NLS-1$ - public static final byte[] y = ascii ("y"); // $NON-NLS-1$ + public static final byte[] user_agent = ascii ("user-agent"); // $NON-NLS-1$ // Webkit1 & Webkit2 + + public static final byte[] javascript_can_open_windows_automatically = ascii ("javascript-can-open-windows-automatically"); // $NON-NLS-1$ // Webkit1 & Webit2 + + public static final byte[] locationbar_visible = ascii ("locationbar-visible"); // $NON-NLS-1$ // Webkit1 (Settings) & Webkit2 (Properties) + public static final byte[] menubar_visible = ascii ("menubar-visible"); // $NON-NLS-1$ // Webkit1 (Settings) & Webkit2 (Properties) + public static final byte[] statusbar_visible = ascii ("statusbar-visible"); // $NON-NLS-1$ // Webkit1 (Settings) & Webkit2 (Properties) + public static final byte[] toolbar_visible = ascii ("toolbar-visible"); // $NON-NLS-1$ // Webkit1 (Settings) & Webkit2 (Properties) + + // Webki1 only (Settings). (In Webkit2 height/width/x/y are stored in "geometry" of 'Properties') + public static final byte[] height = ascii ("height"); // $NON-NLS-1$ // Webkit1 only + public static final byte[] width = ascii ("width"); // $NON-NLS-1$ // Wekbit1 only + public static final byte[] x = ascii ("x"); // $NON-NLS-1$ // Webkit1 only + public static final byte[] y = ascii ("y"); // $NON-NLS-1$ // Webkit1 only + + public static final byte[] SOUP_SESSION_PROXY_URI = ascii ("proxy-uri"); // $NON-NLS-1$ // libsoup /** DOM events */ public static final byte[] dragstart = ascii ("dragstart"); // $NON-NLS-1$ @@ -1459,6 +1466,7 @@ public static final long /*int*/ webkit_web_view_get_uri (long /*int*/ web_view) } } +// Webkit1 only. /** @method flags=dynamic */ public static final native long /*int*/ _webkit_web_view_get_window_features (long /*int*/ web_view); public static final long /*int*/ webkit_web_view_get_window_features (long /*int*/ web_view) { @@ -1470,6 +1478,36 @@ public static final long /*int*/ webkit_web_view_get_window_features (long /*int } } +// Webkit2 only. +/** @method flags=dynamic */ +public static final native long /*int*/ _webkit_web_view_get_window_properties (long /*int*/ webView); +/** WebKitWindowProperties * webkit_web_view_get_window_properties (WebKitWebView *web_view); */ +public static final long /*int*/ webkit_web_view_get_window_properties (long /*int*/ webView) { + lock.lock(); + try { + return _webkit_web_view_get_window_properties (webView); + } finally { + lock.unlock(); + } +} + +// Webkit2 only. +/** + * @method flags=dynamic + * @param rectangle cast=(GdkRectangle *),flags=no_in + */ +public static final native void _webkit_window_properties_get_geometry (long /*int*/ webKitWindowProperties, GdkRectangle rectangle); +public static final void webkit_window_properties_get_geometry (long /*int*/ webKitWindowProperties, GdkRectangle rectangle ) { + lock.lock(); + try { + _webkit_window_properties_get_geometry (webKitWindowProperties, rectangle); + } finally { + lock.unlock(); + } +} + + + /** @method flags=dynamic */ public static final native void _webkit_web_view_go_back (long /*int*/ web_view); public static final void webkit_web_view_go_back (long /*int*/ web_view) { @@ -1729,7 +1767,7 @@ public static final long /*int*/ webkit_uri_response_get_mime_type (long /*int* /* --------------------- start SWT natives --------------------- */ public static final native int JSClassDefinition_sizeof (); - +public static final native int GdkRectangle_sizeof(); /** * @param dest cast=(void *) |
