event: fix configure requests where a window in another desktop requests focus; client, cursor, event, grab, key, manage, menu: clang-format

This commit is contained in:
Iris Lightshard 2021-04-29 00:41:36 -04:00
parent 2a3fb33866
commit 548f2f7cba
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
7 changed files with 36 additions and 36 deletions

View file

@ -141,8 +141,7 @@ static char grey_bits[] = {0x01, 0x04};
static XColor bl, wh; static XColor bl, wh;
Cursor getcursor(Cursordata* c, ScreenInfo* s) Cursor getcursor(Cursordata* c, ScreenInfo* s) {
{
Pixmap f, m; Pixmap f, m;
f = XCreatePixmapFromBitmapData( f = XCreatePixmapFromBitmapData(
@ -166,8 +165,7 @@ Cursor getcursor(Cursordata* c, ScreenInfo* s)
return XCreatePixmapCursor(dpy, f, m, &bl, &wh, c->hot[0], c->hot[1]); return XCreatePixmapCursor(dpy, f, m, &bl, &wh, c->hot[0], c->hot[1]);
} }
void initcurs(ScreenInfo* s) void initcurs(ScreenInfo* s) {
{
XColor dummy; XColor dummy;
XAllocNamedColor(dpy, DefaultColormap(dpy, s->num), "black", &bl, &dummy); XAllocNamedColor(dpy, DefaultColormap(dpy, s->num), "black", &bl, &dummy);

View file

@ -159,6 +159,8 @@ void configurereq(XConfigureRequestEvent* e) {
XConfigureWindow(dpy, c->parent, e->value_mask, &wc); XConfigureWindow(dpy, c->parent, e->value_mask, &wc);
if (e->value_mask & CWStackMode) { if (e->value_mask & CWStackMode) {
if (c->virt > 0 && c->virt != virt)
switch_to(c->virt);
top(c); top(c);
active(c); active(c);
} }
@ -292,14 +294,14 @@ void newwindow(XCreateWindowEvent* e) {
void destroy(Window w) { void destroy(Window w) {
int i; int i;
Client* c; Client* c;
// int v; // int v;
curtime = CurrentTime; curtime = CurrentTime;
c = getclient(w, 0); c = getclient(w, 0);
if (c == 0) if (c == 0)
return; return;
// v = c->virt; // v = c->virt;
if (numvirtuals > 1) if (numvirtuals > 1)
for (i = 0; i < numvirtuals; i++) for (i = 0; i < numvirtuals; i++)
if (currents[i] == c) if (currents[i] == c)

10
grab.c
View file

@ -581,7 +581,7 @@ int sweepdrag(
getmouse(&cx, &cy, c->screen); getmouse(&cx, &cy, c->screen);
else else
getmouse(&c->x, &c->y, c->screen); getmouse(&c->x, &c->y, c->screen);
//XGrabServer(dpy); // XGrabServer(dpy);
if (bl != BorderUnknown) { if (bl != BorderUnknown) {
notmoved = recalc(c, cx, cy, bl, notmoved); notmoved = recalc(c, cx, cy, bl, notmoved);
} }
@ -593,10 +593,10 @@ int sweepdrag(
if (rx != cx || ry != cy || ++idle > 300) { if (rx != cx || ry != cy || ++idle > 300) {
drawbound(c, 0); drawbound(c, 0);
if (rx == cx && ry == cy) { if (rx == cx && ry == cy) {
//XUngrabServer(dpy); // XUngrabServer(dpy);
XFlush(dpy); XFlush(dpy);
//misleep(500); // misleep(500);
//XGrabServer(dpy); // XGrabServer(dpy);
idle = 0; idle = 0;
} }
if (e0 || bl != BorderUnknown) if (e0 || bl != BorderUnknown)
@ -617,7 +617,7 @@ int sweepdrag(
case ButtonRelease: case ButtonRelease:
drawbound(c, 0); drawbound(c, 0);
ungrab(e); ungrab(e);
//XUngrabServer(dpy); // XUngrabServer(dpy);
if (e->button != but && c->init) if (e->button != but && c->init)
goto bad; goto bad;
if (c->dx < 0) { if (c->dx < 0) {

16
key.c
View file

@ -461,11 +461,11 @@ void keypress(XKeyEvent* e) {
zoom = !zoom; zoom = !zoom;
if (zoom) { if (zoom) {
quickreshape( quickreshape(
current, current,
-BORDER, -BORDER,
-BORDER, -BORDER,
ra.width + 2 * BORDER, ra.width + 2 * BORDER,
ra.height + 2 * BORDER); ra.height + 2 * BORDER);
} }
} }
#endif #endif
@ -508,7 +508,7 @@ void keypress(XKeyEvent* e) {
ra.height / 2 - 1.5 * GAPSZ); ra.height / 2 - 1.5 * GAPSZ);
#endif #endif
/* quarter snap */ /* quarter snap */
#ifdef SNAPTOPLEFT_KEY #ifdef SNAPTOPLEFT_KEY
else if (e->keycode == qcode && (e->state & SHORTCUTMOD) == (MODBITS)) else if (e->keycode == qcode && (e->state & SHORTCUTMOD) == (MODBITS))
quickreshape( quickreshape(
@ -546,7 +546,7 @@ void keypress(XKeyEvent* e) {
ra.height / 2 - 1.5 * GAPSZ); ra.height / 2 - 1.5 * GAPSZ);
#endif #endif
/* center snap */ /* center snap */
#ifdef SNAPCENTER_KEY #ifdef SNAPCENTER_KEY
else if (e->keycode == ccode && (e->state & SHORTCUTMOD) == (MODBITS)) { else if (e->keycode == ccode && (e->state & SHORTCUTMOD) == (MODBITS)) {
if ((e->state & ShiftMask) == (1 << 0)) { if ((e->state & ShiftMask) == (1 << 0)) {
@ -573,7 +573,7 @@ void keypress(XKeyEvent* e) {
stickystack(0); stickystack(0);
#endif #endif
/* launch */ /* launch */
#ifdef LAUNCH_KEY #ifdef LAUNCH_KEY
else if (e->keycode == slcode && (e->state & SHORTCUTMOD) == (MODBITS)) { else if (e->keycode == slcode && (e->state & SHORTCUTMOD) == (MODBITS)) {
kbLaunch = 1; kbLaunch = 1;

View file

@ -560,15 +560,15 @@ void getproto(Client* c) {
#ifdef ALWAYSDRAW #ifdef ALWAYSDRAW
int shouldalwaysdraw(Client* c) { int shouldalwaysdraw(Client* c) {
static char* alwaysdraw[] = ALWAYSDRAW; static char* alwaysdraw[] = ALWAYSDRAW;
char** a = alwaysdraw; char** a = alwaysdraw;
while (*a) { while (*a) {
if (c && c->class && strstr(c->class, *a)) { if (c && c->class && strstr(c->class, *a)) {
return 1; return 1;
}
++a;
} }
return 0; ++a;
}
return 0;
} }
#endif #endif

6
menu.c
View file

@ -182,7 +182,7 @@ void button(XButtonEvent* e) {
case Delete: case Delete:
shift = 0; shift = 0;
c = selectwin(1, &shift, s); c = selectwin(1, &shift, s);
delete(c, shift); delete (c, shift);
break; break;
case Hide: case Hide:
hide(selectwin(1, 0, s)); hide(selectwin(1, 0, s));
@ -294,10 +294,10 @@ void move(Client* c, int but) {
} }
void delete (Client* c, int shift) { void delete (Client* c, int shift) {
//int v; // int v;
if (c == 0) if (c == 0)
return; return;
//v = c->virt; // v = c->virt;
if ((c->proto & Pdelete) && !shift) if ((c->proto & Pdelete) && !shift)
sendcmessage(c->window, wm_protocols, wm_delete, 0, 0); sendcmessage(c->window, wm_protocols, wm_delete, 0, 0);
else else