BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask) { // just treat a double click as a second click return handleMouseDown(x, y, mask); }
bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) { if (!m_widget) return false; // FIXME: WebKit seems to always return false on mouse events methods. For // now we'll assume it has processed them (as we are only interested in // whether keyboard events are processed). switch (inputEvent.type) { case WebInputEvent::MouseMove: handleMouseMove(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseLeave: handleMouseLeave(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseWheel: handleMouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent)); return true; case WebInputEvent::MouseDown: handleMouseDown(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseUp: handleMouseUp(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; // In Windows, RawKeyDown only has information about the physical key, but // for "selection", we need the information about the character the key // translated into. For English, the physical key value and the character // value are the same, hence, "selection" works for English. But for other // languages, such as Hebrew, the character value is different from the // physical key value. Thus, without accepting Char event type which // contains the key's character value, the "selection" won't work for // non-English languages, such as Hebrew. case WebInputEvent::RawKeyDown: case WebInputEvent::KeyDown: case WebInputEvent::KeyUp: case WebInputEvent::Char: return handleKeyEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent)); case WebInputEvent::TouchStart: case WebInputEvent::TouchMove: case WebInputEvent::TouchEnd: case WebInputEvent::TouchCancel: return handleTouchEvent(*static_cast<const WebTouchEvent*>(&inputEvent)); case WebInputEvent::GestureScrollBegin: case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: case WebInputEvent::GestureFlingStart: case WebInputEvent::GestureFlingCancel: case WebInputEvent::GestureTap: case WebInputEvent::GestureTapDown: case WebInputEvent::GestureDoubleTap: case WebInputEvent::GestureTwoFingerTap: case WebInputEvent::GestureLongPress: case WebInputEvent::GesturePinchBegin: case WebInputEvent::GesturePinchEnd: case WebInputEvent::GesturePinchUpdate: return handleGestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent)); case WebInputEvent::Undefined: case WebInputEvent::MouseEnter: case WebInputEvent::ContextMenu: return false; } return false; }
BOOL LLColorSwatchCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { return handleMouseDown(x, y, mask); }
BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask) { return handleMouseDown(x, y, mask); }
// <FS:Zi> Add middle mouse control for switching uniform scaling on the fly BOOL LLToolCompScale::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { LLToolCompScale::getInstance()->mManip->handleMiddleMouseDown(x,y,mask); return handleMouseDown(x,y,mask); }
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event) { OSStatus err = eventNotHandledErr; GHOST_IWindow* window = m_windowManager->getActiveWindow(); UInt32 kind = ::GetEventKind(event); switch (kind) { case kEventMouseDown: case kEventMouseUp: // Handle Mac application responsibilities if ((kind == kEventMouseDown) && handleMouseDown(event)) { err = noErr; } else { GHOST_TEventType type = (kind == kEventMouseDown) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp; EventMouseButton button; /* Window still gets mouse up after command-H */ if (m_windowManager->getActiveWindow()) { // handle any tablet events that may have come with the mouse event (optional) handleTabletEvent(event); ::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); pushEvent(new GHOST_EventButton(getMilliSeconds(), type, window, convertButton(button))); err = noErr; } } break; case kEventMouseMoved: case kEventMouseDragged: { Point mousePos; if (window) { //handle any tablet events that may have come with the mouse event (optional) handleTabletEvent(event); ::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos); pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, mousePos.h, mousePos.v)); err = noErr; } break; } case kEventMouseWheelMoved: { OSStatus status; //UInt32 modifiers; EventMouseWheelAxis axis; SInt32 delta; //status = ::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers); //GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed"); status = ::GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(axis), NULL, &axis); GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed"); if (axis == kEventMouseWheelAxisY) { status = ::GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta); GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed"); /* * Limit mouse wheel delta to plus and minus one. */ delta = delta > 0 ? 1 : -1; pushEvent(new GHOST_EventWheel(getMilliSeconds(), window, delta)); err = noErr; } } break; } return err; }
void eventLoop() { EventRecord event; WindowPtr window; short clickArea; Rect screenRect; long sleep = 30; Point point; for (;;) { if (WaitNextEvent( everyEvent, &event, sleep, (RgnHandle)nil )) { if (event.what == mouseDown) { clickArea = FindWindow( event.where, &window ); if (clickArea == inDrag) { //screenRect = (**GetGrayRgn()).rgnBBox; GetRegionBounds(GetGrayRgn(), &screenRect); DragWindow(window, event.where, &screenRect ); } else if (clickArea == inGoAway) { if (TrackGoAway( window , event.where )) ExitToShell(); } else if (clickArea == inMenuBar) { adjustMenus(); handleMenu( MenuSelect( event.where ) ); } else if (clickArea == inContent) { if (window != FrontWindow()) SelectWindow( window ); else { point = event.where; GlobalToLocal( &point ); handleMouseDown( point ); } } } else if (event.what == updateEvt) { window = (WindowPtr)event.message; //SetPort( window ); SetPortWindowPort( window ); BeginUpdate( window ); updateWindow(); EndUpdate( window ); } else if (event.what == keyDown || event.what == autoKey) { if ((event.modifiers & cmdKey) != 0) { adjustMenus(); handleMenu( MenuKey( (char)(event.message & charCodeMask) ) ); } } } } }
bool Window::handleEvent() { SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: case SDL_MOUSEMOTION: input.setLastMouseEvent(Chrono::getCurMillis()); input.setMousePos(Vec2i(event.button.x, event.button.y)); } switch(event.type) { case SDL_QUIT: return false; case SDL_MOUSEBUTTONDOWN: handleMouseDown(event); break; case SDL_MOUSEBUTTONUP: { MouseButton b = Input::getMouseButton(event.button.button); input.setMouseState(b, false); eventMouseUp(event.button.x, event.button.y, b); break; } case SDL_MOUSEMOTION: input.setMouseState(MouseButton::LEFT, event.motion.state & SDL_BUTTON_LMASK); input.setMouseState(MouseButton::RIGHT, event.motion.state & SDL_BUTTON_RMASK); input.setMouseState(MouseButton::MIDDLE, event.motion.state & SDL_BUTTON_MMASK); eventMouseMove(event.motion.x, event.motion.y, input.getMouseState()); break; case SDL_KEYDOWN: /* handle ALT+Return */ if(event.key.keysym.sym == SDLK_RETURN && (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) { toggleFullscreen(); } else { eventKeyDown(Key(event.key.keysym)); eventKeyPress(static_cast<char>(event.key.keysym.unicode)); } break; case SDL_KEYUP: eventKeyUp(Key(event.key.keysym)); break; case SDL_ACTIVEEVENT: if(event.active.state & SDL_APPACTIVE){ if(event.active.gain){ // got focus eventResize(ssRestored); }else{ // lost focus (minimized) eventResize(ssMinimized); } } break; } } return true; }