Bug 672175 part.1 Implement MouseScrollHandler for Windows r=jimm

This commit is contained in:
Masayuki Nakano 2012-03-06 12:20:28 +09:00
Родитель fb07fe8847
Коммит 6b2ac6869b
5 изменённых файлов: 141 добавлений и 8 удалений

Просмотреть файл

@ -79,6 +79,7 @@ CPPSRCS = \
AudioSession.cpp \
nsWidgetFactory.cpp \
WinUtils.cpp \
WinMouseScrollHandler.cpp \
$(NULL)
ifdef MOZ_CRASHREPORTER

Просмотреть файл

@ -0,0 +1,85 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif // MOZ_LOGGING
#include "prlog.h"
#include "WinMouseScrollHandler.h"
#include "nsWindow.h"
namespace mozilla {
namespace widget {
#ifdef PR_LOGGING
PRLogModuleInfo* gMouseScrollLog = nsnull;
#endif
MouseScrollHandler* MouseScrollHandler::sInstance = nsnull;
/******************************************************************************
*
* MouseScrollHandler
*
******************************************************************************/
/* static */
void
MouseScrollHandler::Initialize()
{
#ifdef PR_LOGGING
if (!gMouseScrollLog) {
gMouseScrollLog = PR_NewLogModule("MouseScrollHandlerWidgets");
}
#endif
}
/* static */
void
MouseScrollHandler::Shutdown()
{
delete sInstance;
sInstance = nsnull;
}
/* static */
MouseScrollHandler*
MouseScrollHandler::GetInstance()
{
if (!sInstance) {
sInstance = new MouseScrollHandler();
}
return sInstance;
}
MouseScrollHandler::MouseScrollHandler()
{
PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
("MouseScroll: Creating an instance, this=%p, sInstance=%p",
this, sInstance));
}
MouseScrollHandler::~MouseScrollHandler()
{
PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
("MouseScroll: Destroying an instance, this=%p, sInstance=%p",
this, sInstance));
}
/* static */
bool
MouseScrollHandler::ProcessMessage(nsWindow* aWindow, UINT msg,
WPARAM wParam, LPARAM lParam,
LRESULT *aRetValue, bool &aEatMessage)
{
return false;
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,44 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_widget_WinMouseScrollHandler_h__
#define mozilla_widget_WinMouseScrollHandler_h__
#include "nscore.h"
#include "nsDebug.h"
#include "mozilla/Assertions.h"
#include <windows.h>
class nsWindow;
namespace mozilla {
namespace widget {
class MouseScrollHandler {
public:
static MouseScrollHandler* GetInstance();
static void Initialize();
static void Shutdown();
static bool ProcessMessage(nsWindow* aWindow,
UINT msg,
WPARAM wParam,
LPARAM lParam,
LRESULT *aRetValue,
bool &aEatMessage);
private:
MouseScrollHandler();
~MouseScrollHandler();
static MouseScrollHandler* sInstance;
};
} // namespace widget
} // namespace mozilla
#endif // mozilla_widget_WinMouseScrollHandler_h__

Просмотреть файл

@ -53,6 +53,7 @@
#include "nsScreenManagerWin.h"
#include "nsSound.h"
#include "nsWindow.h"
#include "WinMouseScrollHandler.h"
#include "WinTaskbar.h"
#include "JumpListBuilder.h"
#include "JumpListItem.h"
@ -209,6 +210,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
static void
nsWidgetWindowsModuleDtor()
{
MouseScrollHandler::Shutdown();
nsLookAndFeel::Shutdown();
nsToolkit::Shutdown();
nsAppShellShutdown();

Просмотреть файл

@ -133,6 +133,7 @@
#include "nsIServiceManager.h"
#include "nsIClipboard.h"
#include "nsIMM32Handler.h"
#include "WinMouseScrollHandler.h"
#include "nsILocalFile.h"
#include "nsFontMetrics.h"
#include "nsIFontEnumerator.h"
@ -427,27 +428,22 @@ nsWindow::nsWindow() : nsBaseWidget()
// Global app registration id for Win7 and up. See
// WinTaskbar.cpp for details.
mozilla::widget::WinTaskbar::RegisterAppUserModelID();
gKbdLayout.LoadLayout(::GetKeyboardLayout(0));
// Init IME handler
nsIMM32Handler::Initialize();
#ifdef NS_ENABLE_TSF
nsTextStore::Initialize();
#endif
if (SUCCEEDED(::OleInitialize(NULL)))
if (SUCCEEDED(::OleInitialize(NULL))) {
sIsOleInitialized = TRUE;
}
NS_ASSERTION(sIsOleInitialized, "***** OLE is not initialized!\n");
InitInputWorkaroundPrefDefaults();
MouseScrollHandler::Initialize();
// Init titlebar button info for custom frames.
nsUXThemeData::InitTitlebarInfo();
// Init theme data
nsUXThemeData::UpdateNativeThemeInfo();
ForgetRedirectedKeyDownMessage();
} // !sInstanceCount
@ -4528,6 +4524,11 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
return mWnd ? eatMessage : true;
}
if (MouseScrollHandler::ProcessMessage(this, msg, wParam, lParam, aRetValue,
eatMessage)) {
return mWnd ? eatMessage : true;
}
if (PluginHasFocus()) {
bool callDefaultWndProc;
MSG nativeMsg = WinUtils::InitMSG(msg, wParam, lParam);