Skip to content
Snippets Groups Projects
Commit d7b56ef5 authored by Nick's avatar Nick :v:
Browse files

fix rotated input in mirror mode not working

Change-Id: Ied37b2e8a376da93328e6c2c36b338ad0b2074c2
parent 7c2e69ac
No related branches found
No related tags found
No related merge requests found
......@@ -222,8 +222,8 @@ void AndroidDesktop::pointerEvent(const rfb::Point& pos, int buttonMask) {
}
uint32_t mx = (mPixels->width() - mDisplayRect.getWidth()) / 2;
uint32_t my = (mPixels->height() - mDisplayRect.getHeight()) / 2;
uint32_t x = (((pos.x - mx) * mDisplayMode.width) / ((float)(mDisplayRect.getWidth())));
uint32_t y = (((pos.y - my) * mDisplayMode.height) / ((float)(mDisplayRect.getHeight())));
uint32_t x = (((pos.x - mx) * mDisplayModeRotated.width) / ((float)(mDisplayRect.getWidth())));
uint32_t y = (((pos.y - my) * mDisplayModeRotated.height) / ((float)(mDisplayRect.getHeight())));
ALOGV("pointer xlate x1=%d y1=%d x2=%d y2=%d", pos.x, pos.y, x, y);
......@@ -263,6 +263,8 @@ status_t AndroidDesktop::updateDisplayInfo(bool force) {
ALOGE("Invalid rect");
return -1;
}
bool rotated = mDisplayState == ui::ROTATION_90 || mDisplayState == ui::ROTATION_270;
mDisplayModeRotated = ui::Size(rotated ? mDisplayMode.height : mDisplayMode.width, rotated ? mDisplayMode.width : mDisplayMode.height);
ALOGV("updateDisplayInfo: [%d:%d], rotated %d, layerId %d", mDisplayMode.width, mDisplayMode.height, mDisplayState, mLayerId);
if (mPixels != NULL)
......@@ -288,7 +290,7 @@ void AndroidDesktop::onBufferDimensionsChanged(uint32_t width, uint32_t height)
mDisplayRect = mVirtualDisplay->getDisplayRect();
mInputDevice->reconfigure(mDisplayMode.width, mDisplayMode.height, touch, relative);
mInputDevice->reconfigure(mDisplayModeRotated.width, mDisplayModeRotated.height, touch, relative);
mServer->setPixelBuffer(mPixels.get(), computeScreenLayout());
mServer->setScreenLayout(computeScreenLayout());
......
......@@ -94,6 +94,7 @@ class AndroidDesktop : public rfb::SDesktop,
// Primary display
ui::Size mDisplayMode = {};
ui::Size mDisplayModeRotated = {};
ui::Rotation mDisplayState = {};
// Virtual input device
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment