backout 82937be94f94 due to bustage.

This commit is contained in:
Jim Mathies 2014-02-05 06:18:43 -06:00
parent eedfc8d406
commit 6dfcd758e9
5 changed files with 129 additions and 146 deletions

View File

@ -3695,6 +3695,70 @@ bool nsWindow::DispatchWindowEvent(WidgetGUIEvent* event,
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)
@ -5025,8 +5089,69 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
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

View File

@ -357,6 +357,7 @@ protected:
*/
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);

View File

@ -194,136 +194,4 @@ nsWindowBase::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;
}

View File

@ -78,6 +78,7 @@ public:
return (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN);
}
public:
/*
* Touch input injection apis
*/
@ -88,15 +89,7 @@ public:
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,

View File

@ -889,10 +889,6 @@ MetroWidget::WindowProcedure(HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLPara
break;
}
case WM_APPCOMMAND:
processDefault = HandleAppCommandMsg(aWParam, aLParam, &processResult);
break;
case WM_GETOBJECT:
{
DWORD dwObjId = (LPARAM)(DWORD) aLParam;