Commit 6f071341 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Clipboard.c: use designated initializers where appropriate

parent 1af01db3
...@@ -574,8 +574,7 @@ void nxagentClearSelection(XEvent *X) ...@@ -574,8 +574,7 @@ void nxagentClearSelection(XEvent *X)
{ {
if (lastSelectionOwner[i].client != NULL) if (lastSelectionOwner[i].client != NULL)
{ {
xEvent x; xEvent x = {0};
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionClear; x.u.u.type = SelectionClear;
x.u.selectionClear.time = GetTimeInMillis(); x.u.selectionClear.time = GetTimeInMillis();
x.u.selectionClear.window = lastSelectionOwner[i].window; x.u.selectionClear.window = lastSelectionOwner[i].window;
...@@ -606,9 +605,9 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success) ...@@ -606,9 +605,9 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success)
XSelectionEvent eventSelection = { XSelectionEvent eventSelection = {
.requestor = X->xselectionrequest.requestor, .requestor = X->xselectionrequest.requestor,
.selection = X->xselectionrequest.selection, .selection = X->xselectionrequest.selection,
.target = X->xselectionrequest.target, .target = X->xselectionrequest.target,
.time = X->xselectionrequest.time, .time = X->xselectionrequest.time,
.property = X->xselectionrequest.property .property = X->xselectionrequest.property
}; };
if (!success) if (!success)
...@@ -722,8 +721,6 @@ FIXME: Do we need this? ...@@ -722,8 +721,6 @@ FIXME: Do we need this?
if (lastSelectionOwner[i].client != NULL && if (lastSelectionOwner[i].client != NULL &&
nxagentOption(Clipboard) != ClipboardClient) nxagentOption(Clipboard) != ClipboardClient)
{ {
xEvent x;
lastServerProperty = X->xselectionrequest.property; lastServerProperty = X->xselectionrequest.property;
lastServerRequestor = X->xselectionrequest.requestor; lastServerRequestor = X->xselectionrequest.requestor;
lastServerTarget = X->xselectionrequest.target; lastServerTarget = X->xselectionrequest.target;
...@@ -734,7 +731,7 @@ FIXME: Do we need this? ...@@ -734,7 +731,7 @@ FIXME: Do we need this?
lastServerTime = X->xselectionrequest.time; lastServerTime = X->xselectionrequest.time;
memset(&x, 0, sizeof(xEvent)); xEvent x = {0};
x.u.u.type = SelectionRequest; x.u.u.type = SelectionRequest;
x.u.selectionRequest.time = GetTimeInMillis(); x.u.selectionRequest.time = GetTimeInMillis();
x.u.selectionRequest.owner = lastSelectionOwner[i].window; x.u.selectionRequest.owner = lastSelectionOwner[i].window;
...@@ -1080,8 +1077,6 @@ void nxagentCollectPropertyEvent(int resource) ...@@ -1080,8 +1077,6 @@ void nxagentCollectPropertyEvent(int resource)
void nxagentNotifySelection(XEvent *X) void nxagentNotifySelection(XEvent *X)
{ {
XSelectionEvent eventSelection;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Got called.\n", __func__); fprintf(stderr, "%s: Got called.\n", __func__);
#endif #endif
...@@ -1199,23 +1194,15 @@ void nxagentNotifySelection(XEvent *X) ...@@ -1199,23 +1194,15 @@ void nxagentNotifySelection(XEvent *X)
} }
memset(&eventSelection, 0, sizeof(XSelectionEvent)); XSelectionEvent eventSelection = {
eventSelection.requestor = lastServerRequestor; .requestor = lastServerRequestor,
.selection = X->xselection.selection,
eventSelection.selection = X->xselection.selection; /* .target = X->xselection.target, */
.target = lastServerTarget,
/* .property = lastServerProperty,
* eventSelection.target = X->xselection.target; .time = lastServerTime,
*/ /* .time = CurrentTime */
};
eventSelection.target = lastServerTarget;
eventSelection.property = lastServerProperty;
eventSelection.time = lastServerTime;
/*
* eventSelection.time = CurrentTime;
* eventSelection.time = lastServerTime;
*/
SendSelectionNotifyEventToServer(&eventSelection); SendSelectionNotifyEventToServer(&eventSelection);
...@@ -1646,14 +1633,18 @@ int nxagentSendNotify(xEvent *event) ...@@ -1646,14 +1633,18 @@ int nxagentSendNotify(xEvent *event)
if (event->u.selectionNotify.property == clientCutProperty) if (event->u.selectionNotify.property == clientCutProperty)
{ {
XSelectionEvent x;
/* /*
* Setup selection notify event to real server. * Setup selection notify event to real server.
*/ */
memset(&x, 0, sizeof(XSelectionEvent)); XSelectionEvent eventSelection = {
x.requestor = serverWindow; .requestor = serverWindow,
.selection = event->u.selectionNotify.selection,
.target = event->u.selectionNotify.target,
.property = event->u.selectionNotify.property,
.time = CurrentTime,
};
/* /*
* On real server, the right CLIPBOARD atom is * On real server, the right CLIPBOARD atom is
...@@ -1662,22 +1653,14 @@ int nxagentSendNotify(xEvent *event) ...@@ -1662,22 +1653,14 @@ int nxagentSendNotify(xEvent *event)
if (event->u.selectionNotify.selection == MakeAtom("CLIPBOARD", 9, 0)) if (event->u.selectionNotify.selection == MakeAtom("CLIPBOARD", 9, 0))
{ {
x.selection = lastSelectionOwner[nxagentClipboardSelection].selection; eventSelection.selection = lastSelectionOwner[nxagentClipboardSelection].selection;
} }
else
{
x.selection = event->u.selectionNotify.selection;
}
x.target = event->u.selectionNotify.target;
x.property = event->u.selectionNotify.property;
x.time = CurrentTime;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Propagating clientCutProperty to requestor [%p].\n", __func__, (void *)x.requestor); fprintf(stderr, "%s: Propagating clientCutProperty to requestor [%p].\n", __func__, (void *)eventSelection.requestor);
#endif #endif
SendSelectionNotifyEventToServer(&x); SendSelectionNotifyEventToServer(&eventSelection);
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment