mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] clipboard: try each clipboard until one initializes
Previously, main.c would segfault at runtime if clipboards were disabled via cmake flags, as the clipboards array would be empty but still indexed during initialization. Co-authored-by: Quantum <quantum2048@gmail.com>
This commit is contained in:
parent
2627381021
commit
bf223158d0
@ -398,7 +398,6 @@ static bool wayland_cb_init(
|
||||
{
|
||||
if (wminfo->subsystem != SDL_SYSWM_WAYLAND)
|
||||
{
|
||||
DEBUG_ERROR("wrong subsystem");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,6 @@ static bool x11_cb_init(
|
||||
// final sanity check
|
||||
if (wminfo->subsystem != SDL_SYSWM_X11)
|
||||
{
|
||||
DEBUG_ERROR("wrong subsystem");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2025,29 +2025,26 @@ static int lg_run()
|
||||
(unsigned char *)&value,
|
||||
1
|
||||
);
|
||||
|
||||
g_state.lgc = LG_Clipboards[0];
|
||||
}
|
||||
else if (g_state.wminfo.subsystem == SDL_SYSWM_WAYLAND)
|
||||
{
|
||||
g_state.lgc = LG_Clipboards[1];
|
||||
}
|
||||
} else {
|
||||
DEBUG_ERROR("Could not get SDL window information %s", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (LG_Clipboard ** clipboard = LG_Clipboards; *clipboard; clipboard++)
|
||||
if ((*clipboard)->init(&g_state.wminfo, clipboardRelease, clipboardNotify, clipboardData))
|
||||
{
|
||||
g_state.lgc = *clipboard;
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_state.lgc)
|
||||
{
|
||||
DEBUG_INFO("Using Clipboard: %s", g_state.lgc->getName());
|
||||
if (!g_state.lgc->init(&g_state.wminfo, clipboardRelease, clipboardNotify, clipboardData))
|
||||
{
|
||||
DEBUG_WARN("Failed to initialize the clipboard interface, continuing anyway");
|
||||
g_state.lgc = NULL;
|
||||
}
|
||||
|
||||
g_state.cbRequestList = ll_new();
|
||||
}
|
||||
else
|
||||
DEBUG_WARN("Failed to initialize the clipboard interface, continuing anyway");
|
||||
|
||||
initSDLCursor();
|
||||
if (params.hideMouse)
|
||||
|
Loading…
Reference in New Issue
Block a user