mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 14:03:40 +00:00
[client] core: added initial clipboard interface and x11 stubs
This commit is contained in:
parent
08bf01b649
commit
54e8cce33c
@ -57,6 +57,7 @@ set(SOURCES
|
|||||||
utils.c
|
utils.c
|
||||||
spice/rsa.c
|
spice/rsa.c
|
||||||
spice/spice.c
|
spice/spice.c
|
||||||
|
clipboard/x11.c
|
||||||
decoders/null.c
|
decoders/null.c
|
||||||
decoders/yuv420.c
|
decoders/yuv420.c
|
||||||
renderers/opengl.c
|
renderers/opengl.c
|
||||||
|
42
client/clipboard/x11.c
Normal file
42
client/clipboard/x11.c
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
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 "lg-clipboard.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
static const char * x11_cb_getName()
|
||||||
|
{
|
||||||
|
return "X11";
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool x11_cb_init()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void x11_cb_free()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const LG_Clipboard LGC_X11 =
|
||||||
|
{
|
||||||
|
.getName = x11_cb_getName,
|
||||||
|
.init = x11_cb_init,
|
||||||
|
.free = x11_cb_free
|
||||||
|
};
|
35
client/lg-clipboard.h
Normal file
35
client/lg-clipboard.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef const char * (* LG_ClipboardGetName)();
|
||||||
|
typedef bool (* LG_ClipboardInit)();
|
||||||
|
typedef void (* LG_ClipboardFree)();
|
||||||
|
|
||||||
|
typedef struct LG_Clipboard
|
||||||
|
{
|
||||||
|
LG_ClipboardGetName getName;
|
||||||
|
LG_ClipboardInit init;
|
||||||
|
LG_ClipboardFree free;
|
||||||
|
}
|
||||||
|
LG_Clipboard;
|
34
client/lg-clipboards.h
Normal file
34
client/lg-clipboards.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "lg-clipboard.h"
|
||||||
|
|
||||||
|
extern const LG_Clipboard LGC_X11;
|
||||||
|
|
||||||
|
const LG_Clipboard * LG_Clipboards[] =
|
||||||
|
{
|
||||||
|
&LGC_X11,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LG_CLIPBOARD_COUNT ((sizeof(LG_Clipboards) / sizeof(LG_Clipboard *)) - 1)
|
@ -42,6 +42,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "kb.h"
|
#include "kb.h"
|
||||||
|
|
||||||
#include "lg-renderers.h"
|
#include "lg-renderers.h"
|
||||||
|
#include "lg-clipboards.h"
|
||||||
|
|
||||||
struct AppState
|
struct AppState
|
||||||
{
|
{
|
||||||
@ -58,10 +59,12 @@ struct AppState
|
|||||||
float scaleX, scaleY;
|
float scaleX, scaleY;
|
||||||
float accX, accY;
|
float accX, accY;
|
||||||
|
|
||||||
const LG_Renderer * lgr ;
|
const LG_Renderer * lgr;
|
||||||
void * lgrData;
|
void * lgrData;
|
||||||
bool lgrResize;
|
bool lgrResize;
|
||||||
|
|
||||||
|
const LG_Clipboard * lgc;
|
||||||
|
|
||||||
SDL_Window * window;
|
SDL_Window * window;
|
||||||
int shmFD;
|
int shmFD;
|
||||||
struct KVMFRHeader * shm;
|
struct KVMFRHeader * shm;
|
||||||
@ -857,7 +860,6 @@ int run()
|
|||||||
if (try_renderer(i, lgrParams, &sdlFlags))
|
if (try_renderer(i, lgrParams, &sdlFlags))
|
||||||
{
|
{
|
||||||
state.lgr = LG_Renderers[i];
|
state.lgr = LG_Renderers[i];
|
||||||
DEBUG_INFO("Using: %s", state.lgr->get_name());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,6 +892,18 @@ int run()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// choose a clipboard api
|
||||||
|
for(unsigned int i = 0; i < LG_CLIPBOARD_COUNT; ++i)
|
||||||
|
{
|
||||||
|
const LG_Clipboard * cb = LG_Clipboards[i];
|
||||||
|
if (cb->init())
|
||||||
|
{
|
||||||
|
state.lgc = cb;
|
||||||
|
DEBUG_INFO("Using Clipboard: %s", cb->getName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params.fullscreen)
|
if (params.fullscreen)
|
||||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||||
|
|
||||||
@ -1104,6 +1118,9 @@ int run()
|
|||||||
if (state.lgr)
|
if (state.lgr)
|
||||||
state.lgr->deinitialize(state.lgrData);
|
state.lgr->deinitialize(state.lgrData);
|
||||||
|
|
||||||
|
if (state.lgc)
|
||||||
|
state.lgc->free();
|
||||||
|
|
||||||
if (state.window)
|
if (state.window)
|
||||||
SDL_DestroyWindow(state.window);
|
SDL_DestroyWindow(state.window);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user