mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-05-07 15:11:19 +00:00
[client] wayland: move wayland early init code out of main.c
This commit is contained in:
parent
bad25c409c
commit
9f74bb785e
@ -22,6 +22,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
@ -254,6 +255,28 @@ static const struct wl_seat_listener seatListener = {
|
|||||||
.name = seatNameHandler,
|
.name = seatNameHandler,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool waylandEarlyInit(void)
|
||||||
|
{
|
||||||
|
if (getenv("SDL_VIDEODRIVER") != NULL)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
int err = setenv("SDL_VIDEODRIVER", "wayland", 1);
|
||||||
|
if (err < 0)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Unable to set the env variable SDL_VIDEODRIVER: %d", err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
DEBUG_INFO("SDL_VIDEODRIVER has been set to wayland");
|
||||||
|
|
||||||
|
// Request to receive EPIPE instead of SIGPIPE when one end of a pipe
|
||||||
|
// disconnects while a write is pending. This is useful to the Wayland
|
||||||
|
// clipboard backend, where an arbitrary application is on the other end of
|
||||||
|
// that pipe.
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void waylandInit(SDL_SysWMinfo * info)
|
static void waylandInit(SDL_SysWMinfo * info)
|
||||||
{
|
{
|
||||||
memset(&wm, 0, sizeof(wm));
|
memset(&wm, 0, sizeof(wm));
|
||||||
@ -711,6 +734,7 @@ static void waylandCBRelease(void)
|
|||||||
struct LG_DisplayServerOps LGDS_Wayland =
|
struct LG_DisplayServerOps LGDS_Wayland =
|
||||||
{
|
{
|
||||||
.subsystem = SDL_SYSWM_WAYLAND,
|
.subsystem = SDL_SYSWM_WAYLAND,
|
||||||
|
.earlyInit = waylandEarlyInit,
|
||||||
.init = waylandInit,
|
.init = waylandInit,
|
||||||
.startup = waylandStartup,
|
.startup = waylandStartup,
|
||||||
.free = waylandFree,
|
.free = waylandFree,
|
||||||
|
@ -1712,12 +1712,6 @@ static int lg_run(void)
|
|||||||
signal(SIGINT , int_handler);
|
signal(SIGINT , int_handler);
|
||||||
signal(SIGTERM, int_handler);
|
signal(SIGTERM, int_handler);
|
||||||
|
|
||||||
// Request to receive EPIPE instead of SIGPIPE when one end of a pipe
|
|
||||||
// disconnects while a write is pending. This is useful to the Wayland
|
|
||||||
// clipboard backend, where an arbitrary application is on the other end of
|
|
||||||
// that pipe.
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
|
||||||
|
|
||||||
// try map the shared memory
|
// try map the shared memory
|
||||||
if (!ivshmemOpen(&g_state.shm))
|
if (!ivshmemOpen(&g_state.shm))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user