mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-12-16 13:08:13 +00:00
Compare commits
11 Commits
B4-rc3
...
Release/B4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25c88a1c6c | ||
|
|
7decb58bf7 | ||
|
|
d1ec19b30b | ||
|
|
74468cf799 | ||
|
|
411a6b1e49 | ||
|
|
e228165ff9 | ||
|
|
d615514799 | ||
|
|
ed717351cf | ||
|
|
4658244686 | ||
|
|
48ae5c69f4 | ||
|
|
4d065d577b |
@@ -444,7 +444,7 @@ void waylandWarpPointer(int x, int y, bool exiting)
|
|||||||
|
|
||||||
INTERLOCKED_SECTION(wlWm.confineLock,
|
INTERLOCKED_SECTION(wlWm.confineLock,
|
||||||
{
|
{
|
||||||
if (!wlWm.lockedPointer)
|
if (wlWm.lockedPointer)
|
||||||
{
|
{
|
||||||
LG_UNLOCK(wlWm.confineLock);
|
LG_UNLOCK(wlWm.confineLock);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -59,14 +59,12 @@ Required Dependencies
|
|||||||
- libgl-dev
|
- libgl-dev
|
||||||
- libfontconfig1-dev
|
- libfontconfig1-dev
|
||||||
- libgmp-dev
|
- libgmp-dev
|
||||||
- libsdl2-dev
|
|
||||||
- libsdl2-ttf-dev
|
|
||||||
- libspice-protocol-dev
|
- libspice-protocol-dev
|
||||||
- make
|
- make
|
||||||
- nettle-dev
|
- nettle-dev
|
||||||
- pkg-config
|
- pkg-config
|
||||||
|
|
||||||
.. _may_be_disabled:
|
.. _client_deps_may_be_disabled:
|
||||||
|
|
||||||
May be disabled
|
May be disabled
|
||||||
<<<<<<<<<<<<<<<
|
<<<<<<<<<<<<<<<
|
||||||
@@ -83,6 +81,7 @@ feature is disabled when running :ref:`cmake <client_building>`.
|
|||||||
- libx11-dev
|
- libx11-dev
|
||||||
- libxfixes-dev
|
- libxfixes-dev
|
||||||
- libxi-dev
|
- libxi-dev
|
||||||
|
- libxinerama-dev
|
||||||
- libxss-dev
|
- libxss-dev
|
||||||
|
|
||||||
- Disable with ``cmake -DENABLE_WAYLAND=no ..``
|
- Disable with ``cmake -DENABLE_WAYLAND=no ..``
|
||||||
@@ -91,11 +90,33 @@ feature is disabled when running :ref:`cmake <client_building>`.
|
|||||||
- libwayland-dev
|
- libwayland-dev
|
||||||
- wayland-protocols
|
- wayland-protocols
|
||||||
|
|
||||||
You can fetch these dependencies on Debian systems with the following command:
|
.. _client_deps_deprecated:
|
||||||
|
|
||||||
|
Deprecated
|
||||||
|
<<<<<<<<<<
|
||||||
|
|
||||||
|
These dependencies may be used, but are not required, and will be removed
|
||||||
|
in the future.
|
||||||
|
|
||||||
|
- Enable with ``cmake -DENABLE_SDL=yes ..``
|
||||||
|
|
||||||
|
- libsdl2-dev
|
||||||
|
- libsdl2-ttf-dev
|
||||||
|
|
||||||
|
.. _client_fetching_with_apt:
|
||||||
|
|
||||||
|
Fetching with APT
|
||||||
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
You can fetch these dependencies with the following command:
|
||||||
|
|
||||||
``apt-get install binutils-dev cmake fonts-freefont-ttf libfontconfig1-dev
|
``apt-get install binutils-dev cmake fonts-freefont-ttf libfontconfig1-dev
|
||||||
libsdl2-dev libsdl2-ttf-dev libspice-protocol-dev libx11-dev nettle-dev
|
libegl-dev libspice-protocol-dev nettle-dev libx11-dev libxi-dev libxinerama-dev
|
||||||
wayland-protocols``
|
libxss-dev libwayland-dev wayland-protocols``
|
||||||
|
|
||||||
|
You may omit some dependencies, if you disable the feature which requires them
|
||||||
|
when running :ref:`cmake <client_building>`.
|
||||||
|
(See :ref:`client_deps_may_be_disabled`)
|
||||||
|
|
||||||
|
|
||||||
.. _client_building:
|
.. _client_building:
|
||||||
|
|||||||
17
doc/faq.rst
17
doc/faq.rst
@@ -88,13 +88,20 @@ The mouse is jumpy, slow, laggy when using SPICE
|
|||||||
Please be sure to install the SPICE guest tools from
|
Please be sure to install the SPICE guest tools from
|
||||||
https://www.spice-space.org/download.html#windows-binaries.
|
https://www.spice-space.org/download.html#windows-binaries.
|
||||||
|
|
||||||
.. _the_mouse_doesnt_stay_aligned_with_the_host.:
|
.. _mouse_desync_when_entering:
|
||||||
|
|
||||||
The mouse doesn't stay aligned with the host.
|
The mouse position is wrong when entering the window
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
This is intentional. The host's mouse no longer interacts with your operating
|
This is due to windows mouse acceleration, it can be disabled by
|
||||||
system, and is completely captured by Looking Glass.
|
following one of these methods:
|
||||||
|
|
||||||
|
- Disabling pointer precision (Control Panel > Mouse > Pointer Options
|
||||||
|
> Uncheck Enhance pointer precision)
|
||||||
|
- By changing the acceleration behavior with the following registry
|
||||||
|
magic:
|
||||||
|
http://donewmouseaccel.blogspot.com.au/2010/03/markc-windows-7-mouse-acceleration-fix.html
|
||||||
|
(Contrary to the title this works just fine on Windows 10)
|
||||||
|
|
||||||
.. _the_cursor_position_doesnt_update_until_i_click:
|
.. _the_cursor_position_doesnt_update_until_i_click:
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ add_library(platform_Windows STATIC
|
|||||||
src/service.c
|
src/service.c
|
||||||
src/mousehook.c
|
src/mousehook.c
|
||||||
src/force_compose.c
|
src/force_compose.c
|
||||||
|
src/delay.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# allow use of functions for Windows Vista or later
|
# allow use of functions for Windows Vista or later
|
||||||
|
|||||||
34
host/platform/Windows/include/windows/delay.h
Normal file
34
host/platform/Windows/include/windows/delay.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* Looking Glass
|
||||||
|
* Copyright (C) 2017-2021 The Looking Glass Authors
|
||||||
|
* https://looking-glass.io
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation; either version 2 of the License, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||||
|
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
typedef NTSTATUS (__stdcall *ZwSetTimerResolution_t)(ULONG RequestedResolution,
|
||||||
|
BOOLEAN Set, PULONG ActualResolution);
|
||||||
|
extern ZwSetTimerResolution_t ZwSetTimerResolution;
|
||||||
|
|
||||||
|
typedef NTSTATUS (__stdcall *NtDelayExecution_t)(BOOL Alertable,
|
||||||
|
PLARGE_INTEGER DelayInterval);
|
||||||
|
extern NtDelayExecution_t NtDelayExecution;
|
||||||
|
|
||||||
|
void delayInit(void);
|
||||||
|
|
||||||
|
// like sleep but more accurate
|
||||||
|
void delayExecution(float ms);
|
||||||
49
host/platform/Windows/src/delay.c
Normal file
49
host/platform/Windows/src/delay.c
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Looking Glass
|
||||||
|
* Copyright (C) 2017-2021 The Looking Glass Authors
|
||||||
|
* https://looking-glass.io
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation; either version 2 of the License, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||||
|
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "windows/delay.h"
|
||||||
|
#include "common/debug.h"
|
||||||
|
|
||||||
|
NtDelayExecution_t NtDelayExecution;
|
||||||
|
ZwSetTimerResolution_t ZwSetTimerResolution;
|
||||||
|
|
||||||
|
void delayInit(void)
|
||||||
|
{
|
||||||
|
HMODULE ntdll = GetModuleHandle("ntdll.dll");
|
||||||
|
NtDelayExecution = (NtDelayExecution_t)
|
||||||
|
GetProcAddress(ntdll, "NtDelayExecution");
|
||||||
|
|
||||||
|
// Increase the timer resolution
|
||||||
|
ZwSetTimerResolution = (ZwSetTimerResolution_t)
|
||||||
|
GetProcAddress(ntdll, "ZwSetTimerResolution");
|
||||||
|
|
||||||
|
if (ZwSetTimerResolution)
|
||||||
|
{
|
||||||
|
ULONG actualResolution;
|
||||||
|
ZwSetTimerResolution(1, true, &actualResolution);
|
||||||
|
DEBUG_INFO("System timer resolution: %lu ns", actualResolution * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void delayExecution(float ms)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER interval = { .QuadPart = -1 * (int)(ms * 10000.0f) };
|
||||||
|
NtDelayExecution(FALSE, &interval);
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "windows/mousehook.h"
|
#include "windows/mousehook.h"
|
||||||
|
#include "windows/delay.h"
|
||||||
#include "common/windebug.h"
|
#include "common/windebug.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
@@ -31,8 +32,8 @@ struct mouseHook
|
|||||||
HHOOK hook;
|
HHOOK hook;
|
||||||
MouseHookFn callback;
|
MouseHookFn callback;
|
||||||
int x, y;
|
int x, y;
|
||||||
HANDLE event;
|
HANDLE event , updateEvent;
|
||||||
HANDLE thread;
|
HANDLE thread, updateThread;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mouseHook mouseHook = { 0 };
|
static struct mouseHook mouseHook = { 0 };
|
||||||
@@ -85,6 +86,31 @@ static VOID WINAPI winEventProc(HWINEVENTHOOK hWinEventHook, DWORD event,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD WINAPI updateThreadProc(LPVOID lParam)
|
||||||
|
{
|
||||||
|
HANDLE events[2] = {
|
||||||
|
mouseHook.event,
|
||||||
|
mouseHook.updateEvent
|
||||||
|
};
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
switch(WaitForMultipleObjects(2, events, FALSE, INFINITE))
|
||||||
|
{
|
||||||
|
case WAIT_OBJECT_0:
|
||||||
|
DEBUG_INFO("Mouse hook update thread received quit request");
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WAIT_OBJECT_0 + 1:
|
||||||
|
mouseHook.callback(mouseHook.x, mouseHook.y);
|
||||||
|
|
||||||
|
// limit this to 1000Hz, who has a mouse that updates faster anyway?
|
||||||
|
delayExecution(1.0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static DWORD WINAPI threadProc(LPVOID lParam) {
|
static DWORD WINAPI threadProc(LPVOID lParam) {
|
||||||
if (mouseHook.installed)
|
if (mouseHook.installed)
|
||||||
{
|
{
|
||||||
@@ -143,11 +169,28 @@ void mouseHook_install(MouseHookFn callback)
|
|||||||
mouseHook.event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
mouseHook.event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||||
if (!mouseHook.event)
|
if (!mouseHook.event)
|
||||||
{
|
{
|
||||||
DEBUG_WINERROR("Failed to create mouse hook uninstall event", GetLastError());
|
DEBUG_WINERROR("Failed to create mouse hook uninstall event",
|
||||||
|
GetLastError());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mouseHook.thread = CreateThread(NULL, 0, threadProc, callback, 0, NULL);
|
|
||||||
|
if (!mouseHook.updateEvent)
|
||||||
|
{
|
||||||
|
mouseHook.updateEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||||
|
if (!mouseHook.event)
|
||||||
|
{
|
||||||
|
DEBUG_WINERROR("Failed to create mouse hook update event",
|
||||||
|
GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mouseHook.thread =
|
||||||
|
CreateThread(NULL, 0, threadProc, callback, 0, NULL);
|
||||||
|
|
||||||
|
mouseHook.updateThread =
|
||||||
|
CreateThread(NULL, 0, updateThreadProc, 0, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseHook_remove(void)
|
void mouseHook_remove(void)
|
||||||
@@ -157,7 +200,9 @@ void mouseHook_remove(void)
|
|||||||
|
|
||||||
SetEvent(mouseHook.event);
|
SetEvent(mouseHook.event);
|
||||||
WaitForSingleObject(mouseHook.thread , INFINITE);
|
WaitForSingleObject(mouseHook.thread , INFINITE);
|
||||||
|
WaitForSingleObject(mouseHook.updateThread, INFINITE);
|
||||||
CloseHandle(mouseHook.thread);
|
CloseHandle(mouseHook.thread);
|
||||||
|
CloseHandle(mouseHook.updateThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI mouseHook_hook(int nCode, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI mouseHook_hook(int nCode, WPARAM wParam, LPARAM lParam)
|
||||||
@@ -169,7 +214,7 @@ static LRESULT WINAPI mouseHook_hook(int nCode, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
mouseHook.x = msg->pt.x;
|
mouseHook.x = msg->pt.x;
|
||||||
mouseHook.y = msg->pt.y;
|
mouseHook.y = msg->pt.y;
|
||||||
mouseHook.callback(msg->pt.x, msg->pt.y);
|
SetEvent(mouseHook.updateEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CallNextHookEx(mouseHook.hook, nCode, wParam, lParam);
|
return CallNextHookEx(mouseHook.hook, nCode, wParam, lParam);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
|
#include "windows/delay.h"
|
||||||
#include "windows/mousehook.h"
|
#include "windows/mousehook.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -61,10 +62,6 @@ struct AppState
|
|||||||
static struct AppState app = {0};
|
static struct AppState app = {0};
|
||||||
HWND MessageHWND;
|
HWND MessageHWND;
|
||||||
|
|
||||||
// undocumented API to adjust the system timer resolution (yes, its a nasty hack)
|
|
||||||
typedef NTSTATUS (__stdcall *ZwSetTimerResolution_t)(ULONG RequestedResolution, BOOLEAN Set, PULONG ActualResolution);
|
|
||||||
static ZwSetTimerResolution_t ZwSetTimerResolution = NULL;
|
|
||||||
|
|
||||||
// linux mingw64 is missing this
|
// linux mingw64 is missing this
|
||||||
#ifndef MSGFLT_RESET
|
#ifndef MSGFLT_RESET
|
||||||
#define MSGFLT_RESET (0)
|
#define MSGFLT_RESET (0)
|
||||||
@@ -513,14 +510,7 @@ bool app_init(void)
|
|||||||
// always flush stderr
|
// always flush stderr
|
||||||
setbuf(stderr, NULL);
|
setbuf(stderr, NULL);
|
||||||
|
|
||||||
// Increase the timer resolution
|
delayInit();
|
||||||
ZwSetTimerResolution = (ZwSetTimerResolution_t)GetProcAddress(GetModuleHandle("ntdll.dll"), "ZwSetTimerResolution");
|
|
||||||
if (ZwSetTimerResolution)
|
|
||||||
{
|
|
||||||
ULONG actualResolution;
|
|
||||||
ZwSetTimerResolution(1, true, &actualResolution);
|
|
||||||
DEBUG_INFO("System timer resolution: %.2f ns", (float)actualResolution / 100.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the performance frequency for spinlocks
|
// get the performance frequency for spinlocks
|
||||||
QueryPerformanceFrequency(&app.perfFreq);
|
QueryPerformanceFrequency(&app.perfFreq);
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
#include <common/version.h>
|
#include <common/version.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "common/debug.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#undef EXPORT
|
#undef EXPORT
|
||||||
#define EXPORT __declspec(dllexport)
|
#define EXPORT __declspec(dllexport)
|
||||||
@@ -38,6 +40,7 @@ extern struct obs_source_info lg_source;
|
|||||||
|
|
||||||
MODULE_EXPORT bool obs_module_load(void)
|
MODULE_EXPORT bool obs_module_load(void)
|
||||||
{
|
{
|
||||||
|
debug_init();
|
||||||
printf("Looking Glass OBS Client (%s)\n", BUILD_VERSION);
|
printf("Looking Glass OBS Client (%s)\n", BUILD_VERSION);
|
||||||
obs_register_source(&lg_source);
|
obs_register_source(&lg_source);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user