diff --git a/src/framework/platform/androidwindow.cpp b/src/framework/platform/androidwindow.cpp index 3951030f96..e17ca88675 100644 --- a/src/framework/platform/androidwindow.cpp +++ b/src/framework/platform/androidwindow.cpp @@ -255,9 +255,9 @@ void AndroidWindow::processFingerDownAndUp() { m_inputEvent.type = (isTouchdown) ? Fw::MousePressInputEvent : Fw::MouseReleaseInputEvent; m_inputEvent.mouseButton = mouseButton; if(isTouchdown) { - m_mouseButtonStates |= mouseButton; + m_mouseButtonStates |= 1 << mouseButton; } else { - g_dispatcher.addEvent([this, mouseButton] { m_mouseButtonStates &= ~mouseButton; }); + g_dispatcher.addEvent([this, mouseButton] { m_mouseButtonStates &= ~(1 << mouseButton); }); } handleInputEvent(); diff --git a/src/framework/platform/platformwindow.h b/src/framework/platform/platformwindow.h index fba26906a7..7cc3f34aac 100644 --- a/src/framework/platform/platformwindow.h +++ b/src/framework/platform/platformwindow.h @@ -88,7 +88,7 @@ class PlatformWindow bool isKeyPressed(Fw::Key keyCode) { return m_keysState[keyCode]; } bool isMouseButtonPressed(Fw::MouseButton mouseButton) - { if (mouseButton == Fw::MouseNoButton) return m_mouseButtonStates != 0; return (m_mouseButtonStates & mouseButton) == mouseButton; } + { if (mouseButton == Fw::MouseNoButton) return m_mouseButtonStates != 0; return (m_mouseButtonStates & (1 << mouseButton)) == (1 << mouseButton); } bool isVisible() { return m_visible; } bool isMaximized() { return m_maximized; } bool isFullscreen() { return m_fullscreen; } diff --git a/src/framework/platform/win32window.cpp b/src/framework/platform/win32window.cpp index 924db1ea25..8125ef5efd 100644 --- a/src/framework/platform/win32window.cpp +++ b/src/framework/platform/win32window.cpp @@ -647,7 +647,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM SetCapture(m_window); m_inputEvent.reset(Fw::MousePressInputEvent); m_inputEvent.mouseButton = Fw::MouseLeftButton; - m_mouseButtonStates |= Fw::MouseLeftButton; + m_mouseButtonStates |= 1 << Fw::MouseLeftButton; if (m_onInputEvent) m_onInputEvent(m_inputEvent); break; @@ -657,7 +657,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM SetCapture(nullptr); m_inputEvent.reset(Fw::MouseReleaseInputEvent); m_inputEvent.mouseButton = Fw::MouseLeftButton; - g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~Fw::MouseLeftButton; }); + g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~(1 << Fw::MouseLeftButton); }); if (m_onInputEvent) m_onInputEvent(m_inputEvent); break; @@ -667,7 +667,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM SetCapture(m_window); m_inputEvent.reset(Fw::MousePressInputEvent); m_inputEvent.mouseButton = Fw::MouseMidButton; - m_mouseButtonStates |= Fw::MouseMidButton; + m_mouseButtonStates |= 1 << Fw::MouseMidButton; if (m_onInputEvent) m_onInputEvent(m_inputEvent); break; @@ -677,7 +677,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM SetCapture(nullptr); m_inputEvent.reset(Fw::MouseReleaseInputEvent); m_inputEvent.mouseButton = Fw::MouseMidButton; - g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~Fw::MouseMidButton; }); + g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~(1 << Fw::MouseMidButton); }); if (m_onInputEvent) m_onInputEvent(m_inputEvent); break; @@ -687,7 +687,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM SetCapture(m_window); m_inputEvent.reset(Fw::MousePressInputEvent); m_inputEvent.mouseButton = Fw::MouseRightButton; - m_mouseButtonStates |= Fw::MouseRightButton; + m_mouseButtonStates |= 1 << Fw::MouseRightButton; if (m_onInputEvent) m_onInputEvent(m_inputEvent); break; @@ -697,7 +697,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM SetCapture(nullptr); m_inputEvent.reset(Fw::MouseReleaseInputEvent); m_inputEvent.mouseButton = Fw::MouseRightButton; - g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~Fw::MouseRightButton; }); + g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~(1 << Fw::MouseRightButton); }); if (m_onInputEvent) m_onInputEvent(m_inputEvent); break; @@ -710,7 +710,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM const uint32_t mouseButton = (Fw::MouseXButton - 1) + GET_XBUTTON_WPARAM(wParam); m_inputEvent.reset(Fw::MousePressInputEvent); m_inputEvent.mouseButton = static_cast(mouseButton); - m_mouseButtonStates |= mouseButton; + m_mouseButtonStates |= 1 << mouseButton; if (m_onInputEvent) m_onInputEvent(m_inputEvent); @@ -723,7 +723,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, uint32_t uMsg, WPARAM wParam, LPARAM const uint32_t mouseButton = (Fw::MouseXButton - 1) + GET_XBUTTON_WPARAM(wParam); m_inputEvent.reset(Fw::MouseReleaseInputEvent); m_inputEvent.mouseButton = static_cast(mouseButton); - g_dispatcher.addEvent([this, mouseButton] { m_mouseButtonStates &= ~mouseButton; }); + g_dispatcher.addEvent([this, mouseButton] { m_mouseButtonStates &= ~(1 << mouseButton); }); if (m_onInputEvent) m_onInputEvent(m_inputEvent); diff --git a/src/framework/platform/x11window.cpp b/src/framework/platform/x11window.cpp index e596c1e5a0..b35466922c 100644 --- a/src/framework/platform/x11window.cpp +++ b/src/framework/platform/x11window.cpp @@ -782,18 +782,18 @@ void X11Window::poll() switch (event.xbutton.button) { case Button1: m_inputEvent.mouseButton = Fw::MouseLeftButton; - if (event.type == ButtonPress) { m_mouseButtonStates |= Fw::MouseLeftButton; } - else { g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~Fw::MouseLeftButton; }); } + if (event.type == ButtonPress) { m_mouseButtonStates |= 1 << Fw::MouseLeftButton; } + else { g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~(1 << Fw::MouseLeftButton); }); } break; case Button3: m_inputEvent.mouseButton = Fw::MouseRightButton; - if (event.type == ButtonPress) { m_mouseButtonStates |= Fw::MouseRightButton; } - else { g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~Fw::MouseRightButton; }); } + if (event.type == ButtonPress) { m_mouseButtonStates |= 1 << Fw::MouseRightButton; } + else { g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~(1 << Fw::MouseRightButton); }); } break; case Button2: m_inputEvent.mouseButton = Fw::MouseMidButton; - if (event.type == ButtonPress) { m_mouseButtonStates |= Fw::MouseMidButton; } - else { g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~Fw::MouseMidButton; }); } + if (event.type == ButtonPress) { m_mouseButtonStates |= 1 << Fw::MouseMidButton; } + else { g_dispatcher.addEvent([this] { m_mouseButtonStates &= ~(1 << Fw::MouseMidButton); }); } break; case Button4: if (event.type == ButtonPress) {