(submit/xnest-cleanup-event-handler) Xnest: xnestCollectEvents(): scope local variables
Make the code easier to read/understand by scoping variables to where exactly they're needed. Also a preparation for subsequent reworks (keep the diff smaller and thus easier to review) Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
40f17ebabf
commit
e2fc6519b7
|
@ -112,39 +112,49 @@ void
|
|||
xnestCollectEvents(void)
|
||||
{
|
||||
XEvent X;
|
||||
int valuators[2];
|
||||
ValuatorMask mask;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
|
||||
switch (X.type) {
|
||||
case KeyPress:
|
||||
{
|
||||
xnestUpdateModifierState(X.xkey.state);
|
||||
xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
|
||||
break;
|
||||
}
|
||||
|
||||
case KeyRelease:
|
||||
{
|
||||
xnestUpdateModifierState(X.xkey.state);
|
||||
xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
|
||||
break;
|
||||
}
|
||||
|
||||
case ButtonPress:
|
||||
{
|
||||
ValuatorMask mask;
|
||||
valuator_mask_set_range(&mask, 0, 0, NULL);
|
||||
xnestUpdateModifierState(X.xkey.state);
|
||||
lastEventTime = GetTimeInMillis();
|
||||
QueuePointerEvents(xnestPointerDevice, ButtonPress,
|
||||
X.xbutton.button, POINTER_RELATIVE, &mask);
|
||||
break;
|
||||
}
|
||||
|
||||
case ButtonRelease:
|
||||
{
|
||||
ValuatorMask mask;
|
||||
valuator_mask_set_range(&mask, 0, 0, NULL);
|
||||
xnestUpdateModifierState(X.xkey.state);
|
||||
lastEventTime = GetTimeInMillis();
|
||||
QueuePointerEvents(xnestPointerDevice, ButtonRelease,
|
||||
X.xbutton.button, POINTER_RELATIVE, &mask);
|
||||
break;
|
||||
}
|
||||
|
||||
case MotionNotify:
|
||||
{
|
||||
ValuatorMask mask;
|
||||
int valuators[2];
|
||||
valuators[0] = X.xmotion.x;
|
||||
valuators[1] = X.xmotion.y;
|
||||
valuator_mask_set_range(&mask, 0, 2, valuators);
|
||||
|
@ -152,30 +162,38 @@ xnestCollectEvents(void)
|
|||
QueuePointerEvents(xnestPointerDevice, MotionNotify,
|
||||
0, POINTER_ABSOLUTE, &mask);
|
||||
break;
|
||||
}
|
||||
|
||||
case FocusIn:
|
||||
{
|
||||
if (X.xfocus.detail != NotifyInferior) {
|
||||
pScreen = xnestScreen(X.xfocus.window);
|
||||
ScreenPtr pScreen = xnestScreen(X.xfocus.window);
|
||||
if (pScreen)
|
||||
xnestDirectInstallColormaps(pScreen);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case FocusOut:
|
||||
{
|
||||
if (X.xfocus.detail != NotifyInferior) {
|
||||
pScreen = xnestScreen(X.xfocus.window);
|
||||
ScreenPtr pScreen = xnestScreen(X.xfocus.window);
|
||||
if (pScreen)
|
||||
xnestDirectUninstallColormaps(pScreen);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case KeymapNotify:
|
||||
break;
|
||||
|
||||
case EnterNotify:
|
||||
{
|
||||
if (X.xcrossing.detail != NotifyInferior) {
|
||||
pScreen = xnestScreen(X.xcrossing.window);
|
||||
ScreenPtr pScreen = xnestScreen(X.xcrossing.window);
|
||||
if (pScreen) {
|
||||
ValuatorMask mask;
|
||||
int valuators[2];
|
||||
NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x,
|
||||
X.xcrossing.y);
|
||||
valuators[0] = X.xcrossing.x;
|
||||
|
@ -188,21 +206,26 @@ xnestCollectEvents(void)
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case LeaveNotify:
|
||||
{
|
||||
if (X.xcrossing.detail != NotifyInferior) {
|
||||
pScreen = xnestScreen(X.xcrossing.window);
|
||||
ScreenPtr pScreen = xnestScreen(X.xcrossing.window);
|
||||
if (pScreen) {
|
||||
xnestDirectUninstallColormaps(pScreen);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DestroyNotify:
|
||||
{
|
||||
if (xnestParentWindow != (Window) 0 &&
|
||||
X.xdestroywindow.window == xnestParentWindow)
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case CirculateNotify:
|
||||
case ConfigureNotify:
|
||||
|
|
Loading…
Reference in New Issue