Skip to content

Commit

Permalink
* integrated a change from Simon Engelsman (thanks!):
Browse files Browse the repository at this point in the history
	* XNextEvent() was replaced by interruptible_XNextEvent() function in do_event_loop()
  • Loading branch information
nickgravgaard committed Apr 4, 2010
1 parent 35f015f commit b57d268
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,3 +1,9 @@
1.40 (2010-04-04)

* integrated a change from Simon Engelsman (thanks!):
* XNextEvent() was replaced by interruptible_XNextEvent() function in do_event_loop()


1.39 (2009-12-27)

* integrated more changes from Mats Erik Andersson:
Expand Down
2 changes: 1 addition & 1 deletion client.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down
44 changes: 42 additions & 2 deletions events.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down Expand Up @@ -39,6 +39,8 @@ static void handle_expose_event(XExposeEvent *);
static void handle_shape_change(XShapeEvent *);
#endif

static int interruptible_XNextEvent(XEvent *event);

/* We may want to put in some sort of check for unknown events at some
* point. TWM has an interesting and different way of doing this... */

Expand All @@ -48,7 +50,7 @@ void do_event_loop(void)

for (;;)
{
XNextEvent(dsply, &ev);
interruptible_XNextEvent(&ev);
#ifdef DEBUG
show_event(ev);
#endif
Expand Down Expand Up @@ -616,3 +618,41 @@ static void handle_shape_change(XShapeEvent *e)
}
}
#endif

/* interruptibleXNextEvent() was originally taken from Blender's source code
* and came with the following copyright notice: */

/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996. */

/* This program is freely distributable without licensing fees
* and is provided without guarantee or warrantee expressed or
* implied. This program is -not- in the public domain. */

/* Unlike XNextEvent, if a signal arrives, interruptibleXNextEvent will
* return zero. */

static int interruptible_XNextEvent(XEvent *event)
{
fd_set fds;
int rc;
int dsply_fd = ConnectionNumber(dsply);
for (;;)
{
if (XPending(dsply))
{
XNextEvent(dsply, event);
return 1;
}
FD_ZERO(&fds);
FD_SET(dsply_fd, &fds);
rc = select(dsply_fd + 1, &fds, NULL, NULL, NULL);
if (rc < 0)
{
if (errno == EINTR)
{
return 0;
}
return 1;
}
}
}
2 changes: 1 addition & 1 deletion main.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down
2 changes: 1 addition & 1 deletion manage.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down
2 changes: 1 addition & 1 deletion menufile.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down
2 changes: 1 addition & 1 deletion misc.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down
2 changes: 1 addition & 1 deletion new.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down
2 changes: 1 addition & 1 deletion taskbar.c
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand Down
6 changes: 3 additions & 3 deletions windowlab.h
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
* Copyright (c) 2001-2009 Nick Gravgaard
* Copyright (c) 2001-2010 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
Expand All @@ -21,8 +21,8 @@
#ifndef WINDOWLAB_H
#define WINDOWLAB_H

#define VERSION "1.39"
#define RELEASEDATE "2009-12-27"
#define VERSION "1.40"
#define RELEASEDATE "2010-04-04"

#include <errno.h>
#include <limits.h>
Expand Down

0 comments on commit b57d268

Please sign in to comment.