move cursors in awesome config
This commit is contained in:
parent
1a755ff245
commit
2d0526696c
16
awesome.c
16
awesome.c
|
@ -74,9 +74,9 @@ cleanup(DC *drawcontext, awesome_config *awesomeconf)
|
|||
XFreePixmap(awesomeconf->display, awesomeconf[screen].statusbar.drawable);
|
||||
XFreeGC(awesomeconf->display, drawcontext[screen].gc);
|
||||
XDestroyWindow(awesomeconf->display, awesomeconf[screen].statusbar.window);
|
||||
XFreeCursor(awesomeconf->display, drawcontext[screen].cursor[CurNormal]);
|
||||
XFreeCursor(awesomeconf->display, drawcontext[screen].cursor[CurResize]);
|
||||
XFreeCursor(awesomeconf->display, drawcontext[screen].cursor[CurMove]);
|
||||
XFreeCursor(awesomeconf->display, awesomeconf[screen].cursor[CurNormal]);
|
||||
XFreeCursor(awesomeconf->display, awesomeconf[screen].cursor[CurResize]);
|
||||
XFreeCursor(awesomeconf->display, awesomeconf[screen].cursor[CurMove]);
|
||||
|
||||
for(i = 0; i < awesomeconf[screen].ntags; i++)
|
||||
p_delete(&awesomeconf[screen].tags[i].name);
|
||||
|
@ -185,14 +185,14 @@ setup(DC *drawcontext, awesome_config *awesomeconf)
|
|||
XSetWindowAttributes wa;
|
||||
|
||||
/* init cursors */
|
||||
drawcontext->cursor[CurNormal] = XCreateFontCursor(awesomeconf->display, XC_left_ptr);
|
||||
drawcontext->cursor[CurResize] = XCreateFontCursor(awesomeconf->display, XC_sizing);
|
||||
drawcontext->cursor[CurMove] = XCreateFontCursor(awesomeconf->display, XC_fleur);
|
||||
awesomeconf->cursor[CurNormal] = XCreateFontCursor(awesomeconf->display, XC_left_ptr);
|
||||
awesomeconf->cursor[CurResize] = XCreateFontCursor(awesomeconf->display, XC_sizing);
|
||||
awesomeconf->cursor[CurMove] = XCreateFontCursor(awesomeconf->display, XC_fleur);
|
||||
|
||||
/* select for events */
|
||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||
wa.cursor = drawcontext->cursor[CurNormal];
|
||||
wa.cursor = awesomeconf->cursor[CurNormal];
|
||||
|
||||
XChangeWindowAttributes(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), CWEventMask | CWCursor, &wa);
|
||||
|
||||
|
@ -204,7 +204,7 @@ setup(DC *drawcontext, awesome_config *awesomeconf)
|
|||
|
||||
/* bar */
|
||||
awesomeconf->statusbar.height = drawcontext->font->height + 2;
|
||||
initstatusbar(awesomeconf->display, awesomeconf->screen, drawcontext, &awesomeconf->statusbar);
|
||||
initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, awesomeconf->cursor[CurNormal]);
|
||||
drawcontext->gc = XCreateGC(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), 0, 0);
|
||||
XSetLineAttributes(awesomeconf->display, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||
}
|
||||
|
|
3
config.h
3
config.h
|
@ -40,7 +40,6 @@ enum
|
|||
typedef struct
|
||||
{
|
||||
GC gc;
|
||||
Cursor cursor[CurLast];
|
||||
XftFont *font;
|
||||
} DC;
|
||||
|
||||
|
@ -158,6 +157,8 @@ struct awesome_config
|
|||
XColor colors_normal[ColLast];
|
||||
/** Selected colors */
|
||||
XColor colors_selected[ColLast];
|
||||
/** Cursors */
|
||||
Cursor cursor[CurLast];
|
||||
};
|
||||
|
||||
void parse_config(Display *, int, DC *, const char *, awesome_config *); /* parse configuration file */
|
||||
|
|
4
event.c
4
event.c
|
@ -65,7 +65,7 @@ movemouse(Client * c, awesome_config *awesomeconf)
|
|||
ocx = nx = c->x;
|
||||
ocy = ny = c->y;
|
||||
if(XGrabPointer(c->display, RootWindow(c->display, c->phys_screen), False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||
None, dc[c->screen].cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||
None, awesomeconf[c->screen].cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
XQueryPointer(c->display, RootWindow(c->display, c->phys_screen), &dummy, &dummy, &x1, &y1, &di, &di, &dui);
|
||||
for(;;)
|
||||
|
@ -110,7 +110,7 @@ resizemouse(Client * c, awesome_config *awesomeconf)
|
|||
ocy = c->y;
|
||||
if(XGrabPointer(c->display, RootWindow(c->display, c->phys_screen),
|
||||
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||
None, dc[c->screen].cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||
None, awesomeconf[c->screen].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);
|
||||
|
|
|
@ -104,7 +104,7 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
|
|||
}
|
||||
|
||||
void
|
||||
initstatusbar(Display *disp, int screen, DC *drawcontext, Statusbar *statusbar)
|
||||
initstatusbar(Display *disp, int screen, Statusbar *statusbar, Cursor cursor)
|
||||
{
|
||||
XSetWindowAttributes wa;
|
||||
int phys_screen;
|
||||
|
@ -118,14 +118,14 @@ initstatusbar(Display *disp, int screen, DC *drawcontext, Statusbar *statusbar)
|
|||
|
||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||
wa.cursor = drawcontext->cursor[CurNormal];
|
||||
wa.cursor = cursor;
|
||||
wa.override_redirect = 1;
|
||||
wa.background_pixmap = ParentRelative;
|
||||
wa.event_mask = ButtonPressMask | ExposureMask;
|
||||
statusbar->window = XCreateWindow(disp, RootWindow(disp, phys_screen), 0, 0, si[screen].width,
|
||||
statusbar->height, 0, DefaultDepth(disp, phys_screen), CopyFromParent,
|
||||
DefaultVisual(disp, phys_screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||
XDefineCursor(disp, statusbar->window, drawcontext->cursor[CurNormal]);
|
||||
XDefineCursor(disp, statusbar->window, cursor);
|
||||
updatebarpos(disp, *statusbar);
|
||||
XMapRaised(disp, statusbar->window);
|
||||
statusbar->drawable = XCreatePixmap(disp,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
void initstatusbar(Display *, int, DC *, Statusbar *);
|
||||
void initstatusbar(Display *, int, Statusbar *, Cursor);
|
||||
void drawstatusbar(Display *, DC *, awesome_config *);
|
||||
void updatebarpos(Display *, Statusbar);
|
||||
|
||||
|
|
Loading…
Reference in New Issue