зеркало из https://github.com/mozilla/pjs.git
Bug 712483 Implement mozilla::widget::WinUtils r=jimm
This commit is contained in:
Родитель
8ee6724715
Коммит
2d16edec45
|
@ -78,6 +78,7 @@ CPPSRCS = \
|
|||
WidgetTraceEvent.cpp \
|
||||
AudioSession.cpp \
|
||||
nsWidgetFactory.cpp \
|
||||
WinUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_CRASHREPORTER
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nsWindow.h"
|
||||
#include "nsAppShell.h"
|
||||
#include "TaskbarPreviewButton.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include <nsIBaseWindow.h>
|
||||
#include <nsICanvasRenderingContextInternal.h>
|
||||
|
@ -285,7 +286,7 @@ TaskbarPreview::Disable() {
|
|||
bool
|
||||
TaskbarPreview::IsWindowAvailable() const {
|
||||
if (mWnd) {
|
||||
nsWindow* win = nsWindow::GetNSWindowPtr(mWnd);
|
||||
nsWindow* win = WinUtils::GetNSWindowPtr(mWnd);
|
||||
if(win && !win->HasDestroyStarted()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -356,7 +357,7 @@ TaskbarPreview::CanMakeTaskbarCalls() {
|
|||
if (!::IsWindowVisible(mWnd))
|
||||
return false;
|
||||
if (mVisible) {
|
||||
nsWindow *window = nsWindow::GetNSWindowPtr(mWnd);
|
||||
nsWindow *window = WinUtils::GetNSWindowPtr(mWnd);
|
||||
NS_ASSERTION(window, "Could not get nsWindow from HWND");
|
||||
return window->HasTaskbarIconBeenCreated();
|
||||
}
|
||||
|
@ -365,7 +366,7 @@ TaskbarPreview::CanMakeTaskbarCalls() {
|
|||
|
||||
WindowHook&
|
||||
TaskbarPreview::GetWindowHook() {
|
||||
nsWindow *window = nsWindow::GetNSWindowPtr(mWnd);
|
||||
nsWindow *window = WinUtils::GetNSWindowPtr(mWnd);
|
||||
NS_ASSERTION(window, "Cannot use taskbar previews in an embedded context!");
|
||||
|
||||
return window->GetWindowHook();
|
||||
|
@ -449,7 +450,7 @@ TaskbarPreview::MainWindowHook(void *aContext,
|
|||
// We can't really do anything at this point including removing hooks
|
||||
preview->mWnd = NULL;
|
||||
} else {
|
||||
nsWindow *window = nsWindow::GetNSWindowPtr(preview->mWnd);
|
||||
nsWindow *window = WinUtils::GetNSWindowPtr(preview->mWnd);
|
||||
NS_ASSERTION(window, "Cannot use taskbar previews in an embedded context!");
|
||||
|
||||
window->SetHasTaskbarIconBeenCreated();
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "TaskbarTabPreview.h"
|
||||
#include "nsWindowGfx.h"
|
||||
#include "nsUXThemeData.h"
|
||||
#include "WinUtils.h"
|
||||
#include <nsITaskbarPreviewController.h>
|
||||
|
||||
#define TASKBARPREVIEW_HWNDID L"TaskbarTabPreviewHwnd"
|
||||
|
@ -184,7 +185,7 @@ TaskbarTabPreview::WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam) {
|
|||
bool activateWindow;
|
||||
nsresult rv = mController->OnActivate(&activateWindow);
|
||||
if (NS_SUCCEEDED(rv) && activateWindow) {
|
||||
nsWindow* win = nsWindow::GetNSWindowPtr(mWnd);
|
||||
nsWindow* win = WinUtils::GetNSWindowPtr(mWnd);
|
||||
if (win) {
|
||||
nsWindow * parent = win->GetTopLevelWindow(true);
|
||||
if (parent) {
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nsIJumpListBuilder.h"
|
||||
#include "nsUXThemeData.h"
|
||||
#include "nsWindow.h"
|
||||
#include "WinUtils.h"
|
||||
#include "TaskbarTabPreview.h"
|
||||
#include "TaskbarWindowPreview.h"
|
||||
#include "JumpListBuilder.h"
|
||||
|
@ -328,13 +329,13 @@ WinTaskbar::GetAppUserModelID(nsAString & aDefaultGroupId) {
|
|||
// The hash is short, but users may customize this, so use a respectable
|
||||
// string buffer.
|
||||
PRUnichar buf[256];
|
||||
if (nsWindow::GetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
if (WinUtils::GetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
regKey.get(),
|
||||
path,
|
||||
buf,
|
||||
sizeof buf)) {
|
||||
aDefaultGroupId.Assign(buf);
|
||||
} else if (nsWindow::GetRegistryKey(HKEY_CURRENT_USER,
|
||||
} else if (WinUtils::GetRegistryKey(HKEY_CURRENT_USER,
|
||||
regKey.get(),
|
||||
path,
|
||||
buf,
|
||||
|
@ -360,7 +361,7 @@ WinTaskbar::GetDefaultGroupId(nsAString & aDefaultGroupId) {
|
|||
// (static) Called from AppShell
|
||||
bool
|
||||
WinTaskbar::RegisterAppUserModelID() {
|
||||
if (nsWindow::GetWindowsVersion() < WIN7_VERSION)
|
||||
if (WinUtils::GetWindowsVersion() < WinUtils::WIN7_VERSION)
|
||||
return false;
|
||||
|
||||
SetCurrentProcessExplicitAppUserModelIDPtr funcAppUserModelID = nsnull;
|
||||
|
@ -392,7 +393,7 @@ WinTaskbar::RegisterAppUserModelID() {
|
|||
NS_IMETHODIMP
|
||||
WinTaskbar::GetAvailable(bool *aAvailable) {
|
||||
*aAvailable =
|
||||
nsWindow::GetWindowsVersion() < WIN7_VERSION ?
|
||||
WinUtils::GetWindowsVersion() < WinUtils::WIN7_VERSION ?
|
||||
false : true;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -432,7 +433,7 @@ WinTaskbar::GetTaskbarWindowPreview(nsIDocShell *shell, nsITaskbarWindowPreview
|
|||
if (!toplevelHWND)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsWindow *window = nsWindow::GetNSWindowPtr(toplevelHWND);
|
||||
nsWindow *window = WinUtils::GetNSWindowPtr(toplevelHWND);
|
||||
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -0,0 +1,367 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sts=2 sw=2 et cin: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Masayuki Nakano <masayuki@d-toybox.com>
|
||||
*
|
||||
* Original nsWindow.cpp Contributor(s):
|
||||
* Dean Tessman <dean_tessman@hotmail.com>
|
||||
* Ere Maijala <emaijala@kolumbus.fi>
|
||||
* Mark Hammond <markh@activestate.com>
|
||||
* Michael Lowe <michael.lowe@bigfoot.com>
|
||||
* Peter Bajusz <hyp-x@inf.bme.hu>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Robert O'Callahan <roc+moz@cs.cmu.edu>
|
||||
* Roy Yokoyama <yokoyama@netscape.com>
|
||||
* Makoto Kato <m_kato@ga2.so-net.ne.jp>
|
||||
* Masayuki Nakano <masayuki@d-toybox.com>
|
||||
* Dainis Jonitis <Dainis_Jonitis@swh-t.lv>
|
||||
* Christian Biesinger <cbiesinger@web.de>
|
||||
* Mats Palmgren <matspal@gmail.com>
|
||||
* Ningjie Chen <chenn@email.uc.edu>
|
||||
* Jim Mathies <jmathies@mozilla.com>
|
||||
* Kyle Huey <me@kylehuey.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "WinUtils.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsWindowDefs.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
/* static */
|
||||
WinUtils::WinVersion
|
||||
WinUtils::GetWindowsVersion()
|
||||
{
|
||||
static PRInt32 version = 0;
|
||||
|
||||
if (version) {
|
||||
return static_cast<WinVersion>(version);
|
||||
}
|
||||
|
||||
OSVERSIONINFOEX osInfo;
|
||||
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
// This cast is safe and supposed to be here, don't worry
|
||||
::GetVersionEx((OSVERSIONINFO*)&osInfo);
|
||||
version =
|
||||
(osInfo.dwMajorVersion & 0xff) << 8 | (osInfo.dwMinorVersion & 0xff);
|
||||
return static_cast<WinVersion>(version);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
WinUtils::GetRegistryKey(HKEY aRoot,
|
||||
const PRUnichar* aKeyName,
|
||||
const PRUnichar* aValueName,
|
||||
PRUnichar* aBuffer,
|
||||
DWORD aBufferLength)
|
||||
{
|
||||
NS_PRECONDITION(aKeyName, "The key name is NULL");
|
||||
|
||||
HKEY key;
|
||||
LONG result =
|
||||
::RegOpenKeyExW(aRoot, aKeyName, NULL, KEY_READ | KEY_WOW64_32KEY, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
result =
|
||||
::RegOpenKeyExW(aRoot, aKeyName, NULL, KEY_READ | KEY_WOW64_64KEY, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD type;
|
||||
result =
|
||||
::RegQueryValueExW(key, aValueName, NULL, &type, (BYTE*) aBuffer,
|
||||
&aBufferLength);
|
||||
::RegCloseKey(key);
|
||||
if (result != ERROR_SUCCESS || type != REG_SZ) {
|
||||
return false;
|
||||
}
|
||||
if (aBuffer) {
|
||||
aBuffer[aBufferLength / sizeof(*aBuffer) - 1] = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
HWND
|
||||
WinUtils::GetTopLevelHWND(HWND aWnd,
|
||||
bool aStopIfNotChild,
|
||||
bool aStopIfNotPopup)
|
||||
{
|
||||
HWND curWnd = aWnd;
|
||||
HWND topWnd = NULL;
|
||||
|
||||
while (curWnd) {
|
||||
topWnd = curWnd;
|
||||
|
||||
if (aStopIfNotChild) {
|
||||
DWORD_PTR style = ::GetWindowLongPtrW(curWnd, GWL_STYLE);
|
||||
|
||||
VERIFY_WINDOW_STYLE(style);
|
||||
|
||||
if (!(style & WS_CHILD)) // first top-level window
|
||||
break;
|
||||
}
|
||||
|
||||
HWND upWnd = ::GetParent(curWnd); // Parent or owner (if has no parent)
|
||||
|
||||
// GetParent will only return the owner if the passed in window
|
||||
// has the WS_POPUP style.
|
||||
if (!upWnd && !aStopIfNotPopup) {
|
||||
upWnd = ::GetWindow(curWnd, GW_OWNER);
|
||||
}
|
||||
curWnd = upWnd;
|
||||
}
|
||||
|
||||
return topWnd;
|
||||
}
|
||||
|
||||
static PRUnichar*
|
||||
GetNSWindowPropName()
|
||||
{
|
||||
static PRUnichar sPropName[40] = L"";
|
||||
if (!*sPropName) {
|
||||
_snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p",
|
||||
::GetCurrentProcessId());
|
||||
sPropName[39] = '\0';
|
||||
}
|
||||
return sPropName;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
WinUtils::SetNSWindowPtr(HWND aWnd, nsWindow* aWindow)
|
||||
{
|
||||
if (!aWindow) {
|
||||
::RemovePropW(aWnd, GetNSWindowPropName());
|
||||
return true;
|
||||
}
|
||||
return ::SetPropW(aWnd, GetNSWindowPropName(), (HANDLE)aWindow);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsWindow*
|
||||
WinUtils::GetNSWindowPtr(HWND aWnd)
|
||||
{
|
||||
return static_cast<nsWindow*>(::GetPropW(aWnd, GetNSWindowPropName()));
|
||||
}
|
||||
|
||||
static BOOL CALLBACK
|
||||
AddMonitor(HMONITOR, HDC, LPRECT, LPARAM aParam)
|
||||
{
|
||||
(*(PRInt32*)aParam)++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* static */
|
||||
PRInt32
|
||||
WinUtils::GetMonitorCount()
|
||||
{
|
||||
PRInt32 monitorCount = 0;
|
||||
EnumDisplayMonitors(NULL, NULL, AddMonitor, (LPARAM)&monitorCount);
|
||||
return monitorCount;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
WinUtils::IsOurProcessWindow(HWND aWnd)
|
||||
{
|
||||
if (!aWnd) {
|
||||
return false;
|
||||
}
|
||||
DWORD processId = 0;
|
||||
::GetWindowThreadProcessId(aWnd, &processId);
|
||||
return (processId == ::GetCurrentProcessId());
|
||||
}
|
||||
|
||||
/* static */
|
||||
HWND
|
||||
WinUtils::FindOurProcessWindow(HWND aWnd)
|
||||
{
|
||||
for (HWND wnd = ::GetParent(aWnd); wnd; wnd = ::GetParent(wnd)) {
|
||||
if (IsOurProcessWindow(wnd)) {
|
||||
return wnd;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsPointInWindow(HWND aWnd, const POINT& aPointInScreen)
|
||||
{
|
||||
RECT bounds;
|
||||
if (!::GetWindowRect(aWnd, &bounds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (aPointInScreen.x >= bounds.left && aPointInScreen.x < bounds.right &&
|
||||
aPointInScreen.y >= bounds.top && aPointInScreen.y < bounds.bottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* FindTopmostWindowAtPoint() returns the topmost child window (topmost means
|
||||
* forground in this context) of aWnd.
|
||||
*/
|
||||
|
||||
static HWND
|
||||
FindTopmostWindowAtPoint(HWND aWnd, const POINT& aPointInScreen)
|
||||
{
|
||||
if (!::IsWindowVisible(aWnd) || !IsPointInWindow(aWnd, aPointInScreen)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HWND childWnd = ::GetTopWindow(aWnd);
|
||||
while (childWnd) {
|
||||
HWND topmostWnd = FindTopmostWindowAtPoint(childWnd, aPointInScreen);
|
||||
if (topmostWnd) {
|
||||
return topmostWnd;
|
||||
}
|
||||
childWnd = ::GetNextWindow(childWnd, GW_HWNDNEXT);
|
||||
}
|
||||
|
||||
return aWnd;
|
||||
}
|
||||
|
||||
struct FindOurWindowAtPointInfo
|
||||
{
|
||||
POINT mInPointInScreen;
|
||||
HWND mOutWnd;
|
||||
};
|
||||
|
||||
static BOOL CALLBACK
|
||||
FindOurWindowAtPointCallback(HWND aWnd, LPARAM aLPARAM)
|
||||
{
|
||||
if (!WinUtils::IsOurProcessWindow(aWnd)) {
|
||||
// This isn't one of our top-level windows; continue enumerating.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Get the top-most child window under the point. If there's no child
|
||||
// window, and the point is within the top-level window, then the top-level
|
||||
// window will be returned. (This is the usual case. A child window
|
||||
// would be returned for plugins.)
|
||||
FindOurWindowAtPointInfo* info =
|
||||
reinterpret_cast<FindOurWindowAtPointInfo*>(aLPARAM);
|
||||
HWND childWnd = FindTopmostWindowAtPoint(aWnd, info->mInPointInScreen);
|
||||
if (!childWnd) {
|
||||
// This window doesn't contain the point; continue enumerating.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Return the HWND and stop enumerating.
|
||||
info->mOutWnd = childWnd;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* static */
|
||||
HWND
|
||||
WinUtils::FindOurWindowAtPoint(const POINT& aPointInScreen)
|
||||
{
|
||||
FindOurWindowAtPointInfo info;
|
||||
info.mInPointInScreen = aPointInScreen;
|
||||
info.mOutWnd = NULL;
|
||||
|
||||
// This will enumerate all top-level windows in order from top to bottom.
|
||||
EnumWindows(FindOurWindowAtPointCallback, reinterpret_cast<LPARAM>(&info));
|
||||
return info.mOutWnd;
|
||||
}
|
||||
|
||||
/* static */
|
||||
UINT
|
||||
WinUtils::GetInternalMessage(UINT aNativeMessage)
|
||||
{
|
||||
switch (aNativeMessage) {
|
||||
case WM_MOUSEWHEEL:
|
||||
return MOZ_WM_MOUSEVWHEEL;
|
||||
case WM_MOUSEHWHEEL:
|
||||
return MOZ_WM_MOUSEHWHEEL;
|
||||
case WM_VSCROLL:
|
||||
return MOZ_WM_VSCROLL;
|
||||
case WM_HSCROLL:
|
||||
return MOZ_WM_HSCROLL;
|
||||
default:
|
||||
return aNativeMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
UINT
|
||||
WinUtils::GetNativeMessage(UINT aInternalMessage)
|
||||
{
|
||||
switch (aInternalMessage) {
|
||||
case MOZ_WM_MOUSEVWHEEL:
|
||||
return WM_MOUSEWHEEL;
|
||||
case MOZ_WM_MOUSEHWHEEL:
|
||||
return WM_MOUSEHWHEEL;
|
||||
case MOZ_WM_VSCROLL:
|
||||
return WM_VSCROLL;
|
||||
case MOZ_WM_HSCROLL:
|
||||
return WM_HSCROLL;
|
||||
default:
|
||||
return aInternalMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
PRUint16
|
||||
WinUtils::GetMouseInputSource()
|
||||
{
|
||||
PRInt32 inputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
|
||||
LPARAM lParamExtraInfo = ::GetMessageExtraInfo();
|
||||
if ((lParamExtraInfo & TABLET_INK_SIGNATURE) == TABLET_INK_CHECK) {
|
||||
inputSource = (lParamExtraInfo & TABLET_INK_TOUCH) ?
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH : nsIDOMMouseEvent::MOZ_SOURCE_PEN;
|
||||
}
|
||||
return static_cast<PRUint16>(inputSource);
|
||||
}
|
||||
|
||||
/* static */
|
||||
MSG
|
||||
WinUtils::InitMSG(UINT aMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
MSG msg;
|
||||
msg.message = aMessage;
|
||||
msg.wParam = wParam;
|
||||
msg.lParam = lParam;
|
||||
return msg;
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,206 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Masayuki Nakano <masayuki@d-toybox.com>
|
||||
*
|
||||
* Original nsWindow.cpp Contributor(s):
|
||||
* Robert O'Callahan <roc+moz@cs.cmu.edu>
|
||||
* Dean Tessman <dean_tessman@hotmail.com>
|
||||
* Makoto Kato <m_kato@ga2.so-net.ne.jp>
|
||||
* Dainis Jonitis <Dainis_Jonitis@swh-t.lv>
|
||||
* Masayuki Nakano <masayuki@d-toybox.com>
|
||||
* Ningjie Chen <chenn@email.uc.edu>
|
||||
* Jim Mathies <jmathies@mozilla.com>.
|
||||
* Mats Palmgren <matspal@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_widget_WinUtils_h__
|
||||
#define mozilla_widget_WinUtils_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include <windows.h>
|
||||
|
||||
class nsWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class WinUtils {
|
||||
public:
|
||||
enum WinVersion {
|
||||
WIN2K_VERSION = 0x500,
|
||||
WINXP_VERSION = 0x501,
|
||||
WIN2K3_VERSION = 0x502,
|
||||
VISTA_VERSION = 0x600,
|
||||
// WIN2K8_VERSION = VISTA_VERSION,
|
||||
WIN7_VERSION = 0x601
|
||||
// WIN2K8R2_VERSION = WIN7_VERSION
|
||||
// WIN8_VERSION = 0x602
|
||||
};
|
||||
static WinVersion GetWindowsVersion();
|
||||
|
||||
/**
|
||||
* Gets the value of a string-typed registry value.
|
||||
*
|
||||
* @param aRoot The registry root to search in.
|
||||
* @param aKeyName The name of the registry key to open.
|
||||
* @param aValueName The name of the registry value in the specified key whose
|
||||
* value is to be retrieved. Can be null, to retrieve the key's unnamed/
|
||||
* default value.
|
||||
* @param aBuffer The buffer into which to store the string value. Can be
|
||||
* null, in which case the return value indicates just whether the value
|
||||
* exists.
|
||||
* @param aBufferLength The size of aBuffer, in bytes.
|
||||
* @return Whether the value exists and is a string.
|
||||
*/
|
||||
static bool GetRegistryKey(HKEY aRoot,
|
||||
const PRUnichar* aKeyName,
|
||||
const PRUnichar* aValueName,
|
||||
PRUnichar* aBuffer,
|
||||
DWORD aBufferLength);
|
||||
|
||||
/**
|
||||
* GetTopLevelHWND() returns a window handle of the top level window which
|
||||
* aWnd belongs to. Note that the result may not be our window, i.e., it
|
||||
* may not be managed by nsWindow.
|
||||
*
|
||||
* See follwing table for the detail of the result window type.
|
||||
*
|
||||
* +-------------------------+-----------------------------------------------+
|
||||
* | | aStopIfNotPopup |
|
||||
* +-------------------------+-----------------------+-----------------------+
|
||||
* | | TRUE | FALSE |
|
||||
+ +-----------------+-------+-----------------------+-----------------------+
|
||||
* | | | * an independent top level window |
|
||||
* | | TRUE | * a pupup window (WS_POPUP) |
|
||||
* | | | * an owned top level window (like dialog) |
|
||||
* | aStopIfNotChild +-------+-----------------------+-----------------------+
|
||||
* | | | * independent window | * only an independent |
|
||||
* | | FALSE | * non-popup-owned- | top level window |
|
||||
* | | | window like dialog | |
|
||||
* +-----------------+-------+-----------------------+-----------------------+
|
||||
*/
|
||||
static HWND GetTopLevelHWND(HWND aWnd,
|
||||
bool aStopIfNotChild = false,
|
||||
bool aStopIfNotPopup = true);
|
||||
|
||||
/**
|
||||
* SetNSWindowPtr() associates an nsWindow to aWnd. If aWindow is NULL,
|
||||
* it dissociate any nsWindow pointer from aWnd.
|
||||
* GetNSWindowPtr() returns an nsWindow pointer which was associated by
|
||||
* SetNSWindowPtr().
|
||||
*/
|
||||
static bool SetNSWindowPtr(HWND aWnd, nsWindow* aWindow);
|
||||
static nsWindow* GetNSWindowPtr(HWND aWnd);
|
||||
|
||||
/**
|
||||
* GetMonitorCount() returns count of monitors on the environment.
|
||||
*/
|
||||
static PRInt32 GetMonitorCount();
|
||||
|
||||
/**
|
||||
* IsOurProcessWindow() returns TRUE if aWnd belongs our process.
|
||||
* Otherwise, FALSE.
|
||||
*/
|
||||
static bool IsOurProcessWindow(HWND aWnd);
|
||||
|
||||
/**
|
||||
* FindOurProcessWindow() returns the nearest ancestor window which
|
||||
* belongs to our process. If it fails to find our process's window by the
|
||||
* top level window, returns NULL. And note that this is using ::GetParent()
|
||||
* for climbing the window hierarchy, therefore, it gives up at an owned top
|
||||
* level window except popup window (e.g., dialog).
|
||||
*/
|
||||
static HWND FindOurProcessWindow(HWND aWnd);
|
||||
|
||||
/**
|
||||
* FindOurWindowAtPoint() returns the topmost child window which belongs to
|
||||
* our process's top level window.
|
||||
*
|
||||
* NOTE: the topmost child window may NOT be our process's window like a
|
||||
* plugin's window.
|
||||
*/
|
||||
static HWND FindOurWindowAtPoint(const POINT& aPointInScreen);
|
||||
|
||||
/**
|
||||
* InitMSG() returns an MSG struct which was initialized by the params.
|
||||
* Don't trust the other members in the result.
|
||||
*/
|
||||
static MSG InitMSG(UINT aMessage, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/**
|
||||
* GetScanCode() returns a scan code for the LPARAM of WM_KEYDOWN, WM_KEYUP,
|
||||
* WM_CHAR and WM_UNICHAR.
|
||||
*
|
||||
*/
|
||||
static WORD GetScanCode(LPARAM aLParam)
|
||||
{
|
||||
return (aLParam >> 16) & 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* IsExtendedScanCode() returns TRUE if the LPARAM indicates the key message
|
||||
* is an extended key event.
|
||||
*/
|
||||
static bool IsExtendedScanCode(LPARAM aLParam)
|
||||
{
|
||||
return (aLParam & 0x1000000) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetInternalMessage() converts a native message to an internal message.
|
||||
* If there is no internal message for the given native message, returns
|
||||
* the native message itself.
|
||||
*/
|
||||
static UINT GetInternalMessage(UINT aNativeMessage);
|
||||
|
||||
/**
|
||||
* GetNativeMessage() converts an internal message to a native message.
|
||||
* If aInternalMessage is a native message, returns the native message itself.
|
||||
*/
|
||||
static UINT GetNativeMessage(UINT aInternalMessage);
|
||||
|
||||
/**
|
||||
* GetMouseInputSource() returns a pointing device information. The value is
|
||||
* one of nsIDOMMouseEvent::MOZ_SOURCE_*. This method MUST be called during
|
||||
* mouse message handling.
|
||||
*/
|
||||
static PRUint16 GetMouseInputSource();
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_widget_WinUtils_h__
|
|
@ -59,6 +59,9 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
PRUnichar *nsFilePicker::mLastUsedUnicodeDirectory;
|
||||
char nsFilePicker::mLastUsedDirectory[MAX_PATH+1] = { 0 };
|
||||
|
@ -706,7 +709,7 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
|
|||
// a hook procedure. The hook procedure fixes a problem on XP dialogs for
|
||||
// file picker visibility. Vista and up automatically ensures the file
|
||||
// picker is always visible.
|
||||
if (nsWindow::GetWindowsVersion() < VISTA_VERSION) {
|
||||
if (WinUtils::GetWindowsVersion() < WinUtils::VISTA_VERSION) {
|
||||
ofn.lpfnHook = FilePickerHook;
|
||||
ofn.Flags |= OFN_ENABLEHOOK;
|
||||
}
|
||||
|
@ -765,7 +768,7 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
|
|||
// the file picker to use the old style dialogs because hooks are not
|
||||
// allowed in the new file picker UI. We need to eventually move to
|
||||
// the new Common File Dialogs for Vista and up.
|
||||
if (nsWindow::GetWindowsVersion() < VISTA_VERSION) {
|
||||
if (WinUtils::GetWindowsVersion() < WinUtils::VISTA_VERSION) {
|
||||
ofn.lpfnHook = MultiFilePickerHook;
|
||||
fileBuffer.forget();
|
||||
result = FilePickerWrapper(&ofn, PICKER_TYPE_OPEN);
|
||||
|
@ -1053,7 +1056,7 @@ nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
|||
bool result = false;
|
||||
if (mMode == modeGetFolder) {
|
||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||
if (nsWindow::GetWindowsVersion() >= VISTA_VERSION)
|
||||
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
||||
result = ShowFolderPicker(initialDir);
|
||||
else
|
||||
result = ShowXPFolderPicker(initialDir);
|
||||
|
@ -1062,7 +1065,7 @@ nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
|||
#endif
|
||||
} else {
|
||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||
if (nsWindow::GetWindowsVersion() >= VISTA_VERSION)
|
||||
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
||||
result = ShowFilePicker(initialDir);
|
||||
else
|
||||
result = ShowXPFilePicker(initialDir);
|
||||
|
@ -1259,7 +1262,7 @@ NS_IMETHODIMP
|
|||
nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter)
|
||||
{
|
||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||
if (nsWindow::GetWindowsVersion() >= VISTA_VERSION) {
|
||||
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION) {
|
||||
mComFilterList.Append(aTitle, aFilter);
|
||||
} else {
|
||||
AppendXPFilter(aTitle, aFilter);
|
||||
|
|
|
@ -60,6 +60,9 @@
|
|||
|
||||
#include "nsIMM32Handler.h"
|
||||
#include "nsWindow.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
static nsIMM32Handler* gIMM32Handler = nsnull;
|
||||
|
||||
|
@ -148,7 +151,7 @@ nsIMM32Handler::IsTopLevelWindowOfComposition(nsWindow* aWindow)
|
|||
return false;
|
||||
}
|
||||
HWND wnd = gIMM32Handler->mComposingWindow->GetWindowHandle();
|
||||
return nsWindow::GetTopLevelHWND(wnd, true) == aWindow->GetWindowHandle();
|
||||
return WinUtils::GetTopLevelHWND(wnd, true) == aWindow->GetWindowHandle();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "nsWindow.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "prinrval.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxContext.h"
|
||||
|
@ -71,6 +72,8 @@
|
|||
#include "nsUXThemeData.h"
|
||||
#include "nsUXThemeConstants.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gWindowsLog;
|
||||
#endif
|
||||
|
@ -382,7 +385,7 @@ static void AddPaddingRect(nsIntSize* aSize, CaptionButton button) {
|
|||
RECT offset;
|
||||
if (!nsUXThemeData::IsAppThemed())
|
||||
offset = buttonData[CAPTION_CLASSIC].hotPadding[button];
|
||||
else if (nsWindow::GetWindowsVersion() == WINXP_VERSION)
|
||||
else if (WinUtils::GetWindowsVersion() == WinUtils::WINXP_VERSION)
|
||||
offset = buttonData[CAPTION_XPTHEME].hotPadding[button];
|
||||
else
|
||||
offset = buttonData[CAPTION_BASIC].hotPadding[button];
|
||||
|
@ -396,7 +399,7 @@ static void OffsetBackgroundRect(RECT& rect, CaptionButton button) {
|
|||
RECT offset;
|
||||
if (!nsUXThemeData::IsAppThemed())
|
||||
offset = buttonData[CAPTION_CLASSIC].hotPadding[button];
|
||||
else if (nsWindow::GetWindowsVersion() == WINXP_VERSION)
|
||||
else if (WinUtils::GetWindowsVersion() == WinUtils::WINXP_VERSION)
|
||||
offset = buttonData[CAPTION_XPTHEME].hotPadding[button];
|
||||
else
|
||||
offset = buttonData[CAPTION_BASIC].hotPadding[button];
|
||||
|
@ -2077,7 +2080,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a
|
|||
aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_RESTORE].cx;
|
||||
aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_RESTORE].cy;
|
||||
// For XP, subtract 4 from system metrics dimensions.
|
||||
if (nsWindow::GetWindowsVersion() == WINXP_VERSION) {
|
||||
if (WinUtils::GetWindowsVersion() == WinUtils::WINXP_VERSION) {
|
||||
aResult->width -= 4;
|
||||
aResult->height -= 4;
|
||||
}
|
||||
|
@ -2089,7 +2092,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a
|
|||
QueryForButtonData(aFrame);
|
||||
aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_MINIMIZE].cx;
|
||||
aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_MINIMIZE].cy;
|
||||
if (nsWindow::GetWindowsVersion() == WINXP_VERSION) {
|
||||
if (WinUtils::GetWindowsVersion() == WinUtils::WINXP_VERSION) {
|
||||
aResult->width -= 4;
|
||||
aResult->height -= 4;
|
||||
}
|
||||
|
@ -2101,7 +2104,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a
|
|||
QueryForButtonData(aFrame);
|
||||
aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_CLOSE].cx;
|
||||
aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_CLOSE].cy;
|
||||
if (nsWindow::GetWindowsVersion() == WINXP_VERSION) {
|
||||
if (WinUtils::GetWindowsVersion() == WinUtils::WINXP_VERSION) {
|
||||
aResult->width -= 4;
|
||||
aResult->height -= 4;
|
||||
}
|
||||
|
|
|
@ -43,11 +43,12 @@
|
|||
|
||||
#include "nsUXThemeData.h"
|
||||
#include "nsDebug.h"
|
||||
// For GetWindowsVersion
|
||||
#include "nsWindow.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "WinUtils.h"
|
||||
#include "nsUXThemeConstants.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
const PRUnichar
|
||||
nsUXThemeData::kThemeLibraryName[] = L"uxtheme.dll";
|
||||
|
@ -120,9 +121,9 @@ nsUXThemeData::Initialize()
|
|||
::ZeroMemory(sThemes, sizeof(sThemes));
|
||||
NS_ASSERTION(!sThemeDLL, "nsUXThemeData being initialized twice!");
|
||||
|
||||
PRInt32 version = nsWindow::GetWindowsVersion();
|
||||
sIsXPOrLater = version >= WINXP_VERSION;
|
||||
sIsVistaOrLater = version >= VISTA_VERSION;
|
||||
WinUtils::WinVersion version = WinUtils::GetWindowsVersion();
|
||||
sIsXPOrLater = version >= WinUtils::WINXP_VERSION;
|
||||
sIsVistaOrLater = version >= WinUtils::VISTA_VERSION;
|
||||
|
||||
if (GetThemeDLL()) {
|
||||
openTheme = (OpenThemeDataPtr)GetProcAddress(sThemeDLL, "OpenThemeData");
|
||||
|
@ -272,7 +273,7 @@ nsUXThemeData::InitTitlebarInfo()
|
|||
// Use system metrics for pre-vista, otherwise trigger a
|
||||
// refresh on the next layout.
|
||||
sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed =
|
||||
(nsWindow::GetWindowsVersion() < VISTA_VERSION);
|
||||
(WinUtils::GetWindowsVersion() < WinUtils::VISTA_VERSION);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -400,7 +401,8 @@ void
|
|||
nsUXThemeData::UpdateNativeThemeInfo()
|
||||
{
|
||||
// Trigger a refresh of themed button metrics if needed
|
||||
sTitlebarInfoPopulatedThemed = (nsWindow::GetWindowsVersion() < VISTA_VERSION);
|
||||
sTitlebarInfoPopulatedThemed =
|
||||
(WinUtils::GetWindowsVersion() < WinUtils::VISTA_VERSION);
|
||||
|
||||
sIsDefaultWindowsTheme = false;
|
||||
sThemeId = LookAndFeel::eWindowsTheme_Generic;
|
||||
|
|
|
@ -161,6 +161,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "nsISound.h"
|
||||
#include "WinTaskbar.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#ifdef MOZ_ENABLE_D3D9_LAYER
|
||||
#include "LayerManagerD3D9.h"
|
||||
|
@ -543,7 +544,8 @@ nsWindow::Create(nsIWidget *aParent,
|
|||
mParent = aParent;
|
||||
} else { // has a nsNative parent
|
||||
parent = (HWND)aNativeParent;
|
||||
mParent = aNativeParent ? GetNSWindowPtr((HWND)aNativeParent) : nsnull;
|
||||
mParent = aNativeParent ?
|
||||
WinUtils::GetNSWindowPtr((HWND)aNativeParent) : nsnull;
|
||||
}
|
||||
|
||||
mPopupType = aInitData->mPopupHint;
|
||||
|
@ -677,7 +679,7 @@ nsWindow::Create(nsIWidget *aParent,
|
|||
// bugs over the years, disable it (sTrimOnMinimize=1) on Vista and up.
|
||||
sTrimOnMinimize =
|
||||
Preferences::GetBool("config.trim_on_minimize",
|
||||
(GetWindowsVersion() >= VISTA_VERSION)) ? 1 : 0;
|
||||
(WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)) ? 1 : 0;
|
||||
sSwitchKeyboardLayout =
|
||||
Preferences::GetBool("intl.keyboard.per_window_layout", false);
|
||||
gDisableNativeTheme =
|
||||
|
@ -949,66 +951,19 @@ void nsWindow::SubclassWindow(BOOL bState)
|
|||
(LONG_PTR)nsWindow::WindowProc);
|
||||
NS_ASSERTION(mPrevWndProc, "Null standard window procedure");
|
||||
// connect the this pointer to the nsWindow handle
|
||||
SetNSWindowPtr(mWnd, this);
|
||||
WinUtils::SetNSWindowPtr(mWnd, this);
|
||||
}
|
||||
else {
|
||||
if (mUnicodeWidget)
|
||||
::SetWindowLongPtrW(mWnd, GWLP_WNDPROC, (LONG_PTR)mPrevWndProc);
|
||||
else
|
||||
::SetWindowLongPtrA(mWnd, GWLP_WNDPROC, (LONG_PTR)mPrevWndProc);
|
||||
SetNSWindowPtr(mWnd, NULL);
|
||||
WinUtils::SetNSWindowPtr(mWnd, NULL);
|
||||
mPrevWndProc = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* SECTION: Window properties
|
||||
*
|
||||
* Set and clear native window properties.
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
static PRUnichar sPropName[40] = L"";
|
||||
static PRUnichar* GetNSWindowPropName()
|
||||
{
|
||||
if (!*sPropName)
|
||||
{
|
||||
_snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p", GetCurrentProcessId());
|
||||
sPropName[39] = '\0';
|
||||
}
|
||||
return sPropName;
|
||||
}
|
||||
|
||||
nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd)
|
||||
{
|
||||
return (nsWindow *) ::GetPropW(aWnd, GetNSWindowPropName());
|
||||
}
|
||||
|
||||
BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr)
|
||||
{
|
||||
if (ptr == NULL) {
|
||||
::RemovePropW(aWnd, GetNSWindowPropName());
|
||||
return TRUE;
|
||||
} else {
|
||||
return ::SetPropW(aWnd, GetNSWindowPropName(), (HANDLE)ptr);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL CALLBACK AddMonitor(HMONITOR, HDC, LPRECT, LPARAM aParam)
|
||||
{
|
||||
(*(PRInt32*)aParam)++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PRInt32 nsWindow::GetMonitorCount()
|
||||
{
|
||||
PRInt32 monitorCount = 0;
|
||||
EnumDisplayMonitors(NULL, NULL, AddMonitor, (LPARAM)&monitorCount);
|
||||
return monitorCount;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* SECTION: nsIWidget::SetParent, nsIWidget::GetParent
|
||||
|
@ -1106,7 +1061,7 @@ nsWindow* nsWindow::GetParentWindow(bool aIncludeOwner)
|
|||
parent = ::GetAncestor(mWnd, GA_PARENT);
|
||||
|
||||
if (parent) {
|
||||
widget = GetNSWindowPtr(parent);
|
||||
widget = WinUtils::GetNSWindowPtr(parent);
|
||||
if (widget) {
|
||||
// If the widget is in the process of being destroyed then
|
||||
// do NOT return it
|
||||
|
@ -1123,7 +1078,7 @@ nsWindow* nsWindow::GetParentWindow(bool aIncludeOwner)
|
|||
BOOL CALLBACK
|
||||
nsWindow::EnumAllChildWindProc(HWND aWnd, LPARAM aParam)
|
||||
{
|
||||
nsWindow *wnd = nsWindow::GetNSWindowPtr(aWnd);
|
||||
nsWindow *wnd = WinUtils::GetNSWindowPtr(aWnd);
|
||||
if (wnd) {
|
||||
((nsWindow::WindowEnumCallback*)aParam)(wnd);
|
||||
}
|
||||
|
@ -1133,7 +1088,7 @@ nsWindow::EnumAllChildWindProc(HWND aWnd, LPARAM aParam)
|
|||
BOOL CALLBACK
|
||||
nsWindow::EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam)
|
||||
{
|
||||
nsWindow *wnd = nsWindow::GetNSWindowPtr(aWnd);
|
||||
nsWindow *wnd = WinUtils::GetNSWindowPtr(aWnd);
|
||||
if (wnd) {
|
||||
((nsWindow::WindowEnumCallback*)aParam)(wnd);
|
||||
}
|
||||
|
@ -1166,7 +1121,7 @@ NS_METHOD nsWindow::Show(bool bState)
|
|||
// pop-up windows when the DWM is disabled and two monitors are
|
||||
// connected.
|
||||
if (HasBogusPopupsDropShadowOnMultiMonitor() &&
|
||||
GetMonitorCount() > 1 &&
|
||||
WinUtils::GetMonitorCount() > 1 &&
|
||||
!nsUXThemeData::CheckForCompositor())
|
||||
{
|
||||
if (sDropShadowEnabled) {
|
||||
|
@ -1369,14 +1324,14 @@ NS_METHOD nsWindow::UnregisterTouchWindow() {
|
|||
}
|
||||
|
||||
BOOL CALLBACK nsWindow::RegisterTouchForDescendants(HWND aWnd, LPARAM aMsg) {
|
||||
nsWindow* win = GetNSWindowPtr(aWnd);
|
||||
nsWindow* win = WinUtils::GetNSWindowPtr(aWnd);
|
||||
if (win)
|
||||
win->mGesture.RegisterTouchWindow(aWnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK nsWindow::UnregisterTouchForDescendants(HWND aWnd, LPARAM aMsg) {
|
||||
nsWindow* win = GetNSWindowPtr(aWnd);
|
||||
nsWindow* win = WinUtils::GetNSWindowPtr(aWnd);
|
||||
if (win)
|
||||
win->mGesture.UnregisterTouchWindow(aWnd);
|
||||
return TRUE;
|
||||
|
@ -1579,7 +1534,7 @@ nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVert
|
|||
CaptureMouse(false);
|
||||
|
||||
// find the top-level window
|
||||
HWND toplevelWnd = GetTopLevelHWND(mWnd, true);
|
||||
HWND toplevelWnd = WinUtils::GetTopLevelHWND(mWnd, true);
|
||||
|
||||
// tell Windows to start the resize
|
||||
::PostMessage(toplevelWnd, WM_SYSCOMMAND, syscommand,
|
||||
|
@ -1806,7 +1761,7 @@ NS_METHOD nsWindow::SetFocus(bool aRaise)
|
|||
{
|
||||
if (mWnd) {
|
||||
#ifdef WINSTATE_DEBUG_OUTPUT
|
||||
if (mWnd == GetTopLevelHWND(mWnd)) {
|
||||
if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) {
|
||||
PR_LOG(gWindowsLog, PR_LOG_ALWAYS,
|
||||
("*** SetFocus: [ top] raise=%d\n", aRaise));
|
||||
} else {
|
||||
|
@ -1815,7 +1770,7 @@ NS_METHOD nsWindow::SetFocus(bool aRaise)
|
|||
}
|
||||
#endif
|
||||
// Uniconify, if necessary
|
||||
HWND toplevelWnd = GetTopLevelHWND(mWnd);
|
||||
HWND toplevelWnd = WinUtils::GetTopLevelHWND(mWnd);
|
||||
if (aRaise && ::IsIconic(toplevelWnd)) {
|
||||
::ShowWindow(toplevelWnd, SW_RESTORE);
|
||||
}
|
||||
|
@ -2604,8 +2559,8 @@ void nsWindow::UpdateGlass()
|
|||
|
||||
NS_IMETHODIMP nsWindow::HideWindowChrome(bool aShouldHide)
|
||||
{
|
||||
HWND hwnd = GetTopLevelHWND(mWnd, true);
|
||||
if (!GetNSWindowPtr(hwnd))
|
||||
HWND hwnd = WinUtils::GetTopLevelHWND(mWnd, true);
|
||||
if (!WinUtils::GetNSWindowPtr(hwnd))
|
||||
{
|
||||
NS_WARNING("Trying to hide window decorations in an embedded context");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -3106,13 +3061,13 @@ nsWindow::GetAttention(PRInt32 aCycleCount)
|
|||
if (!mWnd)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
HWND flashWnd = GetTopLevelHWND(mWnd, false, false);
|
||||
HWND flashWnd = WinUtils::GetTopLevelHWND(mWnd, false, false);
|
||||
HWND fgWnd = ::GetForegroundWindow();
|
||||
// Don't flash if the flash count is 0 or if the foreground window is our
|
||||
// window handle or that of our owned-most window.
|
||||
if (aCycleCount == 0 ||
|
||||
flashWnd == fgWnd ||
|
||||
flashWnd == GetTopLevelHWND(fgWnd, false, false)) {
|
||||
flashWnd == WinUtils::GetTopLevelHWND(fgWnd, false, false)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3374,7 +3329,8 @@ nsWindow::OnDefaultButtonLoaded(const nsIntRect &aButtonRect)
|
|||
// Don't snap when we are not active.
|
||||
HWND activeWnd = ::GetActiveWindow();
|
||||
if (activeWnd != ::GetForegroundWindow() ||
|
||||
GetTopLevelHWND(mWnd, true) != GetTopLevelHWND(activeWnd, true)) {
|
||||
WinUtils::GetTopLevelHWND(mWnd, true) !=
|
||||
WinUtils::GetTopLevelHWND(activeWnd, true)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3447,7 +3403,7 @@ nsWindow::OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta,
|
|||
|
||||
// Only Vista and later, Windows has the system setting of horizontal
|
||||
// scrolling by the mouse wheel.
|
||||
if (GetWindowsVersion() >= VISTA_VERSION) {
|
||||
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION) {
|
||||
if (!::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &systemSpeed, 0)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -3501,15 +3457,6 @@ nsWindow::OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta,
|
|||
**************************************************************/
|
||||
|
||||
// Event intialization
|
||||
MSG nsWindow::InitMSG(UINT aMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
MSG msg;
|
||||
msg.message = aMessage;
|
||||
msg.wParam = wParam;
|
||||
msg.lParam = lParam;
|
||||
return msg;
|
||||
}
|
||||
|
||||
void nsWindow::InitEvent(nsGUIEvent& event, nsIntPoint* aPoint)
|
||||
{
|
||||
if (nsnull == aPoint) { // use the point from the event
|
||||
|
@ -3766,7 +3713,7 @@ void nsWindow::DispatchPendingEvents()
|
|||
// paint events pending.
|
||||
if (::GetQueueStatus(QS_PAINT)) {
|
||||
// Find the top level window.
|
||||
HWND topWnd = GetTopLevelHWND(mWnd);
|
||||
HWND topWnd = WinUtils::GetTopLevelHWND(mWnd);
|
||||
|
||||
// Dispatch pending paints for topWnd and all its descendant windows.
|
||||
// Note: EnumChildWindows enumerates all descendant windows not just
|
||||
|
@ -3799,7 +3746,7 @@ bool nsWindow::DispatchPluginEvent(UINT aMessage,
|
|||
LPARAM aLParam,
|
||||
bool aDispatchPendingEvents)
|
||||
{
|
||||
bool ret = DispatchPluginEvent(InitMSG(aMessage, aWParam, aLParam));
|
||||
bool ret = DispatchPluginEvent(WinUtils::InitMSG(aMessage, aWParam, aLParam));
|
||||
if (aDispatchPendingEvents) {
|
||||
DispatchPendingEvents();
|
||||
}
|
||||
|
@ -4097,7 +4044,7 @@ bool nsWindow::DispatchFocusToTopLevelWindow(PRUint32 aEventType)
|
|||
while (curWnd) {
|
||||
toplevelWnd = curWnd;
|
||||
|
||||
nsWindow *win = GetNSWindowPtr(curWnd);
|
||||
nsWindow *win = WinUtils::GetNSWindowPtr(curWnd);
|
||||
if (win) {
|
||||
nsWindowType wintype;
|
||||
win->GetWindowType(wintype);
|
||||
|
@ -4109,7 +4056,7 @@ bool nsWindow::DispatchFocusToTopLevelWindow(PRUint32 aEventType)
|
|||
}
|
||||
|
||||
if (toplevelWnd) {
|
||||
nsWindow *win = GetNSWindowPtr(toplevelWnd);
|
||||
nsWindow *win = WinUtils::GetNSWindowPtr(toplevelWnd);
|
||||
if (win)
|
||||
return win->DispatchFocus(aEventType);
|
||||
}
|
||||
|
@ -4161,14 +4108,14 @@ bool nsWindow::IsTopLevelMouseExit(HWND aWnd)
|
|||
mp.y = GET_Y_LPARAM(pos);
|
||||
HWND mouseWnd = ::WindowFromPoint(mp);
|
||||
|
||||
// GetTopLevelHWND will return a HWND for the window frame (which includes
|
||||
// the non-client area). If the mouse has moved into the non-client area,
|
||||
// we should treat it as a top-level exit.
|
||||
HWND mouseTopLevel = nsWindow::GetTopLevelHWND(mouseWnd);
|
||||
// WinUtils::GetTopLevelHWND() will return a HWND for the window frame
|
||||
// (which includes the non-client area). If the mouse has moved into
|
||||
// the non-client area, we should treat it as a top-level exit.
|
||||
HWND mouseTopLevel = WinUtils::GetTopLevelHWND(mouseWnd);
|
||||
if (mouseWnd == mouseTopLevel)
|
||||
return true;
|
||||
|
||||
return nsWindow::GetTopLevelHWND(aWnd) != mouseTopLevel;
|
||||
return WinUtils::GetTopLevelHWND(aWnd) != mouseTopLevel;
|
||||
}
|
||||
|
||||
bool nsWindow::BlurEventsSuppressed()
|
||||
|
@ -4180,7 +4127,7 @@ bool nsWindow::BlurEventsSuppressed()
|
|||
// are they suppressed by any container widget?
|
||||
HWND parentWnd = ::GetParent(mWnd);
|
||||
if (parentWnd) {
|
||||
nsWindow *parent = GetNSWindowPtr(parentWnd);
|
||||
nsWindow *parent = WinUtils::GetNSWindowPtr(parentWnd);
|
||||
if (parent)
|
||||
return parent->BlurEventsSuppressed();
|
||||
}
|
||||
|
@ -4290,7 +4237,7 @@ nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam)
|
|||
GetClassNameW(focusWnd, szClass,
|
||||
sizeof(szClass)/sizeof(PRUnichar)) &&
|
||||
!wcscmp(szClass, L"Edit") &&
|
||||
!IsOurProcessWindow(focusWnd)) {
|
||||
!WinUtils::IsOurProcessWindow(focusWnd)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4421,7 +4368,7 @@ LRESULT CALLBACK nsWindow::WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam
|
|||
}
|
||||
|
||||
// Get the window which caused the event and ask it to process the message
|
||||
nsWindow *someWindow = GetNSWindowPtr(hWnd);
|
||||
nsWindow *someWindow = WinUtils::GetNSWindowPtr(hWnd);
|
||||
|
||||
if (someWindow)
|
||||
someWindow->IPCWindowProcHandler(msg, wParam, lParam);
|
||||
|
@ -4579,7 +4526,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
|
||||
if (PluginHasFocus()) {
|
||||
bool callDefaultWndProc;
|
||||
MSG nativeMsg = InitMSG(msg, wParam, lParam);
|
||||
MSG nativeMsg = WinUtils::InitMSG(msg, wParam, lParam);
|
||||
if (ProcessMessageForPlugin(nativeMsg, aRetValue, callDefaultWndProc)) {
|
||||
return mWnd ? !callDefaultWndProc : true;
|
||||
}
|
||||
|
@ -4897,7 +4844,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
case WM_SYSCHAR:
|
||||
case WM_CHAR:
|
||||
{
|
||||
MSG nativeMsg = InitMSG(msg, wParam, lParam);
|
||||
MSG nativeMsg = WinUtils::InitMSG(msg, wParam, lParam);
|
||||
result = ProcessCharMessage(nativeMsg, nsnull);
|
||||
DispatchPendingEvents();
|
||||
}
|
||||
|
@ -4906,7 +4853,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
case WM_SYSKEYUP:
|
||||
case WM_KEYUP:
|
||||
{
|
||||
MSG nativeMsg = InitMSG(msg, wParam, lParam);
|
||||
MSG nativeMsg = WinUtils::InitMSG(msg, wParam, lParam);
|
||||
nativeMsg.time = ::GetMessageTime();
|
||||
result = ProcessKeyUpMessage(nativeMsg, nsnull);
|
||||
DispatchPendingEvents();
|
||||
|
@ -4916,7 +4863,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
MSG nativeMsg = InitMSG(msg, wParam, lParam);
|
||||
MSG nativeMsg = WinUtils::InitMSG(msg, wParam, lParam);
|
||||
result = ProcessKeyDownMessage(nativeMsg, nsnull);
|
||||
DispatchPendingEvents();
|
||||
}
|
||||
|
@ -5158,7 +5105,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
case MOZ_WM_HSCROLL:
|
||||
case MOZ_WM_VSCROLL:
|
||||
*aRetValue = 0;
|
||||
OnScrollInternal(GetNativeMessage(msg), wParam, lParam);
|
||||
OnScrollInternal(WinUtils::GetNativeMessage(msg), wParam, lParam);
|
||||
// Doesn't need to call next wndproc for internal message.
|
||||
return true;
|
||||
|
||||
|
@ -5222,7 +5169,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
case WM_SETFOCUS:
|
||||
// If previous focused window isn't ours, it must have received the
|
||||
// redirected message. So, we should forget it.
|
||||
if (!IsOurProcessWindow(HWND(wParam))) {
|
||||
if (!WinUtils::IsOurProcessWindow(HWND(wParam))) {
|
||||
ForgetRedirectedKeyDownMessage();
|
||||
}
|
||||
if (sJustGotActivate) {
|
||||
|
@ -5337,7 +5284,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
case MOZ_WM_MOUSEVWHEEL:
|
||||
case MOZ_WM_MOUSEHWHEEL:
|
||||
{
|
||||
UINT nativeMessage = GetNativeMessage(msg);
|
||||
UINT nativeMessage = WinUtils::GetNativeMessage(msg);
|
||||
// If OnMouseWheel returns true, the event was forwarded directly to another
|
||||
// mozilla window message handler (ProcessMessage). In this case the return
|
||||
// value of the forwarded event is in 'result' which we should return immediately.
|
||||
|
@ -5880,7 +5827,7 @@ nsWindow::SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
|
|||
}
|
||||
::SetKeyboardState(kbdState);
|
||||
nsModifierKeyState modKeyState;
|
||||
MSG msg = InitMSG(WM_KEYDOWN, key, 0);
|
||||
MSG msg = WinUtils::InitMSG(WM_KEYDOWN, key, 0);
|
||||
if (i == keySequence.Length() - 1 && aCharacters.Length() > 0) {
|
||||
UINT scanCode = ::MapVirtualKeyEx(aNativeKeyCode, MAPVK_VK_TO_VSC,
|
||||
gKbdLayout.GetLayout());
|
||||
|
@ -5899,7 +5846,7 @@ nsWindow::SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
|
|||
}
|
||||
::SetKeyboardState(kbdState);
|
||||
nsModifierKeyState modKeyState;
|
||||
MSG msg = InitMSG(WM_KEYUP, key, 0);
|
||||
MSG msg = WinUtils::InitMSG(WM_KEYUP, key, 0);
|
||||
OnKeyUp(msg, modKeyState, nsnull);
|
||||
}
|
||||
|
||||
|
@ -5954,7 +5901,7 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS *wp, bool& result)
|
|||
return;
|
||||
|
||||
#ifdef WINSTATE_DEBUG_OUTPUT
|
||||
if (mWnd == GetTopLevelHWND(mWnd)) {
|
||||
if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) {
|
||||
PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("*** OnWindowPosChanged: [ top] "));
|
||||
} else {
|
||||
PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("*** OnWindowPosChanged: [child] "));
|
||||
|
@ -6206,7 +6153,7 @@ void nsWindow::OnWindowPosChanging(LPWINDOWPOS& info)
|
|||
event.mPlacement = nsWindowZTop;
|
||||
else {
|
||||
event.mPlacement = nsWindowZRelative;
|
||||
aboveWindow = GetNSWindowPtr(hwndAfter);
|
||||
aboveWindow = WinUtils::GetNSWindowPtr(hwndAfter);
|
||||
}
|
||||
event.mReqBelow = aboveWindow;
|
||||
event.mActualBelow = nsnull;
|
||||
|
@ -6356,17 +6303,6 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
|
|||
return true; // Handled
|
||||
}
|
||||
|
||||
PRUint16 nsWindow::GetMouseInputSource()
|
||||
{
|
||||
PRUint16 inputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
|
||||
LPARAM lParamExtraInfo = ::GetMessageExtraInfo();
|
||||
if ((lParamExtraInfo & TABLET_INK_SIGNATURE) == TABLET_INK_CHECK) {
|
||||
inputSource = (lParamExtraInfo & TABLET_INK_TOUCH) ?
|
||||
PRUint16(nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) : nsIDOMMouseEvent::MOZ_SOURCE_PEN;
|
||||
}
|
||||
return inputSource;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsWindow::InitMouseWheelScrollData()
|
||||
{
|
||||
|
@ -6664,7 +6600,8 @@ bool nsWindow::IsRedirectedKeyDownMessage(const MSG &aMsg)
|
|||
{
|
||||
return (aMsg.message == WM_KEYDOWN || aMsg.message == WM_SYSKEYDOWN) &&
|
||||
(sRedirectedKeyDown.message == aMsg.message &&
|
||||
GetScanCode(sRedirectedKeyDown.lParam) == GetScanCode(aMsg.lParam));
|
||||
WinUtils::GetScanCode(sRedirectedKeyDown.lParam) ==
|
||||
WinUtils::GetScanCode(aMsg.lParam));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6755,9 +6692,9 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
|
|||
INPUT keyinput;
|
||||
keyinput.type = INPUT_KEYBOARD;
|
||||
keyinput.ki.wVk = aMsg.wParam;
|
||||
keyinput.ki.wScan = GetScanCode(aMsg.lParam);
|
||||
keyinput.ki.wScan = WinUtils::GetScanCode(aMsg.lParam);
|
||||
keyinput.ki.dwFlags = KEYEVENTF_SCANCODE;
|
||||
if (IsExtendedScanCode(aMsg.lParam)) {
|
||||
if (WinUtils::IsExtendedScanCode(aMsg.lParam)) {
|
||||
keyinput.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||
}
|
||||
keyinput.ki.time = 0;
|
||||
|
@ -7492,105 +7429,6 @@ bool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool nsWindow::IsOurProcessWindow(HWND aHWND)
|
||||
{
|
||||
if (!aHWND) {
|
||||
return false;
|
||||
}
|
||||
DWORD processId = 0;
|
||||
::GetWindowThreadProcessId(aHWND, &processId);
|
||||
return processId == ::GetCurrentProcessId();
|
||||
}
|
||||
|
||||
/* static */
|
||||
HWND nsWindow::FindOurProcessWindow(HWND aHWND)
|
||||
{
|
||||
for (HWND wnd = ::GetParent(aHWND); wnd; wnd = ::GetParent(wnd)) {
|
||||
if (IsOurProcessWindow(wnd)) {
|
||||
return wnd;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
static bool PointInWindow(HWND aHWND, const POINT& aPoint)
|
||||
{
|
||||
RECT bounds;
|
||||
if (!::GetWindowRect(aHWND, &bounds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aPoint.x < bounds.left
|
||||
|| aPoint.x >= bounds.right
|
||||
|| aPoint.y < bounds.top
|
||||
|| aPoint.y >= bounds.bottom) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static HWND FindTopmostWindowAtPoint(HWND aHWND, const POINT& aPoint)
|
||||
{
|
||||
if (!::IsWindowVisible(aHWND) || !PointInWindow(aHWND, aPoint)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HWND childWnd = ::GetTopWindow(aHWND);
|
||||
while (childWnd) {
|
||||
HWND topmostWnd = FindTopmostWindowAtPoint(childWnd, aPoint);
|
||||
if (topmostWnd) {
|
||||
return topmostWnd;
|
||||
}
|
||||
childWnd = ::GetNextWindow(childWnd, GW_HWNDNEXT);
|
||||
}
|
||||
|
||||
return aHWND;
|
||||
}
|
||||
|
||||
struct FindOurWindowAtPointInfo
|
||||
{
|
||||
POINT mInPoint;
|
||||
HWND mOutHWND;
|
||||
};
|
||||
|
||||
/* static */
|
||||
BOOL CALLBACK nsWindow::FindOurWindowAtPointCallback(HWND aHWND, LPARAM aLPARAM)
|
||||
{
|
||||
if (!nsWindow::IsOurProcessWindow(aHWND)) {
|
||||
// This isn't one of our top-level windows; continue enumerating.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Get the top-most child window under the point. If there's no child
|
||||
// window, and the point is within the top-level window, then the top-level
|
||||
// window will be returned. (This is the usual case. A child window
|
||||
// would be returned for plugins.)
|
||||
FindOurWindowAtPointInfo* info = reinterpret_cast<FindOurWindowAtPointInfo*>(aLPARAM);
|
||||
HWND childWnd = FindTopmostWindowAtPoint(aHWND, info->mInPoint);
|
||||
if (!childWnd) {
|
||||
// This window doesn't contain the point; continue enumerating.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Return the HWND and stop enumerating.
|
||||
info->mOutHWND = childWnd;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* static */
|
||||
HWND nsWindow::FindOurWindowAtPoint(const POINT& aPoint)
|
||||
{
|
||||
FindOurWindowAtPointInfo info;
|
||||
info.mInPoint = aPoint;
|
||||
info.mOutHWND = 0;
|
||||
|
||||
// This will enumerate all top-level windows in order from top to bottom.
|
||||
EnumWindows(FindOurWindowAtPointCallback, reinterpret_cast<LPARAM>(&info));
|
||||
return info.mOutHWND;
|
||||
}
|
||||
|
||||
typedef DWORD (WINAPI *GetProcessImageFileNameProc)(HANDLE, LPWSTR, DWORD);
|
||||
|
||||
// Determine whether the given HWND is the handle for the Elantech helper
|
||||
|
@ -7632,42 +7470,6 @@ static bool IsElantechHelperWindow(HWND aHWND)
|
|||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
UINT
|
||||
nsWindow::GetInternalMessage(UINT aNativeMessage)
|
||||
{
|
||||
switch (aNativeMessage) {
|
||||
case WM_MOUSEWHEEL:
|
||||
return MOZ_WM_MOUSEVWHEEL;
|
||||
case WM_MOUSEHWHEEL:
|
||||
return MOZ_WM_MOUSEHWHEEL;
|
||||
case WM_VSCROLL:
|
||||
return MOZ_WM_VSCROLL;
|
||||
case WM_HSCROLL:
|
||||
return MOZ_WM_HSCROLL;
|
||||
default:
|
||||
return aNativeMessage;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
UINT
|
||||
nsWindow::GetNativeMessage(UINT aInternalMessage)
|
||||
{
|
||||
switch (aInternalMessage) {
|
||||
case MOZ_WM_MOUSEVWHEEL:
|
||||
return WM_MOUSEWHEEL;
|
||||
case MOZ_WM_MOUSEHWHEEL:
|
||||
return WM_MOUSEHWHEEL;
|
||||
case MOZ_WM_VSCROLL:
|
||||
return WM_VSCROLL;
|
||||
case MOZ_WM_HSCROLL:
|
||||
return WM_HSCROLL;
|
||||
default:
|
||||
return aInternalMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OnMouseWheel() is called when ProcessMessage() handles WM_MOUSEWHEEL,
|
||||
* WM_MOUSEHWHEEL and also OnScroll() tries to emulate mouse wheel action for
|
||||
|
@ -7721,7 +7523,7 @@ nsWindow::OnMouseWheel(UINT aMsg, WPARAM aWParam, LPARAM aLParam,
|
|||
// when sending a WM_MOUSEWHEEL event to us as part of a pinch-to-zoom
|
||||
// gesture. We detect that here, and search for our window that would
|
||||
// be beneath the cursor if that window wasn't there.
|
||||
underCursorWnd = FindOurWindowAtPoint(point);
|
||||
underCursorWnd = WinUtils::FindOurWindowAtPoint(point);
|
||||
if (!underCursorWnd) {
|
||||
return;
|
||||
}
|
||||
|
@ -7730,13 +7532,13 @@ nsWindow::OnMouseWheel(UINT aMsg, WPARAM aWParam, LPARAM aLParam,
|
|||
// Handle most cases first. If the window under mouse cursor is our window
|
||||
// except plugin window (MozillaWindowClass), we should handle the message
|
||||
// on the window.
|
||||
if (IsOurProcessWindow(underCursorWnd)) {
|
||||
nsWindow* destWindow = GetNSWindowPtr(underCursorWnd);
|
||||
if (WinUtils::IsOurProcessWindow(underCursorWnd)) {
|
||||
nsWindow* destWindow = WinUtils::GetNSWindowPtr(underCursorWnd);
|
||||
if (!destWindow) {
|
||||
NS_WARNING("We're not sure what cause this is.");
|
||||
HWND wnd = ::GetParent(underCursorWnd);
|
||||
for (; wnd; wnd = ::GetParent(wnd)) {
|
||||
destWindow = GetNSWindowPtr(wnd);
|
||||
destWindow = WinUtils::GetNSWindowPtr(wnd);
|
||||
if (destWindow) {
|
||||
break;
|
||||
}
|
||||
|
@ -7756,7 +7558,7 @@ nsWindow::OnMouseWheel(UINT aMsg, WPARAM aWParam, LPARAM aLParam,
|
|||
destWindow = destWindow->GetParentWindow(false);
|
||||
NS_ENSURE_TRUE(destWindow, );
|
||||
}
|
||||
UINT internalMessage = GetInternalMessage(aMsg);
|
||||
UINT internalMessage = WinUtils::GetInternalMessage(aMsg);
|
||||
::PostMessage(destWindow->mWnd, internalMessage, aWParam, aLParam);
|
||||
return;
|
||||
}
|
||||
|
@ -7764,7 +7566,7 @@ nsWindow::OnMouseWheel(UINT aMsg, WPARAM aWParam, LPARAM aLParam,
|
|||
// If the window under cursor is not in our process, it means:
|
||||
// 1. The window may be a plugin window (GeckoPluginWindow or its descendant).
|
||||
// 2. The window may be another application's window.
|
||||
HWND pluginWnd = FindOurProcessWindow(underCursorWnd);
|
||||
HWND pluginWnd = WinUtils::FindOurProcessWindow(underCursorWnd);
|
||||
if (!pluginWnd) {
|
||||
// If there is no plugin window in ancestors of the window under cursor,
|
||||
// the window is for another applications (case 2).
|
||||
|
@ -7780,7 +7582,7 @@ nsWindow::OnMouseWheel(UINT aMsg, WPARAM aWParam, LPARAM aLParam,
|
|||
if (mWindowType == eWindowType_plugin && pluginWnd == mWnd) {
|
||||
nsWindow* destWindow = GetParentWindow(false);
|
||||
NS_ENSURE_TRUE(destWindow, );
|
||||
UINT internalMessage = GetInternalMessage(aMsg);
|
||||
UINT internalMessage = WinUtils::GetInternalMessage(aMsg);
|
||||
::PostMessage(destWindow->mWnd, internalMessage, aWParam, aLParam);
|
||||
return;
|
||||
}
|
||||
|
@ -8185,7 +7987,7 @@ bool nsWindow::AssociateDefaultIMC(bool aAssociate)
|
|||
|
||||
#define NS_LOG_WMGETOBJECT_WND(aMsg, aHwnd) \
|
||||
{ \
|
||||
nsWindow* wnd = GetNSWindowPtr(aHwnd); \
|
||||
nsWindow* wnd = WinUtils::GetNSWindowPtr(aHwnd); \
|
||||
PR_LOG(gWindowsLog, PR_LOG_ALWAYS, \
|
||||
("Get " aMsg ":\n {\n HWND: %d, parent HWND: %d, wndobj: %p,\n", \
|
||||
aHwnd, ::GetParent(aHwnd), wnd)); \
|
||||
|
@ -8293,8 +8095,8 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode)
|
|||
return;
|
||||
|
||||
// stop on dialogs and popups!
|
||||
HWND hWnd = GetTopLevelHWND(mWnd, true);
|
||||
nsWindow* parent = GetNSWindowPtr(hWnd);
|
||||
HWND hWnd = WinUtils::GetTopLevelHWND(mWnd, true);
|
||||
nsWindow* parent = WinUtils::GetNSWindowPtr(hWnd);
|
||||
|
||||
if (!parent)
|
||||
{
|
||||
|
@ -8364,7 +8166,7 @@ nsresult nsWindow::UpdateTranslucentWindow()
|
|||
BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
|
||||
SIZE winSize = { mBounds.width, mBounds.height };
|
||||
POINT srcPos = { 0, 0 };
|
||||
HWND hWnd = GetTopLevelHWND(mWnd, true);
|
||||
HWND hWnd = WinUtils::GetTopLevelHWND(mWnd, true);
|
||||
RECT winRect;
|
||||
::GetWindowRect(hWnd, &winRect);
|
||||
|
||||
|
@ -8471,7 +8273,7 @@ LRESULT CALLBACK nsWindow::MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM l
|
|||
LRESULT CALLBACK nsWindow::MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (sProcessHook) {
|
||||
switch (GetNativeMessage(wParam)) {
|
||||
switch (WinUtils::GetNativeMessage(wParam)) {
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_MBUTTONDOWN:
|
||||
|
@ -8479,7 +8281,7 @@ LRESULT CALLBACK nsWindow::MozSpecialMouseProc(int code, WPARAM wParam, LPARAM l
|
|||
case WM_MOUSEHWHEEL:
|
||||
{
|
||||
MOUSEHOOKSTRUCT* ms = (MOUSEHOOKSTRUCT*)lParam;
|
||||
nsIWidget* mozWin = (nsIWidget*)GetNSWindowPtr(ms->hwnd);
|
||||
nsIWidget* mozWin = WinUtils::GetNSWindowPtr(ms->hwnd);
|
||||
if (mozWin) {
|
||||
// If this window is windowed plugin window, the mouse events are not
|
||||
// sent to us.
|
||||
|
@ -8622,7 +8424,7 @@ VOID CALLBACK nsWindow::HookTimerForPopups(HWND hwnd, UINT uMsg, UINT idEvent, D
|
|||
|
||||
BOOL CALLBACK nsWindow::ClearResourcesCallback(HWND aWnd, LPARAM aMsg)
|
||||
{
|
||||
nsWindow *window = nsWindow::GetNSWindowPtr(aWnd);
|
||||
nsWindow *window = WinUtils::GetNSWindowPtr(aWnd);
|
||||
if (window) {
|
||||
window->ClearCachedResources();
|
||||
}
|
||||
|
@ -8673,7 +8475,7 @@ nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLPara
|
|||
{
|
||||
if (sRollupListener && sRollupWidget && ::IsWindowVisible(inWnd)) {
|
||||
|
||||
inMsg = GetNativeMessage(inMsg);
|
||||
inMsg = WinUtils::GetNativeMessage(inMsg);
|
||||
if (inMsg == WM_LBUTTONDOWN || inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN ||
|
||||
inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL || inMsg == WM_ACTIVATE ||
|
||||
(inMsg == WM_KILLFOCUS && IsDifferentThreadWindow((HWND)inWParam)) ||
|
||||
|
@ -8770,7 +8572,7 @@ nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLPara
|
|||
|
||||
// However, don't activate panels
|
||||
if (inMsg == WM_MOUSEACTIVATE) {
|
||||
nsWindow* activateWindow = GetNSWindowPtr(inWnd);
|
||||
nsWindow* activateWindow = WinUtils::GetNSWindowPtr(inWnd);
|
||||
if (activateWindow) {
|
||||
nsWindowType wintype;
|
||||
activateWindow->GetWindowType(wintype);
|
||||
|
@ -8814,27 +8616,10 @@ nsModifierKeyState::nsModifierKeyState()
|
|||
}
|
||||
|
||||
|
||||
PRInt32 nsWindow::GetWindowsVersion()
|
||||
{
|
||||
static PRInt32 version = 0;
|
||||
static bool didCheck = false;
|
||||
|
||||
if (!didCheck)
|
||||
{
|
||||
didCheck = true;
|
||||
OSVERSIONINFOEX osInfo;
|
||||
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
// This cast is safe and supposed to be here, don't worry
|
||||
::GetVersionEx((OSVERSIONINFO*)&osInfo);
|
||||
version = (osInfo.dwMajorVersion & 0xff) << 8 | (osInfo.dwMinorVersion & 0xff);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
// Note that the result of GetTopLevelWindow method can be different from the
|
||||
// result of GetTopLevelHWND method. The result can be non-floating window.
|
||||
// Because our top level window may be contained in another window which is
|
||||
// not managed by us.
|
||||
// result of WinUtils::GetTopLevelHWND(). The result can be non-floating
|
||||
// window. Because our top level window may be contained in another window
|
||||
// which is not managed by us.
|
||||
nsWindow* nsWindow::GetTopLevelWindow(bool aStopOnDialogOrPopup)
|
||||
{
|
||||
nsWindow* curWindow = this;
|
||||
|
@ -8860,43 +8645,6 @@ nsWindow* nsWindow::GetTopLevelWindow(bool aStopOnDialogOrPopup)
|
|||
}
|
||||
}
|
||||
|
||||
// Note that the result of GetTopLevelHWND can be different from the result
|
||||
// of GetTopLevelWindow method. Because this is checking whether the window
|
||||
// is top level only in Win32 window system. Therefore, the result window
|
||||
// may not be managed by us.
|
||||
HWND nsWindow::GetTopLevelHWND(HWND aWnd,
|
||||
bool aStopIfNotChild,
|
||||
bool aStopIfNotPopup)
|
||||
{
|
||||
HWND curWnd = aWnd;
|
||||
HWND topWnd = NULL;
|
||||
HWND upWnd = NULL;
|
||||
|
||||
while (curWnd) {
|
||||
topWnd = curWnd;
|
||||
|
||||
if (aStopIfNotChild) {
|
||||
DWORD_PTR style = ::GetWindowLongPtrW(curWnd, GWL_STYLE);
|
||||
|
||||
VERIFY_WINDOW_STYLE(style);
|
||||
|
||||
if (!(style & WS_CHILD)) // first top-level window
|
||||
break;
|
||||
}
|
||||
|
||||
upWnd = ::GetParent(curWnd); // Parent or owner (if has no parent)
|
||||
|
||||
// GetParent will only return the owner if the passed in window
|
||||
// has the WS_POPUP style.
|
||||
if (!upWnd && !aStopIfNotPopup) {
|
||||
upWnd = ::GetWindow(curWnd, GW_OWNER);
|
||||
}
|
||||
curWnd = upWnd;
|
||||
}
|
||||
|
||||
return topWnd;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK gEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
DWORD pid;
|
||||
|
@ -8989,51 +8737,11 @@ HasRegistryKey(HKEY aRoot, PRUnichar* aName)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of a string-typed registry value.
|
||||
*
|
||||
* @param aRoot The registry root to search in.
|
||||
* @param aKeyName The name of the registry key to open.
|
||||
* @param aValueName The name of the registry value in the specified key whose
|
||||
* value is to be retrieved. Can be null, to retrieve the key's unnamed/
|
||||
* default value.
|
||||
* @param aBuffer The buffer into which to store the string value. Can be null,
|
||||
* in which case the return value indicates just whether the value exists.
|
||||
* @param aBufferLength The size of aBuffer, in bytes.
|
||||
* @return Whether the value exists and is a string.
|
||||
*/
|
||||
bool
|
||||
nsWindow::GetRegistryKey(HKEY aRoot,
|
||||
const PRUnichar* aKeyName,
|
||||
const PRUnichar* aValueName,
|
||||
PRUnichar* aBuffer,
|
||||
DWORD aBufferLength)
|
||||
{
|
||||
if (!aKeyName)
|
||||
return false;
|
||||
|
||||
HKEY key;
|
||||
LONG result = ::RegOpenKeyExW(aRoot, aKeyName, NULL, KEY_READ | KEY_WOW64_32KEY, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
result = ::RegOpenKeyExW(aRoot, aKeyName, NULL, KEY_READ | KEY_WOW64_64KEY, &key);
|
||||
if (result != ERROR_SUCCESS)
|
||||
return false;
|
||||
}
|
||||
DWORD type;
|
||||
result = ::RegQueryValueExW(key, aValueName, NULL, &type, (BYTE*) aBuffer, &aBufferLength);
|
||||
::RegCloseKey(key);
|
||||
if (result != ERROR_SUCCESS || type != REG_SZ)
|
||||
return false;
|
||||
if (aBuffer)
|
||||
aBuffer[aBufferLength / sizeof(*aBuffer) - 1] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsObsoleteSynapticsDriver()
|
||||
{
|
||||
PRUnichar buf[40];
|
||||
bool foundKey = nsWindow::GetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
bool foundKey = WinUtils::GetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
L"Software\\Synaptics\\SynTP\\Install",
|
||||
L"DriverVersion",
|
||||
buf,
|
||||
|
@ -9055,13 +8763,13 @@ GetElantechDriverMajorVersion()
|
|||
{
|
||||
PRUnichar buf[40];
|
||||
// The driver version is found in one of these two registry keys.
|
||||
bool foundKey = nsWindow::GetRegistryKey(HKEY_CURRENT_USER,
|
||||
bool foundKey = WinUtils::GetRegistryKey(HKEY_CURRENT_USER,
|
||||
L"Software\\Elantech\\MainOption",
|
||||
L"DriverVersion",
|
||||
buf,
|
||||
sizeof buf);
|
||||
if (!foundKey)
|
||||
foundKey = nsWindow::GetRegistryKey(HKEY_CURRENT_USER,
|
||||
foundKey = WinUtils::GetRegistryKey(HKEY_CURRENT_USER,
|
||||
L"Software\\Elantech",
|
||||
L"DriverVersion",
|
||||
buf,
|
||||
|
|
|
@ -199,16 +199,6 @@ public:
|
|||
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
|
||||
void SetDrawsInTitlebar(bool aState);
|
||||
|
||||
/**
|
||||
* Statics used in other classes
|
||||
*/
|
||||
static PRInt32 GetWindowsVersion();
|
||||
static bool GetRegistryKey(HKEY aRoot,
|
||||
const PRUnichar* aKeyName,
|
||||
const PRUnichar* aValueName,
|
||||
PRUnichar* aBuffer,
|
||||
DWORD aBufferLength);
|
||||
|
||||
/**
|
||||
* Event helpers
|
||||
*/
|
||||
|
@ -242,12 +232,8 @@ public:
|
|||
* Window utilities
|
||||
*/
|
||||
nsWindow* GetTopLevelWindow(bool aStopOnDialogOrPopup);
|
||||
static HWND GetTopLevelHWND(HWND aWnd,
|
||||
bool aStopIfNotChild = false,
|
||||
bool aStopIfNotPopup = true);
|
||||
HWND GetWindowHandle() { return mWnd; }
|
||||
WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
|
||||
static nsWindow* GetNSWindowPtr(HWND aWnd);
|
||||
WindowHook& GetWindowHook() { return mWindowHook; }
|
||||
nsWindow* GetParentWindow(bool aIncludeOwner);
|
||||
// Get an array of all nsWindow*s on the main thread.
|
||||
|
@ -337,13 +323,10 @@ protected:
|
|||
static BOOL CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam);
|
||||
static void AllowD3D9Callback(nsWindow *aWindow);
|
||||
static void AllowD3D9WithReinitializeCallback(nsWindow *aWindow);
|
||||
static BOOL CALLBACK FindOurWindowAtPointCallback(HWND aHWND, LPARAM aLPARAM);
|
||||
|
||||
/**
|
||||
* Window utilities
|
||||
*/
|
||||
static BOOL SetNSWindowPtr(HWND aWnd, nsWindow * ptr);
|
||||
static PRInt32 GetMonitorCount();
|
||||
LPARAM lParamToScreen(LPARAM lParam);
|
||||
LPARAM lParamToClient(LPARAM lParam);
|
||||
virtual void SubclassWindow(BOOL bState);
|
||||
|
@ -362,9 +345,6 @@ protected:
|
|||
return mTransparencyMode == eTransparencyGlass ||
|
||||
mTransparencyMode == eTransparencyBorderlessGlass;
|
||||
}
|
||||
static bool IsOurProcessWindow(HWND aHWND);
|
||||
static HWND FindOurProcessWindow(HWND aHWND);
|
||||
static HWND FindOurWindowAtPoint(const POINT& aPoint);
|
||||
|
||||
/**
|
||||
* Event processing helpers
|
||||
|
@ -379,7 +359,6 @@ protected:
|
|||
void RemoveMessageAndDispatchPluginEvent(UINT aFirstMsg,
|
||||
UINT aLastMsg,
|
||||
nsFakeCharMessage* aFakeCharMessage = nsnull);
|
||||
static MSG InitMSG(UINT aMessage, WPARAM wParam, LPARAM lParam);
|
||||
virtual bool ProcessMessage(UINT msg, WPARAM &wParam,
|
||||
LPARAM &lParam, LRESULT *aRetValue);
|
||||
bool ProcessMessageForPlugin(const MSG &aMsg,
|
||||
|
@ -395,14 +374,6 @@ protected:
|
|||
static bool ConvertStatus(nsEventStatus aStatus);
|
||||
static void PostSleepWakeNotification(const bool aIsSleepMode);
|
||||
PRInt32 ClientMarginHitTestPoint(PRInt32 mx, PRInt32 my);
|
||||
static WORD GetScanCode(LPARAM aLParam)
|
||||
{
|
||||
return (aLParam >> 16) & 0xFF;
|
||||
}
|
||||
static bool IsExtendedScanCode(LPARAM aLParam)
|
||||
{
|
||||
return (aLParam & 0x1000000) != 0;
|
||||
}
|
||||
static bool IsRedirectedKeyDownMessage(const MSG &aMsg);
|
||||
static void ForgetRedirectedKeyDownMessage()
|
||||
{
|
||||
|
@ -442,8 +413,6 @@ protected:
|
|||
BOOL OnInputLangChange(HKL aHKL);
|
||||
bool OnPaint(HDC aDC, PRUint32 aNestingLevel);
|
||||
void OnWindowPosChanged(WINDOWPOS *wp, bool& aResult);
|
||||
static UINT GetInternalMessage(UINT aNativeMessage);
|
||||
static UINT GetNativeMessage(UINT aInternalMessage);
|
||||
void OnMouseWheel(UINT aMsg, WPARAM aWParam,
|
||||
LPARAM aLParam, LRESULT *aRetValue);
|
||||
void OnMouseWheelInternal(UINT aMessage, WPARAM aWParam,
|
||||
|
@ -511,7 +480,6 @@ protected:
|
|||
nsIntRegion GetRegionToPaint(bool aForceFullRepaint,
|
||||
PAINTSTRUCT ps, HDC aDC);
|
||||
static void ActivateOtherWindowHelper(HWND aWnd);
|
||||
static PRUint16 GetMouseInputSource();
|
||||
#ifdef ACCESSIBILITY
|
||||
static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
|
||||
#endif // ACCESSIBILITY
|
||||
|
|
|
@ -68,13 +68,6 @@
|
|||
// systems, and when the screen resolution changes.
|
||||
#define MOZ_WM_ENSUREVISIBLE (WM_APP + 14159)
|
||||
|
||||
// GetWindowsVersion constants
|
||||
#define WIN2K_VERSION 0x500
|
||||
#define WINXP_VERSION 0x501
|
||||
#define WIN2K3_VERSION 0x502
|
||||
#define VISTA_VERSION 0x600
|
||||
#define WIN7_VERSION 0x601
|
||||
|
||||
#ifndef WM_THEMECHANGED
|
||||
#define WM_THEMECHANGED 0x031A
|
||||
#endif
|
||||
|
@ -186,7 +179,7 @@
|
|||
#define TABLET_INK_SIGNATURE 0xFFFFFF00
|
||||
#define TABLET_INK_CHECK 0xFF515700
|
||||
#define TABLET_INK_TOUCH 0x00000080
|
||||
#define MOUSE_INPUT_SOURCE() GetMouseInputSource()
|
||||
#define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource()
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
|
|
|
@ -65,6 +65,7 @@ using mozilla::plugins::PluginInstanceParent;
|
|||
#include "gfxContext.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "prmem.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include "LayerManagerOGL.h"
|
||||
#include "BasicLayers.h"
|
||||
|
@ -84,6 +85,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
/**************************************************************
|
||||
**************************************************************
|
||||
|
@ -761,7 +763,7 @@ bool nsWindowGfx::IsCursorTranslucencySupported()
|
|||
if (!didCheck) {
|
||||
didCheck = true;
|
||||
// Cursor translucency is supported on Windows XP and newer
|
||||
isSupported = nsWindow::GetWindowsVersion() >= 0x501;
|
||||
isSupported = WinUtils::GetWindowsVersion() >= WinUtils::WINXP_VERSION;
|
||||
}
|
||||
|
||||
return isSupported;
|
||||
|
|
Загрузка…
Ссылка в новой задаче