main.c
changeset 84 052fe7498930
parent 79 aabebd6e61f3
child 92 4bee0aa5b286
equal deleted inserted replaced
83:ca809fdd30ea 84:052fe7498930
    12 #include <unistd.h>
    12 #include <unistd.h>
    13 #include <X11/cursorfont.h>
    13 #include <X11/cursorfont.h>
    14 #include <X11/Xatom.h>
    14 #include <X11/Xatom.h>
    15 #include <X11/Xproto.h>
    15 #include <X11/Xproto.h>
    16 
    16 
    17 Display *dpy;
    17 
    18 Window root, barwin;
    18 /* static */
    19 Atom wmatom[WMLast], netatom[NetLast];
       
    20 Cursor cursor[CurLast];
       
    21 Bool running = True;
       
    22 Bool issel = True;
       
    23 
       
    24 int tsel = Tdev; /* default tag */
       
    25 int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
       
    26 char stext[1024];
       
    27 
       
    28 DC dc = {0};
       
    29 Client *clients = NULL;
       
    30 Client *sel = NULL;
       
    31 
    19 
    32 static Bool otherwm;
    20 static Bool otherwm;
    33 static int (*xerrorxlib)(Display *, XErrorEvent *);
    21 static int (*xerrorxlib)(Display *, XErrorEvent *);
    34 
       
    35 /* static functions */
       
    36 
    22 
    37 static void
    23 static void
    38 cleanup()
    24 cleanup()
    39 {
    25 {
    40 	while(sel) {
    26 	while(sel) {
    95 {
    81 {
    96 	otherwm = True;
    82 	otherwm = True;
    97 	return -1;
    83 	return -1;
    98 }
    84 }
    99 
    85 
   100 /* extern functions */
    86 /* extern */
       
    87 
       
    88 char stext[1024];
       
    89 int tsel = Tdev; /* default tag */
       
    90 int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
       
    91 Atom wmatom[WMLast], netatom[NetLast];
       
    92 Bool running = True;
       
    93 Bool issel = True;
       
    94 Client *clients = NULL;
       
    95 Client *sel = NULL;
       
    96 Cursor cursor[CurLast];
       
    97 Display *dpy;
       
    98 DC dc = {0};
       
    99 Window root, barwin;
   101 
   100 
   102 int
   101 int
   103 getproto(Window w)
   102 getproto(Window w)
   104 {
   103 {
   105 	unsigned char *protocols;
   104 	unsigned char *protocols;
   139 {
   138 {
   140 	running = False;
   139 	running = False;
   141 }
   140 }
   142 
   141 
   143 /*
   142 /*
   144  * There's no way to check accesses to destroyed windows, thus
   143  * There's no way to check accesses to destroyed windows, thus those cases are
   145  * those cases are ignored (especially on UnmapNotify's).
   144  * ignored (especially on UnmapNotify's).  Other types of errors call Xlibs
   146  * Other types of errors call Xlib's default error handler, which
   145  * default error handler, which calls exit().
   147  * calls exit().
       
   148  */
   146  */
   149 int
   147 int
   150 xerror(Display *dpy, XErrorEvent *ee)
   148 xerror(Display *dpy, XErrorEvent *ee)
   151 {
   149 {
   152 	if(ee->error_code == BadWindow
   150 	if(ee->error_code == BadWindow