diff --git a/awesome.c b/awesome.c index d28b4b36d..d035e7000 100644 --- a/awesome.c +++ b/awesome.c @@ -38,7 +38,6 @@ Client *clients = NULL; Client *sel = NULL; Client *stack = NULL; -Cursor cursor[CurLast]; DC dc; /* static */ @@ -63,9 +62,9 @@ cleanup(Display *disp, DC *drawcontext, awesome_config *awesomeconf) XFreePixmap(disp, drawcontext->drawable); XFreeGC(disp, drawcontext->gc); XDestroyWindow(disp, awesomeconf->statusbar.window); - XFreeCursor(disp, cursor[CurNormal]); - XFreeCursor(disp, cursor[CurResize]); - XFreeCursor(disp, cursor[CurMove]); + XFreeCursor(disp, drawcontext->cursor[CurNormal]); + XFreeCursor(disp, drawcontext->cursor[CurResize]); + XFreeCursor(disp, drawcontext->cursor[CurMove]); XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime); XSync(disp, False); } @@ -138,13 +137,13 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf) XChangeProperty(disp, DefaultRootWindow(disp), netatom[NetSupported], XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast); /* init cursors */ - cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr); - cursor[CurResize] = XCreateFontCursor(disp, XC_sizing); - cursor[CurMove] = XCreateFontCursor(disp, XC_fleur); + drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr); + drawcontext->cursor[CurResize] = XCreateFontCursor(disp, XC_sizing); + drawcontext->cursor[CurMove] = XCreateFontCursor(disp, XC_fleur); /* select for events */ wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | LeaveWindowMask | StructureNotifyMask; - wa.cursor = cursor[CurNormal]; + wa.cursor = drawcontext->cursor[CurNormal]; XChangeWindowAttributes(disp, DefaultRootWindow(disp), CWEventMask | CWCursor, &wa); XSelectInput(disp, DefaultRootWindow(disp), wa.event_mask); grabkeys(disp, awesomeconf); @@ -158,7 +157,7 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf) DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent, DefaultVisual(disp, DefaultScreen(disp)), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); - XDefineCursor(disp, awesomeconf->statusbar.window, cursor[CurNormal]); + XDefineCursor(disp, awesomeconf->statusbar.window, drawcontext->cursor[CurNormal]); updatebarpos(disp, awesomeconf->statusbar); XMapRaised(disp, awesomeconf->statusbar.window); /* pixmap for everything */ diff --git a/awesome.h b/awesome.h index cbde52257..f721009bd 100644 --- a/awesome.h +++ b/awesome.h @@ -24,9 +24,6 @@ #include "config.h" -enum -{ CurNormal, CurResize, CurMove, CurLast }; /* cursor */ - Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return text property, UTF-8 compliant */ void updatebarpos(Display *, Statusbar); /* updates the bar position */ void uicb_quit(Display *, DC *, awesome_config *, const char *); /* quit awesome nicely */ diff --git a/config.h b/config.h index bf783e8a9..4d2f7f019 100644 --- a/config.h +++ b/config.h @@ -33,6 +33,9 @@ enum enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ +enum +{ CurNormal, CurResize, CurMove, CurLast }; /* cursor */ + typedef struct { int x, y, w, h; @@ -40,6 +43,7 @@ typedef struct unsigned long sel[ColLast]; Drawable drawable; GC gc; + Cursor cursor[CurLast]; struct { int ascent; diff --git a/event.c b/event.c index b9ae2f41a..8ab25032b 100644 --- a/event.c +++ b/event.c @@ -32,7 +32,6 @@ /* extern */ extern DC dc; /* global draw context */ -extern Cursor cursor[CurLast]; extern Client *clients, *sel; /* global client list */ #define CLEANMASK(mask) (mask & ~(awesomeconf->numlockmask | LockMask)) @@ -62,7 +61,7 @@ movemouse(Client * c, awesome_config *awesomeconf) ocx = nx = c->x; ocy = ny = c->y; if(XGrabPointer(c->display, DefaultRootWindow(c->display), False, MOUSEMASK, GrabModeAsync, GrabModeAsync, - None, cursor[CurMove], CurrentTime) != GrabSuccess) + None, dc.cursor[CurMove], CurrentTime) != GrabSuccess) return; XQueryPointer(c->display, DefaultRootWindow(c->display), &dummy, &dummy, &x1, &y1, &di, &di, &dui); for(;;) @@ -106,7 +105,7 @@ resizemouse(Client * c, awesome_config *awesomeconf) ocx = c->x; ocy = c->y; if(XGrabPointer(c->display, DefaultRootWindow(c->display), False, MOUSEMASK, GrabModeAsync, GrabModeAsync, - None, cursor[CurResize], CurrentTime) != GrabSuccess) + None, dc.cursor[CurResize], CurrentTime) != GrabSuccess) return; c->ismax = False; XWarpPointer(c->display, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);