diff options
author | Oystein Eftevaag | 2007-12-07 23:49:27 +0000 |
---|---|---|
committer | Oystein Eftevaag | 2007-12-07 23:49:27 +0000 |
commit | 0522c55faf3837f8e018a270e62f01b4d13b9683 (patch) | |
tree | b64bae574270afe010454a82370f082332d0a7ba /backends/platform | |
parent | c0920e02248562354c2c53fcd91f6b972299d999 (diff) | |
download | scummvm-rg350-0522c55faf3837f8e018a270e62f01b4d13b9683.tar.gz scummvm-rg350-0522c55faf3837f8e018a270e62f01b4d13b9683.tar.bz2 scummvm-rg350-0522c55faf3837f8e018a270e62f01b4d13b9683.zip |
Enabled click-and-drag mouse mode for the right mouse button as well as the left button, and fixed a the mouse cursor being able to go 1 pixel off screen on one side
svn-id: r29753
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/iphone/iphone_video.m | 6 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.cpp | 54 |
2 files changed, 38 insertions, 22 deletions
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 6e66b829a6..1d1f46179d 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -93,8 +93,8 @@ bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) { } bool getLocalMouseCoords(CGPoint *point) { - if (point->x < _screenRect.origin.x || point->x > _screenRect.origin.x + _screenRect.size.width || - point->y < _screenRect.origin.y || point->y > _screenRect.origin.y + _screenRect.size.height) { + if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width || + point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) { return false; } @@ -208,7 +208,7 @@ bool getLocalMouseCoords(CGPoint *point) { _screenRect = CGRectMake(0, 0, _fullWidth, _fullWidth * ratio); [screenLayer setFrame: _screenRect]; - CGRect keyFrame = CGRectMake(0.0f, _screenRect.size.height, _fullWidth, _fullHeight); + CGRect keyFrame = CGRectMake(0.0f, _screenRect.size.height, _fullWidth, _fullHeight - _screenRect.size.height); if (_keyboardView == nil) { _keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame]; [_keyboardView setInputDelegate:self]; diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index e0334d9778..95e8e37012 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -712,29 +712,45 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { _lastSecondaryDown = curTime; _gestureStartX = x; _gestureStartY = y; - return false; - } else if (curTime - _lastSecondaryDown < 250 ) { - if (curTime - _lastSecondaryTap < 250 && !_overlayVisible) { - event.type = Common::EVENT_KEYDOWN; - _queuedInputEvent.type = Common::EVENT_KEYUP; - - event.kbd.flags = _queuedInputEvent.kbd.flags = 0; - event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE; - event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE; - _needEventRestPeriod = true; - _lastSecondaryTap = 0; - } else { - event.type = Common::EVENT_RBUTTONDOWN; + if (_mouseClickAndDragEnabled) { + event.type = Common::EVENT_LBUTTONUP; event.mouse.x = _mouseX; event.mouse.y = _mouseY; - _queuedInputEvent.type = Common::EVENT_RBUTTONUP; + + _queuedInputEvent.type = Common::EVENT_RBUTTONDOWN; _queuedInputEvent.mouse.x = _mouseX; _queuedInputEvent.mouse.y = _mouseY; - _lastSecondaryTap = curTime; - _needEventRestPeriod = true; - } - } else - return false; + } + else + return false; + } else { + if (curTime - _lastSecondaryDown < 250 ) { + if (curTime - _lastSecondaryTap < 250 && !_overlayVisible) { + event.type = Common::EVENT_KEYDOWN; + _queuedInputEvent.type = Common::EVENT_KEYUP; + + event.kbd.flags = _queuedInputEvent.kbd.flags = 0; + event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE; + event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE; + _needEventRestPeriod = true; + _lastSecondaryTap = 0; + } else if (!_mouseClickAndDragEnabled) { + event.type = Common::EVENT_RBUTTONDOWN; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + _queuedInputEvent.type = Common::EVENT_RBUTTONUP; + _queuedInputEvent.mouse.x = _mouseX; + _queuedInputEvent.mouse.y = _mouseY; + _lastSecondaryTap = curTime; + _needEventRestPeriod = true; + } + } + if (_mouseClickAndDragEnabled) { + event.type = Common::EVENT_RBUTTONUP; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + } + } break; case kInputOrientationChanged: bool newModeIsLandscape = (int)xUnit != 1; |