From 2abbf9ab8b16d4ca2e216b4bc9cd1f4d29486e0e Mon Sep 17 00:00:00 2001 From: Nikita Prokopov Date: Thu, 23 Dec 2021 18:41:41 +0100 Subject: [PATCH] Fix Windows build --- shared/cc/Window.cc | 2 +- shared/cc/Window.hh | 2 +- windows/cc/WindowWin32.cc | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shared/cc/Window.cc b/shared/cc/Window.cc index 5e06c2c3..0e4e7116 100644 --- a/shared/cc/Window.cc +++ b/shared/cc/Window.cc @@ -12,7 +12,7 @@ void jwm::Window::dispatch(jobject event) { jwm::classes::Consumer::accept(fEnv, fWindow, event); } -bool jwm::Window::getRectForMarkedRange(jint selectionStart, jint selectionEnd, jwm::IRect& rect) { +bool jwm::Window::getRectForMarkedRange(jint selectionStart, jint selectionEnd, jwm::IRect& rect) const { JNILocal client(fEnv, fEnv->GetObjectField(fWindow, jwm::classes::Window::kTextInputClient)); jwm::classes::Throwable::exceptionThrown(fEnv); if (client.get()) { diff --git a/shared/cc/Window.hh b/shared/cc/Window.hh index 6c58361f..281889f8 100644 --- a/shared/cc/Window.hh +++ b/shared/cc/Window.hh @@ -13,7 +13,7 @@ namespace jwm { void dispatch(jobject event); - bool getRectForMarkedRange(jint selectionStart, jint selectionEnd, jwm::IRect& rect); + bool getRectForMarkedRange(jint selectionStart, jint selectionEnd, jwm::IRect& rect) const; JNIEnv* fEnv = nullptr; jobject fWindow = nullptr; diff --git a/windows/cc/WindowWin32.cc b/windows/cc/WindowWin32.cc index 33d8ad48..2b6b9578 100644 --- a/windows/cc/WindowWin32.cc +++ b/windows/cc/WindowWin32.cc @@ -368,7 +368,7 @@ LRESULT jwm::WindowWin32::processEvent(UINT uMsg, WPARAM wParam, LPARAM lParam) // assume page scroll // https://github.com/mozilla/gecko-dev/blob/da97cbad6c9f00fc596253feb5964a8adbb45d9e/widget/windows/WinMouseScrollHandler.cpp#L891-L903 if (linesPerTick > WHEEL_DELTA) { - float sign = ticks > 0 ? 1 : ticks < 0 ? -1 : 0; + float sign = ticks > 0.0f ? 1.0f : ticks < 0.0f ? -1.0f : 0.0f; JNILocal eventMouseScroll(env, classes::EventMouseScroll::make(env, 0.0f, getContentRect().getHeight() * sign, 0.0f, 0.0f, sign, modifiers)); dispatch(eventMouseScroll.get()); } else { @@ -880,9 +880,9 @@ void jwm::WindowWin32::_imeGetCompositionStringConvertedRange(HIMC hImc, int &se bool jwm::WindowWin32::_imeGetRectForMarkedRange(IRect &rect) const { // Query current cursor position // If composition starts, Pos will be always 0 - auto sectionStart = static_cast(_compositionPos); - auto sectionEnd = sectionStart + 0; - return this->getRectForMarkedRange(selectionStart, selectionEnd, rect); + auto selectionStart = static_cast(_compositionPos); + auto selectionEnd = selectionStart + 0; + return getRectForMarkedRange(selectionStart, selectionEnd, rect); } std::wstring jwm::WindowWin32::_imeGetCompositionString(HIMC hImc, DWORD compType) const {