mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-24 23:56:26 +00:00
[client] core: new message event system to debounce window size events
This commit is contained in:
parent
4b11743f18
commit
852eb6bf69
@ -113,6 +113,7 @@ set(SOURCES
|
||||
src/main.c
|
||||
src/core.c
|
||||
src/app.c
|
||||
src/message.c
|
||||
src/audio.c
|
||||
src/config.c
|
||||
src/keybind.c
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "app.h"
|
||||
#include "util.h"
|
||||
#include "kb.h"
|
||||
#include "message.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "common/time.h"
|
||||
#include "common/debug.h"
|
||||
@ -188,18 +190,13 @@ bool core_warpPointer(int x, int y, bool exiting)
|
||||
return true;
|
||||
}
|
||||
|
||||
void core_updatePositionInfo(void)
|
||||
void core_onWindowSizeChanged(unsigned width, unsigned height)
|
||||
{
|
||||
if (g_state.pointerQueue &&
|
||||
g_state.kvmfrFeatures & KVMFR_FEATURE_WINDOWSIZE)
|
||||
{
|
||||
static unsigned lastW = 0, lastH = 0;
|
||||
if (lastW != g_state.windowW || lastH != g_state.windowH)
|
||||
{
|
||||
lastW = g_state.windowW;
|
||||
lastH = g_state.windowH;
|
||||
if (!g_state.pointerQueue)
|
||||
return;
|
||||
|
||||
const KVMFRWindowSize msg = {
|
||||
const KVMFRWindowSize msg =
|
||||
{
|
||||
.msg.type = KVMFR_MESSAGE_WINDOWSIZE,
|
||||
.w = g_state.windowW,
|
||||
.h = g_state.windowH
|
||||
@ -211,6 +208,21 @@ void core_updatePositionInfo(void)
|
||||
&msg, sizeof(msg), &serial)) != LGMP_OK)
|
||||
DEBUG_WARN("Message send failed: %s", lgmpStatusString(status));
|
||||
}
|
||||
|
||||
void core_updatePositionInfo(void)
|
||||
{
|
||||
if (g_state.kvmfrFeatures & KVMFR_FEATURE_WINDOWSIZE)
|
||||
{
|
||||
LGMsg msg =
|
||||
{
|
||||
.type = LG_MSG_WINDOWSIZE,
|
||||
.windowSize =
|
||||
{
|
||||
.width = g_state.windowW,
|
||||
.height = g_state.windowH
|
||||
}
|
||||
};
|
||||
lgMessage_post(&msg);
|
||||
}
|
||||
|
||||
if (!g_state.haveSrcSize)
|
||||
|
@ -29,6 +29,7 @@ void core_setCursorInView(bool enable);
|
||||
void core_setGrab(bool enable);
|
||||
void core_setGrabQuiet(bool enable);
|
||||
bool core_warpPointer(int x, int y, bool exiting);
|
||||
void core_onWindowSizeChanged(unsigned width, unsigned height);
|
||||
void core_updatePositionInfo(void);
|
||||
void core_alignToGuest(void);
|
||||
bool core_isValidPointerPos(int x, int y);
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "common/cpuinfo.h"
|
||||
#include "common/ll.h"
|
||||
|
||||
#include "message.h"
|
||||
#include "core.h"
|
||||
#include "app.h"
|
||||
#include "audio.h"
|
||||
@ -1756,6 +1757,7 @@ restart:
|
||||
g_state.state = APP_STATE_RESTART;
|
||||
break;
|
||||
}
|
||||
lgMessage_process();
|
||||
g_state.ds->wait(100);
|
||||
}
|
||||
|
||||
@ -1872,6 +1874,9 @@ int main(int argc, char * argv[])
|
||||
egl_dynProcsInit();
|
||||
gl_dynProcsInit();
|
||||
|
||||
if (!lgMessage_init())
|
||||
return -1;
|
||||
|
||||
g_state.bindings = ll_new();
|
||||
|
||||
g_state.overlays = ll_new();
|
||||
@ -1902,6 +1907,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
const int ret = lg_run();
|
||||
lg_shutdown();
|
||||
lgMessage_deinit();
|
||||
|
||||
config_free();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user