mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[client] wayland: bind xdg_activation_v1
when available
This commit is contained in:
parent
b13582a911
commit
4ee6bdf198
@ -23,6 +23,7 @@ else()
|
||||
endif()
|
||||
|
||||
add_library(displayserver_Wayland STATIC
|
||||
activation.c
|
||||
clipboard.c
|
||||
cursor.c
|
||||
gl.c
|
||||
|
42
client/displayservers/Wayland/activation.c
Normal file
42
client/displayservers/Wayland/activation.c
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* 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 "wayland.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
bool waylandActivationInit(void)
|
||||
{
|
||||
if (!wlWm.xdgActivation)
|
||||
DEBUG_WARN("xdg_activation_v1 not exported by compositor, will not be able "
|
||||
"to request host focus on behalf of guest applications");
|
||||
return true;
|
||||
}
|
||||
|
||||
void waylandActivationFree(void)
|
||||
{
|
||||
if (wlWm.xdgActivation)
|
||||
{
|
||||
xdg_activation_v1_destroy(wlWm.xdgActivation);
|
||||
}
|
||||
}
|
@ -72,6 +72,9 @@ static void registryGlobalHandler(void * data, struct wl_registry * registry,
|
||||
wlWm.xdgOutputManager = wl_registry_bind(wlWm.registry, name,
|
||||
// we only need v2 to run, but v3 saves a callback
|
||||
&zxdg_output_manager_v1_interface, version > 3 ? 3 : version);
|
||||
else if (!strcmp(interface, xdg_activation_v1_interface.name))
|
||||
wlWm.xdgActivation = wl_registry_bind(wlWm.registry, name,
|
||||
&xdg_activation_v1_interface, 1);
|
||||
}
|
||||
|
||||
static void registryGlobalRemoveHandler(void * data,
|
||||
|
@ -89,6 +89,9 @@ static bool waylandInit(const LG_DSInitParams params)
|
||||
if (!waylandRegistryInit())
|
||||
return false;
|
||||
|
||||
if (!waylandActivationInit())
|
||||
return false;
|
||||
|
||||
if (!waylandIdleInit())
|
||||
return false;
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "wayland-relative-pointer-unstable-v1-client-protocol.h"
|
||||
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h"
|
||||
#include "wayland-xdg-output-unstable-v1-client-protocol.h"
|
||||
#include "wayland-xdg-activation-v1-client-protocol.h"
|
||||
|
||||
typedef void (*WaylandPollCallback)(uint32_t events, void * opaque);
|
||||
|
||||
@ -180,6 +181,8 @@ struct WaylandDSState
|
||||
struct zwp_idle_inhibit_manager_v1 * idleInhibitManager;
|
||||
struct zwp_idle_inhibitor_v1 * idleInhibitor;
|
||||
|
||||
struct xdg_activation_v1 * xdgActivation;
|
||||
|
||||
struct wp_viewporter * viewporter;
|
||||
struct wp_viewport * viewport;
|
||||
struct zxdg_output_manager_v1 * xdgOutputManager;
|
||||
@ -231,6 +234,10 @@ struct WCBState
|
||||
extern struct WaylandDSState wlWm;
|
||||
extern struct WCBState wlCb;
|
||||
|
||||
// activation module
|
||||
bool waylandActivationInit(void);
|
||||
void waylandActivationFree(void);
|
||||
|
||||
// clipboard module
|
||||
bool waylandCBInit(void);
|
||||
void waylandCBRequest(LG_ClipboardData type);
|
||||
|
Loading…
Reference in New Issue
Block a user