summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2016-01-13 11:25:40 +0100
committerPierre Ossman <ossman@cendio.se>2016-02-05 10:34:56 +0100
commite4be5cc09850b3e606f9315334b0253467e66655 (patch)
tree758c9f80b68887878b0deffb9343dc7ba8624826 /unix
parentbfd567a014d5d04de6abc24a24c7c75d651ae76f (diff)
downloadtigervnc-e4be5cc09850b3e606f9315334b0253467e66655.tar.gz
tigervnc-e4be5cc09850b3e606f9315334b0253467e66655.zip
Create all Atoms in a central place
Diffstat (limited to 'unix')
-rw-r--r--unix/xserver/hw/vnc/vncSelection.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/unix/xserver/hw/vnc/vncSelection.c b/unix/xserver/hw/vnc/vncSelection.c
index 263dbeca..b4a58e38 100644
--- a/unix/xserver/hw/vnc/vncSelection.c
+++ b/unix/xserver/hw/vnc/vncSelection.c
@@ -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;