mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 23:21:29 +00:00
[client] clipboard: add direct LGMP synchronization
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "main.h"
|
||||
#include "core.h"
|
||||
#include "util.h"
|
||||
#include "clipboard.h"
|
||||
#include "render_queue.h"
|
||||
#include "evdev.h"
|
||||
#include "input.h"
|
||||
@@ -349,35 +348,6 @@ void app_handleEnterEvent(bool entered)
|
||||
}
|
||||
}
|
||||
|
||||
void app_clipboardRelease(void)
|
||||
{
|
||||
lgClipboard_release();
|
||||
}
|
||||
|
||||
void app_clipboardNotifyTypes(const LG_ClipboardData types[], int count)
|
||||
{
|
||||
if (count < 0)
|
||||
return;
|
||||
lgClipboard_notifyTypes(types, (size_t)count);
|
||||
}
|
||||
|
||||
void app_clipboardData(LG_ClipboardRequest request,
|
||||
const LG_ClipboardData type, const void * data, size_t size)
|
||||
{
|
||||
lgClipboard_data(request, type, data, size);
|
||||
}
|
||||
|
||||
void app_clipboardAbort(LG_ClipboardRequest request)
|
||||
{
|
||||
lgClipboard_abort(request);
|
||||
}
|
||||
|
||||
bool app_clipboardRequest(LG_ClipboardData type,
|
||||
LG_ClipboardReplyFn replyFn, void * opaque)
|
||||
{
|
||||
return lgClipboard_request(type, replyFn, opaque);
|
||||
}
|
||||
|
||||
static int mapInputToImGuiButton(uint32_t button)
|
||||
{
|
||||
switch (button)
|
||||
|
||||
@@ -1761,6 +1761,11 @@ static bool requestClipboard(LG_ClipboardData type,
|
||||
|
||||
const bool queued = available &&
|
||||
ll_push(clipboard.requests, request);
|
||||
/* Publish the request before the provider can make it visible to its
|
||||
* worker. A provider event may otherwise reach the stream sink before the
|
||||
* caller has learned which request it belongs to. */
|
||||
if (queued && resultId)
|
||||
*resultId = id;
|
||||
bool result = queued;
|
||||
if (queued)
|
||||
result = clipboard.active.ops->request(clipboard.active.opaque,
|
||||
@@ -1769,20 +1774,14 @@ static bool requestClipboard(LG_ClipboardData type,
|
||||
LG_UNLOCK_SHARED(clipboard.activeLock);
|
||||
|
||||
if (result)
|
||||
{
|
||||
if (resultId)
|
||||
*resultId = id;
|
||||
return true;
|
||||
}
|
||||
if (queued)
|
||||
{
|
||||
ClipboardRequest * failed = takeRequest(id);
|
||||
if (!failed)
|
||||
{
|
||||
if (resultId)
|
||||
*resultId = id;
|
||||
return true;
|
||||
}
|
||||
if (resultId)
|
||||
*resultId = LG_CLIPBOARD_REQUEST_INVALID;
|
||||
freeRequest(failed);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,9 @@ LG_ClipboardResult lgClipboard_dataEnd(LG_ClipboardRequest request,
|
||||
void lgClipboard_data(LG_ClipboardRequest request,
|
||||
LG_ClipboardData type, const void * data, size_t size);
|
||||
void lgClipboard_abort(LG_ClipboardRequest request);
|
||||
/* request is published before provider dispatch. Its storage must remain
|
||||
* valid until this function returns and may be observed by stream callbacks
|
||||
* before then. */
|
||||
bool lgClipboard_requestStream(LG_ClipboardData type,
|
||||
const LG_ClipboardStreamOps * stream, void * opaque,
|
||||
LG_ClipboardRequest * request);
|
||||
|
||||
Reference in New Issue
Block a user