mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 891316 part.1 Make widget::MSGResult struct and use it in nsWindow r=jimm
This commit is contained in:
parent
ec8a83979e
commit
2a1bb2dffa
@ -4422,37 +4422,53 @@ static bool CleartypeSettingChanged()
|
||||
return true;
|
||||
}
|
||||
|
||||
// The main windows message processing method.
|
||||
bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
||||
LRESULT *aRetValue)
|
||||
bool
|
||||
nsWindow::ExternalHandlerProcessMessage(UINT aMessage,
|
||||
WPARAM& aWParam,
|
||||
LPARAM& aLParam,
|
||||
MSGResult& aResult)
|
||||
{
|
||||
// (Large blocks of code should be broken out into OnEvent handlers.)
|
||||
if (mWindowHook.Notify(mWnd, msg, wParam, lParam, aRetValue))
|
||||
if (mWindowHook.Notify(mWnd, aMessage, aWParam, aLParam, &aResult.mResult)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IMEHandler::ProcessMessage(this, aMessage, aWParam, aLParam,
|
||||
&aResult.mResult, aResult.mConsumed)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (MouseScrollHandler::ProcessMessage(this, aMessage, aWParam, aLParam,
|
||||
&aResult.mResult, aResult.mConsumed)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PluginHasFocus()) {
|
||||
bool callDefaultWndProc;
|
||||
MSG nativeMsg = WinUtils::InitMSG(aMessage, aWParam, aLParam, mWnd);
|
||||
if (ProcessMessageForPlugin(nativeMsg, &aResult.mResult,
|
||||
callDefaultWndProc)) {
|
||||
aResult.mConsumed = !callDefaultWndProc;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// The main windows message processing method.
|
||||
bool
|
||||
nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||
LRESULT *aRetValue)
|
||||
{
|
||||
#if defined(EVENT_DEBUG_OUTPUT)
|
||||
// First param shows all events, second param indicates whether
|
||||
// to show mouse move events. See nsWindowDbg for details.
|
||||
PrintEvent(msg, SHOW_REPEAT_EVENTS, SHOW_MOUSEMOVE_EVENTS);
|
||||
#endif
|
||||
|
||||
bool eatMessage;
|
||||
if (IMEHandler::ProcessMessage(this, msg, wParam, lParam, aRetValue,
|
||||
eatMessage)) {
|
||||
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, mWnd);
|
||||
if (ProcessMessageForPlugin(nativeMsg, aRetValue, callDefaultWndProc)) {
|
||||
return mWnd ? !callDefaultWndProc : true;
|
||||
}
|
||||
MSGResult msgResult(aRetValue);
|
||||
if (ExternalHandlerProcessMessage(msg, wParam, lParam, msgResult)) {
|
||||
return (msgResult.mConsumed || !mWnd);
|
||||
}
|
||||
|
||||
bool result = false; // call the default nsWindow proc
|
||||
@ -4467,6 +4483,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
||||
return true;
|
||||
}
|
||||
|
||||
// (Large blocks of code should be broken out into OnEvent handlers.)
|
||||
switch (msg) {
|
||||
// WM_QUERYENDSESSION must be handled by all windows.
|
||||
// Otherwise Windows thinks the window can just be killed at will.
|
||||
|
@ -58,6 +58,7 @@ namespace mozilla {
|
||||
namespace widget {
|
||||
class NativeKey;
|
||||
class ModifierKeyState;
|
||||
struct MSGResult;
|
||||
} // namespace widget
|
||||
} // namespacw mozilla;
|
||||
|
||||
@ -72,6 +73,7 @@ class nsWindow : public nsWindowBase
|
||||
typedef mozilla::widget::WindowHook WindowHook;
|
||||
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
||||
typedef mozilla::widget::NativeKey NativeKey;
|
||||
typedef mozilla::widget::MSGResult MSGResult;
|
||||
public:
|
||||
nsWindow();
|
||||
virtual ~nsWindow();
|
||||
@ -328,6 +330,9 @@ protected:
|
||||
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
|
||||
virtual bool ProcessMessage(UINT msg, WPARAM &wParam,
|
||||
LPARAM &lParam, LRESULT *aRetValue);
|
||||
bool ExternalHandlerProcessMessage(
|
||||
UINT aMessage, WPARAM& aWParam,
|
||||
LPARAM& aLParam, MSGResult& aResult);
|
||||
bool ProcessMessageForPlugin(const MSG &aMsg,
|
||||
LRESULT *aRetValue, bool &aCallDefWndProc);
|
||||
LRESULT ProcessCharMessage(const MSG &aMsg,
|
||||
|
@ -221,6 +221,28 @@ struct TITLEBARINFOEX
|
||||
};
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
struct MSGResult
|
||||
{
|
||||
// Result for the message.
|
||||
LRESULT& mResult;
|
||||
// If mConsumed is true, the caller shouldn't call next wndproc.
|
||||
bool mConsumed;
|
||||
|
||||
MSGResult(LRESULT* aResult = nullptr) :
|
||||
mResult(aResult ? *aResult : mDefaultResult), mConsumed(false)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
LRESULT mDefaultResult;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* SECTION: macros
|
||||
|
Loading…
Reference in New Issue
Block a user