edge: Cosmetics

This commit is contained in:
Kim Woelders 2022-07-18 13:04:39 +02:00
parent 3b07d3f12a
commit ee3355669c
1 changed files with 23 additions and 17 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2015 Kim Woelders * Copyright (C) 2004-2021 Kim Woelders
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -33,6 +33,11 @@
#include "timers.h" #include "timers.h"
#include "xwin.h" #include "xwin.h"
#define EW_L 0 /* Left */
#define EW_R 1 /* Right */
#define EW_T 2 /* Top */
#define EW_B 3 /* Bottom */
static EObj *w1 = NULL, *w2 = NULL, *w3 = NULL, *w4 = NULL; static EObj *w1 = NULL, *w2 = NULL, *w3 = NULL, *w4 = NULL;
static Timer *edge_timer = NULL; static Timer *edge_timer = NULL;
@ -66,25 +71,25 @@ EdgeTimeout(void *data)
day = 0; day = 0;
switch (val) switch (val)
{ {
case 0: case EW_L:
if (ax == 0 && !Conf.desks.areas_wraparound) if (ax == 0 && !Conf.desks.areas_wraparound)
goto done; goto done;
dx = WinGetW(VROOT) - 2; dx = WinGetW(VROOT) - 2;
dax = -1; dax = -1;
break; break;
case 1: case EW_R:
if (ax == (aw - 1) && !Conf.desks.areas_wraparound) if (ax == (aw - 1) && !Conf.desks.areas_wraparound)
goto done; goto done;
dx = -(WinGetW(VROOT) - 2); dx = -(WinGetW(VROOT) - 2);
dax = 1; dax = 1;
break; break;
case 2: case EW_T:
if (ay == 0 && !Conf.desks.areas_wraparound) if (ay == 0 && !Conf.desks.areas_wraparound)
goto done; goto done;
dy = WinGetH(VROOT) - 2; dy = WinGetH(VROOT) - 2;
day = -1; day = -1;
break; break;
case 3: case EW_B:
if (ay == (ah - 1) && !Conf.desks.areas_wraparound) if (ay == (ah - 1) && !Conf.desks.areas_wraparound)
goto done; goto done;
dy = -(WinGetH(VROOT) - 2); dy = -(WinGetH(VROOT) - 2);
@ -173,6 +178,7 @@ EdgeCheckMotion(int x, int y)
dir = 3; dir = 3;
else else
dir = -1; dir = -1;
EdgeEvent(dir); EdgeEvent(dir);
} }
@ -188,20 +194,20 @@ EdgeWindowShow(int which, int on)
switch (which) switch (which)
{ {
default: default:
case 1: /* Left */ case EW_L: /* Left */
eo = w1; eo = w1;
h = WinGetH(VROOT); h = WinGetH(VROOT);
break; break;
case 2: /* Right */ case EW_R: /* Right */
eo = w2; eo = w2;
x = WinGetW(VROOT) - 1; x = WinGetW(VROOT) - 1;
h = WinGetH(VROOT); h = WinGetH(VROOT);
break; break;
case 3: /* Top */ case EW_T: /* Top */
eo = w3; eo = w3;
w = WinGetW(VROOT); w = WinGetW(VROOT);
break; break;
case 4: /* Bottom */ case EW_B: /* Bottom */
eo = w4; eo = w4;
y = WinGetH(VROOT) - 1; y = WinGetH(VROOT) - 1;
w = WinGetW(VROOT); w = WinGetW(VROOT);
@ -246,18 +252,18 @@ EdgeWindowsShow(void)
ESelectInput(EobjGetWin(w2), EnterWindowMask | LeaveWindowMask); ESelectInput(EobjGetWin(w2), EnterWindowMask | LeaveWindowMask);
ESelectInput(EobjGetWin(w3), EnterWindowMask | LeaveWindowMask); ESelectInput(EobjGetWin(w3), EnterWindowMask | LeaveWindowMask);
ESelectInput(EobjGetWin(w4), EnterWindowMask | LeaveWindowMask); ESelectInput(EobjGetWin(w4), EnterWindowMask | LeaveWindowMask);
EventCallbackRegister(EobjGetWin(w1), EdgeHandleEvents, (void *)0); EventCallbackRegister(EobjGetWin(w1), EdgeHandleEvents, (void *)EW_L);
EventCallbackRegister(EobjGetWin(w2), EdgeHandleEvents, (void *)1); EventCallbackRegister(EobjGetWin(w2), EdgeHandleEvents, (void *)EW_R);
EventCallbackRegister(EobjGetWin(w3), EdgeHandleEvents, (void *)2); EventCallbackRegister(EobjGetWin(w3), EdgeHandleEvents, (void *)EW_T);
EventCallbackRegister(EobjGetWin(w4), EdgeHandleEvents, (void *)3); EventCallbackRegister(EobjGetWin(w4), EdgeHandleEvents, (void *)EW_B);
} }
DeskCurrentGetArea(&cx, &cy); DeskCurrentGetArea(&cx, &cy);
DesksGetAreaSize(&ax, &ay); DesksGetAreaSize(&ax, &ay);
EdgeWindowShow(1, cx != 0 || Conf.desks.areas_wraparound); EdgeWindowShow(EW_L, cx != 0 || Conf.desks.areas_wraparound);
EdgeWindowShow(2, cx != (ax - 1) || Conf.desks.areas_wraparound); EdgeWindowShow(EW_R, cx != (ax - 1) || Conf.desks.areas_wraparound);
EdgeWindowShow(3, cy != 0 || Conf.desks.areas_wraparound); EdgeWindowShow(EW_T, cy != 0 || Conf.desks.areas_wraparound);
EdgeWindowShow(4, cy != (ay - 1) || Conf.desks.areas_wraparound); EdgeWindowShow(EW_B, cy != (ay - 1) || Conf.desks.areas_wraparound);
} }
void void