1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
#! /bin/sh -e
##
## DP: Patch to set the classic theme for the browser widget to improve the
## DP: L&F of the widget(https://bugs.eclipse.org/bugs/show_bug.cgi?id=108257)
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
if [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $patch_opts -p0 < $0;;
-unpatch)
patch $patch_opts -p0 -R < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1;;
esac
exit 0
@DPATCH@
diff -u -r -P ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChromeRegistry.java source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChromeRegistry.java
--- ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChromeRegistry.java 1970-01-01 01:00:00.000000000 +0100
+++ source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChromeRegistry.java 2005-10-29 22:31:31.000000000 +0200
@@ -0,0 +1,44 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2003 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+package org.eclipse.swt.internal.mozilla;
+
+
+public class nsIChromeRegistry extends nsISupports {
+
+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3;
+
+ public static final String NS_ICHROMEREGISTRY_IID_STR =
+ "68389281-f6d0-4533-841d-344a2018140c";
+
+ public static final nsID NS_ICHROMEREGISTRY_IID =
+ new nsID(NS_ICHROMEREGISTRY_IID_STR);
+
+ public nsIChromeRegistry(int /*long*/ address) {
+ super(address);
+ }
+}
diff -u -r -P ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXULChromeRegistry.java source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXULChromeRegistry.java
--- ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXULChromeRegistry.java 1970-01-01 01:00:00.000000000 +0100
+++ source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXULChromeRegistry.java 2005-10-29 22:31:31.000000000 +0200
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2003 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+package org.eclipse.swt.internal.mozilla;
+
+
+public class nsIXULChromeRegistry extends nsIChromeRegistry {
+
+ static final int LAST_METHOD_ID = nsIChromeRegistry.LAST_METHOD_ID + 29;
+
+ public static final String NS_IXULCHROMEREGISTRY_IID_STR =
+ "fd1ee2f8-0238-40b0-9b54-27cf810d9c86";
+
+ public static final nsID NS_XULCHROMEREGISTRY_IID =
+ new nsID(NS_IXULCHROMEREGISTRY_IID_STR);
+
+ public nsIXULChromeRegistry(int /*long*/ address) {
+ super(address);
+ }
+
+ public int SelectSkin(int /*long*/ skinName, boolean useProfile) {
+ return XPCOM.VtblCall(nsIChromeRegistry.LAST_METHOD_ID + 1, getAddress(), skinName, useProfile);
+ }
+
+ public int SelectLocale(int /*long*/ localeName, boolean useProfile) {
+ return XPCOM.VtblCall(nsIChromeRegistry.LAST_METHOD_ID + 2, getAddress(), localeName, useProfile);
+ }
+
+ public int SetRuntimeProvider(boolean runtimeProvider) {
+ return XPCOM.VtblCall(nsIChromeRegistry.LAST_METHOD_ID + 10, getAddress(), runtimeProvider);
+ }
+}
diff -u -r -P ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
--- ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java 2005-10-29 22:19:31.000000000 +0200
+++ source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java 2005-10-29 22:31:31.000000000 +0200
@@ -54,6 +54,7 @@
public static final String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1"; //$NON-NLS-1$
public static final String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; //$NON-NLS-1$
public static final String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$NON-NLS-1$
+ public static final String NS_CHROMEREGISTRY_CONTRACTID = "@mozilla.org/chrome/chrome-registry;1"; //$NON-NLS-1$
/* XPCOM constants */
public static final int NS_OK = 0;
diff -u -r -P ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java
--- ../source-tree.orig/plugins/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java 2005-10-29 22:19:31.000000000 +0200
+++ source-tree/plugins/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java 2005-10-29 22:38:18.000000000 +0200
@@ -201,6 +201,41 @@
rc = windowWatcher.SetWindowCreator(WindowCreator.getAddress());
if (rc != XPCOM.NS_OK) error(rc);
windowWatcher.Release();
+
+ // Get service manager
+ rc = XPCOM.NS_GetServiceManager(result);
+ if (rc != XPCOM.NS_OK) error(rc);
+ if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
+
+ // Get chrome registry
+ serviceManager = new nsIServiceManager(result[0]);
+ result[0] = 0;
+ buffer = XPCOM.NS_CHROMEREGISTRY_CONTRACTID.getBytes();
+ aContractID = new byte[buffer.length + 1];
+ System.arraycopy(buffer, 0, aContractID, 0, buffer.length);
+ rc = serviceManager.GetServiceByContractID(aContractID, nsIXULChromeRegistry.NS_XULCHROMEREGISTRY_IID, result);
+ serviceManager.Release();
+
+ if (rc == XPCOM.NS_OK) {
+ // if chrome registry is available
+ if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
+
+ // Set classic theme
+ nsIXULChromeRegistry chromRegistry = new nsIXULChromeRegistry(result[0]);
+ result[0] = 0;
+ // Set runtime provider
+ rc = chromRegistry.SetRuntimeProvider(true);
+ if (rc != XPCOM.NS_OK) error(rc);
+ // Set theme
+ buffer = "classic/1.0".getBytes(); //$NON-NLS-1$
+ byte[] aThemeBuffer = new byte[buffer.length + 1];
+ System.arraycopy(buffer, 0, aThemeBuffer, 0, buffer.length);
+ int /*long*/ aTheme = XPCOM.nsEmbedCString_new(aThemeBuffer, aThemeBuffer.length);
+ rc = chromRegistry.SelectSkin(aTheme, false);
+ XPCOM.nsEmbedCString_delete(aTheme);
+ if (rc != XPCOM.NS_OK) error(rc);
+ chromRegistry.Release();
+ }
PromptServiceFactory factory = new PromptServiceFactory();
factory.AddRef();
|