Sfoglia il codice sorgente

Create all Atoms in a central place

tags/v1.7.90
Pierre Ossman 8 anni fa
parent
commit
e4be5cc098
1 ha cambiato i file con 13 aggiunte e 17 eliminazioni
  1. 13
    17
      unix/xserver/hw/vnc/vncSelection.c

+ 13
- 17
unix/xserver/hw/vnc/vncSelection.c Vedi File

@@ -41,6 +41,9 @@
#define LOG_INFO(...) vncLogInfo(LOG_NAME, __VA_ARGS__)
#define LOG_DEBUG(...) vncLogDebug(LOG_NAME, __VA_ARGS__)

static Atom xaPRIMARY, xaCLIPBOARD;
static Atom xaTARGETS, xaTIMESTAMP, xaSTRING, xaTEXT;

static WindowPtr pWindow;
static Window wid;

@@ -59,6 +62,14 @@ static int (*origProcSendEvent)(ClientPtr);

void vncSelectionInit(void)
{
xaPRIMARY = MakeAtom("PRIMARY", 7, TRUE);
xaCLIPBOARD = MakeAtom("CLIPBOARD", 9, TRUE);

xaTARGETS = MakeAtom("TARGETS", 7, TRUE);
xaTIMESTAMP = MakeAtom("TIMESTAMP", 9, TRUE);
xaSTRING = MakeAtom("STRING", 6, TRUE);
xaTEXT = MakeAtom("TEXT", 4, TRUE);

/* There are no hooks for when these are internal windows, so
* override the relevant handlers. */
origProcConvertSelection = ProcVector[X_ConvertSelection];
@@ -87,10 +98,10 @@ void vncClientCutText(const char* str, int len)
memcpy(clientCutText, str, len);
clientCutTextLen = len;

rc = vncOwnSelection(MakeAtom("PRIMARY", 7, TRUE));
rc = vncOwnSelection(xaPRIMARY);
if (rc != Success)
LOG_ERROR("Could not set PRIMARY selection");
vncOwnSelection(MakeAtom("CLIPBOARD", 9, TRUE));
vncOwnSelection(xaCLIPBOARD);
if (rc != Success)
LOG_ERROR("Could not set CLIPBOARD selection");
}
@@ -186,7 +197,6 @@ static int vncConvertSelection(ClientPtr client, Atom selection,
WindowPtr pWin;
int rc;

Atom xaTARGETS, xaTIMESTAMP, xaSTRING, xaTEXT;
Atom realProperty;

xEvent event;
@@ -212,11 +222,6 @@ static int vncConvertSelection(ClientPtr client, Atom selection,

/* FIXME: MULTIPLE target */

xaTARGETS = MakeAtom("TARGETS", 7, TRUE);
xaTIMESTAMP = MakeAtom("TIMESTAMP", 9, TRUE);
xaSTRING = MakeAtom("STRING", 6, TRUE);
xaTEXT = MakeAtom("TEXT", 4, TRUE);

if (target == xaTARGETS) {
Atom targets[] = { xaTARGETS, xaTIMESTAMP, xaSTRING, xaTEXT };

@@ -305,7 +310,6 @@ static void vncHandleSelection(Atom selection, Atom target,
Atom property, Atom requestor,
TimeStamp time)
{
Atom xaSTRING;
PropertyPtr prop;
int rc;

@@ -313,8 +317,6 @@ static void vncHandleSelection(Atom selection, Atom target,
NameForAtom(selection), NameForAtom(target),
NameForAtom(property));

xaSTRING = MakeAtom("STRING", 6, TRUE);

if (target != xaSTRING)
return;
if (property != xaSTRING)
@@ -361,7 +363,6 @@ static void vncSelectionCallback(CallbackListPtr *callbacks,
{
SelectionInfoRec *info = (SelectionInfoRec *) args;

Atom xaPRIMARY, xaCLIPBOARD, xaSTRING;
xEvent event;
int rc;

@@ -370,9 +371,6 @@ static void vncSelectionCallback(CallbackListPtr *callbacks,
if (info->client == serverClient)
return;

xaPRIMARY = MakeAtom("PRIMARY", 7, TRUE);
xaCLIPBOARD = MakeAtom("CLIPBOARD", 9, TRUE);

if ((info->selection->selection != xaPRIMARY) &&
(info->selection->selection != xaCLIPBOARD))
return;
@@ -388,8 +386,6 @@ static void vncSelectionCallback(CallbackListPtr *callbacks,
LOG_DEBUG("Requesting %s selection",
NameForAtom(info->selection->selection));

xaSTRING = MakeAtom("STRING", 6, TRUE);

event.u.u.type = SelectionRequest;
event.u.selectionRequest.owner = info->selection->window;
event.u.selectionRequest.time = currentTime.milliseconds;

Loading…
Annulla
Salva