From 9272a0034c912b09c1291dab2caaf621daf14bfa Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 8 May 2015 16:16:17 +0200 Subject: [PATCH] window: support mouse coordinates up to 255 --- src/window.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 6e313b63..5d24be12 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -741,8 +741,8 @@ int Window::getInputChar() return KEY_HOME; case 'M': key = wgetch(m_window); - m_mouse_event.x = wgetch(m_window); - m_mouse_event.y = wgetch(m_window); + m_mouse_event.x = (wgetch(m_window) - 33) & 0xff; + m_mouse_event.y = (wgetch(m_window) - 33) & 0xff; switch (key & ~24) { case ' ': @@ -767,10 +767,8 @@ int Window::getInputChar() m_mouse_event.bstate |= BUTTON_ALT; if (key & 16) m_mouse_event.bstate |= BUTTON_CTRL; - m_mouse_event.x -= 33; if (m_mouse_event.x < 0 || m_mouse_event.x >= COLS) return ERR; - m_mouse_event.y -= 33; if (m_mouse_event.y < 0 || m_mouse_event.y >= LINES) return ERR; return KEY_MOUSE;