mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
convert globals from G_foo to Foo, as per TODO.
"looks good" pedro@, ok matthieu@
This commit is contained in:
parent
4a498a4c60
commit
9006bbf20b
2
TODO
2
TODO
@ -28,5 +28,3 @@
|
|||||||
once before moving on.
|
once before moving on.
|
||||||
|
|
||||||
- cache all the atoms somewhere.
|
- cache all the atoms somewhere.
|
||||||
|
|
||||||
- convert globals from G_foo to Foo;
|
|
||||||
|
132
calmwm.c
132
calmwm.c
@ -10,24 +10,24 @@
|
|||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
Display *G_dpy;
|
Display *X_Dpy;
|
||||||
XFontStruct *G_font;
|
XFontStruct *X_Font;
|
||||||
|
|
||||||
Cursor G_cursor_move;
|
Cursor Cursor_move;
|
||||||
Cursor G_cursor_resize;
|
Cursor Cursor_resize;
|
||||||
Cursor G_cursor_select;
|
Cursor Cursor_select;
|
||||||
Cursor G_cursor_default;
|
Cursor Cursor_default;
|
||||||
Cursor G_cursor_question;
|
Cursor Cursor_question;
|
||||||
|
|
||||||
struct screen_ctx_q G_screenq;
|
struct screen_ctx_q Screenq;
|
||||||
struct screen_ctx *G_curscreen;
|
struct screen_ctx *Curscreen;
|
||||||
u_int G_nscreens;
|
u_int Nscreens;
|
||||||
|
|
||||||
struct client_ctx_q G_clientq;
|
struct client_ctx_q Clientq;
|
||||||
|
|
||||||
int G_doshape, G_shape_ev;
|
int Doshape, Shape_ev;
|
||||||
int G_starting;
|
int Starting;
|
||||||
struct conf G_conf;
|
struct conf Conf;
|
||||||
struct fontdesc *DefaultFont;
|
struct fontdesc *DefaultFont;
|
||||||
char *DefaultFontName;
|
char *DefaultFontName;
|
||||||
|
|
||||||
@ -86,12 +86,12 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
group_init();
|
group_init();
|
||||||
|
|
||||||
G_starting = 1;
|
Starting = 1;
|
||||||
conf_setup(&G_conf);
|
conf_setup(&Conf);
|
||||||
G_conf.flags |= conf_flags;
|
Conf.flags |= conf_flags;
|
||||||
client_setup();
|
client_setup();
|
||||||
x_setup(display_name);
|
x_setup(display_name);
|
||||||
G_starting = 0;
|
Starting = 0;
|
||||||
|
|
||||||
xev_init();
|
xev_init();
|
||||||
XEV_QUICK(NULL, NULL, MapRequest, xev_handle_maprequest, NULL);
|
XEV_QUICK(NULL, NULL, MapRequest, xev_handle_maprequest, NULL);
|
||||||
@ -121,39 +121,39 @@ x_setup(char *display_name)
|
|||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
char *fontname;
|
char *fontname;
|
||||||
|
|
||||||
TAILQ_INIT(&G_screenq);
|
TAILQ_INIT(&Screenq);
|
||||||
|
|
||||||
if ((G_dpy = XOpenDisplay(display_name)) == NULL)
|
if ((X_Dpy = XOpenDisplay(display_name)) == NULL)
|
||||||
errx(1, "%s:%d XOpenDisplay()", __FILE__, __LINE__);
|
errx(1, "%s:%d XOpenDisplay()", __FILE__, __LINE__);
|
||||||
|
|
||||||
XSetErrorHandler(x_errorhandler);
|
XSetErrorHandler(x_errorhandler);
|
||||||
|
|
||||||
G_doshape = XShapeQueryExtension(G_dpy, &G_shape_ev, &i);
|
Doshape = XShapeQueryExtension(X_Dpy, &Shape_ev, &i);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((fontname = tryfonts[i++]) != NULL) {
|
while ((fontname = tryfonts[i++]) != NULL) {
|
||||||
if ((G_font = XLoadQueryFont(G_dpy, fontname)) != NULL)
|
if ((X_Font = XLoadQueryFont(X_Dpy, fontname)) != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fontname == NULL)
|
if (fontname == NULL)
|
||||||
errx(1, "Couldn't load any fonts.");
|
errx(1, "Couldn't load any fonts.");
|
||||||
|
|
||||||
G_nscreens = ScreenCount(G_dpy);
|
Nscreens = ScreenCount(X_Dpy);
|
||||||
for (i = 0; i < (int)G_nscreens; i++) {
|
for (i = 0; i < (int)Nscreens; i++) {
|
||||||
XMALLOC(sc, struct screen_ctx);
|
XMALLOC(sc, struct screen_ctx);
|
||||||
x_setupscreen(sc, i);
|
x_setupscreen(sc, i);
|
||||||
TAILQ_INSERT_TAIL(&G_screenq, sc, entry);
|
TAILQ_INSERT_TAIL(&Screenq, sc, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_cursor_move = XCreateFontCursor(G_dpy, XC_fleur);
|
Cursor_move = XCreateFontCursor(X_Dpy, XC_fleur);
|
||||||
G_cursor_resize = XCreateFontCursor(G_dpy, XC_bottom_right_corner);
|
Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
|
||||||
/* (used to be) XCreateFontCursor(G_dpy, XC_hand1); */
|
/* (used to be) XCreateFontCursor(X_Dpy, XC_hand1); */
|
||||||
G_cursor_select = XCreateFontCursor(G_dpy, XC_hand1);
|
Cursor_select = XCreateFontCursor(X_Dpy, XC_hand1);
|
||||||
/* G_cursor_select = cursor_bigarrow(G_curscreen); */
|
/* Cursor_select = cursor_bigarrow(Curscreen); */
|
||||||
G_cursor_default = XCreateFontCursor(G_dpy, XC_X_cursor);
|
Cursor_default = XCreateFontCursor(X_Dpy, XC_X_cursor);
|
||||||
/* G_cursor_default = cursor_bigarrow(G_curscreen); */
|
/* Cursor_default = cursor_bigarrow(Curscreen); */
|
||||||
G_cursor_question = XCreateFontCursor(G_dpy, XC_question_arrow);
|
Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -169,55 +169,55 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
|
|||||||
|
|
||||||
sc->display = x_screenname(which);
|
sc->display = x_screenname(which);
|
||||||
sc->which = which;
|
sc->which = which;
|
||||||
sc->rootwin = RootWindow(G_dpy, which);
|
sc->rootwin = RootWindow(X_Dpy, which);
|
||||||
XAllocNamedColor(G_dpy, DefaultColormap(G_dpy, which),
|
XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
|
||||||
"black", &sc->fgcolor, &tmp);
|
"black", &sc->fgcolor, &tmp);
|
||||||
XAllocNamedColor(G_dpy, DefaultColormap(G_dpy, which),
|
XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
|
||||||
"#00cc00", &sc->bgcolor, &tmp);
|
"#00cc00", &sc->bgcolor, &tmp);
|
||||||
XAllocNamedColor(G_dpy,DefaultColormap(G_dpy, which),
|
XAllocNamedColor(X_Dpy,DefaultColormap(X_Dpy, which),
|
||||||
"blue", &sc->fccolor, &tmp);
|
"blue", &sc->fccolor, &tmp);
|
||||||
XAllocNamedColor(G_dpy, DefaultColormap(G_dpy, which),
|
XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
|
||||||
"red", &sc->redcolor, &tmp);
|
"red", &sc->redcolor, &tmp);
|
||||||
XAllocNamedColor(G_dpy, DefaultColormap(G_dpy, which),
|
XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
|
||||||
"#00ccc8", &sc->cyancolor, &tmp);
|
"#00ccc8", &sc->cyancolor, &tmp);
|
||||||
XAllocNamedColor(G_dpy, DefaultColormap(G_dpy, which),
|
XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
|
||||||
"white", &sc->whitecolor, &tmp);
|
"white", &sc->whitecolor, &tmp);
|
||||||
XAllocNamedColor(G_dpy, DefaultColormap(G_dpy, which),
|
XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
|
||||||
"black", &sc->blackcolor, &tmp);
|
"black", &sc->blackcolor, &tmp);
|
||||||
|
|
||||||
TAILQ_FOREACH(kb, &G_conf.keybindingq, entry)
|
TAILQ_FOREACH(kb, &Conf.keybindingq, entry)
|
||||||
xu_key_grab(sc->rootwin, kb->modmask, kb->keysym);
|
xu_key_grab(sc->rootwin, kb->modmask, kb->keysym);
|
||||||
|
|
||||||
/* Special -- for alt state. */
|
/* Special -- for alt state. */
|
||||||
/* xu_key_grab(sc->rootwin, 0, XK_Alt_L); */
|
/* xu_key_grab(sc->rootwin, 0, XK_Alt_L); */
|
||||||
/* xu_key_grab(sc->rootwin, 0, XK_Alt_R); */
|
/* xu_key_grab(sc->rootwin, 0, XK_Alt_R); */
|
||||||
|
|
||||||
sc->blackpixl = BlackPixel(G_dpy, sc->which);
|
sc->blackpixl = BlackPixel(X_Dpy, sc->which);
|
||||||
sc->whitepixl = WhitePixel(G_dpy, sc->which);
|
sc->whitepixl = WhitePixel(X_Dpy, sc->which);
|
||||||
sc->bluepixl = sc->fccolor.pixel;
|
sc->bluepixl = sc->fccolor.pixel;
|
||||||
sc->redpixl = sc->redcolor.pixel;
|
sc->redpixl = sc->redcolor.pixel;
|
||||||
sc->cyanpixl = sc->cyancolor.pixel;
|
sc->cyanpixl = sc->cyancolor.pixel;
|
||||||
|
|
||||||
sc->gray = XCreatePixmapFromBitmapData(G_dpy, sc->rootwin,
|
sc->gray = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
||||||
gray_bits, gray_width, gray_height,
|
gray_bits, gray_width, gray_height,
|
||||||
sc->blackpixl, sc->whitepixl, DefaultDepth(G_dpy, sc->which));
|
sc->blackpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
||||||
|
|
||||||
sc->blue = XCreatePixmapFromBitmapData(G_dpy, sc->rootwin,
|
sc->blue = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
||||||
gray_bits, gray_width, gray_height,
|
gray_bits, gray_width, gray_height,
|
||||||
sc->bluepixl, sc->whitepixl, DefaultDepth(G_dpy, sc->which));
|
sc->bluepixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
||||||
|
|
||||||
sc->red = XCreatePixmapFromBitmapData(G_dpy, sc->rootwin,
|
sc->red = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
||||||
gray_bits, gray_width, gray_height,
|
gray_bits, gray_width, gray_height,
|
||||||
sc->redpixl, sc->whitepixl, DefaultDepth(G_dpy, sc->which));
|
sc->redpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
||||||
|
|
||||||
gv.foreground = sc->blackpixl^sc->whitepixl;
|
gv.foreground = sc->blackpixl^sc->whitepixl;
|
||||||
gv.background = sc->whitepixl;
|
gv.background = sc->whitepixl;
|
||||||
gv.function = GXxor;
|
gv.function = GXxor;
|
||||||
gv.line_width = 1;
|
gv.line_width = 1;
|
||||||
gv.subwindow_mode = IncludeInferiors;
|
gv.subwindow_mode = IncludeInferiors;
|
||||||
gv.font = G_font->fid;
|
gv.font = X_Font->fid;
|
||||||
|
|
||||||
sc->gc = XCreateGC(G_dpy, sc->rootwin,
|
sc->gc = XCreateGC(X_Dpy, sc->rootwin,
|
||||||
GCForeground|GCBackground|GCFunction|
|
GCForeground|GCBackground|GCFunction|
|
||||||
GCLineWidth|GCSubwindowMode|GCFont, &gv);
|
GCLineWidth|GCSubwindowMode|GCFont, &gv);
|
||||||
|
|
||||||
@ -227,19 +227,19 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
|
|||||||
gv2.function = GXxor;
|
gv2.function = GXxor;
|
||||||
gv2.line_width = 1;
|
gv2.line_width = 1;
|
||||||
gv2.subwindow_mode = IncludeInferiors;
|
gv2.subwindow_mode = IncludeInferiors;
|
||||||
gv2.font = G_font->fid;
|
gv2.font = X_Font->fid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sc->hlgc = XCreateGC(G_dpy, sc->rootwin,
|
sc->hlgc = XCreateGC(X_Dpy, sc->rootwin,
|
||||||
GCForeground|GCBackground|GCFunction|
|
GCForeground|GCBackground|GCFunction|
|
||||||
GCLineWidth|GCSubwindowMode|GCFont, &gv);
|
GCLineWidth|GCSubwindowMode|GCFont, &gv);
|
||||||
|
|
||||||
gv1.function = GXinvert;
|
gv1.function = GXinvert;
|
||||||
gv1.subwindow_mode = IncludeInferiors;
|
gv1.subwindow_mode = IncludeInferiors;
|
||||||
gv1.line_width = 1;
|
gv1.line_width = 1;
|
||||||
gv1.font = G_font->fid;
|
gv1.font = X_Font->fid;
|
||||||
|
|
||||||
sc->invgc = XCreateGC(G_dpy, sc->rootwin,
|
sc->invgc = XCreateGC(X_Dpy, sc->rootwin,
|
||||||
GCFunction|GCSubwindowMode|GCLineWidth|GCFont, &gv1);
|
GCFunction|GCSubwindowMode|GCLineWidth|GCFont, &gv1);
|
||||||
|
|
||||||
font_init(sc);
|
font_init(sc);
|
||||||
@ -256,21 +256,21 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
|
|||||||
search_init(sc);
|
search_init(sc);
|
||||||
|
|
||||||
/* Deal with existing clients. */
|
/* Deal with existing clients. */
|
||||||
XQueryTree(G_dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
|
XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
|
||||||
|
|
||||||
for (i = 0; i < nwins; i++) {
|
for (i = 0; i < nwins; i++) {
|
||||||
XGetWindowAttributes(G_dpy, wins[i], &winattr);
|
XGetWindowAttributes(X_Dpy, wins[i], &winattr);
|
||||||
if (winattr.override_redirect ||
|
if (winattr.override_redirect ||
|
||||||
winattr.map_state != IsViewable) {
|
winattr.map_state != IsViewable) {
|
||||||
char *name;
|
char *name;
|
||||||
XFetchName(G_dpy, wins[i], &name);
|
XFetchName(X_Dpy, wins[i], &name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
client_new(wins[i], sc, winattr.map_state != IsUnmapped);
|
client_new(wins[i], sc, winattr.map_state != IsUnmapped);
|
||||||
}
|
}
|
||||||
XFree(wins);
|
XFree(wins);
|
||||||
|
|
||||||
G_curscreen = sc; /* XXX */
|
Curscreen = sc; /* XXX */
|
||||||
screen_init();
|
screen_init();
|
||||||
screen_updatestackingorder();
|
screen_updatestackingorder();
|
||||||
|
|
||||||
@ -280,10 +280,10 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
|
|||||||
/* Set the root cursor to a nice obnoxious arrow :-) */
|
/* Set the root cursor to a nice obnoxious arrow :-) */
|
||||||
/* rootattr.cursor = cursor_bigarrow(sc); */
|
/* rootattr.cursor = cursor_bigarrow(sc); */
|
||||||
|
|
||||||
XChangeWindowAttributes(G_dpy, sc->rootwin,
|
XChangeWindowAttributes(X_Dpy, sc->rootwin,
|
||||||
/* CWCursor| */CWEventMask, &rootattr);
|
/* CWCursor| */CWEventMask, &rootattr);
|
||||||
|
|
||||||
XSync(G_dpy, False);
|
XSync(X_Dpy, False);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ x_screenname(int which)
|
|||||||
errx(1, "Can't handle more than 9 screens. If you need it, "
|
errx(1, "Can't handle more than 9 screens. If you need it, "
|
||||||
"tell <marius@monkey.org>. It's a trivial fix.");
|
"tell <marius@monkey.org>. It's a trivial fix.");
|
||||||
|
|
||||||
dstr = xstrdup(DisplayString(G_dpy));
|
dstr = xstrdup(DisplayString(X_Dpy));
|
||||||
|
|
||||||
if ((cp = rindex(dstr, ':')) == NULL)
|
if ((cp = rindex(dstr, ':')) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -321,16 +321,16 @@ x_errorhandler(Display *dpy, XErrorEvent *e)
|
|||||||
{
|
{
|
||||||
char msg[80], number[80], req[80];
|
char msg[80], number[80], req[80];
|
||||||
|
|
||||||
XGetErrorText(G_dpy, e->error_code, msg, sizeof(msg));
|
XGetErrorText(X_Dpy, e->error_code, msg, sizeof(msg));
|
||||||
snprintf(number, sizeof(number), "%d", e->request_code);
|
snprintf(number, sizeof(number), "%d", e->request_code);
|
||||||
XGetErrorDatabaseText(G_dpy, "XRequest", number,
|
XGetErrorDatabaseText(X_Dpy, "XRequest", number,
|
||||||
"<unknown>", req, sizeof(req));
|
"<unknown>", req, sizeof(req));
|
||||||
|
|
||||||
warnx("%s(0x%x): %s", req, (u_int)e->resourceid, msg);
|
warnx("%s(0x%x): %s", req, (u_int)e->resourceid, msg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (G_starting &&
|
if (Starting &&
|
||||||
e->error_code == BadAccess &&
|
e->error_code == BadAccess &&
|
||||||
e->request_code == X_GrabKey)
|
e->request_code == X_GrabKey)
|
||||||
errx(1, "root window unavailable - perhaps another "
|
errx(1, "root window unavailable - perhaps another "
|
||||||
|
28
calmwm.h
28
calmwm.h
@ -484,25 +484,25 @@ struct fontdesc *font_getx(struct screen_ctx *sc, const char *name);
|
|||||||
|
|
||||||
/* Externs */
|
/* Externs */
|
||||||
|
|
||||||
extern Display *G_dpy;
|
extern Display *X_Dpy;
|
||||||
extern XFontStruct *G_font;
|
extern XFontStruct *X_Font;
|
||||||
|
|
||||||
extern Cursor G_cursor_move;
|
extern Cursor Cursor_move;
|
||||||
extern Cursor G_cursor_resize;
|
extern Cursor Cursor_resize;
|
||||||
extern Cursor G_cursor_select;
|
extern Cursor Cursor_select;
|
||||||
extern Cursor G_cursor_default;
|
extern Cursor Cursor_default;
|
||||||
extern Cursor G_cursor_question;
|
extern Cursor Cursor_question;
|
||||||
|
|
||||||
extern struct screen_ctx_q G_screenq;
|
extern struct screen_ctx_q Screenq;
|
||||||
extern struct screen_ctx *G_curscreen;
|
extern struct screen_ctx *curscreen;
|
||||||
extern u_int G_nscreens;
|
extern u_int Nscreens;
|
||||||
|
|
||||||
extern struct client_ctx_q G_clientq;
|
extern struct client_ctx_q Clientq;
|
||||||
|
|
||||||
extern int G_doshape, G_shape_ev;
|
extern int Doshape, Shape_ev;
|
||||||
extern struct conf G_conf;
|
extern struct conf Conf;
|
||||||
|
|
||||||
extern int G_groupmode;
|
extern int Groupmode;
|
||||||
extern struct fontdesc *DefaultFont;
|
extern struct fontdesc *DefaultFont;
|
||||||
|
|
||||||
|
|
||||||
|
140
client.c
140
client.c
@ -21,7 +21,7 @@ struct client_ctx *_curcc = NULL;
|
|||||||
void
|
void
|
||||||
client_setup(void)
|
client_setup(void)
|
||||||
{
|
{
|
||||||
TAILQ_INIT(&G_clientq);
|
TAILQ_INIT(&Clientq);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
@ -29,7 +29,7 @@ client_find(Window win)
|
|||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &G_clientq, entry)
|
TAILQ_FOREACH(cc, &Clientq, entry)
|
||||||
if (cc->pwin == win || cc->win == win)
|
if (cc->pwin == win || cc->win == win)
|
||||||
return (cc);
|
return (cc);
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
|
|
||||||
XCALLOC(cc, struct client_ctx);
|
XCALLOC(cc, struct client_ctx);
|
||||||
|
|
||||||
XGrabServer(G_dpy);
|
XGrabServer(X_Dpy);
|
||||||
|
|
||||||
cc->state = mapped ? NormalState : IconicState;
|
cc->state = mapped ? NormalState : IconicState;
|
||||||
cc->sc = sc;
|
cc->sc = sc;
|
||||||
@ -70,8 +70,8 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
*/
|
*/
|
||||||
conf_client(cc);
|
conf_client(cc);
|
||||||
|
|
||||||
XGetWMNormalHints(G_dpy, cc->win, cc->size, &tmp);
|
XGetWMNormalHints(X_Dpy, cc->win, cc->size, &tmp);
|
||||||
XGetWindowAttributes(G_dpy, cc->win, &wattr);
|
XGetWindowAttributes(X_Dpy, cc->win, &wattr);
|
||||||
|
|
||||||
if (cc->size->flags & PBaseSize) {
|
if (cc->size->flags & PBaseSize) {
|
||||||
cc->geom.min_dx = cc->size->base_width;
|
cc->geom.min_dx = cc->size->base_width;
|
||||||
@ -96,7 +96,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
|
|
||||||
if (wattr.map_state != IsViewable) {
|
if (wattr.map_state != IsViewable) {
|
||||||
client_placecalc(cc);
|
client_placecalc(cc);
|
||||||
if ((wmhints = XGetWMHints(G_dpy, cc->win)) != NULL) {
|
if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) {
|
||||||
if (wmhints->flags & StateHint)
|
if (wmhints->flags & StateHint)
|
||||||
xu_setstate(cc, wmhints->initial_state);
|
xu_setstate(cc, wmhints->initial_state);
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
if (xu_getstate(cc, &state) < 0)
|
if (xu_getstate(cc, &state) < 0)
|
||||||
state = NormalState;
|
state = NormalState;
|
||||||
|
|
||||||
XSelectInput(G_dpy, cc->win,
|
XSelectInput(X_Dpy, cc->win,
|
||||||
ColormapChangeMask|EnterWindowMask|PropertyChangeMask|KeyReleaseMask);
|
ColormapChangeMask|EnterWindowMask|PropertyChangeMask|KeyReleaseMask);
|
||||||
|
|
||||||
x = cc->geom.x - cc->bwidth;
|
x = cc->geom.x - cc->bwidth;
|
||||||
@ -129,24 +129,24 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
/* pxattr.background_pixel = sc->whitepix; */
|
/* pxattr.background_pixel = sc->whitepix; */
|
||||||
|
|
||||||
|
|
||||||
/* cc->pwin = XCreateSimpleWindow(G_dpy, sc->rootwin, */
|
/* cc->pwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, */
|
||||||
/* x, y, width, height, 1, sc->blackpix, sc->whitepix); */
|
/* x, y, width, height, 1, sc->blackpix, sc->whitepix); */
|
||||||
|
|
||||||
cc->pwin = XCreateWindow(G_dpy, sc->rootwin, x, y,
|
cc->pwin = XCreateWindow(X_Dpy, sc->rootwin, x, y,
|
||||||
width, height, 0, /* XXX */
|
width, height, 0, /* XXX */
|
||||||
DefaultDepth(G_dpy, sc->which), CopyFromParent,
|
DefaultDepth(X_Dpy, sc->which), CopyFromParent,
|
||||||
DefaultVisual(G_dpy, sc->which),
|
DefaultVisual(X_Dpy, sc->which),
|
||||||
CWOverrideRedirect | CWBackPixel | CWEventMask, &pxattr);
|
CWOverrideRedirect | CWBackPixel | CWEventMask, &pxattr);
|
||||||
|
|
||||||
if (G_doshape) {
|
if (Doshape) {
|
||||||
XRectangle *r;
|
XRectangle *r;
|
||||||
int n, tmp;
|
int n, tmp;
|
||||||
|
|
||||||
XShapeSelectInput(G_dpy, cc->win, ShapeNotifyMask);
|
XShapeSelectInput(X_Dpy, cc->win, ShapeNotifyMask);
|
||||||
|
|
||||||
r = XShapeGetRectangles(G_dpy, cc->win, ShapeBounding, &n, &tmp);
|
r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding, &n, &tmp);
|
||||||
if (n > 1)
|
if (n > 1)
|
||||||
XShapeCombineShape(G_dpy, cc->pwin, ShapeBounding,
|
XShapeCombineShape(X_Dpy, cc->pwin, ShapeBounding,
|
||||||
0, 0, /* XXX border */
|
0, 0, /* XXX border */
|
||||||
cc->win, ShapeBounding, ShapeSet);
|
cc->win, ShapeBounding, ShapeSet);
|
||||||
XFree(r);
|
XFree(r);
|
||||||
@ -155,28 +155,28 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
cc->active = 0;
|
cc->active = 0;
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
|
|
||||||
XAddToSaveSet(G_dpy, cc->win);
|
XAddToSaveSet(X_Dpy, cc->win);
|
||||||
XSetWindowBorderWidth(G_dpy, cc->win, 0);
|
XSetWindowBorderWidth(X_Dpy, cc->win, 0);
|
||||||
XReparentWindow(G_dpy, cc->win, cc->pwin, cc->bwidth, cc->bwidth);
|
XReparentWindow(X_Dpy, cc->win, cc->pwin, cc->bwidth, cc->bwidth);
|
||||||
|
|
||||||
/* Notify client of its configuration. */
|
/* Notify client of its configuration. */
|
||||||
xev_reconfig(cc);
|
xev_reconfig(cc);
|
||||||
|
|
||||||
XMapRaised(G_dpy, cc->pwin);
|
XMapRaised(X_Dpy, cc->pwin);
|
||||||
XMapWindow(G_dpy, cc->win);
|
XMapWindow(X_Dpy, cc->win);
|
||||||
xu_setstate(cc, cc->state);
|
xu_setstate(cc, cc->state);
|
||||||
|
|
||||||
XSync(G_dpy, False);
|
XSync(X_Dpy, False);
|
||||||
XUngrabServer(G_dpy);
|
XUngrabServer(X_Dpy);
|
||||||
|
|
||||||
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
||||||
TAILQ_INSERT_TAIL(&G_clientq, cc, entry);
|
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
|
||||||
|
|
||||||
client_gethints(cc);
|
client_gethints(cc);
|
||||||
client_update(cc);
|
client_update(cc);
|
||||||
|
|
||||||
if (mapped) {
|
if (mapped) {
|
||||||
if (G_conf.flags & CONF_STICKY_GROUPS)
|
if (Conf.flags & CONF_STICKY_GROUPS)
|
||||||
group_sticky(cc);
|
group_sticky(cc);
|
||||||
else
|
else
|
||||||
group_autogroup(cc);
|
group_autogroup(cc);
|
||||||
@ -195,25 +195,25 @@ client_delete(struct client_ctx *cc, int sendevent, int ignorewindow)
|
|||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
group_client_delete(cc);
|
group_client_delete(cc);
|
||||||
XGrabServer(G_dpy);
|
XGrabServer(X_Dpy);
|
||||||
|
|
||||||
xu_setstate(cc, WithdrawnState);
|
xu_setstate(cc, WithdrawnState);
|
||||||
XRemoveFromSaveSet(G_dpy, cc->win);
|
XRemoveFromSaveSet(X_Dpy, cc->win);
|
||||||
|
|
||||||
if (!ignorewindow) {
|
if (!ignorewindow) {
|
||||||
client_gravitate(cc, 0);
|
client_gravitate(cc, 0);
|
||||||
XSetWindowBorderWidth(G_dpy, cc->win, 1); /* XXX */
|
XSetWindowBorderWidth(X_Dpy, cc->win, 1); /* XXX */
|
||||||
XReparentWindow(G_dpy, cc->win,
|
XReparentWindow(X_Dpy, cc->win,
|
||||||
sc->rootwin, cc->geom.x, cc->geom.y);
|
sc->rootwin, cc->geom.x, cc->geom.y);
|
||||||
}
|
}
|
||||||
if (cc->pwin)
|
if (cc->pwin)
|
||||||
XDestroyWindow(G_dpy, cc->pwin);
|
XDestroyWindow(X_Dpy, cc->pwin);
|
||||||
|
|
||||||
XSync(G_dpy, False);
|
XSync(X_Dpy, False);
|
||||||
XUngrabServer(G_dpy);
|
XUngrabServer(X_Dpy);
|
||||||
|
|
||||||
TAILQ_REMOVE(&sc->mruq, cc, mru_entry);
|
TAILQ_REMOVE(&sc->mruq, cc, mru_entry);
|
||||||
TAILQ_REMOVE(&G_clientq, cc, entry);
|
TAILQ_REMOVE(&Clientq, cc, entry);
|
||||||
|
|
||||||
if (_curcc == cc)
|
if (_curcc == cc)
|
||||||
_curcc = NULL;
|
_curcc = NULL;
|
||||||
@ -273,8 +273,8 @@ client_setactive(struct client_ctx *cc, int fg)
|
|||||||
sc = CCTOSC(cc);
|
sc = CCTOSC(cc);
|
||||||
|
|
||||||
if (fg) {
|
if (fg) {
|
||||||
XInstallColormap(G_dpy, cc->cmap);
|
XInstallColormap(X_Dpy, cc->cmap);
|
||||||
XSetInputFocus(G_dpy, cc->win,
|
XSetInputFocus(X_Dpy, cc->win,
|
||||||
RevertToPointerRoot, CurrentTime);
|
RevertToPointerRoot, CurrentTime);
|
||||||
xu_btn_grab(cc->pwin, Mod1Mask, AnyButton);
|
xu_btn_grab(cc->pwin, Mod1Mask, AnyButton);
|
||||||
xu_btn_grab(cc->pwin, ControlMask|Mod1Mask, Button1);
|
xu_btn_grab(cc->pwin, ControlMask|Mod1Mask, Button1);
|
||||||
@ -334,7 +334,7 @@ client_maximize(struct client_ctx *cc)
|
|||||||
XWindowAttributes rootwin_geom;
|
XWindowAttributes rootwin_geom;
|
||||||
struct screen_ctx *sc = CCTOSC(cc);
|
struct screen_ctx *sc = CCTOSC(cc);
|
||||||
|
|
||||||
XGetWindowAttributes(G_dpy, sc->rootwin, &rootwin_geom);
|
XGetWindowAttributes(X_Dpy, sc->rootwin, &rootwin_geom);
|
||||||
cc->savegeom = cc->geom;
|
cc->savegeom = cc->geom;
|
||||||
cc->geom.x = 0;
|
cc->geom.x = 0;
|
||||||
cc->geom.y = 0;
|
cc->geom.y = 0;
|
||||||
@ -362,10 +362,10 @@ client_restore_geometry(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
client_resize(struct client_ctx *cc)
|
client_resize(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
XMoveResizeWindow(G_dpy, cc->pwin, cc->geom.x - cc->bwidth,
|
XMoveResizeWindow(X_Dpy, cc->pwin, cc->geom.x - cc->bwidth,
|
||||||
cc->geom.y - cc->bwidth, cc->geom.width + cc->bwidth*2,
|
cc->geom.y - cc->bwidth, cc->geom.width + cc->bwidth*2,
|
||||||
cc->geom.height + cc->bwidth*2);
|
cc->geom.height + cc->bwidth*2);
|
||||||
XMoveResizeWindow(G_dpy, cc->win, cc->bwidth, cc->bwidth,
|
XMoveResizeWindow(X_Dpy, cc->win, cc->bwidth, cc->bwidth,
|
||||||
cc->geom.width, cc->geom.height);
|
cc->geom.width, cc->geom.height);
|
||||||
xev_reconfig(cc);
|
xev_reconfig(cc);
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
@ -374,7 +374,7 @@ client_resize(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
client_move(struct client_ctx *cc)
|
client_move(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
XMoveWindow(G_dpy, cc->pwin,
|
XMoveWindow(X_Dpy, cc->pwin,
|
||||||
cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth);
|
cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth);
|
||||||
xev_reconfig(cc);
|
xev_reconfig(cc);
|
||||||
}
|
}
|
||||||
@ -382,13 +382,13 @@ client_move(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
client_lower(struct client_ctx *cc)
|
client_lower(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
XLowerWindow(G_dpy, cc->pwin);
|
XLowerWindow(X_Dpy, cc->pwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
client_raise(struct client_ctx *cc)
|
client_raise(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
XRaiseWindow(G_dpy, cc->pwin);
|
XRaiseWindow(X_Dpy, cc->pwin);
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,8 +429,8 @@ void
|
|||||||
client_hide(struct client_ctx *cc)
|
client_hide(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
/* XXX - add wm_state stuff */
|
/* XXX - add wm_state stuff */
|
||||||
XUnmapWindow(G_dpy, cc->pwin);
|
XUnmapWindow(X_Dpy, cc->pwin);
|
||||||
XUnmapWindow(G_dpy, cc->win);
|
XUnmapWindow(X_Dpy, cc->win);
|
||||||
|
|
||||||
cc->active = 0;
|
cc->active = 0;
|
||||||
cc->flags |= CLIENT_HIDDEN;
|
cc->flags |= CLIENT_HIDDEN;
|
||||||
@ -443,8 +443,8 @@ client_hide(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
client_unhide(struct client_ctx *cc)
|
client_unhide(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
XMapWindow(G_dpy, cc->win);
|
XMapWindow(X_Dpy, cc->win);
|
||||||
XMapRaised(G_dpy, cc->pwin);
|
XMapRaised(X_Dpy, cc->pwin);
|
||||||
|
|
||||||
cc->flags &= ~CLIENT_HIDDEN;
|
cc->flags &= ~CLIENT_HIDDEN;
|
||||||
xu_setstate(cc, NormalState);
|
xu_setstate(cc, NormalState);
|
||||||
@ -456,21 +456,21 @@ client_draw_border(struct client_ctx *cc)
|
|||||||
struct screen_ctx *sc = CCTOSC(cc);
|
struct screen_ctx *sc = CCTOSC(cc);
|
||||||
|
|
||||||
if (cc->active) {
|
if (cc->active) {
|
||||||
XSetWindowBackground(G_dpy, cc->pwin, client_bg_pixel(cc));
|
XSetWindowBackground(X_Dpy, cc->pwin, client_bg_pixel(cc));
|
||||||
XClearWindow(G_dpy, cc->pwin);
|
XClearWindow(X_Dpy, cc->pwin);
|
||||||
|
|
||||||
if (!cc->highlight && cc->bwidth > 1)
|
if (!cc->highlight && cc->bwidth > 1)
|
||||||
XDrawRectangle(G_dpy, cc->pwin, sc->gc, 1, 1,
|
XDrawRectangle(X_Dpy, cc->pwin, sc->gc, 1, 1,
|
||||||
cc->geom.width + cc->bwidth,
|
cc->geom.width + cc->bwidth,
|
||||||
cc->geom.height + cc->bwidth);
|
cc->geom.height + cc->bwidth);
|
||||||
} else {
|
} else {
|
||||||
XSetWindowBackgroundPixmap(G_dpy, cc->pwin,
|
XSetWindowBackgroundPixmap(X_Dpy, cc->pwin,
|
||||||
client_bg_pixmap(cc));
|
client_bg_pixmap(cc));
|
||||||
if (cc->bwidth > 1)
|
if (cc->bwidth > 1)
|
||||||
XSetWindowBackgroundPixmap(G_dpy,
|
XSetWindowBackgroundPixmap(X_Dpy,
|
||||||
cc->pwin, client_bg_pixmap(cc));
|
cc->pwin, client_bg_pixmap(cc));
|
||||||
|
|
||||||
XClearWindow(G_dpy, cc->pwin);
|
XClearWindow(X_Dpy, cc->pwin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,9 +524,9 @@ client_update(struct client_ctx *cc)
|
|||||||
long n;
|
long n;
|
||||||
|
|
||||||
/* XXX cache these. */
|
/* XXX cache these. */
|
||||||
wm_delete = XInternAtom(G_dpy, "WM_DELETE_WINDOW", False);
|
wm_delete = XInternAtom(X_Dpy, "WM_DELETE_WINDOW", False);
|
||||||
wm_protocols = XInternAtom(G_dpy, "WM_PROTOCOLS", False);
|
wm_protocols = XInternAtom(X_Dpy, "WM_PROTOCOLS", False);
|
||||||
wm_take_focus = XInternAtom(G_dpy, "WM_TAKE_FOCUS", False);
|
wm_take_focus = XInternAtom(X_Dpy, "WM_TAKE_FOCUS", False);
|
||||||
|
|
||||||
if ((n = xu_getprop(cc, wm_protocols,
|
if ((n = xu_getprop(cc, wm_protocols,
|
||||||
XA_ATOM, 20L, (u_char **)&p)) <= 0)
|
XA_ATOM, 20L, (u_char **)&p)) <= 0)
|
||||||
@ -547,13 +547,13 @@ client_send_delete(struct client_ctx *cc)
|
|||||||
Atom wm_delete, wm_protocols;
|
Atom wm_delete, wm_protocols;
|
||||||
|
|
||||||
/* XXX - cache */
|
/* XXX - cache */
|
||||||
wm_delete = XInternAtom(G_dpy, "WM_DELETE_WINDOW", False);
|
wm_delete = XInternAtom(X_Dpy, "WM_DELETE_WINDOW", False);
|
||||||
wm_protocols = XInternAtom(G_dpy, "WM_PROTOCOLS", False);
|
wm_protocols = XInternAtom(X_Dpy, "WM_PROTOCOLS", False);
|
||||||
|
|
||||||
if (cc->xproto & CLIENT_PROTO_DELETE)
|
if (cc->xproto & CLIENT_PROTO_DELETE)
|
||||||
xu_sendmsg(cc, wm_protocols, wm_delete);
|
xu_sendmsg(cc, wm_protocols, wm_delete);
|
||||||
else
|
else
|
||||||
XKillClient(G_dpy, cc->win);
|
XKillClient(X_Dpy, cc->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -562,7 +562,7 @@ client_setname(struct client_ctx *cc)
|
|||||||
char *newname;
|
char *newname;
|
||||||
struct winname *wn;
|
struct winname *wn;
|
||||||
|
|
||||||
XFetchName(G_dpy, cc->win, &newname);
|
XFetchName(X_Dpy, cc->win, &newname);
|
||||||
if (newname == NULL)
|
if (newname == NULL)
|
||||||
newname = emptystring;
|
newname = emptystring;
|
||||||
|
|
||||||
@ -689,10 +689,10 @@ client_cycleinfo(struct client_ctx *cc)
|
|||||||
if ((diff = cc->geom.height - (y + h)) < 0)
|
if ((diff = cc->geom.height - (y + h)) < 0)
|
||||||
y += diff;
|
y += diff;
|
||||||
|
|
||||||
XReparentWindow(G_dpy, sc->infowin, cc->win, 0, 0);
|
XReparentWindow(X_Dpy, sc->infowin, cc->win, 0, 0);
|
||||||
XMoveResizeWindow(G_dpy, sc->infowin, x, y, w, h);
|
XMoveResizeWindow(X_Dpy, sc->infowin, x, y, w, h);
|
||||||
XMapRaised(G_dpy, sc->infowin);
|
XMapRaised(X_Dpy, sc->infowin);
|
||||||
XClearWindow(G_dpy, sc->infowin);
|
XClearWindow(X_Dpy, sc->infowin);
|
||||||
|
|
||||||
for (i = 0, n = 0; i < sizeof(list)/sizeof(list[0]); i++) {
|
for (i = 0, n = 0; i < sizeof(list)/sizeof(list[0]); i++) {
|
||||||
if ((ccc = list[i]) == NULL)
|
if ((ccc = list[i]) == NULL)
|
||||||
@ -707,7 +707,7 @@ client_cycleinfo(struct client_ctx *cc)
|
|||||||
assert(curn != -1);
|
assert(curn != -1);
|
||||||
|
|
||||||
/* Highlight the current entry. */
|
/* Highlight the current entry. */
|
||||||
XFillRectangle(G_dpy, sc->infowin, sc->hlgc, 0, curn*oneh, w, oneh);
|
XFillRectangle(X_Dpy, sc->infowin, sc->hlgc, 0, curn*oneh, w, oneh);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
@ -754,8 +754,8 @@ client_altrelease()
|
|||||||
return;
|
return;
|
||||||
sc = CCTOSC(cc);
|
sc = CCTOSC(cc);
|
||||||
|
|
||||||
XUnmapWindow(G_dpy, sc->infowin);
|
XUnmapWindow(X_Dpy, sc->infowin);
|
||||||
XReparentWindow(G_dpy, sc->infowin, sc->rootwin, 0, 0);
|
XReparentWindow(X_Dpy, sc->infowin, sc->rootwin, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -771,8 +771,8 @@ client_placecalc(struct client_ctx *cc)
|
|||||||
height = cc->geom.height;
|
height = cc->geom.height;
|
||||||
width = cc->geom.width;
|
width = cc->geom.width;
|
||||||
|
|
||||||
ymax = DisplayHeight(G_dpy, sc->which) - cc->bwidth;
|
ymax = DisplayHeight(X_Dpy, sc->which) - cc->bwidth;
|
||||||
xmax = DisplayWidth(G_dpy, sc->which) - cc->bwidth;
|
xmax = DisplayWidth(X_Dpy, sc->which) - cc->bwidth;
|
||||||
|
|
||||||
yslack = ymax - cc->geom.height;
|
yslack = ymax - cc->geom.height;
|
||||||
xslack = xmax - cc->geom.width;
|
xslack = xmax - cc->geom.width;
|
||||||
@ -827,7 +827,7 @@ client_vertmaximize(struct client_ctx *cc)
|
|||||||
cc->geom = cc->savegeom;
|
cc->geom = cc->savegeom;
|
||||||
} else {
|
} else {
|
||||||
struct screen_ctx *sc = CCTOSC(cc);
|
struct screen_ctx *sc = CCTOSC(cc);
|
||||||
int display_height = DisplayHeight(G_dpy, sc->which) -
|
int display_height = DisplayHeight(X_Dpy, sc->which) -
|
||||||
cc->bwidth*2;
|
cc->bwidth*2;
|
||||||
|
|
||||||
cc->savegeom = cc->geom;
|
cc->savegeom = cc->geom;
|
||||||
@ -876,21 +876,21 @@ client_gethints(struct client_ctx *cc)
|
|||||||
Atom mha;
|
Atom mha;
|
||||||
struct mwm_hints *mwmh;
|
struct mwm_hints *mwmh;
|
||||||
|
|
||||||
if (XGetClassHint(G_dpy, cc->win, &xch)) {
|
if (XGetClassHint(X_Dpy, cc->win, &xch)) {
|
||||||
if (xch.res_name != NULL)
|
if (xch.res_name != NULL)
|
||||||
cc->app_name = xch.res_name;
|
cc->app_name = xch.res_name;
|
||||||
if (xch.res_class != NULL)
|
if (xch.res_class != NULL)
|
||||||
cc->app_class = xch.res_class;
|
cc->app_class = xch.res_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
mha = XInternAtom(G_dpy, "_MOTIF_WM_HINTS", False);
|
mha = XInternAtom(X_Dpy, "_MOTIF_WM_HINTS", False);
|
||||||
if (xu_getprop(cc, mha, mha, PROP_MWM_HINTS_ELEMENTS,
|
if (xu_getprop(cc, mha, mha, PROP_MWM_HINTS_ELEMENTS,
|
||||||
(u_char **)&mwmh) == MWM_NUMHINTS)
|
(u_char **)&mwmh) == MWM_NUMHINTS)
|
||||||
if (mwmh->flags & MWM_HINTS_DECORATIONS &&
|
if (mwmh->flags & MWM_HINTS_DECORATIONS &&
|
||||||
!(mwmh->decorations & MWM_DECOR_ALL) &&
|
!(mwmh->decorations & MWM_DECOR_ALL) &&
|
||||||
!(mwmh->decorations & MWM_DECOR_BORDER))
|
!(mwmh->decorations & MWM_DECOR_BORDER))
|
||||||
cc->bwidth = 0;
|
cc->bwidth = 0;
|
||||||
if (XGetCommand(G_dpy, cc->win, &argv, &argc)) {
|
if (XGetCommand(X_Dpy, cc->win, &argv, &argc)) {
|
||||||
#define MAX_ARGLEN 512
|
#define MAX_ARGLEN 512
|
||||||
#define ARG_SEP_ " "
|
#define ARG_SEP_ " "
|
||||||
int len = MAX_ARGLEN;
|
int len = MAX_ARGLEN;
|
||||||
|
10
conf.c
10
conf.c
@ -78,9 +78,9 @@ conf_cmd_add(struct conf *c, char *image, char *label, int flags)
|
|||||||
/* "term" and "lock" have special meanings. */
|
/* "term" and "lock" have special meanings. */
|
||||||
|
|
||||||
if (strcmp(label, "term") == 0) {
|
if (strcmp(label, "term") == 0) {
|
||||||
strlcpy(G_conf.termpath, image, sizeof(G_conf.termpath));
|
strlcpy(Conf.termpath, image, sizeof(Conf.termpath));
|
||||||
} else if (strcmp(label, "lock") == 0) {
|
} else if (strcmp(label, "lock") == 0) {
|
||||||
strlcpy(G_conf.lockpath, image, sizeof(G_conf.lockpath));
|
strlcpy(Conf.lockpath, image, sizeof(Conf.lockpath));
|
||||||
} else {
|
} else {
|
||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
XMALLOC(cmd, struct cmd);
|
XMALLOC(cmd, struct cmd);
|
||||||
@ -262,8 +262,8 @@ conf_setup(struct conf *c)
|
|||||||
c->flags = 0;
|
c->flags = 0;
|
||||||
|
|
||||||
/* Default term/lock */
|
/* Default term/lock */
|
||||||
strlcpy(G_conf.termpath, "xterm", sizeof(G_conf.termpath));
|
strlcpy(Conf.termpath, "xterm", sizeof(Conf.termpath));
|
||||||
strlcpy(G_conf.lockpath, "xlock", sizeof(G_conf.lockpath));
|
strlcpy(Conf.lockpath, "xlock", sizeof(Conf.lockpath));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -471,7 +471,7 @@ conf_parsesettings(struct conf *c, char *filename)
|
|||||||
if (ent->d_name[0] == '.')
|
if (ent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
if (strncmp(ent->d_name, "sticky", 7)==0)
|
if (strncmp(ent->d_name, "sticky", 7)==0)
|
||||||
G_conf.flags |= CONF_STICKY_GROUPS;
|
Conf.flags |= CONF_STICKY_GROUPS;
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
6
cursor.c
6
cursor.c
@ -48,12 +48,12 @@ _mkcursor(struct cursor_data *c, struct screen_ctx *sc)
|
|||||||
{
|
{
|
||||||
Pixmap f, m;
|
Pixmap f, m;
|
||||||
|
|
||||||
f = XCreatePixmapFromBitmapData(G_dpy, sc->rootwin, (char *)c->fore,
|
f = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin, (char *)c->fore,
|
||||||
c->width, c->width, 1, 0, 1);
|
c->width, c->width, 1, 0, 1);
|
||||||
m = XCreatePixmapFromBitmapData(G_dpy, sc->rootwin, (char *)c->mask,
|
m = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin, (char *)c->mask,
|
||||||
c->width, c->width, 1, 0, 1);
|
c->width, c->width, 1, 0, 1);
|
||||||
|
|
||||||
return (XCreatePixmapCursor(G_dpy, f, m,
|
return (XCreatePixmapCursor(X_Dpy, f, m,
|
||||||
&sc->blackcolor, &sc->whitecolor, c->hot[0], c->hot[1]));
|
&sc->blackcolor, &sc->whitecolor, c->hot[0], c->hot[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
draw.c
2
draw.c
@ -15,7 +15,7 @@ draw_outline(struct client_ctx *cc)
|
|||||||
{
|
{
|
||||||
struct screen_ctx *sc = CCTOSC(cc);
|
struct screen_ctx *sc = CCTOSC(cc);
|
||||||
|
|
||||||
XDrawRectangle(G_dpy, sc->rootwin, sc->invgc,
|
XDrawRectangle(X_Dpy, sc->rootwin, sc->invgc,
|
||||||
cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth,
|
cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth,
|
||||||
cc->geom.width + cc->bwidth, cc->geom.height + cc->bwidth);
|
cc->geom.width + cc->bwidth, cc->geom.height + cc->bwidth);
|
||||||
}
|
}
|
||||||
|
12
font.c
12
font.c
@ -61,12 +61,12 @@ font_init(struct screen_ctx *sc)
|
|||||||
XColor xcolor, tmp;
|
XColor xcolor, tmp;
|
||||||
|
|
||||||
HASH_INIT(&sc->fonthash, fontdesc_hash);
|
HASH_INIT(&sc->fonthash, fontdesc_hash);
|
||||||
sc->xftdraw = XftDrawCreate(G_dpy, sc->rootwin,
|
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
|
||||||
DefaultVisual(G_dpy, sc->which), DefaultColormap(G_dpy, sc->which));
|
DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
|
||||||
if (sc->xftdraw == NULL)
|
if (sc->xftdraw == NULL)
|
||||||
errx(1, "XftDrawCreate");
|
errx(1, "XftDrawCreate");
|
||||||
|
|
||||||
if (!XAllocNamedColor(G_dpy, DefaultColormap(G_dpy, sc->which),
|
if (!XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, sc->which),
|
||||||
"black", &xcolor, &tmp))
|
"black", &xcolor, &tmp))
|
||||||
errx(1, "XAllocNamedColor");
|
errx(1, "XAllocNamedColor");
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ int
|
|||||||
font_width(struct fontdesc *fdp, const char *text, int len)
|
font_width(struct fontdesc *fdp, const char *text, int len)
|
||||||
{
|
{
|
||||||
XGlyphInfo extents;
|
XGlyphInfo extents;
|
||||||
XftTextExtents8(G_dpy, fdp->fn, (const XftChar8*)text, len, &extents);
|
XftTextExtents8(X_Dpy, fdp->fn, (const XftChar8*)text, len, &extents);
|
||||||
|
|
||||||
return (extents.xOff);
|
return (extents.xOff);
|
||||||
}
|
}
|
||||||
@ -149,8 +149,8 @@ _make_font(struct screen_ctx *sc, struct fontdesc *fdp)
|
|||||||
if ((pat = FcNameParse(fdp->name)) == NULL)
|
if ((pat = FcNameParse(fdp->name)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if ((patx = XftFontMatch(G_dpy, sc->which, pat, &res)) != NULL)
|
if ((patx = XftFontMatch(X_Dpy, sc->which, pat, &res)) != NULL)
|
||||||
fn = XftFontOpenPattern(G_dpy, patx);
|
fn = XftFontOpenPattern(X_Dpy, patx);
|
||||||
|
|
||||||
FcPatternDestroy(pat);
|
FcPatternDestroy(pat);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ _visible(struct client_ctx *this_cc)
|
|||||||
if (cc->flags & CLIENT_HIDDEN)
|
if (cc->flags & CLIENT_HIDDEN)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &G_clientq, entry) {
|
TAILQ_FOREACH(cc, &Clientq, entry) {
|
||||||
if (cc->flags & CLIENT_HIDDEN)
|
if (cc->flags & CLIENT_HIDDEN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
102
grab.c
102
grab.c
@ -32,10 +32,10 @@ grab_sweep_draw(struct client_ctx *cc, int dx, int dy)
|
|||||||
wide = MAX(wide_size, wide_name);
|
wide = MAX(wide_size, wide_name);
|
||||||
height = font_ascent(font) + font_descent(font) + 1;
|
height = font_ascent(font) + font_descent(font) + 1;
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, sc->menuwin, x0, y0, wide, height * 2);
|
XMoveResizeWindow(X_Dpy, sc->menuwin, x0, y0, wide, height * 2);
|
||||||
XMapWindow(G_dpy, sc->menuwin);
|
XMapWindow(X_Dpy, sc->menuwin);
|
||||||
XReparentWindow(G_dpy, sc->menuwin, cc->win, 0, 0);
|
XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0);
|
||||||
XClearWindow(G_dpy, sc->menuwin);
|
XClearWindow(X_Dpy, sc->menuwin);
|
||||||
font_draw(font, cc->name, strlen(cc->name), sc->menuwin,
|
font_draw(font, cc->name, strlen(cc->name), sc->menuwin,
|
||||||
2, font_ascent(font) + 1);
|
2, font_ascent(font) + 1);
|
||||||
font_draw(font, asize, strlen(asize), sc->menuwin,
|
font_draw(font, asize, strlen(asize), sc->menuwin,
|
||||||
@ -56,7 +56,7 @@ grab_sweep(struct client_ctx *cc)
|
|||||||
client_raise(cc);
|
client_raise(cc);
|
||||||
client_ptrsave(cc);
|
client_ptrsave(cc);
|
||||||
|
|
||||||
if (xu_ptr_grab(sc->rootwin, MouseMask, G_cursor_resize) < 0)
|
if (xu_ptr_grab(sc->rootwin, MouseMask, Cursor_resize) < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
xu_ptr_setpos(cc->win, cc->geom.width, cc->geom.height);
|
xu_ptr_setpos(cc->win, cc->geom.width, cc->geom.height);
|
||||||
@ -64,7 +64,7 @@ grab_sweep(struct client_ctx *cc)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* Look for changes in ptr position. */
|
/* Look for changes in ptr position. */
|
||||||
XMaskEvent(G_dpy, MouseMask, &ev);
|
XMaskEvent(X_Dpy, MouseMask, &ev);
|
||||||
|
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
@ -72,19 +72,19 @@ grab_sweep(struct client_ctx *cc)
|
|||||||
/* Recompute window output */
|
/* Recompute window output */
|
||||||
grab_sweep_draw(cc, dx, dy);
|
grab_sweep_draw(cc, dx, dy);
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, cc->pwin,
|
XMoveResizeWindow(X_Dpy, cc->pwin,
|
||||||
cc->geom.x - cc->bwidth,
|
cc->geom.x - cc->bwidth,
|
||||||
cc->geom.y - cc->bwidth,
|
cc->geom.y - cc->bwidth,
|
||||||
cc->geom.width + cc->bwidth*2,
|
cc->geom.width + cc->bwidth*2,
|
||||||
cc->geom.height + cc->bwidth*2);
|
cc->geom.height + cc->bwidth*2);
|
||||||
XMoveResizeWindow(G_dpy, cc->win,
|
XMoveResizeWindow(X_Dpy, cc->win,
|
||||||
cc->bwidth, cc->bwidth,
|
cc->bwidth, cc->bwidth,
|
||||||
cc->geom.width, cc->geom.height);
|
cc->geom.width, cc->geom.height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
XUnmapWindow(G_dpy, sc->menuwin);
|
XUnmapWindow(X_Dpy, sc->menuwin);
|
||||||
XReparentWindow(G_dpy, sc->menuwin, sc->rootwin, 0, 0);
|
XReparentWindow(X_Dpy, sc->menuwin, sc->rootwin, 0, 0);
|
||||||
xu_ptr_ungrab();
|
xu_ptr_ungrab();
|
||||||
client_ptrwarp(cc);
|
client_ptrwarp(cc);
|
||||||
return (0);
|
return (0);
|
||||||
@ -102,20 +102,20 @@ grab_drag(struct client_ctx *cc)
|
|||||||
|
|
||||||
client_raise(cc);
|
client_raise(cc);
|
||||||
|
|
||||||
if (xu_ptr_grab(sc->rootwin, MouseMask, G_cursor_move) < 0)
|
if (xu_ptr_grab(sc->rootwin, MouseMask, Cursor_move) < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
xu_ptr_getpos(sc->rootwin, &xm, &ym);
|
xu_ptr_getpos(sc->rootwin, &xm, &ym);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
XMaskEvent(G_dpy, MouseMask, &ev);
|
XMaskEvent(X_Dpy, MouseMask, &ev);
|
||||||
|
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
cc->geom.x = x0 + (ev.xmotion.x - xm);
|
cc->geom.x = x0 + (ev.xmotion.x - xm);
|
||||||
cc->geom.y = y0 + (ev.xmotion.y - ym);
|
cc->geom.y = y0 + (ev.xmotion.y - ym);
|
||||||
|
|
||||||
XMoveWindow(G_dpy, cc->pwin,
|
XMoveWindow(X_Dpy, cc->pwin,
|
||||||
cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth);
|
cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -185,8 +185,8 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
y = e->y - cur*high - high/2;
|
y = e->y - cur*high - high/2;
|
||||||
warp = 0;
|
warp = 0;
|
||||||
/* XXX - cache these in sc. */
|
/* XXX - cache these in sc. */
|
||||||
xmax = DisplayWidth(G_dpy, sc->which);
|
xmax = DisplayWidth(X_Dpy, sc->which);
|
||||||
ymax = DisplayHeight(G_dpy, sc->which);
|
ymax = DisplayHeight(X_Dpy, sc->which);
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
e->x -= x;
|
e->x -= x;
|
||||||
x = 0;
|
x = 0;
|
||||||
@ -210,12 +210,12 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
if (warp)
|
if (warp)
|
||||||
xu_ptr_setpos(e->root, e->x, e->y);
|
xu_ptr_setpos(e->root, e->x, e->y);
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, sc->menuwin, x, y, dx, dy);
|
XMoveResizeWindow(X_Dpy, sc->menuwin, x, y, dx, dy);
|
||||||
XSelectInput(G_dpy, sc->menuwin, MenuMask);
|
XSelectInput(X_Dpy, sc->menuwin, MenuMask);
|
||||||
XMapRaised(G_dpy, sc->menuwin);
|
XMapRaised(X_Dpy, sc->menuwin);
|
||||||
status = xu_ptr_grab(sc->menuwin, MenuGrabMask, G_cursor_select);
|
status = xu_ptr_grab(sc->menuwin, MenuGrabMask, Cursor_select);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
XUnmapWindow(G_dpy, sc->menuwin);
|
XUnmapWindow(X_Dpy, sc->menuwin);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
drawn = 0;
|
drawn = 0;
|
||||||
@ -226,13 +226,13 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
cc = grab_menu_getcc(menuq, cur);
|
cc = grab_menu_getcc(menuq, cur);
|
||||||
if (cc != NULL) {
|
if (cc != NULL) {
|
||||||
client_unhide(cc);
|
client_unhide(cc);
|
||||||
XRaiseWindow(G_dpy, sc->menuwin);
|
XRaiseWindow(X_Dpy, sc->menuwin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
XMaskEvent(G_dpy, MenuMask, &ev);
|
XMaskEvent(X_Dpy, MenuMask, &ev);
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
default:
|
default:
|
||||||
warnx("menuhit: unknown ev.type %d\n", ev.type);
|
warnx("menuhit: unknown ev.type %d\n", ev.type);
|
||||||
@ -259,7 +259,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
/* XXX */
|
/* XXX */
|
||||||
/* ungrab(&ev.xbutton); */
|
/* ungrab(&ev.xbutton); */
|
||||||
xu_ptr_ungrab();
|
xu_ptr_ungrab();
|
||||||
XUnmapWindow(G_dpy, sc->menuwin);
|
XUnmapWindow(X_Dpy, sc->menuwin);
|
||||||
n = 0;
|
n = 0;
|
||||||
TAILQ_FOREACH(mi, menuq, entry)
|
TAILQ_FOREACH(mi, menuq, entry)
|
||||||
if (i == n++)
|
if (i == n++)
|
||||||
@ -290,7 +290,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
client_hide(cc);
|
client_hide(cc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
XFillRectangle(G_dpy, sc->menuwin,
|
XFillRectangle(X_Dpy, sc->menuwin,
|
||||||
sc->hlgc, 0, old*high, wide, high);
|
sc->hlgc, 0, old*high, wide, high);
|
||||||
}
|
}
|
||||||
if (cur >= 0 && cur < n) {
|
if (cur >= 0 && cur < n) {
|
||||||
@ -300,19 +300,19 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
cc = grab_menu_getcc(menuq, cur);
|
cc = grab_menu_getcc(menuq, cur);
|
||||||
if (cc != NULL) {
|
if (cc != NULL) {
|
||||||
client_unhide(cc);
|
client_unhide(cc);
|
||||||
XRaiseWindow(G_dpy,
|
XRaiseWindow(X_Dpy,
|
||||||
sc->menuwin);
|
sc->menuwin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
xu_ptr_regrab(MenuGrabMask, G_cursor_select);
|
xu_ptr_regrab(MenuGrabMask, Cursor_select);
|
||||||
XFillRectangle(G_dpy, sc->menuwin,
|
XFillRectangle(X_Dpy, sc->menuwin,
|
||||||
sc->hlgc, 0, cur*high, wide, high);
|
sc->hlgc, 0, cur*high, wide, high);
|
||||||
} else
|
} else
|
||||||
xu_ptr_regrab(MenuGrabMask, G_cursor_default);
|
xu_ptr_regrab(MenuGrabMask, Cursor_default);
|
||||||
break;
|
break;
|
||||||
case Expose:
|
case Expose:
|
||||||
XClearWindow(G_dpy, sc->menuwin);
|
XClearWindow(X_Dpy, sc->menuwin);
|
||||||
i = 0;
|
i = 0;
|
||||||
TAILQ_FOREACH(mi, menuq, entry) {
|
TAILQ_FOREACH(mi, menuq, entry) {
|
||||||
tx = (wide - font_width(font, mi->text,
|
tx = (wide - font_width(font, mi->text,
|
||||||
@ -323,7 +323,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (cur >= 0 && cur < n)
|
if (cur >= 0 && cur < n)
|
||||||
XFillRectangle(G_dpy, sc->menuwin,
|
XFillRectangle(X_Dpy, sc->menuwin,
|
||||||
sc->hlgc, 0, cur*high, wide, high);
|
sc->hlgc, 0, cur*high, wide, high);
|
||||||
drawn = 1;
|
drawn = 1;
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
void
|
void
|
||||||
grab_menuinit(struct screen_ctx *sc)
|
grab_menuinit(struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
sc->menuwin = XCreateSimpleWindow(G_dpy, sc->rootwin, 0, 0,
|
sc->menuwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0,
|
||||||
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,16 +364,16 @@ grab_label(struct client_ctx *cc)
|
|||||||
dy = fontheight = font_ascent(font) + font_descent(font) + 1;
|
dy = fontheight = font_ascent(font) + font_descent(font) + 1;
|
||||||
dx = font_width(font, "label>", 6);
|
dx = font_width(font, "label>", 6);
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, sc->searchwin, x, y, dx, dy);
|
XMoveResizeWindow(X_Dpy, sc->searchwin, x, y, dx, dy);
|
||||||
XSelectInput(G_dpy, sc->searchwin, LabelMask);
|
XSelectInput(X_Dpy, sc->searchwin, LabelMask);
|
||||||
XMapRaised(G_dpy, sc->searchwin);
|
XMapRaised(X_Dpy, sc->searchwin);
|
||||||
|
|
||||||
XGetInputFocus(G_dpy, &focuswin, &focusrevert);
|
XGetInputFocus(X_Dpy, &focuswin, &focusrevert);
|
||||||
XSetInputFocus(G_dpy, sc->searchwin,
|
XSetInputFocus(X_Dpy, sc->searchwin,
|
||||||
RevertToPointerRoot, CurrentTime);
|
RevertToPointerRoot, CurrentTime);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
XMaskEvent(G_dpy, LabelMask, &e);
|
XMaskEvent(X_Dpy, LabelMask, &e);
|
||||||
|
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
@ -415,8 +415,8 @@ grab_label(struct client_ctx *cc)
|
|||||||
dx = font_width(font, dispstr, strlen(dispstr));
|
dx = font_width(font, dispstr, strlen(dispstr));
|
||||||
dy = fontheight;
|
dy = fontheight;
|
||||||
|
|
||||||
XClearWindow(G_dpy, sc->searchwin);
|
XClearWindow(X_Dpy, sc->searchwin);
|
||||||
XResizeWindow(G_dpy, sc->searchwin, dx, dy);
|
XResizeWindow(X_Dpy, sc->searchwin, dx, dy);
|
||||||
|
|
||||||
font_draw(font, dispstr, strlen(dispstr),
|
font_draw(font, dispstr, strlen(dispstr),
|
||||||
sc->searchwin, 0, font_ascent(font) + 1);
|
sc->searchwin, 0, font_ascent(font) + 1);
|
||||||
@ -425,9 +425,9 @@ grab_label(struct client_ctx *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
XSetInputFocus(G_dpy, focuswin,
|
XSetInputFocus(X_Dpy, focuswin,
|
||||||
focusrevert, CurrentTime);
|
focusrevert, CurrentTime);
|
||||||
XUnmapWindow(G_dpy, sc->searchwin);
|
XUnmapWindow(X_Dpy, sc->searchwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ExecMask (KeyPressMask|ExposureMask)
|
#define ExecMask (KeyPressMask|ExposureMask)
|
||||||
@ -452,16 +452,16 @@ grab_exec(void)
|
|||||||
dy = fontheight = font_ascent(font) + font_descent(font) + 1;
|
dy = fontheight = font_ascent(font) + font_descent(font) + 1;
|
||||||
dx = font_width(font, "exec>", 5);
|
dx = font_width(font, "exec>", 5);
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, sc->searchwin, x, y, dx, dy);
|
XMoveResizeWindow(X_Dpy, sc->searchwin, x, y, dx, dy);
|
||||||
XSelectInput(G_dpy, sc->searchwin, ExecMask);
|
XSelectInput(X_Dpy, sc->searchwin, ExecMask);
|
||||||
XMapRaised(G_dpy, sc->searchwin);
|
XMapRaised(X_Dpy, sc->searchwin);
|
||||||
|
|
||||||
XGetInputFocus(G_dpy, &focuswin, &focusrevert);
|
XGetInputFocus(X_Dpy, &focuswin, &focusrevert);
|
||||||
XSetInputFocus(G_dpy, sc->searchwin,
|
XSetInputFocus(X_Dpy, sc->searchwin,
|
||||||
RevertToPointerRoot, CurrentTime);
|
RevertToPointerRoot, CurrentTime);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
XMaskEvent(G_dpy, ExecMask, &e);
|
XMaskEvent(X_Dpy, ExecMask, &e);
|
||||||
|
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
@ -496,8 +496,8 @@ grab_exec(void)
|
|||||||
dx = font_width(font, dispstr, strlen(dispstr));
|
dx = font_width(font, dispstr, strlen(dispstr));
|
||||||
dy = fontheight;
|
dy = fontheight;
|
||||||
|
|
||||||
XClearWindow(G_dpy, sc->searchwin);
|
XClearWindow(X_Dpy, sc->searchwin);
|
||||||
XResizeWindow(G_dpy, sc->searchwin, dx, dy);
|
XResizeWindow(X_Dpy, sc->searchwin, dx, dy);
|
||||||
|
|
||||||
font_draw(font, dispstr, strlen(dispstr),
|
font_draw(font, dispstr, strlen(dispstr),
|
||||||
sc->searchwin, 0, font_ascent(font) + 1);
|
sc->searchwin, 0, font_ascent(font) + 1);
|
||||||
@ -505,8 +505,8 @@ grab_exec(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
XSetInputFocus(G_dpy, focuswin, focusrevert, CurrentTime);
|
XSetInputFocus(X_Dpy, focuswin, focusrevert, CurrentTime);
|
||||||
XUnmapWindow(G_dpy, sc->searchwin);
|
XUnmapWindow(X_Dpy, sc->searchwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
148
group.c
148
group.c
@ -13,17 +13,17 @@
|
|||||||
|
|
||||||
#define CALMWM_NGROUPS 9
|
#define CALMWM_NGROUPS 9
|
||||||
|
|
||||||
int G_groupmode = 0;
|
int Groupmode = 0;
|
||||||
int G_groupnamemode = 0;
|
int Groupnamemode = 0;
|
||||||
struct group_ctx *G_group_active = NULL;
|
struct group_ctx *Group_active = NULL;
|
||||||
struct group_ctx *G_group_current = NULL;
|
struct group_ctx *Group_current = NULL;
|
||||||
struct group_ctx G_groups[CALMWM_NGROUPS];
|
struct group_ctx Groups[CALMWM_NGROUPS];
|
||||||
char G_group_name[256];
|
char Group_name[256];
|
||||||
int G_groupfocusset = 0;
|
int Groupfocusset = 0;
|
||||||
Window G_groupfocuswin;
|
Window Groupfocuswin;
|
||||||
int G_groupfocusrevert;
|
int Groupfocusrevert;
|
||||||
int G_grouphideall = 0;
|
int Grouphideall = 0;
|
||||||
struct group_ctx_q G_groupq;
|
struct group_ctx_q Groupq;
|
||||||
|
|
||||||
#define GroupMask (KeyPressMask|ExposureMask)
|
#define GroupMask (KeyPressMask|ExposureMask)
|
||||||
|
|
||||||
@ -137,11 +137,11 @@ _group_show(struct group_ctx *gc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XRestackWindows(G_dpy, winlist, gc->nhidden);
|
XRestackWindows(X_Dpy, winlist, gc->nhidden);
|
||||||
xfree(winlist);
|
xfree(winlist);
|
||||||
|
|
||||||
gc->hidden = 0;
|
gc->hidden = 0;
|
||||||
G_group_active = gc;
|
Group_active = gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -170,16 +170,16 @@ group_init(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TAILQ_INIT(&G_groupq);
|
TAILQ_INIT(&Groupq);
|
||||||
|
|
||||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||||
TAILQ_INIT(&G_groups[i].clients);
|
TAILQ_INIT(&Groups[i].clients);
|
||||||
G_groups[i].hidden = 0;
|
Groups[i].hidden = 0;
|
||||||
G_groups[i].shortcut = i + 1;
|
Groups[i].shortcut = i + 1;
|
||||||
TAILQ_INSERT_TAIL(&G_groupq, &G_groups[i], entry);
|
TAILQ_INSERT_TAIL(&Groupq, &Groups[i], entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_group_current = G_group_active = &G_groups[0];
|
Group_current = Group_active = &Groups[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -196,8 +196,8 @@ group_new(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < CALMWM_NGROUPS; i++) {
|
for (i=0; i < CALMWM_NGROUPS; i++) {
|
||||||
if (TAILQ_EMPTY(&G_groups[i].clients)) {
|
if (TAILQ_EMPTY(&Groups[i].clients)) {
|
||||||
G_group_current = &G_groups[i];
|
Group_current = &Groups[i];
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ group_new(void)
|
|||||||
int
|
int
|
||||||
group_select(int idx)
|
group_select(int idx)
|
||||||
{
|
{
|
||||||
struct group_ctx *gc = G_group_current;
|
struct group_ctx *gc = Group_current;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
||||||
@ -223,7 +223,7 @@ group_select(int idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_group_commit(gc);
|
_group_commit(gc);
|
||||||
G_group_current = &G_groups[idx];
|
Group_current = &Groups[idx];
|
||||||
|
|
||||||
group_display_draw(screen_current());
|
group_display_draw(screen_current());
|
||||||
return (0);
|
return (0);
|
||||||
@ -233,16 +233,16 @@ group_select(int idx)
|
|||||||
void
|
void
|
||||||
group_enter(void)
|
group_enter(void)
|
||||||
{
|
{
|
||||||
if (G_groupmode != 0)
|
if (Groupmode != 0)
|
||||||
errx(1, "group_enter called twice");
|
errx(1, "group_enter called twice");
|
||||||
|
|
||||||
if (G_group_current == NULL)
|
if (Group_current == NULL)
|
||||||
G_group_current = &G_groups[0];
|
Group_current = &Groups[0];
|
||||||
|
|
||||||
/* setup input buffer */
|
/* setup input buffer */
|
||||||
G_group_name[0] = '\0';
|
Group_name[0] = '\0';
|
||||||
|
|
||||||
G_groupmode = 1;
|
Groupmode = 1;
|
||||||
|
|
||||||
group_display_init(screen_current());
|
group_display_init(screen_current());
|
||||||
group_display_draw(screen_current());
|
group_display_draw(screen_current());
|
||||||
@ -252,10 +252,10 @@ group_enter(void)
|
|||||||
void
|
void
|
||||||
group_exit(int commit)
|
group_exit(int commit)
|
||||||
{
|
{
|
||||||
struct group_ctx *gc = G_group_current;
|
struct group_ctx *gc = Group_current;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
if (G_groupmode != 1)
|
if (Groupmode != 1)
|
||||||
errx(1, "group_exit called twice");
|
errx(1, "group_exit called twice");
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
||||||
@ -272,21 +272,21 @@ group_exit(int commit)
|
|||||||
_group_destroy(gc);
|
_group_destroy(gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
XUnmapWindow(G_dpy, screen_current()->groupwin);
|
XUnmapWindow(X_Dpy, screen_current()->groupwin);
|
||||||
|
|
||||||
if (G_groupnamemode) {
|
if (Groupnamemode) {
|
||||||
XSetInputFocus(G_dpy, G_groupfocuswin, G_groupfocusrevert,
|
XSetInputFocus(X_Dpy, Groupfocuswin, Groupfocusrevert,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
G_groupfocusset = 0;
|
Groupfocusset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_groupmode = G_groupnamemode = 0;
|
Groupmode = Groupnamemode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
group_click(struct client_ctx *cc)
|
group_click(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
struct group_ctx *gc = G_group_current;
|
struct group_ctx *gc = Group_current;
|
||||||
|
|
||||||
if (gc == cc->group)
|
if (gc == cc->group)
|
||||||
_group_remove(cc);
|
_group_remove(cc);
|
||||||
@ -301,13 +301,13 @@ group_click(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
group_sticky(struct client_ctx *cc)
|
group_sticky(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
_group_add(G_group_active, cc);
|
_group_add(Group_active, cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
group_sticky_toggle_enter(struct client_ctx *cc)
|
group_sticky_toggle_enter(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
struct group_ctx *gc = G_group_active;
|
struct group_ctx *gc = Group_active;
|
||||||
|
|
||||||
if (gc == cc->group) {
|
if (gc == cc->group) {
|
||||||
_group_remove(cc);
|
_group_remove(cc);
|
||||||
@ -334,14 +334,14 @@ group_sticky_toggle_exit(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
group_display_init(struct screen_ctx *sc)
|
group_display_init(struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
sc->groupwin = XCreateSimpleWindow(G_dpy, sc->rootwin, 0, 0,
|
sc->groupwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0,
|
||||||
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
group_display_draw(struct screen_ctx *sc)
|
group_display_draw(struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
struct group_ctx *gc = G_group_current;
|
struct group_ctx *gc = Group_current;
|
||||||
int x, y, dx, dy, fontheight, titlelen;
|
int x, y, dx, dy, fontheight, titlelen;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
char titlebuf[1024];
|
char titlebuf[1024];
|
||||||
@ -360,13 +360,13 @@ group_display_draw(struct screen_ctx *sc)
|
|||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, sc->groupwin, x, y, dx, dy);
|
XMoveResizeWindow(X_Dpy, sc->groupwin, x, y, dx, dy);
|
||||||
|
|
||||||
/* XXX */
|
/* XXX */
|
||||||
XSelectInput(G_dpy, sc->groupwin, GroupMask);
|
XSelectInput(X_Dpy, sc->groupwin, GroupMask);
|
||||||
|
|
||||||
XMapRaised(G_dpy, sc->groupwin);
|
XMapRaised(X_Dpy, sc->groupwin);
|
||||||
XClearWindow(G_dpy, sc->groupwin);
|
XClearWindow(X_Dpy, sc->groupwin);
|
||||||
font_draw(font, titlebuf, strlen(titlebuf), sc->groupwin,
|
font_draw(font, titlebuf, strlen(titlebuf), sc->groupwin,
|
||||||
0, font_ascent(font) + 1);
|
0, font_ascent(font) + 1);
|
||||||
}
|
}
|
||||||
@ -374,12 +374,12 @@ group_display_draw(struct screen_ctx *sc)
|
|||||||
void
|
void
|
||||||
group_display_keypress(KeyCode k)
|
group_display_keypress(KeyCode k)
|
||||||
{
|
{
|
||||||
struct group_ctx * gc = G_group_current;
|
struct group_ctx * gc = Group_current;
|
||||||
char chr;
|
char chr;
|
||||||
enum ctltype ctl;
|
enum ctltype ctl;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (!G_groupnamemode)
|
if (!Groupnamemode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (input_keycodetrans(k, 0, &ctl, &chr, 1) < 0)
|
if (input_keycodetrans(k, 0, &ctl, &chr, 1) < 0)
|
||||||
@ -387,14 +387,14 @@ group_display_keypress(KeyCode k)
|
|||||||
|
|
||||||
switch (ctl) {
|
switch (ctl) {
|
||||||
case CTL_ERASEONE:
|
case CTL_ERASEONE:
|
||||||
if ((len = strlen(G_group_name)) > 0)
|
if ((len = strlen(Group_name)) > 0)
|
||||||
G_group_name[len - 1] = '\0';
|
Group_name[len - 1] = '\0';
|
||||||
break;
|
break;
|
||||||
case CTL_RETURN:
|
case CTL_RETURN:
|
||||||
if (gc->name != NULL)
|
if (gc->name != NULL)
|
||||||
xfree(gc->name);
|
xfree(gc->name);
|
||||||
|
|
||||||
gc->name = xstrdup(G_group_name);
|
gc->name = xstrdup(Group_name);
|
||||||
|
|
||||||
group_exit(1);
|
group_exit(1);
|
||||||
return;
|
return;
|
||||||
@ -403,8 +403,8 @@ group_display_keypress(KeyCode k)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chr != '\0')
|
if (chr != '\0')
|
||||||
snprintf(G_group_name, sizeof(G_group_name), "%s%c",
|
snprintf(Group_name, sizeof(Group_name), "%s%c",
|
||||||
G_group_name, chr);
|
Group_name, chr);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
group_display_draw(screen_current());
|
group_display_draw(screen_current());
|
||||||
@ -438,7 +438,7 @@ group_hidetoggle(int idx)
|
|||||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
||||||
err(1, "group_hidetoggle: index out of range (%d)", idx);
|
err(1, "group_hidetoggle: index out of range (%d)", idx);
|
||||||
|
|
||||||
gc = &G_groups[idx];
|
gc = &Groups[idx];
|
||||||
|
|
||||||
_group_fix_hidden_state(gc);
|
_group_fix_hidden_state(gc);
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ group_hidetoggle(int idx)
|
|||||||
else {
|
else {
|
||||||
_group_hide(gc);
|
_group_hide(gc);
|
||||||
if (TAILQ_EMPTY(&gc->clients))
|
if (TAILQ_EMPTY(&gc->clients))
|
||||||
G_group_active = gc;
|
Group_active = gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
@ -468,15 +468,15 @@ group_slide(int fwd)
|
|||||||
{
|
{
|
||||||
struct group_ctx *gc, *showgroup = NULL;
|
struct group_ctx *gc, *showgroup = NULL;
|
||||||
|
|
||||||
assert(G_group_active != NULL);
|
assert(Group_active != NULL);
|
||||||
|
|
||||||
gc = G_group_active;
|
gc = Group_active;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
gc = GROUP_NEXT(gc, fwd);
|
gc = GROUP_NEXT(gc, fwd);
|
||||||
if (gc == NULL)
|
if (gc == NULL)
|
||||||
gc = fwd ? TAILQ_FIRST(&G_groupq) :
|
gc = fwd ? TAILQ_FIRST(&Groupq) :
|
||||||
TAILQ_LAST(&G_groupq, group_ctx_q);
|
TAILQ_LAST(&Groupq, group_ctx_q);
|
||||||
if (gc == G_group_active)
|
if (gc == Group_active)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!TAILQ_EMPTY(&gc->clients) && showgroup == NULL)
|
if (!TAILQ_EMPTY(&gc->clients) && showgroup == NULL)
|
||||||
@ -488,12 +488,12 @@ group_slide(int fwd)
|
|||||||
if (showgroup == NULL)
|
if (showgroup == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_group_hide(G_group_active);
|
_group_hide(Group_active);
|
||||||
|
|
||||||
if (showgroup->hidden)
|
if (showgroup->hidden)
|
||||||
_group_show(showgroup);
|
_group_show(showgroup);
|
||||||
else
|
else
|
||||||
G_group_active = showgroup;
|
Group_active = showgroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called when a client is deleted */
|
/* called when a client is deleted */
|
||||||
@ -519,7 +519,7 @@ group_menu(XButtonEvent *e)
|
|||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||||
gc = &G_groups[i];
|
gc = &Groups[i];
|
||||||
|
|
||||||
if (TAILQ_EMPTY(&gc->clients))
|
if (TAILQ_EMPTY(&gc->clients))
|
||||||
continue;
|
continue;
|
||||||
@ -563,7 +563,7 @@ group_menu(XButtonEvent *e)
|
|||||||
void
|
void
|
||||||
group_namemode(void)
|
group_namemode(void)
|
||||||
{
|
{
|
||||||
G_groupnamemode = 1;
|
Groupnamemode = 1;
|
||||||
|
|
||||||
group_display_draw(screen_current());
|
group_display_draw(screen_current());
|
||||||
}
|
}
|
||||||
@ -574,31 +574,31 @@ group_alltoggle(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < CALMWM_NGROUPS; i++) {
|
for (i=0; i < CALMWM_NGROUPS; i++) {
|
||||||
if (G_grouphideall)
|
if (Grouphideall)
|
||||||
_group_show(&G_groups[i]);
|
_group_show(&Groups[i]);
|
||||||
else
|
else
|
||||||
_group_hide(&G_groups[i]);
|
_group_hide(&Groups[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_grouphideall)
|
if (Grouphideall)
|
||||||
G_grouphideall = 0;
|
Grouphideall = 0;
|
||||||
else
|
else
|
||||||
G_grouphideall = 1;
|
Grouphideall = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
group_deletecurrent(void)
|
group_deletecurrent(void)
|
||||||
{
|
{
|
||||||
_group_destroy(G_group_current);
|
_group_destroy(Group_current);
|
||||||
XUnmapWindow(G_dpy, screen_current()->groupwin);
|
XUnmapWindow(X_Dpy, screen_current()->groupwin);
|
||||||
|
|
||||||
G_groupmode = G_groupnamemode = 0;
|
Groupmode = Groupnamemode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
group_done(void)
|
group_done(void)
|
||||||
{
|
{
|
||||||
struct group_ctx *gc = G_group_current;
|
struct group_ctx *gc = Group_current;
|
||||||
|
|
||||||
if (gc->name != NULL)
|
if (gc->name != NULL)
|
||||||
xfree(gc->name);
|
xfree(gc->name);
|
||||||
@ -618,7 +618,7 @@ group_autogroup(struct client_ctx *cc)
|
|||||||
if (cc->app_class == NULL || cc->app_name == NULL)
|
if (cc->app_class == NULL || cc->app_name == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TAILQ_FOREACH(aw, &G_conf.autogroupq, entry) {
|
TAILQ_FOREACH(aw, &Conf.autogroupq, entry) {
|
||||||
if (strcmp(aw->class, cc->app_class) == 0 &&
|
if (strcmp(aw->class, cc->app_class) == 0 &&
|
||||||
(aw->name == NULL || strcmp(aw->name, cc->app_name) == 0)) {
|
(aw->name == NULL || strcmp(aw->name, cc->app_name) == 0)) {
|
||||||
strlcpy(group, aw->group, sizeof(group));
|
strlcpy(group, aw->group, sizeof(group));
|
||||||
@ -626,7 +626,7 @@ group_autogroup(struct client_ctx *cc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &G_groupq, entry) {
|
TAILQ_FOREACH(gc, &Groupq, entry) {
|
||||||
if (strcmp(shortcut_to_name[gc->shortcut], group) == 0)
|
if (strcmp(shortcut_to_name[gc->shortcut], group) == 0)
|
||||||
_group_add(gc, cc);
|
_group_add(gc, cc);
|
||||||
}
|
}
|
||||||
|
4
input.c
4
input.c
@ -20,9 +20,9 @@ input_keycodetrans(KeyCode kc, u_int state,
|
|||||||
*chr = '\0';
|
*chr = '\0';
|
||||||
|
|
||||||
if (state & ShiftMask)
|
if (state & ShiftMask)
|
||||||
ks = XKeycodeToKeysym(G_dpy, kc, 1);
|
ks = XKeycodeToKeysym(X_Dpy, kc, 1);
|
||||||
else
|
else
|
||||||
ks = XKeycodeToKeysym(G_dpy, kc, 0);
|
ks = XKeycodeToKeysym(X_Dpy, kc, 0);
|
||||||
|
|
||||||
/* Look for control characters. */
|
/* Look for control characters. */
|
||||||
switch (ks) {
|
switch (ks) {
|
||||||
|
20
kbfunc.c
20
kbfunc.c
@ -31,7 +31,7 @@ kbfunc_client_search(struct client_ctx *scratch, void *arg)
|
|||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &G_clientq, entry) {
|
TAILQ_FOREACH(cc, &Clientq, entry) {
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
XCALLOC(mi, struct menu);
|
XCALLOC(mi, struct menu);
|
||||||
strlcpy(mi->text, cc->name, sizeof(mi->text));
|
strlcpy(mi->text, cc->name, sizeof(mi->text));
|
||||||
@ -66,8 +66,8 @@ kbfunc_menu_search(struct client_ctx *scratch, void *arg)
|
|||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
conf_cmd_refresh(&G_conf);
|
conf_cmd_refresh(&Conf);
|
||||||
TAILQ_FOREACH(cmd, &G_conf.cmdq, entry) {
|
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
||||||
XCALLOC(mi, struct menu);
|
XCALLOC(mi, struct menu);
|
||||||
strlcpy(mi->text, cmd->label, sizeof(mi->text));
|
strlcpy(mi->text, cmd->label, sizeof(mi->text));
|
||||||
mi->ctx = cmd;
|
mi->ctx = cmd;
|
||||||
@ -111,15 +111,15 @@ kbfunc_cmdexec(struct client_ctx *cc, void *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_term(struct client_ctx *cc, void *arg)
|
kbfunc_term(struct client_ctx *cc, void *arg)
|
||||||
{
|
{
|
||||||
conf_cmd_refresh(&G_conf);
|
conf_cmd_refresh(&Conf);
|
||||||
u_spawn(G_conf.termpath);
|
u_spawn(Conf.termpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kbfunc_lock(struct client_ctx *cc, void *arg)
|
kbfunc_lock(struct client_ctx *cc, void *arg)
|
||||||
{
|
{
|
||||||
conf_cmd_refresh(&G_conf);
|
conf_cmd_refresh(&Conf);
|
||||||
u_spawn(G_conf.lockpath);
|
u_spawn(Conf.lockpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -143,7 +143,7 @@ kbfunc_client_delete(struct client_ctx *cc, void *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_client_groupselect(struct client_ctx *cc, void *arg)
|
kbfunc_client_groupselect(struct client_ctx *cc, void *arg)
|
||||||
{
|
{
|
||||||
if (G_groupmode)
|
if (Groupmode)
|
||||||
group_done();
|
group_done();
|
||||||
else
|
else
|
||||||
group_enter();
|
group_enter();
|
||||||
@ -152,7 +152,7 @@ kbfunc_client_groupselect(struct client_ctx *cc, void *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_client_group(struct client_ctx *cc, void *arg)
|
kbfunc_client_group(struct client_ctx *cc, void *arg)
|
||||||
{
|
{
|
||||||
if (G_groupmode)
|
if (Groupmode)
|
||||||
group_select(KBTOGROUP((int)arg));
|
group_select(KBTOGROUP((int)arg));
|
||||||
else
|
else
|
||||||
group_hidetoggle(KBTOGROUP((int)arg));
|
group_hidetoggle(KBTOGROUP((int)arg));
|
||||||
@ -173,7 +173,7 @@ kbfunc_client_prevgroup(struct client_ctx *cc, void *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_client_nogroup(struct client_ctx *cc, void *arg)
|
kbfunc_client_nogroup(struct client_ctx *cc, void *arg)
|
||||||
{
|
{
|
||||||
if (G_groupmode)
|
if (Groupmode)
|
||||||
group_deletecurrent();
|
group_deletecurrent();
|
||||||
else
|
else
|
||||||
group_alltoggle();
|
group_alltoggle();
|
||||||
|
22
screen.c
22
screen.c
@ -10,14 +10,14 @@
|
|||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
extern struct screen_ctx_q G_screenq;
|
extern struct screen_ctx_q Screenq;
|
||||||
extern struct screen_ctx *G_curscreen;
|
extern struct screen_ctx *Curscreen;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_clearwindow_cb(int sig)
|
_clearwindow_cb(int sig)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc = screen_current();
|
struct screen_ctx *sc = screen_current();
|
||||||
XUnmapWindow(G_dpy, sc->infowin);
|
XUnmapWindow(X_Dpy, sc->infowin);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct screen_ctx *
|
struct screen_ctx *
|
||||||
@ -25,18 +25,18 @@ screen_fromroot(Window rootwin)
|
|||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
|
|
||||||
TAILQ_FOREACH(sc, &G_screenq, entry)
|
TAILQ_FOREACH(sc, &Screenq, entry)
|
||||||
if (sc->rootwin == rootwin)
|
if (sc->rootwin == rootwin)
|
||||||
return (sc);
|
return (sc);
|
||||||
|
|
||||||
/* XXX FAIL HERE */
|
/* XXX FAIL HERE */
|
||||||
return (TAILQ_FIRST(&G_screenq));
|
return (TAILQ_FIRST(&Screenq));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct screen_ctx *
|
struct screen_ctx *
|
||||||
screen_current(void)
|
screen_current(void)
|
||||||
{
|
{
|
||||||
return (G_curscreen);
|
return (Curscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -47,7 +47,7 @@ screen_updatestackingorder(void)
|
|||||||
u_int nwins, i, s;
|
u_int nwins, i, s;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
if (!XQueryTree(G_dpy, sc->rootwin, &w0, &w1, &wins, &nwins))
|
if (!XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (s = 0, i = 0; i < nwins; i++) {
|
for (s = 0, i = 0; i < nwins; i++) {
|
||||||
@ -70,7 +70,7 @@ screen_init(void)
|
|||||||
|
|
||||||
sc->cycle_client = NULL;
|
sc->cycle_client = NULL;
|
||||||
|
|
||||||
sc->infowin = XCreateSimpleWindow(G_dpy, sc->rootwin, 0, 0,
|
sc->infowin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0,
|
||||||
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
||||||
|
|
||||||
/* XXX - marius. */
|
/* XXX - marius. */
|
||||||
@ -86,15 +86,15 @@ screen_infomsg(char *msg)
|
|||||||
int dy, dx;
|
int dy, dx;
|
||||||
struct fontdesc *font = DefaultFont;
|
struct fontdesc *font = DefaultFont;
|
||||||
|
|
||||||
XUnmapWindow(G_dpy, sc->infowin);
|
XUnmapWindow(X_Dpy, sc->infowin);
|
||||||
alarm(0);
|
alarm(0);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), ">%s", msg);
|
snprintf(buf, sizeof(buf), ">%s", msg);
|
||||||
dy = font_ascent(font) + font_descent(font) + 1;
|
dy = font_ascent(font) + font_descent(font) + 1;
|
||||||
dx = font_width(font, buf, strlen(buf));
|
dx = font_width(font, buf, strlen(buf));
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, sc->infowin, 0, 0, dx, dy);
|
XMoveResizeWindow(X_Dpy, sc->infowin, 0, 0, dx, dy);
|
||||||
XMapRaised(G_dpy, sc->infowin);
|
XMapRaised(X_Dpy, sc->infowin);
|
||||||
|
|
||||||
font_draw(font, buf, strlen(buf), sc->infowin,
|
font_draw(font, buf, strlen(buf), sc->infowin,
|
||||||
0, font_ascent(font) + 1);
|
0, font_ascent(font) + 1);
|
||||||
|
34
search.c
34
search.c
@ -17,7 +17,7 @@ static int _strsubmatch(char *, char *);
|
|||||||
void
|
void
|
||||||
search_init(struct screen_ctx *sc)
|
search_init(struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
sc->searchwin = XCreateSimpleWindow(G_dpy, sc->rootwin, 0, 0,
|
sc->searchwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0,
|
||||||
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
1, 1, 1, sc->blackpixl, sc->whitepixl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +63,8 @@ search_start(struct menu_q *menuq,
|
|||||||
|
|
||||||
TAILQ_INIT(&resultq);
|
TAILQ_INIT(&resultq);
|
||||||
|
|
||||||
xmax = DisplayWidth(G_dpy, sc->which);
|
xmax = DisplayWidth(X_Dpy, sc->which);
|
||||||
ymax = DisplayHeight(G_dpy, sc->which);
|
ymax = DisplayHeight(X_Dpy, sc->which);
|
||||||
|
|
||||||
xu_ptr_getpos(sc->rootwin, &x, &y);
|
xu_ptr_getpos(sc->rootwin, &x, &y);
|
||||||
|
|
||||||
@ -75,27 +75,27 @@ search_start(struct menu_q *menuq,
|
|||||||
snprintf(dispstr, sizeof(dispstr), "%s%c", promptstr, endchar);
|
snprintf(dispstr, sizeof(dispstr), "%s%c", promptstr, endchar);
|
||||||
dx = font_width(font, dispstr, strlen(dispstr));
|
dx = font_width(font, dispstr, strlen(dispstr));
|
||||||
|
|
||||||
XMoveResizeWindow(G_dpy, sc->searchwin, x, y, dx, dy);
|
XMoveResizeWindow(X_Dpy, sc->searchwin, x, y, dx, dy);
|
||||||
XSelectInput(G_dpy, sc->searchwin, SearchMask);
|
XSelectInput(X_Dpy, sc->searchwin, SearchMask);
|
||||||
XMapRaised(G_dpy, sc->searchwin);
|
XMapRaised(X_Dpy, sc->searchwin);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: eventually, the mouse should be able to select
|
* TODO: eventually, the mouse should be able to select
|
||||||
* results as well. Right now we grab it only to set a fancy
|
* results as well. Right now we grab it only to set a fancy
|
||||||
* cursor.
|
* cursor.
|
||||||
*/
|
*/
|
||||||
if (xu_ptr_grab(sc->searchwin, 0, G_cursor_question) < 0) {
|
if (xu_ptr_grab(sc->searchwin, 0, Cursor_question) < 0) {
|
||||||
XUnmapWindow(G_dpy, sc->searchwin);
|
XUnmapWindow(X_Dpy, sc->searchwin);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
XGetInputFocus(G_dpy, &focuswin, &focusrevert);
|
XGetInputFocus(X_Dpy, &focuswin, &focusrevert);
|
||||||
XSetInputFocus(G_dpy, sc->searchwin, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(X_Dpy, sc->searchwin, RevertToPointerRoot, CurrentTime);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
added = mutated = 0;
|
added = mutated = 0;
|
||||||
|
|
||||||
XMaskEvent(G_dpy, SearchMask, &e);
|
XMaskEvent(X_Dpy, SearchMask, &e);
|
||||||
|
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
@ -239,8 +239,8 @@ search_start(struct menu_q *menuq,
|
|||||||
if (warp)
|
if (warp)
|
||||||
xu_ptr_setpos(sc->rootwin, x, y);
|
xu_ptr_setpos(sc->rootwin, x, y);
|
||||||
|
|
||||||
XClearWindow(G_dpy, sc->searchwin);
|
XClearWindow(X_Dpy, sc->searchwin);
|
||||||
XMoveResizeWindow(G_dpy, sc->searchwin, x, y, dx, dy);
|
XMoveResizeWindow(X_Dpy, sc->searchwin, x, y, dx, dy);
|
||||||
|
|
||||||
font_draw(font, dispstr, strlen(dispstr), sc->searchwin,
|
font_draw(font, dispstr, strlen(dispstr), sc->searchwin,
|
||||||
0, font_ascent(font) + 1);
|
0, font_ascent(font) + 1);
|
||||||
@ -258,11 +258,11 @@ search_start(struct menu_q *menuq,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (n > 1)
|
if (n > 1)
|
||||||
XFillRectangle(G_dpy, sc->searchwin, sc->gc,
|
XFillRectangle(X_Dpy, sc->searchwin, sc->gc,
|
||||||
0, fontheight, dx, fontheight);
|
0, fontheight, dx, fontheight);
|
||||||
|
|
||||||
if (beobnoxious)
|
if (beobnoxious)
|
||||||
XFillRectangle(G_dpy, sc->searchwin, sc->gc,
|
XFillRectangle(X_Dpy, sc->searchwin, sc->gc,
|
||||||
0, 0, dx, fontheight);
|
0, 0, dx, fontheight);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -272,9 +272,9 @@ search_start(struct menu_q *menuq,
|
|||||||
out:
|
out:
|
||||||
/* (if no match) */
|
/* (if no match) */
|
||||||
xu_ptr_ungrab();
|
xu_ptr_ungrab();
|
||||||
XSetInputFocus(G_dpy, focuswin, focusrevert, CurrentTime);
|
XSetInputFocus(X_Dpy, focuswin, focusrevert, CurrentTime);
|
||||||
found:
|
found:
|
||||||
XUnmapWindow(G_dpy, sc->searchwin);
|
XUnmapWindow(X_Dpy, sc->searchwin);
|
||||||
|
|
||||||
return (mi);
|
return (mi);
|
||||||
}
|
}
|
||||||
|
42
xevents.c
42
xevents.c
@ -38,7 +38,7 @@ xev_handle_maprequest(struct xevent *xev, XEvent *ee)
|
|||||||
client_ptrsave(old_cc);
|
client_ptrsave(old_cc);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) == NULL) {
|
if ((cc = client_find(e->window)) == NULL) {
|
||||||
XGetWindowAttributes(G_dpy, e->window, &xattr);
|
XGetWindowAttributes(X_Dpy, e->window, &xattr);
|
||||||
cc = client_new(e->window, screen_fromroot(xattr.root), 1);
|
cc = client_new(e->window, screen_fromroot(xattr.root), 1);
|
||||||
sc = CCTOSC(cc);
|
sc = CCTOSC(cc);
|
||||||
} else {
|
} else {
|
||||||
@ -113,11 +113,11 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee)
|
|||||||
cc->geom.y = e->y;
|
cc->geom.y = e->y;
|
||||||
|
|
||||||
if (cc->geom.x == 0 &&
|
if (cc->geom.x == 0 &&
|
||||||
cc->geom.width >= DisplayWidth(G_dpy, sc->which))
|
cc->geom.width >= DisplayWidth(X_Dpy, sc->which))
|
||||||
cc->geom.x -= cc->bwidth;
|
cc->geom.x -= cc->bwidth;
|
||||||
|
|
||||||
if (cc->geom.y == 0 &&
|
if (cc->geom.y == 0 &&
|
||||||
cc->geom.height >= DisplayHeight(G_dpy, sc->which))
|
cc->geom.height >= DisplayHeight(X_Dpy, sc->which))
|
||||||
cc->geom.y -= cc->bwidth;
|
cc->geom.y -= cc->bwidth;
|
||||||
|
|
||||||
client_gravitate(cc, 1);
|
client_gravitate(cc, 1);
|
||||||
@ -129,7 +129,7 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee)
|
|||||||
wc.border_width = 0;
|
wc.border_width = 0;
|
||||||
|
|
||||||
/* We need to move the parent window, too. */
|
/* We need to move the parent window, too. */
|
||||||
XConfigureWindow(G_dpy, cc->pwin, e->value_mask, &wc);
|
XConfigureWindow(X_Dpy, cc->pwin, e->value_mask, &wc);
|
||||||
xev_reconfig(cc);
|
xev_reconfig(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee)
|
|||||||
e->value_mask &= ~CWStackMode;
|
e->value_mask &= ~CWStackMode;
|
||||||
e->value_mask |= CWBorderWidth;
|
e->value_mask |= CWBorderWidth;
|
||||||
|
|
||||||
XConfigureWindow(G_dpy, e->window, e->value_mask, &wc);
|
XConfigureWindow(X_Dpy, e->window, e->value_mask, &wc);
|
||||||
|
|
||||||
xev_register(xev);
|
xev_register(xev);
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ xev_handle_propertynotify(struct xevent *xev, XEvent *ee)
|
|||||||
if ((cc = client_find(e->window)) != NULL) {
|
if ((cc = client_find(e->window)) != NULL) {
|
||||||
switch(e->atom) {
|
switch(e->atom) {
|
||||||
case XA_WM_NORMAL_HINTS:
|
case XA_WM_NORMAL_HINTS:
|
||||||
XGetWMNormalHints(G_dpy, cc->win, cc->size, &tmp);
|
XGetWMNormalHints(X_Dpy, cc->win, cc->size, &tmp);
|
||||||
break;
|
break;
|
||||||
case XA_WM_NAME:
|
case XA_WM_NAME:
|
||||||
client_setname(cc);
|
client_setname(cc);
|
||||||
@ -187,7 +187,7 @@ xev_reconfig(struct client_ctx *cc)
|
|||||||
ce.above = None;
|
ce.above = None;
|
||||||
ce.override_redirect = 0;
|
ce.override_redirect = 0;
|
||||||
|
|
||||||
XSendEvent(G_dpy, cc->win, False, StructureNotifyMask, (XEvent *)&ce);
|
XSendEvent(X_Dpy, cc->win, False, StructureNotifyMask, (XEvent *)&ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -246,7 +246,7 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
|
|||||||
|
|
||||||
switch (e->button) {
|
switch (e->button) {
|
||||||
case Button1:
|
case Button1:
|
||||||
TAILQ_FOREACH(cc, &G_clientq, entry) {
|
TAILQ_FOREACH(cc, &Clientq, entry) {
|
||||||
if (cc->flags & CLIENT_HIDDEN) {
|
if (cc->flags & CLIENT_HIDDEN) {
|
||||||
if (cc->label != NULL)
|
if (cc->label != NULL)
|
||||||
wname = cc->label;
|
wname = cc->label;
|
||||||
@ -266,11 +266,11 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
|
|||||||
break;
|
break;
|
||||||
case Button3: {
|
case Button3: {
|
||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
if (conf_cmd_changed(G_conf.menu_path)) {
|
if (conf_cmd_changed(Conf.menu_path)) {
|
||||||
conf_cmd_clear(&G_conf);
|
conf_cmd_clear(&Conf);
|
||||||
conf_cmd_populate(&G_conf, G_conf.menu_path);
|
conf_cmd_populate(&Conf, Conf.menu_path);
|
||||||
}
|
}
|
||||||
TAILQ_FOREACH(cmd, &G_conf.cmdq, entry) {
|
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
||||||
XCALLOC(mi, struct menu);
|
XCALLOC(mi, struct menu);
|
||||||
strlcpy(mi->text, cmd->label, sizeof(mi->text));
|
strlcpy(mi->text, cmd->label, sizeof(mi->text));
|
||||||
mi->ctx = cmd;
|
mi->ctx = cmd;
|
||||||
@ -321,7 +321,7 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
|
|||||||
|
|
||||||
switch (e->button) {
|
switch (e->button) {
|
||||||
case Button1:
|
case Button1:
|
||||||
if (altcontrol && !G_groupmode)
|
if (altcontrol && !Groupmode)
|
||||||
group_sticky_toggle_enter(cc);
|
group_sticky_toggle_enter(cc);
|
||||||
else {
|
else {
|
||||||
grab_drag(cc);
|
grab_drag(cc);
|
||||||
@ -330,7 +330,7 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
|
|||||||
break;
|
break;
|
||||||
case Button2:
|
case Button2:
|
||||||
/* XXXSIGH!!! */
|
/* XXXSIGH!!! */
|
||||||
if (G_groupmode)
|
if (Groupmode)
|
||||||
group_click(cc);
|
group_click(cc);
|
||||||
else {
|
else {
|
||||||
grab_sweep(cc);
|
grab_sweep(cc);
|
||||||
@ -351,7 +351,7 @@ xev_handle_buttonrelease(struct xevent *xev, XEvent *ee)
|
|||||||
{
|
{
|
||||||
struct client_ctx *cc = client_current();
|
struct client_ctx *cc = client_current();
|
||||||
|
|
||||||
if (cc != NULL && !G_groupmode)
|
if (cc != NULL && !Groupmode)
|
||||||
group_sticky_toggle_exit(cc);
|
group_sticky_toggle_exit(cc);
|
||||||
|
|
||||||
xev_register(xev);
|
xev_register(xev);
|
||||||
@ -367,10 +367,10 @@ xev_handle_keypress(struct xevent *xev, XEvent *ee)
|
|||||||
KeySym keysym, skeysym;
|
KeySym keysym, skeysym;
|
||||||
int modshift;
|
int modshift;
|
||||||
|
|
||||||
keysym = XKeycodeToKeysym(G_dpy, e->keycode, 0);
|
keysym = XKeycodeToKeysym(X_Dpy, e->keycode, 0);
|
||||||
skeysym = XKeycodeToKeysym(G_dpy, e->keycode, 1);
|
skeysym = XKeycodeToKeysym(X_Dpy, e->keycode, 1);
|
||||||
|
|
||||||
TAILQ_FOREACH(kb, &G_conf.keybindingq, entry) {
|
TAILQ_FOREACH(kb, &Conf.keybindingq, entry) {
|
||||||
if (keysym != kb->keysym && skeysym == kb->keysym)
|
if (keysym != kb->keysym && skeysym == kb->keysym)
|
||||||
modshift = ShiftMask;
|
modshift = ShiftMask;
|
||||||
else
|
else
|
||||||
@ -413,7 +413,7 @@ xev_handle_keyrelease(struct xevent *xev, XEvent *ee)
|
|||||||
struct screen_ctx *sc = screen_fromroot(e->root);
|
struct screen_ctx *sc = screen_fromroot(e->root);
|
||||||
int keysym;
|
int keysym;
|
||||||
|
|
||||||
keysym = XKeycodeToKeysym(G_dpy, e->keycode, 0);
|
keysym = XKeycodeToKeysym(X_Dpy, e->keycode, 0);
|
||||||
if (keysym != XK_Alt_L && keysym != XK_Alt_R)
|
if (keysym != XK_Alt_L && keysym != XK_Alt_R)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ xev_handle_clientmessage(struct xevent *xev, XEvent *ee)
|
|||||||
{
|
{
|
||||||
XClientMessageEvent *e = &ee->xclient;
|
XClientMessageEvent *e = &ee->xclient;
|
||||||
struct client_ctx *cc = client_find(e->window);
|
struct client_ctx *cc = client_find(e->window);
|
||||||
Atom xa_wm_change_state = XInternAtom(G_dpy, "WM_CHANGE_STATE", False);
|
Atom xa_wm_change_state = XInternAtom(X_Dpy, "WM_CHANGE_STATE", False);
|
||||||
|
|
||||||
if (cc == NULL)
|
if (cc == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
@ -536,7 +536,7 @@ xev_loop(void)
|
|||||||
errx(1, "X event queue empty");
|
errx(1, "X event queue empty");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XNextEvent(G_dpy, &e);
|
XNextEvent(X_Dpy, &e);
|
||||||
type = e.type;
|
type = e.type;
|
||||||
|
|
||||||
win = root = 0;
|
win = root = 0;
|
||||||
|
36
xutil.c
36
xutil.c
@ -13,7 +13,7 @@
|
|||||||
int
|
int
|
||||||
xu_ptr_grab(Window win, int mask, Cursor curs)
|
xu_ptr_grab(Window win, int mask, Cursor curs)
|
||||||
{
|
{
|
||||||
return (XGrabPointer(G_dpy, win, False, mask,
|
return (XGrabPointer(X_Dpy, win, False, mask,
|
||||||
GrabModeAsync, GrabModeAsync,
|
GrabModeAsync, GrabModeAsync,
|
||||||
None, curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
None, curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
||||||
}
|
}
|
||||||
@ -21,20 +21,20 @@ xu_ptr_grab(Window win, int mask, Cursor curs)
|
|||||||
int
|
int
|
||||||
xu_ptr_regrab(int mask, Cursor curs)
|
xu_ptr_regrab(int mask, Cursor curs)
|
||||||
{
|
{
|
||||||
return (XChangeActivePointerGrab(G_dpy, mask,
|
return (XChangeActivePointerGrab(X_Dpy, mask,
|
||||||
curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xu_ptr_ungrab(void)
|
xu_ptr_ungrab(void)
|
||||||
{
|
{
|
||||||
XUngrabPointer(G_dpy, CurrentTime);
|
XUngrabPointer(X_Dpy, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xu_btn_grab(Window win, int mask, u_int btn)
|
xu_btn_grab(Window win, int mask, u_int btn)
|
||||||
{
|
{
|
||||||
return (XGrabButton(G_dpy, btn, mask, win,
|
return (XGrabButton(X_Dpy, btn, mask, win,
|
||||||
False, ButtonMask, GrabModeAsync,
|
False, ButtonMask, GrabModeAsync,
|
||||||
GrabModeSync, None, None) == GrabSuccess ? 0 : -1);
|
GrabModeSync, None, None) == GrabSuccess ? 0 : -1);
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ xu_btn_grab(Window win, int mask, u_int btn)
|
|||||||
void
|
void
|
||||||
xu_btn_ungrab(Window win, int mask, u_int btn)
|
xu_btn_ungrab(Window win, int mask, u_int btn)
|
||||||
{
|
{
|
||||||
XUngrabButton(G_dpy, btn, mask, win);
|
XUngrabButton(X_Dpy, btn, mask, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -52,13 +52,13 @@ xu_ptr_getpos(Window rootwin, int *x, int *y)
|
|||||||
u_int tmp2;
|
u_int tmp2;
|
||||||
Window w0, w1;
|
Window w0, w1;
|
||||||
|
|
||||||
XQueryPointer(G_dpy, rootwin, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
|
XQueryPointer(X_Dpy, rootwin, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xu_ptr_setpos(Window win, int x, int y)
|
xu_ptr_setpos(Window win, int x, int y)
|
||||||
{
|
{
|
||||||
XWarpPointer(G_dpy, None, win, 0, 0, 0, 0, x, y);
|
XWarpPointer(X_Dpy, None, win, 0, 0, 0, 0, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -66,15 +66,15 @@ xu_key_grab(Window win, int mask, int keysym)
|
|||||||
{
|
{
|
||||||
KeyCode code;
|
KeyCode code;
|
||||||
|
|
||||||
code = XKeysymToKeycode(G_dpy, keysym);
|
code = XKeysymToKeycode(X_Dpy, keysym);
|
||||||
if ((XKeycodeToKeysym(G_dpy, code, 0) != keysym) &&
|
if ((XKeycodeToKeysym(X_Dpy, code, 0) != keysym) &&
|
||||||
(XKeycodeToKeysym(G_dpy, code, 1) == keysym))
|
(XKeycodeToKeysym(X_Dpy, code, 1) == keysym))
|
||||||
mask |= ShiftMask;
|
mask |= ShiftMask;
|
||||||
|
|
||||||
XGrabKey(G_dpy, XKeysymToKeycode(G_dpy, keysym), mask, win, True,
|
XGrabKey(X_Dpy, XKeysymToKeycode(X_Dpy, keysym), mask, win, True,
|
||||||
GrabModeAsync, GrabModeAsync);
|
GrabModeAsync, GrabModeAsync);
|
||||||
#if 0
|
#if 0
|
||||||
XGrabKey(G_dpy, XKeysymToKeycode(G_dpy, keysym), LockMask|mask,
|
XGrabKey(X_Dpy, XKeysymToKeycode(X_Dpy, keysym), LockMask|mask,
|
||||||
win, True, GrabModeAsync, GrabModeAsync);
|
win, True, GrabModeAsync, GrabModeAsync);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ xu_key_grab(Window win, int mask, int keysym)
|
|||||||
void
|
void
|
||||||
xu_key_grab_keycode(Window win, int mask, int keycode)
|
xu_key_grab_keycode(Window win, int mask, int keycode)
|
||||||
{
|
{
|
||||||
XGrabKey(G_dpy, keycode, mask, win, True, GrabModeAsync, GrabModeAsync);
|
XGrabKey(X_Dpy, keycode, mask, win, True, GrabModeAsync, GrabModeAsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -98,7 +98,7 @@ xu_sendmsg(struct client_ctx *cc, Atom atm, long val)
|
|||||||
e.xclient.data.l[0] = val;
|
e.xclient.data.l[0] = val;
|
||||||
e.xclient.data.l[1] = CurrentTime;
|
e.xclient.data.l[1] = CurrentTime;
|
||||||
|
|
||||||
XSendEvent(G_dpy, cc->win, False, 0, &e);
|
XSendEvent(X_Dpy, cc->win, False, 0, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -108,7 +108,7 @@ xu_getprop(struct client_ctx *cc, Atom atm, Atom type, long len, u_char **p)
|
|||||||
u_long n, extra;
|
u_long n, extra;
|
||||||
int format;
|
int format;
|
||||||
|
|
||||||
if (XGetWindowProperty(G_dpy, cc->win, atm, 0L, len, False, type,
|
if (XGetWindowProperty(X_Dpy, cc->win, atm, 0L, len, False, type,
|
||||||
&realtype, &format, &n, &extra, p) != Success || *p == NULL)
|
&realtype, &format, &n, &extra, p) != Success || *p == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ xu_getprop(struct client_ctx *cc, Atom atm, Atom type, long len, u_char **p)
|
|||||||
int
|
int
|
||||||
xu_getstate(struct client_ctx *cc, int *state)
|
xu_getstate(struct client_ctx *cc, int *state)
|
||||||
{
|
{
|
||||||
Atom wm_state = XInternAtom(G_dpy, "WM_STATE", False);
|
Atom wm_state = XInternAtom(X_Dpy, "WM_STATE", False);
|
||||||
long *p = NULL;
|
long *p = NULL;
|
||||||
|
|
||||||
if (xu_getprop(cc, wm_state, wm_state, 2L, (u_char **)&p) <= 0)
|
if (xu_getprop(cc, wm_state, wm_state, 2L, (u_char **)&p) <= 0)
|
||||||
@ -151,12 +151,12 @@ xu_setstate(struct client_ctx *cc, int state)
|
|||||||
Atom wm_state;
|
Atom wm_state;
|
||||||
|
|
||||||
/* XXX cache */
|
/* XXX cache */
|
||||||
wm_state = XInternAtom(G_dpy, "WM_STATE", False);
|
wm_state = XInternAtom(X_Dpy, "WM_STATE", False);
|
||||||
|
|
||||||
dat[0] = (long)state;
|
dat[0] = (long)state;
|
||||||
dat[1] = (long)None;
|
dat[1] = (long)None;
|
||||||
|
|
||||||
cc->state = state;
|
cc->state = state;
|
||||||
XChangeProperty(G_dpy, cc->win, wm_state, wm_state, 32,
|
XChangeProperty(X_Dpy, cc->win, wm_state, wm_state, 32,
|
||||||
PropModeReplace, (unsigned char *)dat, 2);
|
PropModeReplace, (unsigned char *)dat, 2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user