Exemplo n.º 1
0
bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicString& eventType,
    int detail, Node* relatedTarget)
{
    ASSERT(!eventDispatchForbidden());
    
    IntPoint contentsPos;
    if (FrameView* view = document()->view())
        contentsPos = view->windowToContents(event.pos());

    short button = event.button();

    ASSERT(event.eventType() == MouseEventMoved || button != NoButton);
    
    return dispatchMouseEvent(eventType, button, detail,
        contentsPos.x(), contentsPos.y(), event.globalX(), event.globalY(),
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
        false, relatedTarget);
}
Exemplo n.º 2
0
void EventTargetNode::dispatchSimulatedMouseEvent(const AtomicString& eventType,
    PassRefPtr<Event> underlyingEvent)
{
    ASSERT(!eventDispatchForbidden());

    bool ctrlKey = false;
    bool altKey = false;
    bool shiftKey = false;
    bool metaKey = false;
    if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get())) {
        ctrlKey = keyStateEvent->ctrlKey();
        altKey = keyStateEvent->altKey();
        shiftKey = keyStateEvent->shiftKey();
        metaKey = keyStateEvent->metaKey();
    }

    // Like Gecko, we just pass 0 for everything when we make a fake mouse event.
    // Internet Explorer instead gives the current mouse position and state.
    dispatchMouseEvent(eventType, 0, 0, 0, 0, 0, 0,
        ctrlKey, altKey, shiftKey, metaKey, true, 0, underlyingEvent);
}
Exemplo n.º 3
0
LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
    if (nCode >= 0)
    {

        switch (wParam)
        {
        	// Mouse

            case WM_MOUSEMOVE :
            	dispatchMouseEvent((const uint8_t*) "Mouse.Move");
            	break;

        	// Left Button

            case WM_LBUTTONUP :
            	dispatchMouseEvent((const uint8_t*) "Mouse.Up.LeftButton");
                break;

            case WM_LBUTTONDOWN :
            	dispatchMouseEvent((const uint8_t*) "Mouse.Down.LeftButton");
                break;

            case WM_LBUTTONDBLCLK :
            	dispatchMouseEvent((const uint8_t*) "Mouse.DoubleClick.LeftButton");
                break;

			// Middle Button

            case WM_MBUTTONUP :
            	dispatchMouseEvent((const uint8_t*) "Mouse.Up.MiddleButton");
                break;

            case WM_MBUTTONDOWN :
            	dispatchMouseEvent((const uint8_t*) "Mouse.Down.MiddleButton");
                break;

            case WM_MBUTTONDBLCLK :
            	dispatchMouseEvent((const uint8_t*) "Mouse.DoubleClick.MiddleButton");
                break;

			// Right Button

            case WM_RBUTTONUP :
				dispatchMouseEvent((const uint8_t*) "Mouse.Up.RightButton");
				  break;

			case WM_RBUTTONDOWN :
				dispatchMouseEvent((const uint8_t*) "Mouse.Down.RightButton");
				break;

			case WM_RBUTTONDBLCLK :
				dispatchMouseEvent((const uint8_t*) "Mouse.DoubleClick.RightButton");
				break;

			// Wheel

            case WM_MOUSEWHEEL :
            	dispatchMouseEvent((const uint8_t*) "Mouse.Wheel");
            	break;
        }
    }

    return CallNextHookEx(mouseHook, nCode, wParam, lParam);
}