mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] clipboard/wayland: implement a no-op Wayland clipboard
Build scaffolding only; implementation in later commits. Co-authored-by: Quantum <quantum2048@gmail.com>
This commit is contained in:
parent
8f4e0f6b50
commit
a205515d91
@ -24,6 +24,9 @@ add_feature_info(ENABLE_EGL ENABLE_EGL "EGL renderer.")
|
||||
option(ENABLE_CB_X11 "Enable X11 clipboard integration" ON)
|
||||
add_feature_info(ENABLE_CB_X11 ENABLE_CB_X11 "X11 Clipboard Integration.")
|
||||
|
||||
option(ENABLE_CB_WAYLAND "Enable Wayland clipboard integration" ON)
|
||||
add_feature_info(ENABLE_CB_WAYLAND ENABLE_CB_WAYLAND "Wayland Clipboard Integration.")
|
||||
|
||||
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
||||
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
||||
|
||||
|
@ -23,6 +23,10 @@ if (ENABLE_CB_X11)
|
||||
add_clipboard(X11)
|
||||
endif()
|
||||
|
||||
if (ENABLE_CB_WAYLAND)
|
||||
add_clipboard(Wayland)
|
||||
endif()
|
||||
|
||||
list(REMOVE_AT CLIPBOARDS 0)
|
||||
list(REMOVE_AT CLIPBOARDS_LINK 0)
|
||||
|
||||
|
25
client/clipboards/Wayland/CMakeLists.txt
Normal file
25
client/clipboards/Wayland/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(clipboard_Wayland LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(CLIPBOARD_PKGCONFIG REQUIRED
|
||||
wayland-client
|
||||
)
|
||||
|
||||
add_library(clipboard_Wayland STATIC
|
||||
src/wayland.c
|
||||
)
|
||||
|
||||
target_link_libraries(clipboard_Wayland
|
||||
${CLIPBOARD_PKGCONFIG_LIBRARIES}
|
||||
lg_common
|
||||
)
|
||||
|
||||
target_include_directories(clipboard_Wayland
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
src
|
||||
${CLIPBOARD_PKGCONFIG_INCLUDE_DIRS}
|
||||
)
|
92
client/clipboards/Wayland/src/wayland.c
Normal file
92
client/clipboards/Wayland/src/wayland.c
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
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 "interface/clipboard.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
struct state
|
||||
{
|
||||
LG_ClipboardReleaseFn releaseFn;
|
||||
LG_ClipboardRequestFn requestFn;
|
||||
LG_ClipboardNotifyFn notifyFn;
|
||||
LG_ClipboardDataFn dataFn;
|
||||
LG_ClipboardData type;
|
||||
};
|
||||
|
||||
static struct state * this = NULL;
|
||||
|
||||
static const char * wayland_cb_getName()
|
||||
{
|
||||
return "Wayland";
|
||||
}
|
||||
|
||||
static bool wayland_cb_init(
|
||||
SDL_SysWMinfo * wminfo,
|
||||
LG_ClipboardReleaseFn releaseFn,
|
||||
LG_ClipboardNotifyFn notifyFn,
|
||||
LG_ClipboardDataFn dataFn)
|
||||
{
|
||||
if (wminfo->subsystem != SDL_SYSWM_WAYLAND)
|
||||
{
|
||||
DEBUG_ERROR("wrong subsystem");
|
||||
return false;
|
||||
}
|
||||
|
||||
this = (struct state *)malloc(sizeof(struct state));
|
||||
memset(this, 0, sizeof(struct state));
|
||||
|
||||
this->releaseFn = releaseFn;
|
||||
this->notifyFn = notifyFn;
|
||||
this->dataFn = dataFn;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void wayland_cb_free()
|
||||
{
|
||||
free(this);
|
||||
this = NULL;
|
||||
}
|
||||
|
||||
static void wayland_cb_wmevent(SDL_SysWMmsg * msg)
|
||||
{
|
||||
}
|
||||
|
||||
static void wayland_cb_notice(LG_ClipboardRequestFn requestFn, LG_ClipboardData type)
|
||||
{
|
||||
}
|
||||
|
||||
static void wayland_cb_release()
|
||||
{
|
||||
this->requestFn = NULL;
|
||||
}
|
||||
|
||||
static void wayland_cb_request(LG_ClipboardData type)
|
||||
{
|
||||
}
|
||||
|
||||
const LG_Clipboard LGC_Wayland =
|
||||
{
|
||||
.getName = wayland_cb_getName,
|
||||
.init = wayland_cb_init,
|
||||
.free = wayland_cb_free,
|
||||
.wmevent = wayland_cb_wmevent,
|
||||
.notice = wayland_cb_notice,
|
||||
.release = wayland_cb_release,
|
||||
.request = wayland_cb_request
|
||||
};
|
Loading…
Reference in New Issue
Block a user