From 1cca9c6938b1d77b3ea2f851d0a47f0d9156f2c2 Mon Sep 17 00:00:00 2001 From: Patrick Haller Date: Mon, 7 Mar 2011 09:36:43 +0800 Subject: converted all to c99 pedantic --- Makefile | 2 +- x-alt-tab.c | 2 +- x-focus-manager.c | 29 +---------------------------- x-move-resize.c | 2 +- x-placement-manager.c | 30 +----------------------------- 5 files changed, 5 insertions(+), 60 deletions(-) diff --git a/Makefile b/Makefile index 96b4dec..c93f35f 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SRC = x-session.c X11SRC = x-move-resize.c x-alt-tab.c x-focus-manager.c x-placement-manager.c x-undecorate.c CC = gcc -CFLAGS = -O2 -Wall +CFLAGS = -O2 -Wall -std=c99 -pedantic X11LIB = -lX11 -L/usr/X11/lib BIN = ${SRC:.c=} diff --git a/x-alt-tab.c b/x-alt-tab.c index ded6393..25976e0 100644 --- a/x-alt-tab.c +++ b/x-alt-tab.c @@ -9,7 +9,7 @@ int main(int argc, char **argv) XCirculateSubwindowsDown(dpy, DefaultRootWindow(dpy)); else XCirculateSubwindowsUp(dpy, DefaultRootWindow(dpy)); - XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); // nuke focus back to pointer + XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); /* nuke focus back to pointer */ XSync(dpy, True); return 0; } diff --git a/x-focus-manager.c b/x-focus-manager.c index 69c9e96..5ebba4e 100644 --- a/x-focus-manager.c +++ b/x-focus-manager.c @@ -1,7 +1,3 @@ -#include -#include -#include -#include #include #include #include @@ -28,28 +24,6 @@ reset_focus(Display *d, XEvent *e) { XSetInputFocus(d, PointerRoot , RevertToPointerRoot, CurrentTime); } -int -interruptibleXNextEvent(Display *dpy, XEvent *event) { - fd_set fds; - int rc; - int dpy_fd = ConnectionNumber(dpy); - for (;;) { - if (XPending(dpy)) { - XNextEvent(dpy, event); - return 1; - } - FD_ZERO(&fds); - FD_SET(dpy_fd, &fds); - rc = select(dpy_fd + 1, &fds, NULL, NULL, NULL); - if (rc < 0) { - if (errno == EINTR) { - return 0; - } - // LOG_ERROR("interruptibleXNextEvent(): select()\n"); - } - } -} - int main(int argc, char **argv) { Display *dpy; @@ -64,8 +38,7 @@ main(int argc, char **argv) { XChangeWindowAttributes(dpy, DefaultRootWindow(dpy) , CWEventMask|CWCursor, &wa); for(;;) { - if (! interruptibleXNextEvent(dpy, &e)) - continue; + XNextEvent(dpy, &e); if(handler[e.type]) handler[e.type](dpy, &e); } diff --git a/x-move-resize.c b/x-move-resize.c index 1b04500..b94279e 100644 --- a/x-move-resize.c +++ b/x-move-resize.c @@ -42,7 +42,7 @@ static int interruptibleXNextEvent(Display *dpy, XEvent *event) { if (errno == EINTR) { return 0; } - // LOG_ERROR("interruptibleXNextEvent(): select()\n"); + /* LOG_ERROR("interruptibleXNextEvent(): select()\n"); */ } } } diff --git a/x-placement-manager.c b/x-placement-manager.c index f51e7f2..2cd51b5 100644 --- a/x-placement-manager.c +++ b/x-placement-manager.c @@ -1,7 +1,3 @@ -#include -#include -#include -#include #include #include #include @@ -9,7 +5,6 @@ /* place all clients in the center */ - void place_center(Display *d, XEvent *e); static void (*handler[LASTEvent]) (Display *d, XEvent *) = { @@ -42,28 +37,6 @@ place_center(Display *d, XEvent *e) { XMoveWindow(d, ev->window, x, y); } -int -interruptibleXNextEvent(Display *dpy, XEvent *event) { - fd_set fds; - int rc; - int dpy_fd = ConnectionNumber(dpy); - for (;;) { - if (XPending(dpy)) { - XNextEvent(dpy, event); - return 1; - } - FD_ZERO(&fds); - FD_SET(dpy_fd, &fds); - rc = select(dpy_fd + 1, &fds, NULL, NULL, NULL); - if (rc < 0) { - if (errno == EINTR) { - return 0; - } - // LOG_ERROR("interruptibleXNextEvent(): select()\n"); - } - } -} - int main(int argc, char **argv) { Display *dpy; @@ -78,8 +51,7 @@ main(int argc, char **argv) { XChangeWindowAttributes(dpy, DefaultRootWindow(dpy) , CWEventMask|CWCursor, &wa); for(;;) { - if (! interruptibleXNextEvent(dpy, &e)) - continue; + XNextEvent(dpy, &e); if(handler[e.type]) handler[e.type](dpy, &e); } -- cgit v1.2.3