mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-02-15 15:19:46 +00:00
Compare commits
1 Commits
master
...
gnif-lates
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8120f73cc6 |
1
AUTHORS
1
AUTHORS
@@ -74,4 +74,3 @@ rs189 <35667100+rs189@users.noreply.github.com> (rs189)
|
||||
Jérôme Poulin <jeromepoulin@gmail.com> (ticpu)
|
||||
Marco Rodolfi <marco.rodolfi@tuta.io> (RodoMa92)
|
||||
Stewart Borle <stewi1014@gmail.com> (stewi1014)
|
||||
Jannis Lübke <business.janrupf@gmail.com> (Janrupf)
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
#include "app.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
const double WL_SCROLL_STEP = 15.0;
|
||||
const double WL_HALF_SCROLL_STEP = WL_SCROLL_STEP / 2.0;
|
||||
|
||||
// Mouse-handling listeners.
|
||||
|
||||
static void pointerMotionHandler(void * data, struct wl_pointer * pointer,
|
||||
@@ -94,25 +91,12 @@ static void pointerAxisHandler(void * data, struct wl_pointer * pointer,
|
||||
if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL)
|
||||
return;
|
||||
|
||||
double delta = wl_fixed_to_double(value);
|
||||
|
||||
wlWm.scrollState += delta;
|
||||
|
||||
while (wlWm.scrollState > WL_HALF_SCROLL_STEP)
|
||||
{
|
||||
app_handleButtonPress(5 /* SPICE_MOUSE_BUTTON_DOWN */);
|
||||
app_handleButtonRelease(5 /* SPICE_MOUSE_BUTTON_DOWN */);
|
||||
wlWm.scrollState -= WL_SCROLL_STEP;
|
||||
}
|
||||
|
||||
while (wlWm.scrollState < -WL_HALF_SCROLL_STEP)
|
||||
{
|
||||
app_handleButtonPress(4 /* SPICE_MOUSE_BUTTON_UP */);
|
||||
app_handleButtonRelease(4 /* SPICE_MOUSE_BUTTON_UP */);
|
||||
wlWm.scrollState += WL_SCROLL_STEP;
|
||||
}
|
||||
|
||||
app_handleWheelMotion(delta / WL_SCROLL_STEP);
|
||||
int button = value > 0 ?
|
||||
5 /* SPICE_MOUSE_BUTTON_DOWN */ :
|
||||
4 /* SPICE_MOUSE_BUTTON_UP */;
|
||||
app_handleButtonPress(button);
|
||||
app_handleButtonRelease(button);
|
||||
app_handleWheelMotion(wl_fixed_to_double(value) / 15.0);
|
||||
}
|
||||
|
||||
static int mapWaylandToSpiceButton(uint32_t button)
|
||||
|
||||
@@ -114,7 +114,6 @@ struct WaylandDSState
|
||||
bool configured;
|
||||
bool warpSupport;
|
||||
double cursorX, cursorY;
|
||||
double scrollState;
|
||||
|
||||
#if defined(ENABLE_EGL) || defined(ENABLE_OPENGL)
|
||||
struct wl_egl_window * eglWindow;
|
||||
|
||||
@@ -83,7 +83,7 @@ void CSettings::SetExtraMode(const DisplayMode& mode)
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
bool CSettings::GetExtraMode(DisplayMode& mode)
|
||||
std::wstring CSettings::ReadStringValue(const wchar_t* name, const wchar_t* default)
|
||||
{
|
||||
HKEY hKey = nullptr;
|
||||
LONG ec = RegOpenKeyExW(
|
||||
@@ -95,29 +95,38 @@ bool CSettings::GetExtraMode(DisplayMode& mode)
|
||||
);
|
||||
|
||||
if (ec != ERROR_SUCCESS)
|
||||
return false;
|
||||
return std::wstring(default);
|
||||
|
||||
DWORD type = 0;
|
||||
DWORD cb = 0;
|
||||
|
||||
ec = RegQueryValueExW(hKey, L"ExtraMode", nullptr, &type, nullptr, &cb);
|
||||
ec = RegQueryValueExW(hKey, name, nullptr, &type, nullptr, &cb);
|
||||
if (ec != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ) || cb == 0)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return false;
|
||||
return std::wstring(default);
|
||||
}
|
||||
|
||||
std::vector<wchar_t> buf(cb / sizeof(wchar_t) + 1);
|
||||
ec = RegQueryValueExW(hKey, L"ExtraMode", nullptr, &type,
|
||||
ec = RegQueryValueExW(hKey, name, nullptr, &type,
|
||||
reinterpret_cast<LPBYTE>(buf.data()), &cb);
|
||||
RegCloseKey(hKey);
|
||||
if (ec != ERROR_SUCCESS)
|
||||
return false;
|
||||
return std::wstring(default);
|
||||
|
||||
buf.back() = L'\0';
|
||||
|
||||
std::wstring s(buf.data());
|
||||
return ParseModeString(s, mode);
|
||||
return s;
|
||||
}
|
||||
|
||||
bool CSettings::GetExtraMode(DisplayMode& mode)
|
||||
{
|
||||
std::wstring extraMode = ReadStringValue(L"ExtraMode", NULL);
|
||||
if (extraMode.empty())
|
||||
return false;
|
||||
|
||||
return ParseModeString(extraMode, mode);
|
||||
}
|
||||
|
||||
bool CSettings::ReadModesValue(std::vector<std::wstring> &out) const
|
||||
|
||||
@@ -24,6 +24,7 @@ class CSettings
|
||||
|
||||
private:
|
||||
DisplayModes m_displayModes;
|
||||
std::wstring ReadStringValue(const wchar_t* name, const wchar_t* default);
|
||||
|
||||
bool ReadModesValue(std::vector<std::wstring> &out) const;
|
||||
bool ParseModeString(const std::wstring& in, DisplayMode& out);
|
||||
|
||||
Reference in New Issue
Block a user