diff options
author | Lakshmi Shanmugam <lshanmug@in.ibm.com> | 2013-03-28 17:58:00 +0530 |
---|---|---|
committer | Lakshmi Shanmugam <lshanmug@in.ibm.com> | 2013-03-28 17:58:00 +0530 |
commit | a665198fe9e899923e0c20961d42655c29cefe1d (patch) | |
tree | f6004bdf9ecb035d6516f400ab46adf7956da492 /bundles/org.eclipse.swt/Eclipse SWT Mozilla | |
parent | 1dad781cbb94d95be05e16068bf8370692f59146 (diff) | |
download | eclipse.platform.swt-a665198fe9e899923e0c20961d42655c29cefe1d.tar.gz eclipse.platform.swt-a665198fe9e899923e0c20961d42655c29cefe1d.tar.xz eclipse.platform.swt-a665198fe9e899923e0c20961d42655c29cefe1d.zip |
workaround for: shell.open() terminates program on windows
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Mozilla')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java index 7df2de4fd2..b682436ea0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java @@ -24,6 +24,7 @@ class MozillaDelegate { Vector childWindows = new Vector (9); static long /*int*/ MozillaProc; static Callback SubclassProc; + static Callback SubclassProc_UpdateUIState; MozillaDelegate (Browser browser) { super (); @@ -108,6 +109,12 @@ static byte[] wcsToMbcs (String codePage, String string, boolean terminate) { static long /*int*/ windowProc (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wParam, long /*int*/ lParam) { switch ((int)/*64*/msg) { + case OS.WM_UPDATEUISTATE: + /* + * In XULRunner 17, calling the default windowProc for WM_UPDATEUISTATE message + * terminates the program. Workaround is to prevent the call to default windowProc. + */ + return 0; case OS.WM_ERASEBKGND: RECT rect = new RECT (); OS.GetClientRect (hwnd, rect); @@ -117,6 +124,18 @@ static long /*int*/ windowProc (long /*int*/ hwnd, long /*int*/ msg, long /*int* return OS.CallWindowProc (MozillaProc, hwnd, (int)/*64*/msg, wParam, lParam); } +static long /*int*/ windowProc1 (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wParam, long /*int*/ lParam) { + switch ((int)/*64*/msg) { + case OS.WM_UPDATEUISTATE: + /* + * In XULRunner 17, calling the default windowProc for WM_UPDATEUISTATE message + * terminates the program. Workaround is to prevent the call to default windowProc. + */ + return 0; + } + return OS.CallWindowProc (MozillaProc, hwnd, (int)/*64*/msg, wParam, lParam); +} + void addWindowSubclass () { long /*int*/ hwndChild = OS.GetWindow (browser.handle, OS.GW_CHILD); if (SubclassProc == null) { @@ -231,15 +250,25 @@ void init () { } void onDispose (long /*int*/ embedHandle) { - removeWindowSubclass (); + if (SubclassProc == null && SubclassProc_UpdateUIState == null) return; + long /*int*/ hwndChild = OS.GetWindow (browser.handle, OS.GW_CHILD); + OS.SetWindowLongPtr (hwndChild, OS.GWL_WNDPROC, MozillaProc); childWindows = null; browser = null; } void removeWindowSubclass () { - if (SubclassProc == null) return; long /*int*/ hwndChild = OS.GetWindow (browser.handle, OS.GW_CHILD); - OS.SetWindowLongPtr (hwndChild, OS.GWL_WNDPROC, MozillaProc); + if (Mozilla.IsPre_17) { + if (SubclassProc != null) { + OS.SetWindowLongPtr (hwndChild, OS.GWL_WNDPROC, MozillaProc); + } + } else { + if (SubclassProc_UpdateUIState == null) { + SubclassProc_UpdateUIState = new Callback (MozillaDelegate.class, "windowProc1", 4); //$NON-NLS-1$ + } + OS.SetWindowLongPtr (hwndChild, OS.GWL_WNDPROC, SubclassProc_UpdateUIState.getAddress ()); + } } boolean sendTraverse () { |