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