mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Merge branch 'linux' of git://github.com/chneukirchen/cwm into linux
Conflicts: calmwm.h group.c
This commit is contained in:
commit
0671d579b7
10
calmwm.c
10
calmwm.c
@ -129,8 +129,6 @@ dpy_init(const char *dpyname)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
XSetErrorHandler(x_errorhandler);
|
|
||||||
|
|
||||||
if ((X_Dpy = XOpenDisplay(dpyname)) == NULL)
|
if ((X_Dpy = XOpenDisplay(dpyname)) == NULL)
|
||||||
errx(1, "unable to open display \"%s\"",
|
errx(1, "unable to open display \"%s\"",
|
||||||
XDisplayName(dpyname));
|
XDisplayName(dpyname));
|
||||||
@ -146,7 +144,6 @@ dpy_init(const char *dpyname)
|
|||||||
static void
|
static void
|
||||||
x_setup(void)
|
x_setup(void)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
|
||||||
struct keybinding *kb;
|
struct keybinding *kb;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -156,11 +153,8 @@ x_setup(void)
|
|||||||
Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
|
Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
|
||||||
Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
|
Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
|
||||||
|
|
||||||
for (i = 0; i < ScreenCount(X_Dpy); i++) {
|
for (i = 0; i < ScreenCount(X_Dpy); i++)
|
||||||
sc = xcalloc(1, sizeof(*sc));
|
screen_init(i);
|
||||||
screen_init(sc, i);
|
|
||||||
TAILQ_INSERT_TAIL(&Screenq, sc, entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX key grabs weren't done before, since Screenq was empty,
|
* XXX key grabs weren't done before, since Screenq was empty,
|
||||||
|
11
calmwm.h
11
calmwm.h
@ -228,7 +228,7 @@ TAILQ_HEAD(autostartcmd_q, autostartcmd);
|
|||||||
|
|
||||||
struct screen_ctx {
|
struct screen_ctx {
|
||||||
TAILQ_ENTRY(screen_ctx) entry;
|
TAILQ_ENTRY(screen_ctx) entry;
|
||||||
u_int which;
|
int which;
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
Window rootwin;
|
Window rootwin;
|
||||||
@ -376,7 +376,6 @@ void group_client_delete(struct client_ctx *);
|
|||||||
void group_cycle(struct screen_ctx *, int);
|
void group_cycle(struct screen_ctx *, int);
|
||||||
void group_hidetoggle(struct screen_ctx *, int);
|
void group_hidetoggle(struct screen_ctx *, int);
|
||||||
void group_init(struct screen_ctx *);
|
void group_init(struct screen_ctx *);
|
||||||
void group_make_autogroup(struct conf *, char *, int);
|
|
||||||
void group_make_autostart(struct conf *, char *, int);
|
void group_make_autostart(struct conf *, char *, int);
|
||||||
void group_menu(XButtonEvent *);
|
void group_menu(XButtonEvent *);
|
||||||
void group_movetogroup(struct client_ctx *, int);
|
void group_movetogroup(struct client_ctx *, int);
|
||||||
@ -400,7 +399,7 @@ void search_print_client(struct menu *, int);
|
|||||||
|
|
||||||
struct geom screen_find_xinerama(struct screen_ctx *, int, int);
|
struct geom screen_find_xinerama(struct screen_ctx *, int, int);
|
||||||
struct screen_ctx *screen_fromroot(Window);
|
struct screen_ctx *screen_fromroot(Window);
|
||||||
void screen_init(struct screen_ctx *, u_int);
|
void screen_init(int);
|
||||||
void screen_update_geometry(struct screen_ctx *);
|
void screen_update_geometry(struct screen_ctx *);
|
||||||
void screen_updatestackingorder(struct screen_ctx *);
|
void screen_updatestackingorder(struct screen_ctx *);
|
||||||
|
|
||||||
@ -461,6 +460,7 @@ void menuq_clear(struct menu_q *);
|
|||||||
|
|
||||||
int parse_config(const char *, struct conf *);
|
int parse_config(const char *, struct conf *);
|
||||||
|
|
||||||
|
void conf_autogroup(struct conf *, int, char *);
|
||||||
void conf_bindname(struct conf *, char *, char *);
|
void conf_bindname(struct conf *, char *, char *);
|
||||||
void conf_clear(struct conf *);
|
void conf_clear(struct conf *);
|
||||||
void conf_client(struct client_ctx *);
|
void conf_client(struct client_ctx *);
|
||||||
@ -471,6 +471,7 @@ void conf_gap(struct conf *, struct screen_ctx *);
|
|||||||
void conf_grab(struct conf *, struct keybinding *);
|
void conf_grab(struct conf *, struct keybinding *);
|
||||||
void conf_grab_mouse(struct client_ctx *);
|
void conf_grab_mouse(struct client_ctx *);
|
||||||
void conf_init(struct conf *);
|
void conf_init(struct conf *);
|
||||||
|
void conf_ignore(struct conf *, char *);
|
||||||
void conf_mousebind(struct conf *, char *, char *);
|
void conf_mousebind(struct conf *, char *, char *);
|
||||||
void conf_ungrab(struct conf *, struct keybinding *);
|
void conf_ungrab(struct conf *, struct keybinding *);
|
||||||
|
|
||||||
@ -491,7 +492,7 @@ void xu_configure(struct client_ctx *);
|
|||||||
void xu_getatoms(void);
|
void xu_getatoms(void);
|
||||||
unsigned long xu_getcolor(struct screen_ctx *, char *);
|
unsigned long xu_getcolor(struct screen_ctx *, char *);
|
||||||
int xu_getprop(Window, Atom, Atom, long, u_char **);
|
int xu_getprop(Window, Atom, Atom, long, u_char **);
|
||||||
int xu_getstate(struct client_ctx *, int *);
|
int xu_get_wm_state(Window, int *);
|
||||||
int xu_getstrprop(Window, Atom, char **);
|
int xu_getstrprop(Window, Atom, char **);
|
||||||
void xu_key_grab(Window, int, int);
|
void xu_key_grab(Window, int, int);
|
||||||
void xu_key_ungrab(Window, int, int);
|
void xu_key_ungrab(Window, int, int);
|
||||||
@ -501,7 +502,7 @@ int xu_ptr_regrab(int, Cursor);
|
|||||||
void xu_ptr_setpos(Window, int, int);
|
void xu_ptr_setpos(Window, int, int);
|
||||||
void xu_ptr_ungrab(void);
|
void xu_ptr_ungrab(void);
|
||||||
void xu_sendmsg(Window, Atom, long);
|
void xu_sendmsg(Window, Atom, long);
|
||||||
void xu_setstate(struct client_ctx *, int);
|
void xu_set_wm_state(Window win, int);
|
||||||
void xu_xorcolor(XRenderColor, XRenderColor,
|
void xu_xorcolor(XRenderColor, XRenderColor,
|
||||||
XRenderColor *);
|
XRenderColor *);
|
||||||
|
|
||||||
|
22
client.c
22
client.c
@ -101,17 +101,18 @@ 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);
|
||||||
|
client_move(cc);
|
||||||
if ((wmhints = XGetWMHints(X_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);
|
cc->state = wmhints->initial_state;
|
||||||
|
xu_set_wm_state(cc->win, cc->state);
|
||||||
|
}
|
||||||
XFree(wmhints);
|
XFree(wmhints);
|
||||||
}
|
}
|
||||||
client_move(cc);
|
|
||||||
}
|
}
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
|
|
||||||
if (xu_getstate(cc, &state) < 0)
|
if (xu_get_wm_state(cc->win, &state) < 0)
|
||||||
state = NormalState;
|
state = NormalState;
|
||||||
|
|
||||||
XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
|
XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
|
||||||
@ -125,7 +126,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
xu_configure(cc);
|
xu_configure(cc);
|
||||||
|
|
||||||
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
|
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
|
||||||
xu_setstate(cc, cc->state);
|
|
||||||
|
|
||||||
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
||||||
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
|
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
|
||||||
@ -152,7 +152,8 @@ client_delete(struct client_ctx *cc)
|
|||||||
group_client_delete(cc);
|
group_client_delete(cc);
|
||||||
|
|
||||||
XGrabServer(X_Dpy);
|
XGrabServer(X_Dpy);
|
||||||
xu_setstate(cc, WithdrawnState);
|
cc->state = WithdrawnState;
|
||||||
|
xu_set_wm_state(cc->win, cc->state);
|
||||||
XRemoveFromSaveSet(X_Dpy, cc->win);
|
XRemoveFromSaveSet(X_Dpy, cc->win);
|
||||||
|
|
||||||
XSync(X_Dpy, False);
|
XSync(X_Dpy, False);
|
||||||
@ -448,12 +449,12 @@ client_ptrsave(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
client_hide(struct client_ctx *cc)
|
client_hide(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
/* XXX - add wm_state stuff */
|
|
||||||
XUnmapWindow(X_Dpy, cc->win);
|
XUnmapWindow(X_Dpy, cc->win);
|
||||||
|
|
||||||
cc->active = 0;
|
cc->active = 0;
|
||||||
cc->flags |= CLIENT_HIDDEN;
|
cc->flags |= CLIENT_HIDDEN;
|
||||||
xu_setstate(cc, IconicState);
|
cc->state = IconicState;
|
||||||
|
xu_set_wm_state(cc->win, cc->state);
|
||||||
|
|
||||||
if (cc == client_current())
|
if (cc == client_current())
|
||||||
client_none(cc->sc);
|
client_none(cc->sc);
|
||||||
@ -465,7 +466,8 @@ client_unhide(struct client_ctx *cc)
|
|||||||
XMapRaised(X_Dpy, cc->win);
|
XMapRaised(X_Dpy, cc->win);
|
||||||
|
|
||||||
cc->flags &= ~CLIENT_HIDDEN;
|
cc->flags &= ~CLIENT_HIDDEN;
|
||||||
xu_setstate(cc, NormalState);
|
cc->state = NormalState;
|
||||||
|
xu_set_wm_state(cc->win, cc->state);
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
conf.c
34
conf.c
@ -39,7 +39,6 @@ void
|
|||||||
conf_cmd_add(struct conf *c, char *image, char *label)
|
conf_cmd_add(struct conf *c, char *image, char *label)
|
||||||
{
|
{
|
||||||
/* "term" and "lock" have special meanings. */
|
/* "term" and "lock" have special meanings. */
|
||||||
|
|
||||||
if (strcmp(label, "term") == 0)
|
if (strcmp(label, "term") == 0)
|
||||||
(void)strlcpy(c->termpath, image, sizeof(c->termpath));
|
(void)strlcpy(c->termpath, image, sizeof(c->termpath));
|
||||||
else if (strcmp(label, "lock") == 0)
|
else if (strcmp(label, "lock") == 0)
|
||||||
@ -52,6 +51,39 @@ conf_cmd_add(struct conf *c, char *image, char *label)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
conf_autogroup(struct conf *c, int no, char *val)
|
||||||
|
{
|
||||||
|
struct autogroupwin *aw;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
aw = xcalloc(1, sizeof(*aw));
|
||||||
|
|
||||||
|
if ((p = strchr(val, ',')) == NULL) {
|
||||||
|
aw->name = NULL;
|
||||||
|
aw->class = xstrdup(val);
|
||||||
|
} else {
|
||||||
|
*(p++) = '\0';
|
||||||
|
aw->name = xstrdup(val);
|
||||||
|
aw->class = xstrdup(p);
|
||||||
|
}
|
||||||
|
aw->num = no;
|
||||||
|
|
||||||
|
TAILQ_INSERT_TAIL(&c->autogroupq, aw, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
conf_ignore(struct conf *c, char *val)
|
||||||
|
{
|
||||||
|
struct winmatch *wm;
|
||||||
|
|
||||||
|
wm = xcalloc(1, sizeof(*wm));
|
||||||
|
|
||||||
|
(void)strlcpy(wm->title, val, sizeof(wm->title));
|
||||||
|
|
||||||
|
TAILQ_INSERT_TAIL(&c->ignoreq, wm, entry);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
conf_gap(struct conf *c, struct screen_ctx *sc)
|
conf_gap(struct conf *c, struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
|
37
group.c
37
group.c
@ -99,8 +99,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
Window *winlist;
|
Window *winlist;
|
||||||
u_int i;
|
int i, lastempty = -1;
|
||||||
int lastempty = -1;
|
|
||||||
|
|
||||||
gc->highstack = 0;
|
gc->highstack = 0;
|
||||||
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
||||||
@ -164,27 +163,6 @@ group_init(struct screen_ctx *sc)
|
|||||||
group_setactive(sc, 1);
|
group_setactive(sc, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
group_make_autogroup(struct conf *conf, char *val, int no)
|
|
||||||
{
|
|
||||||
struct autogroupwin *aw;
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
aw = xcalloc(1, sizeof(*aw));
|
|
||||||
|
|
||||||
if ((p = strchr(val, ',')) == NULL) {
|
|
||||||
aw->name = NULL;
|
|
||||||
aw->class = xstrdup(val);
|
|
||||||
} else {
|
|
||||||
*(p++) = '\0';
|
|
||||||
aw->name = xstrdup(val);
|
|
||||||
aw->class = xstrdup(p);
|
|
||||||
}
|
|
||||||
aw->num = no;
|
|
||||||
|
|
||||||
TAILQ_INSERT_TAIL(&conf->autogroupq, aw, entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
group_make_autostart(struct conf *conf, char *cmd, int no)
|
group_make_autostart(struct conf *conf, char *cmd, int no)
|
||||||
{
|
{
|
||||||
@ -384,6 +362,7 @@ group_menu(XButtonEvent *e)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
sc = screen_fromroot(e->root);
|
sc = screen_fromroot(e->root);
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||||
@ -407,15 +386,11 @@ group_menu(XButtonEvent *e)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
|
mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
|
||||||
|
if (mi != NULL && mi->ctx != NULL) {
|
||||||
|
gc = (struct group_ctx *)mi->ctx;
|
||||||
|
(gc->hidden) ? group_show(sc, gc) : group_hide(sc, gc);
|
||||||
|
}
|
||||||
|
|
||||||
if (mi == NULL || mi->ctx == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
gc = (struct group_ctx *)mi->ctx;
|
|
||||||
|
|
||||||
(gc->hidden) ? group_show(sc, gc) : group_hide(sc, gc);
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
menuq_clear(&menuq);
|
menuq_clear(&menuq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
kbfunc.c
1
kbfunc.c
@ -411,6 +411,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
lbuf = NULL;
|
lbuf = NULL;
|
||||||
while ((buf = fgetln(fp, &len))) {
|
while ((buf = fgetln(fp, &len))) {
|
||||||
if (buf[len - 1] == '\n')
|
if (buf[len - 1] == '\n')
|
||||||
|
2
menu.c
2
menu.c
@ -74,6 +74,7 @@ static void menu_draw_entry(struct screen_ctx *, struct menu_ctx *,
|
|||||||
struct menu_q *, int, int);
|
struct menu_q *, int, int);
|
||||||
static int menu_calc_entry(struct screen_ctx *, struct menu_ctx *,
|
static int menu_calc_entry(struct screen_ctx *, struct menu_ctx *,
|
||||||
int, int);
|
int, int);
|
||||||
|
static struct menu *menu_complete_path(struct menu_ctx *);
|
||||||
static int menu_keycode(XKeyEvent *, enum ctltype *,
|
static int menu_keycode(XKeyEvent *, enum ctltype *,
|
||||||
char *);
|
char *);
|
||||||
|
|
||||||
@ -208,6 +209,7 @@ menu_complete_path(struct menu_ctx *mc)
|
|||||||
mr = xcalloc(1, sizeof(*mr));
|
mr = xcalloc(1, sizeof(*mr));
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
if ((mi = menu_filter(mc->sc, &menuq, mc->searchstr, NULL,
|
if ((mi = menu_filter(mc->sc, &menuq, mc->searchstr, NULL,
|
||||||
CWM_MENU_DUMMY, search_match_path_any, NULL)) != NULL) {
|
CWM_MENU_DUMMY, search_match_path_any, NULL)) != NULL) {
|
||||||
mr->abort = mi->abort;
|
mr->abort = mi->abort;
|
||||||
|
11
mousefunc.c
11
mousefunc.c
@ -227,6 +227,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
|||||||
old_cc = client_current();
|
old_cc = client_current();
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry)
|
TAILQ_FOREACH(cc, &Clientq, entry)
|
||||||
if (cc->flags & CLIENT_HIDDEN) {
|
if (cc->flags & CLIENT_HIDDEN) {
|
||||||
wname = (cc->label) ? cc->label : cc->name;
|
wname = (cc->label) ? cc->label : cc->name;
|
||||||
@ -250,8 +251,9 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
|||||||
if (old_cc != NULL)
|
if (old_cc != NULL)
|
||||||
client_ptrsave(old_cc);
|
client_ptrsave(old_cc);
|
||||||
client_ptrwarp(cc);
|
client_ptrwarp(cc);
|
||||||
} else
|
}
|
||||||
menuq_clear(&menuq);
|
|
||||||
|
menuq_clear(&menuq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -263,6 +265,7 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
|
|||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
||||||
mi = xcalloc(1, sizeof(*mi));
|
mi = xcalloc(1, sizeof(*mi));
|
||||||
(void)strlcpy(mi->text, cmd->label, sizeof(mi->text));
|
(void)strlcpy(mi->text, cmd->label, sizeof(mi->text));
|
||||||
@ -275,6 +278,6 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
|
|||||||
mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
|
mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
|
||||||
if (mi != NULL)
|
if (mi != NULL)
|
||||||
u_spawn(((struct cmd *)mi->ctx)->image);
|
u_spawn(((struct cmd *)mi->ctx)->image);
|
||||||
else
|
|
||||||
menuq_clear(&menuq);
|
menuq_clear(&menuq);
|
||||||
}
|
}
|
||||||
|
9
parse.y
9
parse.y
@ -139,7 +139,7 @@ main : FONTNAME STRING {
|
|||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
group_make_autogroup(conf, $3, $2);
|
conf_autogroup(conf, $2, $3);
|
||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| AUTOSTART NUMBER STRING {
|
| AUTOSTART NUMBER STRING {
|
||||||
@ -153,12 +153,7 @@ main : FONTNAME STRING {
|
|||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| IGNORE STRING {
|
| IGNORE STRING {
|
||||||
struct winmatch *wm;
|
conf_ignore(conf, $2);
|
||||||
|
|
||||||
wm = xcalloc(1, sizeof(*wm));
|
|
||||||
(void)strlcpy(wm->title, $2, sizeof(wm->title));
|
|
||||||
TAILQ_INSERT_TAIL(&conf->ignoreq, wm, entry);
|
|
||||||
|
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| BIND STRING string {
|
| BIND STRING string {
|
||||||
|
15
screen.c
15
screen.c
@ -31,13 +31,16 @@
|
|||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
screen_init(struct screen_ctx *sc, u_int which)
|
screen_init(int which)
|
||||||
{
|
{
|
||||||
|
struct screen_ctx *sc;
|
||||||
Window *wins, w0, w1;
|
Window *wins, w0, w1;
|
||||||
XWindowAttributes winattr;
|
XWindowAttributes winattr;
|
||||||
XSetWindowAttributes rootattr;
|
XSetWindowAttributes rootattr;
|
||||||
u_int nwins, i;
|
u_int nwins, i;
|
||||||
|
|
||||||
|
sc = xcalloc(1, sizeof(*sc));
|
||||||
|
|
||||||
sc->which = which;
|
sc->which = which;
|
||||||
sc->visual = DefaultVisual(X_Dpy, sc->which);
|
sc->visual = DefaultVisual(X_Dpy, sc->which);
|
||||||
sc->colormap = DefaultColormap(X_Dpy, sc->which);
|
sc->colormap = DefaultColormap(X_Dpy, sc->which);
|
||||||
@ -47,16 +50,14 @@ screen_init(struct screen_ctx *sc, u_int which)
|
|||||||
xu_ewmh_net_supported_wm_check(sc);
|
xu_ewmh_net_supported_wm_check(sc);
|
||||||
|
|
||||||
conf_gap(&Conf, sc);
|
conf_gap(&Conf, sc);
|
||||||
|
conf_color(&Conf, sc);
|
||||||
|
conf_font(&Conf, sc);
|
||||||
|
|
||||||
screen_update_geometry(sc);
|
screen_update_geometry(sc);
|
||||||
|
|
||||||
conf_color(&Conf, sc);
|
|
||||||
|
|
||||||
group_init(sc);
|
|
||||||
conf_font(&Conf, sc);
|
|
||||||
|
|
||||||
TAILQ_INIT(&sc->mruq);
|
TAILQ_INIT(&sc->mruq);
|
||||||
|
|
||||||
|
group_init(sc);
|
||||||
menu_init(sc);
|
menu_init(sc);
|
||||||
|
|
||||||
rootattr.cursor = Cursor_normal;
|
rootattr.cursor = Cursor_normal;
|
||||||
@ -84,6 +85,8 @@ screen_init(struct screen_ctx *sc, u_int which)
|
|||||||
if (HasRandr)
|
if (HasRandr)
|
||||||
XRRSelectInput(X_Dpy, sc->rootwin, RRScreenChangeNotifyMask);
|
XRRSelectInput(X_Dpy, sc->rootwin, RRScreenChangeNotifyMask);
|
||||||
|
|
||||||
|
TAILQ_INSERT_TAIL(&Screenq, sc, entry);
|
||||||
|
|
||||||
XSync(X_Dpy, False);
|
XSync(X_Dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
search.c
4
search.c
@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
static void search_match_path(struct menu_q *, struct menu_q *,
|
static void search_match_path(struct menu_q *, struct menu_q *,
|
||||||
char *, int);
|
char *, int);
|
||||||
|
static void search_match_path_exec(struct menu_q *, struct menu_q *,
|
||||||
|
char *);
|
||||||
static int strsubmatch(char *, char *, int);
|
static int strsubmatch(char *, char *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -192,7 +194,7 @@ search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, in
|
|||||||
globfree(&g);
|
globfree(&g);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||||
{
|
{
|
||||||
return (search_match_path(menuq, resultq, search, PATH_EXEC));
|
return (search_match_path(menuq, resultq, search, PATH_EXEC));
|
||||||
|
@ -362,7 +362,7 @@ xev_handle_randr(XEvent *ee)
|
|||||||
|
|
||||||
i = XRRRootToScreen(X_Dpy, rev->root);
|
i = XRRRootToScreen(X_Dpy, rev->root);
|
||||||
TAILQ_FOREACH(sc, &Screenq, entry) {
|
TAILQ_FOREACH(sc, &Screenq, entry) {
|
||||||
if (sc->which == (u_int)i) {
|
if (sc->which == i) {
|
||||||
XRRUpdateConfiguration(ee);
|
XRRUpdateConfiguration(ee);
|
||||||
screen_update_geometry(sc);
|
screen_update_geometry(sc);
|
||||||
}
|
}
|
||||||
|
15
xutil.c
15
xutil.c
@ -72,13 +72,13 @@ xu_btn_ungrab(Window win, int mask, u_int btn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xu_ptr_getpos(Window rootwin, int *x, int *y)
|
xu_ptr_getpos(Window win, int *x, int *y)
|
||||||
{
|
{
|
||||||
Window w0, w1;
|
Window w0, w1;
|
||||||
int tmp0, tmp1;
|
int tmp0, tmp1;
|
||||||
u_int tmp2;
|
u_int tmp2;
|
||||||
|
|
||||||
XQueryPointer(X_Dpy, rootwin, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
|
XQueryPointer(X_Dpy, win, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -203,11 +203,11 @@ xu_getstrprop(Window win, Atom atm, char **text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xu_getstate(struct client_ctx *cc, int *state)
|
xu_get_wm_state(Window win, int *state)
|
||||||
{
|
{
|
||||||
long *p = NULL;
|
long *p = NULL;
|
||||||
|
|
||||||
if (xu_getprop(cc->win, cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 2L,
|
if (xu_getprop(win, cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 2L,
|
||||||
(u_char **)&p) <= 0)
|
(u_char **)&p) <= 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
@ -218,15 +218,14 @@ xu_getstate(struct client_ctx *cc, int *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xu_setstate(struct client_ctx *cc, int state)
|
xu_set_wm_state(Window win, int state)
|
||||||
{
|
{
|
||||||
long dat[2];
|
long dat[2];
|
||||||
|
|
||||||
dat[0] = state;
|
dat[0] = state;
|
||||||
dat[1] = None;
|
dat[1] = None;
|
||||||
|
|
||||||
cc->state = state;
|
XChangeProperty(X_Dpy, win,
|
||||||
XChangeProperty(X_Dpy, cc->win,
|
|
||||||
cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 32,
|
cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 32,
|
||||||
PropModeReplace, (unsigned char *)dat, 2);
|
PropModeReplace, (unsigned char *)dat, 2);
|
||||||
}
|
}
|
||||||
@ -292,7 +291,7 @@ xu_ewmh_net_supported_wm_check(struct screen_ctx *sc)
|
|||||||
XChangeProperty(X_Dpy, w, ewmh[_NET_SUPPORTING_WM_CHECK].atom,
|
XChangeProperty(X_Dpy, w, ewmh[_NET_SUPPORTING_WM_CHECK].atom,
|
||||||
XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
|
XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
|
||||||
XChangeProperty(X_Dpy, w, ewmh[_NET_WM_NAME].atom,
|
XChangeProperty(X_Dpy, w, ewmh[_NET_WM_NAME].atom,
|
||||||
XA_WM_NAME, 8, PropModeReplace, (unsigned char *)WMNAME,
|
cwmh[UTF8_STRING].atom, 8, PropModeReplace, (unsigned char *)WMNAME,
|
||||||
strlen(WMNAME));
|
strlen(WMNAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user