backout 82937be94f94 due to bustage.
backout 82937be94f94 due to bustage.
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -3690,16 +3690,80 @@ bool nsWindow::DispatchWindowEvent(Widge
bool nsWindow::DispatchWindowEvent(WidgetGUIEvent* event,
nsEventStatus& aStatus)
{
DispatchEvent(event, aStatus);
return ConvertStatus(aStatus);
}
+bool nsWindow::DispatchCommandEvent(uint32_t aEventCommand)
+{
+ nsCOMPtr<nsIAtom> command;
+ switch (aEventCommand) {
+ case APPCOMMAND_BROWSER_BACKWARD:
+ command = nsGkAtoms::Back;
+ break;
+ case APPCOMMAND_BROWSER_FORWARD:
+ command = nsGkAtoms::Forward;
+ break;
+ case APPCOMMAND_BROWSER_REFRESH:
+ command = nsGkAtoms::Reload;
+ break;
+ case APPCOMMAND_BROWSER_STOP:
+ command = nsGkAtoms::Stop;
+ break;
+ case APPCOMMAND_BROWSER_SEARCH:
+ command = nsGkAtoms::Search;
+ break;
+ case APPCOMMAND_BROWSER_FAVORITES:
+ command = nsGkAtoms::Bookmarks;
+ break;
+ case APPCOMMAND_BROWSER_HOME:
+ command = nsGkAtoms::Home;
+ break;
+ case APPCOMMAND_CLOSE:
+ command = nsGkAtoms::Close;
+ break;
+ case APPCOMMAND_FIND:
+ command = nsGkAtoms::Find;
+ break;
+ case APPCOMMAND_HELP:
+ command = nsGkAtoms::Help;
+ break;
+ case APPCOMMAND_NEW:
+ command = nsGkAtoms::New;
+ break;
+ case APPCOMMAND_OPEN:
+ command = nsGkAtoms::Open;
+ break;
+ case APPCOMMAND_PRINT:
+ command = nsGkAtoms::Print;
+ break;
+ case APPCOMMAND_SAVE:
+ command = nsGkAtoms::Save;
+ break;
+ case APPCOMMAND_FORWARD_MAIL:
+ command = nsGkAtoms::ForwardMail;
+ break;
+ case APPCOMMAND_REPLY_TO_MAIL:
+ command = nsGkAtoms::ReplyToMail;
+ break;
+ case APPCOMMAND_SEND_MAIL:
+ command = nsGkAtoms::SendMail;
+ break;
+ default:
+ return false;
+ }
+ WidgetCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
+
+ InitEvent(event);
+ return DispatchWindowEvent(&event);
+}
+
// Recursively dispatch synchronous paints for nsIWidget
// descendants with invalidated rectangles.
BOOL CALLBACK nsWindow::DispatchStarvedPaints(HWND aWnd, LPARAM aMsg)
{
LONG_PTR proc = ::GetWindowLongPtrW(aWnd, GWLP_WNDPROC);
if (proc == (LONG_PTR)&nsWindow::WindowProc) {
// its one of our windows so check to see if it has a
// invalidated rect. If it does. Dispatch a synchronous
@@ -5020,18 +5084,79 @@ nsWindow::ProcessMessage(UINT msg, WPARA
result =
DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam),
false, WidgetMouseEvent::eLeftButton,
MOUSE_INPUT_SOURCE());
DispatchPendingEvents();
break;
case WM_APPCOMMAND:
- result = HandleAppCommandMsg(wParam, lParam, aRetValue);
- break;
+ {
+ uint32_t appCommand = GET_APPCOMMAND_LPARAM(lParam);
+ uint32_t contentCommandMessage = NS_EVENT_NULL;
+ // XXX After we implement KeyboardEvent.key, we should dispatch the
+ // key event if (GET_DEVICE_LPARAM(lParam) == FAPPCOMMAND_KEY) is.
+ switch (appCommand)
+ {
+ case APPCOMMAND_BROWSER_BACKWARD:
+ case APPCOMMAND_BROWSER_FORWARD:
+ case APPCOMMAND_BROWSER_REFRESH:
+ case APPCOMMAND_BROWSER_STOP:
+ case APPCOMMAND_BROWSER_SEARCH:
+ case APPCOMMAND_BROWSER_FAVORITES:
+ case APPCOMMAND_BROWSER_HOME:
+ case APPCOMMAND_CLOSE:
+ case APPCOMMAND_FIND:
+ case APPCOMMAND_HELP:
+ case APPCOMMAND_NEW:
+ case APPCOMMAND_OPEN:
+ case APPCOMMAND_PRINT:
+ case APPCOMMAND_SAVE:
+ case APPCOMMAND_FORWARD_MAIL:
+ case APPCOMMAND_REPLY_TO_MAIL:
+ case APPCOMMAND_SEND_MAIL:
+ // We shouldn't consume the message always because if we don't handle
+ // the message, the sender (typically, utility of keyboard or mouse)
+ // may send other key messages which indicate well known shortcut key.
+ if (DispatchCommandEvent(appCommand)) {
+ // tell the driver that we handled the event
+ *aRetValue = 1;
+ result = true;
+ }
+ break;
+
+ // Use content command for following commands:
+ case APPCOMMAND_COPY:
+ contentCommandMessage = NS_CONTENT_COMMAND_COPY;
+ break;
+ case APPCOMMAND_CUT:
+ contentCommandMessage = NS_CONTENT_COMMAND_CUT;
+ break;
+ case APPCOMMAND_PASTE:
+ contentCommandMessage = NS_CONTENT_COMMAND_PASTE;
+ break;
+ case APPCOMMAND_REDO:
+ contentCommandMessage = NS_CONTENT_COMMAND_REDO;
+ break;
+ case APPCOMMAND_UNDO:
+ contentCommandMessage = NS_CONTENT_COMMAND_UNDO;
+ break;
+ }
+
+ if (contentCommandMessage) {
+ WidgetContentCommandEvent contentCommand(true, contentCommandMessage,
+ this);
+ DispatchWindowEvent(&contentCommand);
+ // tell the driver that we handled the event
+ *aRetValue = 1;
+ result = true;
+ }
+ // default = false - tell the driver that the event was not handled
+ }
+ break;
// The WM_ACTIVATE event is fired when a window is raised or lowered,
// and the loword of wParam specifies which. But we don't want to tell
// the focus system about this until the WM_SETFOCUS or WM_KILLFOCUS
// events are fired. Instead, set either the sJustGotActivate or
// gJustGotDeactivate flags and activate/deactivate once the focus
// events arrive.
case WM_ACTIVATE:
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -352,16 +352,17 @@ protected:
}
/**
* Event processing helpers
*/
void DispatchFocusToTopLevelWindow(bool aIsActivate);
bool DispatchStandardEvent(uint32_t aMsg);
+ bool DispatchCommandEvent(uint32_t aEventCommand);
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,
MSGResult& aResult);
--- a/widget/windows/nsWindowBase.cpp
+++ b/widget/windows/nsWindowBase.cpp
@@ -189,141 +189,9 @@ nsWindowBase::ClearNativeTouchSequence()
// cancel all input points
mActivePointers.Enumerate(CancelTouchPoints, (void*)this);
nsBaseWidget::ClearNativeTouchSequence();
return NS_OK;
}
-bool
-nsWindowBase::DispatchCommandEvent(uint32_t aEventCommand)
-{
- nsCOMPtr<nsIAtom> command;
- switch (aEventCommand) {
- case APPCOMMAND_BROWSER_BACKWARD:
- command = nsGkAtoms::Back;
- break;
- case APPCOMMAND_BROWSER_FORWARD:
- command = nsGkAtoms::Forward;
- break;
- case APPCOMMAND_BROWSER_REFRESH:
- command = nsGkAtoms::Reload;
- break;
- case APPCOMMAND_BROWSER_STOP:
- command = nsGkAtoms::Stop;
- break;
- case APPCOMMAND_BROWSER_SEARCH:
- command = nsGkAtoms::Search;
- break;
- case APPCOMMAND_BROWSER_FAVORITES:
- command = nsGkAtoms::Bookmarks;
- break;
- case APPCOMMAND_BROWSER_HOME:
- command = nsGkAtoms::Home;
- break;
- case APPCOMMAND_CLOSE:
- command = nsGkAtoms::Close;
- break;
- case APPCOMMAND_FIND:
- command = nsGkAtoms::Find;
- break;
- case APPCOMMAND_HELP:
- command = nsGkAtoms::Help;
- break;
- case APPCOMMAND_NEW:
- command = nsGkAtoms::New;
- break;
- case APPCOMMAND_OPEN:
- command = nsGkAtoms::Open;
- break;
- case APPCOMMAND_PRINT:
- command = nsGkAtoms::Print;
- break;
- case APPCOMMAND_SAVE:
- command = nsGkAtoms::Save;
- break;
- case APPCOMMAND_FORWARD_MAIL:
- command = nsGkAtoms::ForwardMail;
- break;
- case APPCOMMAND_REPLY_TO_MAIL:
- command = nsGkAtoms::ReplyToMail;
- break;
- case APPCOMMAND_SEND_MAIL:
- command = nsGkAtoms::SendMail;
- break;
- default:
- return false;
- }
- WidgetCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
- InitEvent(event);
- return DispatchWindowEvent(&event);
-}
-
-bool
-nsWindowBase::HandleAppCommandMsg(WPARAM aWParam,
- LPARAM aLParam,
- LRESULT *aRetValue)
-{
- uint32_t appCommand = GET_APPCOMMAND_LPARAM(aLParam);
- uint32_t contentCommandMessage = NS_EVENT_NULL;
- // XXX After we implement KeyboardEvent.key, we should dispatch the
- // key event if (GET_DEVICE_LPARAM(lParam) == FAPPCOMMAND_KEY) is.
- switch (appCommand)
- {
- case APPCOMMAND_BROWSER_BACKWARD:
- case APPCOMMAND_BROWSER_FORWARD:
- case APPCOMMAND_BROWSER_REFRESH:
- case APPCOMMAND_BROWSER_STOP:
- case APPCOMMAND_BROWSER_SEARCH:
- case APPCOMMAND_BROWSER_FAVORITES:
- case APPCOMMAND_BROWSER_HOME:
- case APPCOMMAND_CLOSE:
- case APPCOMMAND_FIND:
- case APPCOMMAND_HELP:
- case APPCOMMAND_NEW:
- case APPCOMMAND_OPEN:
- case APPCOMMAND_PRINT:
- case APPCOMMAND_SAVE:
- case APPCOMMAND_FORWARD_MAIL:
- case APPCOMMAND_REPLY_TO_MAIL:
- case APPCOMMAND_SEND_MAIL:
- // We shouldn't consume the message always because if we don't handle
- // the message, the sender (typically, utility of keyboard or mouse)
- // may send other key messages which indicate well known shortcut key.
- if (DispatchCommandEvent(appCommand)) {
- // tell the driver that we handled the event
- *aRetValue = 1;
- return true;
- }
- break;
-
- // Use content command for following commands:
- case APPCOMMAND_COPY:
- contentCommandMessage = NS_CONTENT_COMMAND_COPY;
- break;
- case APPCOMMAND_CUT:
- contentCommandMessage = NS_CONTENT_COMMAND_CUT;
- break;
- case APPCOMMAND_PASTE:
- contentCommandMessage = NS_CONTENT_COMMAND_PASTE;
- break;
- case APPCOMMAND_REDO:
- contentCommandMessage = NS_CONTENT_COMMAND_REDO;
- break;
- case APPCOMMAND_UNDO:
- contentCommandMessage = NS_CONTENT_COMMAND_UNDO;
- break;
- }
-
- if (contentCommandMessage) {
- WidgetContentCommandEvent contentCommand(true, contentCommandMessage,
- this);
- DispatchWindowEvent(&contentCommand);
- // tell the driver that we handled the event
- *aRetValue = 1;
- return true;
- }
-
- // default = false - tell the driver that the event was not handled
- return false;
-}
--- a/widget/windows/nsWindowBase.h
+++ b/widget/windows/nsWindowBase.h
@@ -73,35 +73,28 @@ public:
/*
* Returns true if a plugin has focus on this widget. Otherwise, false.
*/
virtual bool PluginHasFocus() const MOZ_FINAL
{
return (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN);
}
+public:
/*
* Touch input injection apis
*/
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation);
virtual nsresult ClearNativeTouchSequence();
- /*
- * WM_APPCOMMAND common handler. Sends events via DispatchWindowEvent.
- */
- virtual bool HandleAppCommandMsg(WPARAM aWParam,
- LPARAM aLParam,
- LRESULT *aRetValue);
-
protected:
- bool DispatchCommandEvent(uint32_t aEventCommand);
static bool InitTouchInjection();
bool InjectTouchPoint(uint32_t aId, nsIntPoint& aPointerScreenPoint,
POINTER_FLAGS aFlags, uint32_t aPressure = 1024,
uint32_t aOrientation = 90);
class PointerInfo
{
public:
--- a/widget/windows/winrt/MetroWidget.cpp
+++ b/widget/windows/winrt/MetroWidget.cpp
@@ -884,20 +884,16 @@ MetroWidget::WindowProcedure(HWND aWnd,
case WM_INPUTLANGCHANGE:
{
KeyboardLayout::GetInstance()->
OnLayoutChange(reinterpret_cast<HKL>(aLParam));
processResult = 1;
break;
}
- case WM_APPCOMMAND:
- processDefault = HandleAppCommandMsg(aWParam, aLParam, &processResult);
- break;
-
case WM_GETOBJECT:
{
DWORD dwObjId = (LPARAM)(DWORD) aLParam;
// Passing this to CallWindowProc can result in a failure due to a timing issue
// in winrt core window server code, so we call it directly here. Also, it's not
// clear Windows::UI::Core::WindowServer::OnAutomationProviderRequestedEvent is
// compatible with metro enabled desktop browsers, it makes an initial call to
// UiaReturnRawElementProvider passing the return result from FrameworkView