aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-09-05 22:57:13 +0200
committerUlrich Sibiller <uli42@gmx.de>2020-01-05 22:37:36 +0100
commitd501d48c30dca60febbac408dc3118139c687220 (patch)
treed218f83c59e250c9bfb80358fcc1881079c441a0 /nx-X11/programs/Xserver/hw
parent9358eaedc8b323d97dc45c944a29b92d5b327a23 (diff)
downloadnx-libs-d501d48c30dca60febbac408dc3118139c687220.tar.gz
nx-libs-d501d48c30dca60febbac408dc3118139c687220.tar.bz2
nx-libs-d501d48c30dca60febbac408dc3118139c687220.zip
Events.c: use designated initializers
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index 11ea28f0f..70a3f957e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -1610,9 +1610,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow))
{
- XEvent xM;
-
- memset(&xM, 0, sizeof(XEvent));
+ XEvent xM = {0};
xM.type = KeyRelease;
xM.xkey.display = nxagentDisplay;
xM.xkey.type = KeyRelease;
@@ -2539,10 +2537,12 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)
* Rectangle affected by GraphicsExpose event.
*/
- rect.x1 = X -> xgraphicsexpose.x;
- rect.y1 = X -> xgraphicsexpose.y;
- rect.x2 = rect.x1 + X -> xgraphicsexpose.width;
- rect.y2 = rect.y1 + X -> xgraphicsexpose.height;
+ BoxRec rect = {
+ .x1 = X -> xgraphicsexpose.x,
+ .y1 = X -> xgraphicsexpose.y,
+ .x2 = rect.x1 + X -> xgraphicsexpose.width,
+ .y2 = rect.y1 + X -> xgraphicsexpose.height,
+ };
RegionPtr exposeRegion = RegionCreate(&rect, 0);
@@ -2635,12 +2635,9 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
if (message_type == MakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), False))
{
- xEvent x;
-
- memset(&x, 0, sizeof(xEvent));
+ xEvent x = {0};
x.u.u.type = ClientMessage;
x.u.u.detail = X -> xclient.format;
-
x.u.clientMessage.window = pWin -> drawable.id;
x.u.clientMessage.u.l.type = message_type;
x.u.clientMessage.u.l.longs0 = nxagentRemoteToLocalAtom(X -> xclient.data.l[0]);
@@ -2854,8 +2851,6 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
int i = nxagentFindCurrentSelectionIndex(local);
if (i < NumCurrentSelections)
{
- SelectionInfoRec info;
-
if (CurrentSelections[i].client != 0)
{
#ifdef TEST
@@ -2889,8 +2884,10 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
}
#endif
- info.selection = &CurrentSelections[i];
- info.kind = xfixesEvent->xfixesselection.subtype;
+ SelectionInfoRec info = {
+ .selection = &CurrentSelections[i],
+ .kind = xfixesEvent->xfixesselection.subtype
+ };
/*
* The trap indicates that we are triggered by a clipboard event
@@ -3232,9 +3229,8 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (sendEventAnyway || X -> xconfigure.send_event)
{
- xEvent x;
+ xEvent x = {0};
- memset(&x, 0, sizeof(xEvent));
x.u.u.type = X -> xconfigure.type | 0x80;
x.u.configureNotify.event = pWinWindow -> drawable.id;
@@ -3677,10 +3673,9 @@ void nxagentDisablePointerEvents(void)
void nxagentSendFakeKey(int key)
{
- xEvent fake;
Time now = GetTimeInMillis();
- memset(&fake, 0, sizeof(xEvent));
+ xEvent fake = {0};
fake.u.u.type = KeyPress;
fake.u.u.detail = key;
fake.u.keyButtonPointer.time = now;
@@ -3696,7 +3691,7 @@ void nxagentSendFakeKey(int key)
int nxagentInitXkbKeyboardState(void)
{
- XEvent X;
+ XEvent X = {0};
XkbEvent *xkbev = (XkbEvent *) &X;
@@ -3709,8 +3704,6 @@ int nxagentInitXkbKeyboardState(void)
fprintf(stderr, "%s: Initializing XKB state.\n", __func__);
#endif
- memset(&X, 0, sizeof(XEvent));
-
unsigned int modifiers;
XkbGetIndicatorState(nxagentDisplay, XkbUseCoreKbd, &modifiers);