[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:
Tudor Brindus 2021-01-09 01:04:02 -05:00 committed by Geoffrey McRae
parent 8f4e0f6b50
commit a205515d91
4 changed files with 124 additions and 0 deletions

View File

@ -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.")

View File

@ -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)

View 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}
)

View 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
};