mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[client] more cleanup and added alerts for new events
This commit is contained in:
parent
5d254c7751
commit
35094a57cb
@ -72,6 +72,7 @@ link_libraries(
|
|||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/main.c
|
src/main.c
|
||||||
|
src/app.c
|
||||||
src/lg-renderer.c
|
src/lg-renderer.c
|
||||||
src/ll.c
|
src/ll.c
|
||||||
src/utils.c
|
src/utils.c
|
||||||
|
@ -21,9 +21,26 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
|
typedef enum LG_MsgAlert
|
||||||
|
{
|
||||||
|
LG_ALERT_INFO ,
|
||||||
|
LG_ALERT_SUCCESS,
|
||||||
|
LG_ALERT_WARNING,
|
||||||
|
LG_ALERT_ERROR
|
||||||
|
}
|
||||||
|
LG_MsgAlert;
|
||||||
|
|
||||||
typedef struct KeybindHandle * KeybindHandle;
|
typedef struct KeybindHandle * KeybindHandle;
|
||||||
typedef void (*SuperEventFn)(SDL_Scancode key, void * opaque);
|
typedef void (*SuperEventFn)(SDL_Scancode key, void * opaque);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show an alert on screen
|
||||||
|
* @param type The alert type
|
||||||
|
* param fmt The alert message format
|
||||||
|
@ param ... formatted message values
|
||||||
|
*/
|
||||||
|
void app_alert(LG_MsgAlert type, const char * fmt, ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a handler for the <super>+<key> combination
|
* Register a handler for the <super>+<key> combination
|
||||||
* @param key The scancode to register
|
* @param key The scancode to register
|
||||||
|
@ -24,6 +24,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <SDL2/SDL_ttf.h>
|
#include <SDL2/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "app.h"
|
||||||
#include "KVMFR.h"
|
#include "KVMFR.h"
|
||||||
|
|
||||||
#define IS_LG_RENDERER_VALID(x) \
|
#define IS_LG_RENDERER_VALID(x) \
|
||||||
@ -98,15 +99,6 @@ typedef enum LG_RendererCursor
|
|||||||
}
|
}
|
||||||
LG_RendererCursor;
|
LG_RendererCursor;
|
||||||
|
|
||||||
typedef enum LG_RendererOnAlert
|
|
||||||
{
|
|
||||||
LG_ALERT_INFO ,
|
|
||||||
LG_ALERT_SUCCESS,
|
|
||||||
LG_ALERT_WARNING,
|
|
||||||
LG_ALERT_ERROR
|
|
||||||
}
|
|
||||||
LG_RendererAlert;
|
|
||||||
|
|
||||||
typedef const char * (* LG_RendererGetName )();
|
typedef const char * (* LG_RendererGetName )();
|
||||||
typedef bool (* LG_RendererCreate )(void ** opaque, const LG_RendererParams params);
|
typedef bool (* LG_RendererCreate )(void ** opaque, const LG_RendererParams params);
|
||||||
typedef bool (* LG_RendererInitialize )(void * opaque, Uint32 * sdlFlags);
|
typedef bool (* LG_RendererInitialize )(void * opaque, Uint32 * sdlFlags);
|
||||||
@ -115,7 +107,7 @@ typedef void (* LG_RendererOnResize )(void * opaque, const int width,
|
|||||||
typedef bool (* LG_RendererOnMouseShape)(void * opaque, const LG_RendererCursor cursor, const int width, const int height, const int pitch, const uint8_t * data);
|
typedef bool (* LG_RendererOnMouseShape)(void * opaque, const LG_RendererCursor cursor, const int width, const int height, const int pitch, const uint8_t * data);
|
||||||
typedef bool (* LG_RendererOnMouseEvent)(void * opaque, const bool visible , const int x, const int y);
|
typedef bool (* LG_RendererOnMouseEvent)(void * opaque, const bool visible , const int x, const int y);
|
||||||
typedef bool (* LG_RendererOnFrameEvent)(void * opaque, const LG_RendererFormat format, const uint8_t * data);
|
typedef bool (* LG_RendererOnFrameEvent)(void * opaque, const LG_RendererFormat format, const uint8_t * data);
|
||||||
typedef void (* LG_RendererOnAlert )(void * opaque, const LG_RendererAlert alert, const char * message, bool ** closeFlag);
|
typedef void (* LG_RendererOnAlert )(void * opaque, const LG_MsgAlert alert, const char * message, bool ** closeFlag);
|
||||||
typedef bool (* LG_RendererRender )(void * opaque, SDL_Window *window);
|
typedef bool (* LG_RendererRender )(void * opaque, SDL_Window *window);
|
||||||
typedef void (* LG_RendererUpdateFPS )(void * opaque, const float avgUPS, const float avgFPS);
|
typedef void (* LG_RendererUpdateFPS )(void * opaque, const float avgUPS, const float avgFPS);
|
||||||
|
|
||||||
|
@ -130,6 +130,8 @@ void egl_desktop_toggle_nv(SDL_Scancode key, void * opaque)
|
|||||||
EGL_Desktop * desktop = (EGL_Desktop *)opaque;
|
EGL_Desktop * desktop = (EGL_Desktop *)opaque;
|
||||||
if (++desktop->nvGain == 4)
|
if (++desktop->nvGain == 4)
|
||||||
desktop->nvGain = 0;
|
desktop->nvGain = 0;
|
||||||
|
|
||||||
|
app_alert(LG_ALERT_INFO, "Screen Gain +%d", desktop->nvGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void egl_desktop_free(EGL_Desktop ** desktop)
|
void egl_desktop_free(EGL_Desktop ** desktop)
|
||||||
|
@ -251,7 +251,7 @@ bool egl_on_frame_event(void * opaque, const LG_RendererFormat format, const uin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void egl_on_alert(void * opaque, const LG_RendererAlert alert, const char * message, bool ** closeFlag)
|
void egl_on_alert(void * opaque, const LG_MsgAlert alert, const char * message, bool ** closeFlag)
|
||||||
{
|
{
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ bool opengl_on_frame_event(void * opaque, const LG_RendererFormat format, const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void opengl_on_alert(void * opaque, const LG_RendererAlert alert, const char * message, bool ** closeFlag)
|
void opengl_on_alert(void * opaque, const LG_MsgAlert alert, const char * message, bool ** closeFlag)
|
||||||
{
|
{
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
struct Alert * a = malloc(sizeof(struct Alert));
|
struct Alert * a = malloc(sizeof(struct Alert));
|
||||||
|
75
client/src/app.c
Normal file
75
client/src/app.c
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||||
|
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
https://looking-glass.hostfission.com
|
||||||
|
|
||||||
|
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 "main.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
void app_alert(LG_MsgAlert type, const char * fmt, ...)
|
||||||
|
{
|
||||||
|
if (!state.lgr || params.disableAlerts)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
const int length = vsnprintf(NULL, 0, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
char *buffer = malloc(length + 1);
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf(buffer, length + 1, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
state.lgr->on_alert(
|
||||||
|
state.lgrData,
|
||||||
|
type,
|
||||||
|
buffer,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
KeybindHandle app_register_keybind(SDL_Scancode key, SuperEventFn callback, void * opaque)
|
||||||
|
{
|
||||||
|
// don't allow duplicate binds
|
||||||
|
if (state.bindings[key])
|
||||||
|
{
|
||||||
|
DEBUG_INFO("Key already bound");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeybindHandle handle = (KeybindHandle)malloc(sizeof(struct KeybindHandle));
|
||||||
|
handle->key = key;
|
||||||
|
handle->callback = callback;
|
||||||
|
handle->opaque = opaque;
|
||||||
|
|
||||||
|
state.bindings[key] = handle;
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void app_release_keybind(KeybindHandle * handle)
|
||||||
|
{
|
||||||
|
if (!handle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
state.bindings[(*handle)->key] = NULL;
|
||||||
|
free(*handle);
|
||||||
|
*handle = NULL;
|
||||||
|
}
|
@ -17,9 +17,10 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include <SDL2/SDL_syswm.h>
|
#include <SDL2/SDL_syswm.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -38,100 +39,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "KVMFR.h"
|
#include "KVMFR.h"
|
||||||
#include "spice/spice.h"
|
|
||||||
#include "kb.h"
|
#include "kb.h"
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
|
|
||||||
#include "dynamic/renderers.h"
|
// forwards
|
||||||
#include "dynamic/clipboards.h"
|
static int cursorThread(void * unused);
|
||||||
|
static int renderThread(void * unused);
|
||||||
#include "interface/app.h"
|
static int frameThread (void * unused);
|
||||||
|
|
||||||
struct AppState
|
|
||||||
{
|
|
||||||
bool running;
|
|
||||||
bool ignoreInput;
|
|
||||||
bool escapeActive;
|
|
||||||
SDL_Scancode escapeAction;
|
|
||||||
KeybindHandle bindings[SDL_NUM_SCANCODES];
|
|
||||||
bool keyDown[SDL_NUM_SCANCODES];
|
|
||||||
|
|
||||||
bool haveSrcSize;
|
|
||||||
int windowW, windowH;
|
|
||||||
SDL_Point srcSize;
|
|
||||||
LG_RendererRect dstRect;
|
|
||||||
SDL_Point cursor;
|
|
||||||
bool cursorVisible;
|
|
||||||
bool haveCursorPos;
|
|
||||||
float scaleX, scaleY;
|
|
||||||
float accX, accY;
|
|
||||||
|
|
||||||
const LG_Renderer * lgr;
|
|
||||||
void * lgrData;
|
|
||||||
bool lgrResize;
|
|
||||||
|
|
||||||
const LG_Clipboard * lgc;
|
|
||||||
SpiceDataType cbType;
|
|
||||||
struct ll * cbRequestList;
|
|
||||||
|
|
||||||
SDL_Window * window;
|
|
||||||
int shmFD;
|
|
||||||
struct KVMFRHeader * shm;
|
|
||||||
unsigned int shmSize;
|
|
||||||
|
|
||||||
uint64_t frameTime;
|
|
||||||
uint64_t lastFrameTime;
|
|
||||||
uint64_t renderTime;
|
|
||||||
uint64_t frameCount;
|
|
||||||
uint64_t renderCount;
|
|
||||||
|
|
||||||
KeybindHandle kbFS;
|
|
||||||
KeybindHandle kbInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct RenderOpts
|
|
||||||
{
|
|
||||||
unsigned int size;
|
|
||||||
unsigned int argc;
|
|
||||||
LG_RendererOptValue * argv;
|
|
||||||
}
|
|
||||||
RendererOpts;
|
|
||||||
|
|
||||||
struct AppParams
|
|
||||||
{
|
|
||||||
const char * configFile;
|
|
||||||
bool autoResize;
|
|
||||||
bool allowResize;
|
|
||||||
bool keepAspect;
|
|
||||||
bool borderless;
|
|
||||||
bool fullscreen;
|
|
||||||
bool center;
|
|
||||||
int x, y;
|
|
||||||
unsigned int w, h;
|
|
||||||
char * shmFile;
|
|
||||||
unsigned int shmSize;
|
|
||||||
unsigned int fpsLimit;
|
|
||||||
bool showFPS;
|
|
||||||
bool useSpiceInput;
|
|
||||||
bool useSpiceClipboard;
|
|
||||||
char * spiceHost;
|
|
||||||
unsigned int spicePort;
|
|
||||||
bool clipboardToVM;
|
|
||||||
bool clipboardToLocal;
|
|
||||||
bool scaleMouseInput;
|
|
||||||
bool hideMouse;
|
|
||||||
bool ignoreQuit;
|
|
||||||
bool allowScreensaver;
|
|
||||||
bool grabKeyboard;
|
|
||||||
SDL_Scancode escapeKey;
|
|
||||||
bool disableAlerts;
|
|
||||||
|
|
||||||
bool forceRenderer;
|
|
||||||
unsigned int forceRendererIndex;
|
|
||||||
RendererOpts rendererOpts[LG_RENDERER_COUNT];
|
|
||||||
|
|
||||||
char * windowTitle;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct AppState state;
|
struct AppState state;
|
||||||
struct AppParams params =
|
struct AppParams params =
|
||||||
@ -162,31 +76,12 @@ struct AppParams params =
|
|||||||
.ignoreQuit = false,
|
.ignoreQuit = false,
|
||||||
.allowScreensaver = true,
|
.allowScreensaver = true,
|
||||||
.grabKeyboard = true,
|
.grabKeyboard = true,
|
||||||
.escapeKey = SDL_SCANCODE_SCROLLLOCK,
|
.escapeKey = SDL_SCANCODE_SCROLLLOCK,
|
||||||
.disableAlerts = false,
|
.disableAlerts = false,
|
||||||
.forceRenderer = false,
|
.forceRenderer = false,
|
||||||
.windowTitle = "Looking Glass (Client)"
|
.windowTitle = "Looking Glass (Client)"
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CBRequest
|
|
||||||
{
|
|
||||||
SpiceDataType type;
|
|
||||||
LG_ClipboardReplyFn replyFn;
|
|
||||||
void * opaque;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct KeybindHandle
|
|
||||||
{
|
|
||||||
SDL_Scancode key;
|
|
||||||
SuperEventFn callback;
|
|
||||||
void * opaque;
|
|
||||||
};
|
|
||||||
|
|
||||||
// forwards
|
|
||||||
static int cursorThread(void * unused);
|
|
||||||
static int renderThread(void * unused);
|
|
||||||
static int frameThread (void * unused);
|
|
||||||
|
|
||||||
static void updatePositionInfo()
|
static void updatePositionInfo()
|
||||||
{
|
{
|
||||||
if (state.haveSrcSize)
|
if (state.haveSrcSize)
|
||||||
@ -853,13 +748,10 @@ int eventFilter(void * userdata, SDL_Event * event)
|
|||||||
SDL_SetWindowGrab(state.window, serverMode);
|
SDL_SetWindowGrab(state.window, serverMode);
|
||||||
DEBUG_INFO("Server Mode: %s", serverMode ? "on" : "off");
|
DEBUG_INFO("Server Mode: %s", serverMode ? "on" : "off");
|
||||||
|
|
||||||
if (state.lgr && !params.disableAlerts)
|
app_alert(
|
||||||
state.lgr->on_alert(
|
serverMode ? LG_ALERT_SUCCESS : LG_ALERT_WARNING,
|
||||||
state.lgrData,
|
serverMode ? "Capture Enabled" : "Capture Disabled"
|
||||||
serverMode ? LG_ALERT_SUCCESS : LG_ALERT_WARNING,
|
);
|
||||||
serverMode ? "Capture Enabled" : "Capture Disabled",
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!serverMode)
|
if (!serverMode)
|
||||||
realignGuest = true;
|
realignGuest = true;
|
||||||
@ -1028,6 +920,10 @@ static void toggle_fullscreen(SDL_Scancode key, void * opaque)
|
|||||||
static void toggle_input(SDL_Scancode key, void * opaque)
|
static void toggle_input(SDL_Scancode key, void * opaque)
|
||||||
{
|
{
|
||||||
state.ignoreInput = !state.ignoreInput;
|
state.ignoreInput = !state.ignoreInput;
|
||||||
|
app_alert(
|
||||||
|
LG_ALERT_INFO,
|
||||||
|
state.ignoreInput ? "Input Disabled" : "Input Enabled"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void register_key_binds()
|
static void register_key_binds()
|
||||||
@ -1462,8 +1358,8 @@ void doHelp(char * app)
|
|||||||
params.w,
|
params.w,
|
||||||
params.h,
|
params.h,
|
||||||
params.escapeKey,
|
params.escapeKey,
|
||||||
params.disableAlerts ? "disabled" : "enabled",
|
SDL_GetScancodeName(params.escapeKey),
|
||||||
SDL_GetScancodeName(params.escapeKey)
|
params.disableAlerts ? "disabled" : "enabled"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2001,31 +1897,3 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeybindHandle app_register_keybind(SDL_Scancode key, SuperEventFn callback, void * opaque)
|
|
||||||
{
|
|
||||||
// don't allow duplicate binds
|
|
||||||
if (state.bindings[key])
|
|
||||||
{
|
|
||||||
DEBUG_INFO("Key already bound");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
KeybindHandle handle = (KeybindHandle)malloc(sizeof(struct KeybindHandle));
|
|
||||||
handle->key = key;
|
|
||||||
handle->callback = callback;
|
|
||||||
handle->opaque = opaque;
|
|
||||||
|
|
||||||
state.bindings[key] = handle;
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_release_keybind(KeybindHandle * handle)
|
|
||||||
{
|
|
||||||
if (!handle)
|
|
||||||
return;
|
|
||||||
|
|
||||||
state.bindings[(*handle)->key] = NULL;
|
|
||||||
free(*handle);
|
|
||||||
*handle = NULL;
|
|
||||||
}
|
|
131
client/src/main.h
Normal file
131
client/src/main.h
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||||
|
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
https://looking-glass.hostfission.com
|
||||||
|
|
||||||
|
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 <stdbool.h>
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
|
#include "interface/app.h"
|
||||||
|
#include "dynamic/renderers.h"
|
||||||
|
#include "dynamic/clipboards.h"
|
||||||
|
|
||||||
|
#include "spice/spice.h"
|
||||||
|
|
||||||
|
struct AppState
|
||||||
|
{
|
||||||
|
bool running;
|
||||||
|
bool ignoreInput;
|
||||||
|
bool escapeActive;
|
||||||
|
SDL_Scancode escapeAction;
|
||||||
|
KeybindHandle bindings[SDL_NUM_SCANCODES];
|
||||||
|
bool keyDown[SDL_NUM_SCANCODES];
|
||||||
|
|
||||||
|
bool haveSrcSize;
|
||||||
|
int windowW, windowH;
|
||||||
|
SDL_Point srcSize;
|
||||||
|
LG_RendererRect dstRect;
|
||||||
|
SDL_Point cursor;
|
||||||
|
bool cursorVisible;
|
||||||
|
bool haveCursorPos;
|
||||||
|
float scaleX, scaleY;
|
||||||
|
float accX, accY;
|
||||||
|
|
||||||
|
const LG_Renderer * lgr;
|
||||||
|
void * lgrData;
|
||||||
|
bool lgrResize;
|
||||||
|
|
||||||
|
const LG_Clipboard * lgc;
|
||||||
|
SpiceDataType cbType;
|
||||||
|
struct ll * cbRequestList;
|
||||||
|
|
||||||
|
SDL_Window * window;
|
||||||
|
int shmFD;
|
||||||
|
struct KVMFRHeader * shm;
|
||||||
|
unsigned int shmSize;
|
||||||
|
|
||||||
|
uint64_t frameTime;
|
||||||
|
uint64_t lastFrameTime;
|
||||||
|
uint64_t renderTime;
|
||||||
|
uint64_t frameCount;
|
||||||
|
uint64_t renderCount;
|
||||||
|
|
||||||
|
KeybindHandle kbFS;
|
||||||
|
KeybindHandle kbInput;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct RenderOpts
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
unsigned int argc;
|
||||||
|
LG_RendererOptValue * argv;
|
||||||
|
}
|
||||||
|
RendererOpts;
|
||||||
|
|
||||||
|
struct AppParams
|
||||||
|
{
|
||||||
|
const char * configFile;
|
||||||
|
bool autoResize;
|
||||||
|
bool allowResize;
|
||||||
|
bool keepAspect;
|
||||||
|
bool borderless;
|
||||||
|
bool fullscreen;
|
||||||
|
bool center;
|
||||||
|
int x, y;
|
||||||
|
unsigned int w, h;
|
||||||
|
char * shmFile;
|
||||||
|
unsigned int shmSize;
|
||||||
|
unsigned int fpsLimit;
|
||||||
|
bool showFPS;
|
||||||
|
bool useSpiceInput;
|
||||||
|
bool useSpiceClipboard;
|
||||||
|
char * spiceHost;
|
||||||
|
unsigned int spicePort;
|
||||||
|
bool clipboardToVM;
|
||||||
|
bool clipboardToLocal;
|
||||||
|
bool scaleMouseInput;
|
||||||
|
bool hideMouse;
|
||||||
|
bool ignoreQuit;
|
||||||
|
bool allowScreensaver;
|
||||||
|
bool grabKeyboard;
|
||||||
|
SDL_Scancode escapeKey;
|
||||||
|
bool disableAlerts;
|
||||||
|
|
||||||
|
bool forceRenderer;
|
||||||
|
unsigned int forceRendererIndex;
|
||||||
|
RendererOpts rendererOpts[LG_RENDERER_COUNT];
|
||||||
|
|
||||||
|
char * windowTitle;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBRequest
|
||||||
|
{
|
||||||
|
SpiceDataType type;
|
||||||
|
LG_ClipboardReplyFn replyFn;
|
||||||
|
void * opaque;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct KeybindHandle
|
||||||
|
{
|
||||||
|
SDL_Scancode key;
|
||||||
|
SuperEventFn callback;
|
||||||
|
void * opaque;
|
||||||
|
};
|
||||||
|
|
||||||
|
// forwards
|
||||||
|
extern struct AppState state;
|
||||||
|
extern struct AppParams params;
|
Loading…
Reference in New Issue
Block a user