void onDispose(long /*int*/ embedHandle) { if (SubclassProc == null) return; long /*int*/ hwndChild = OS.GetWindow(browser.handle, OS.GW_CHILD); OS.SetWindowLongPtr(hwndChild, OS.GWL_WNDPROC, MozillaProc); childWindows = null; browser = null; }
void addWindowSubclass() { long /*int*/ hwndChild = OS.GetWindow(browser.handle, OS.GW_CHILD); if (SubclassProc == null) { SubclassProc = new Callback(MozillaDelegate.class, "windowProc", 4); // $NON-NLS-1$ MozillaProc = OS.GetWindowLongPtr(hwndChild, OS.GWL_WNDPROC); } OS.SetWindowLongPtr(hwndChild, OS.GWL_WNDPROC, SubclassProc.getAddress()); }
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); OS.FillRect(wParam, rect, OS.GetSysColorBrush(OS.COLOR_WINDOW)); break; } return OS.CallWindowProc(MozillaProc, hwnd, (int) /*64*/ msg, wParam, lParam); }
static String getCacheParentPath() { /* Use the character encoding for the default locale */ TCHAR buffer = new TCHAR(0, OS.MAX_PATH); if (OS.SHGetFolderPath(0, OS.CSIDL_LOCAL_APPDATA, 0, OS.SHGFP_TYPE_CURRENT, buffer) == OS.S_OK) { return buffer.toString(0, buffer.strlen()) + Mozilla.SEPARATOR_OS + "eclipse"; // $NON-NLS-1$ } return getProfilePath(); }
static char[] mbcsToWcs(String codePage, byte[] buffer) { char[] chars = new char[buffer.length]; int charCount = OS.MultiByteToWideChar( OS.CP_ACP, OS.MB_PRECOMPOSED, buffer, buffer.length, chars, chars.length); if (charCount == chars.length) return chars; char[] result = new char[charCount]; System.arraycopy(chars, 0, result, 0, charCount); return result; }
static String getProfilePath() { String baseDir; /* Use the character encoding for the default locale */ TCHAR buffer = new TCHAR(0, OS.MAX_PATH); if (OS.SHGetFolderPath(0, OS.CSIDL_APPDATA, 0, OS.SHGFP_TYPE_CURRENT, buffer) == OS.S_OK) { baseDir = buffer.toString(0, buffer.strlen()); } else { baseDir = System.getProperty("user.home"); // $NON-NLS-1$ } return baseDir + Mozilla.SEPARATOR_OS + "Mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$ }
static byte[] wcsToMbcs(String codePage, String string, boolean terminate) { int byteCount; char[] chars = new char[string.length()]; string.getChars(0, chars.length, chars, 0); byte[] bytes = new byte[byteCount = chars.length * 2 + (terminate ? 1 : 0)]; byteCount = OS.WideCharToMultiByte(OS.CP_ACP, 0, chars, chars.length, bytes, byteCount, null, null); if (terminate) { byteCount++; } else { if (bytes.length != byteCount) { byte[] result = new byte[byteCount]; System.arraycopy(bytes, 0, result, 0, byteCount); bytes = result; } } return bytes; }
void removeWindowSubclass() { long /*int*/ hwndChild = OS.GetWindow(browser.handle, OS.GW_CHILD); if (SubclassProc != null) { OS.SetWindowLongPtr(hwndChild, OS.GWL_WNDPROC, MozillaProc); } }