Move xerror functions to "src/dwm/xerror.c"
This commit is contained in:
parent
631fdd6bcf
commit
2004b0cb97
4 changed files with 52 additions and 40 deletions
3
Makefile
3
Makefile
|
@ -33,7 +33,8 @@ DWM_SRC = \
|
|||
src/dwm/handlers.c \
|
||||
src/dwm/layouts.c \
|
||||
src/dwm/swallow.c \
|
||||
src/dwm/systray.c
|
||||
src/dwm/systray.c \
|
||||
src/dwm/xerror.c
|
||||
|
||||
MODULES_HDR = $(MODULES_SRC:.c=.h)
|
||||
DWM_HDR = $(DWM_SRC:.c=.h)
|
||||
|
|
41
src/dwm.c
41
src/dwm.c
|
@ -278,15 +278,13 @@ static void view(const Arg *arg);
|
|||
static void viewrel(const Arg *arg);
|
||||
static Client *wintoclient(Window w);
|
||||
static Monitor *wintomon(Window w);
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
#include "dwm/handlers.h"
|
||||
#include "dwm/layouts.h"
|
||||
#include "dwm/swallow.h"
|
||||
#include "dwm/systray.h"
|
||||
#include "dwm/xerror.h"
|
||||
|
||||
/*************
|
||||
* variables *
|
||||
|
@ -342,6 +340,7 @@ static xcb_connection_t *xcon;
|
|||
#include "dwm/layouts.c"
|
||||
#include "dwm/swallow.c"
|
||||
#include "dwm/systray.c"
|
||||
#include "dwm/xerror.c"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -2419,42 +2418,6 @@ wintomon(Window w)
|
|||
return selmon;
|
||||
}
|
||||
|
||||
/* There's no way to check accesses to destroyed windows, thus those cases are
|
||||
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
|
||||
* default error handler, which may call exit. */
|
||||
int
|
||||
xerror(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
if (ee->error_code == BadWindow
|
||||
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
|
||||
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable)
|
||||
|| (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable)
|
||||
|| (ee->request_code == X_PolySegment && ee->error_code == BadDrawable)
|
||||
|| (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch)
|
||||
|| (ee->request_code == X_GrabButton && ee->error_code == BadAccess)
|
||||
|| (ee->request_code == X_GrabKey && ee->error_code == BadAccess)
|
||||
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
|
||||
return 0;
|
||||
fprintf(stderr, "polytreewm: fatal error: request code=%d, error code=%d\n",
|
||||
ee->request_code, ee->error_code);
|
||||
return xerrorxlib(dpy, ee); /* may call exit */
|
||||
}
|
||||
|
||||
int
|
||||
xerrordummy(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Startup Error handler to check if another window manager
|
||||
* is already running. */
|
||||
int
|
||||
xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
die("polytreewm: another window manager is already running");
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
|
|
40
src/dwm/xerror.c
Normal file
40
src/dwm/xerror.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
#ifndef _DWM_XERROR_C
|
||||
#define _DWM_XERROR_C
|
||||
|
||||
/* There's no way to check accesses to destroyed windows, thus those cases are
|
||||
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
|
||||
* default error handler, which may call exit. */
|
||||
int
|
||||
xerror(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
if (ee->error_code == BadWindow
|
||||
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
|
||||
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable)
|
||||
|| (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable)
|
||||
|| (ee->request_code == X_PolySegment && ee->error_code == BadDrawable)
|
||||
|| (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch)
|
||||
|| (ee->request_code == X_GrabButton && ee->error_code == BadAccess)
|
||||
|| (ee->request_code == X_GrabKey && ee->error_code == BadAccess)
|
||||
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
|
||||
return 0;
|
||||
fprintf(stderr, "polytreewm: fatal error: request code=%d, error code=%d\n",
|
||||
ee->request_code, ee->error_code);
|
||||
return xerrorxlib(dpy, ee); /* may call exit */
|
||||
}
|
||||
|
||||
int
|
||||
xerrordummy(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Startup Error handler to check if another window manager
|
||||
* is already running. */
|
||||
int
|
||||
xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
die("polytreewm: another window manager is already running");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif // _DWM_XERROR_C
|
8
src/dwm/xerror.h
Normal file
8
src/dwm/xerror.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef _DWM_XERROR_H
|
||||
#define _DWM_XERROR_H
|
||||
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
|
||||
#endif // _DWM_XERROR_H
|
Loading…
Reference in a new issue