mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
This commit is contained in:
commit
6f185bb03c
10
calmwm.c
10
calmwm.c
@ -129,8 +129,6 @@ dpy_init(const char *dpyname)
|
||||
{
|
||||
int i;
|
||||
|
||||
XSetErrorHandler(x_errorhandler);
|
||||
|
||||
if ((X_Dpy = XOpenDisplay(dpyname)) == NULL)
|
||||
errx(1, "unable to open display \"%s\"",
|
||||
XDisplayName(dpyname));
|
||||
@ -146,7 +144,6 @@ dpy_init(const char *dpyname)
|
||||
static void
|
||||
x_setup(void)
|
||||
{
|
||||
struct screen_ctx *sc;
|
||||
struct keybinding *kb;
|
||||
int i;
|
||||
|
||||
@ -156,11 +153,8 @@ x_setup(void)
|
||||
Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
|
||||
Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
|
||||
|
||||
for (i = 0; i < ScreenCount(X_Dpy); i++) {
|
||||
sc = xcalloc(1, sizeof(*sc));
|
||||
screen_init(sc, i);
|
||||
TAILQ_INSERT_TAIL(&Screenq, sc, entry);
|
||||
}
|
||||
for (i = 0; i < ScreenCount(X_Dpy); i++)
|
||||
screen_init(i);
|
||||
|
||||
/*
|
||||
* XXX key grabs weren't done before, since Screenq was empty,
|
||||
|
4
calmwm.h
4
calmwm.h
@ -387,7 +387,7 @@ void search_print_client(struct menu *, int);
|
||||
|
||||
struct geom screen_find_xinerama(struct screen_ctx *, int, int);
|
||||
struct screen_ctx *screen_fromroot(Window);
|
||||
void screen_init(struct screen_ctx *, u_int);
|
||||
void screen_init(u_int);
|
||||
void screen_update_geometry(struct screen_ctx *);
|
||||
void screen_updatestackingorder(struct screen_ctx *);
|
||||
|
||||
@ -478,7 +478,7 @@ void xu_configure(struct client_ctx *);
|
||||
void xu_getatoms(void);
|
||||
unsigned long xu_getcolor(struct screen_ctx *, char *);
|
||||
int xu_getprop(Window, Atom, Atom, long, u_char **);
|
||||
int xu_getstate(struct client_ctx *, int *);
|
||||
int xu_getstate(Window, int *);
|
||||
int xu_getstrprop(Window, Atom, char **);
|
||||
void xu_key_grab(Window, int, int);
|
||||
void xu_key_ungrab(Window, int, int);
|
||||
|
4
client.c
4
client.c
@ -111,7 +111,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||
}
|
||||
client_draw_border(cc);
|
||||
|
||||
if (xu_getstate(cc, &state) < 0)
|
||||
if (xu_getstate(cc->win, &state) < 0)
|
||||
state = NormalState;
|
||||
|
||||
XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
|
||||
@ -125,7 +125,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||
xu_configure(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(&Clientq, cc, entry);
|
||||
@ -448,7 +447,6 @@ client_ptrsave(struct client_ctx *cc)
|
||||
void
|
||||
client_hide(struct client_ctx *cc)
|
||||
{
|
||||
/* XXX - add wm_state stuff */
|
||||
XUnmapWindow(X_Dpy, cc->win);
|
||||
|
||||
cc->active = 0;
|
||||
|
13
group.c
13
group.c
@ -351,6 +351,7 @@ group_menu(XButtonEvent *e)
|
||||
int i;
|
||||
|
||||
sc = screen_fromroot(e->root);
|
||||
|
||||
TAILQ_INIT(&menuq);
|
||||
|
||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||
@ -374,15 +375,11 @@ group_menu(XButtonEvent *e)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
1
kbfunc.c
1
kbfunc.c
@ -335,6 +335,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
|
||||
}
|
||||
|
||||
TAILQ_INIT(&menuq);
|
||||
|
||||
lbuf = NULL;
|
||||
while ((buf = fgetln(fp, &len))) {
|
||||
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);
|
||||
static int menu_calc_entry(struct screen_ctx *, struct menu_ctx *,
|
||||
int, int);
|
||||
static struct menu *menu_complete_path(struct menu_ctx *);
|
||||
static int menu_keycode(XKeyEvent *, enum ctltype *,
|
||||
char *);
|
||||
|
||||
@ -208,6 +209,7 @@ menu_complete_path(struct menu_ctx *mc)
|
||||
mr = xcalloc(1, sizeof(*mr));
|
||||
|
||||
TAILQ_INIT(&menuq);
|
||||
|
||||
if ((mi = menu_filter(mc->sc, &menuq, mc->searchstr, NULL,
|
||||
CWM_MENU_DUMMY, search_match_path_any, NULL)) != NULL) {
|
||||
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();
|
||||
|
||||
TAILQ_INIT(&menuq);
|
||||
|
||||
TAILQ_FOREACH(cc, &Clientq, entry)
|
||||
if (cc->flags & CLIENT_HIDDEN) {
|
||||
wname = (cc->label) ? cc->label : cc->name;
|
||||
@ -250,8 +251,9 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
||||
if (old_cc != NULL)
|
||||
client_ptrsave(old_cc);
|
||||
client_ptrwarp(cc);
|
||||
} else
|
||||
menuq_clear(&menuq);
|
||||
}
|
||||
|
||||
menuq_clear(&menuq);
|
||||
}
|
||||
|
||||
void
|
||||
@ -263,6 +265,7 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
|
||||
struct cmd *cmd;
|
||||
|
||||
TAILQ_INIT(&menuq);
|
||||
|
||||
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
|
||||
mi = xcalloc(1, sizeof(*mi));
|
||||
(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);
|
||||
if (mi != NULL)
|
||||
u_spawn(((struct cmd *)mi->ctx)->image);
|
||||
else
|
||||
menuq_clear(&menuq);
|
||||
|
||||
menuq_clear(&menuq);
|
||||
}
|
||||
|
7
screen.c
7
screen.c
@ -31,13 +31,16 @@
|
||||
#include "calmwm.h"
|
||||
|
||||
void
|
||||
screen_init(struct screen_ctx *sc, u_int which)
|
||||
screen_init(u_int which)
|
||||
{
|
||||
struct screen_ctx *sc;
|
||||
Window *wins, w0, w1;
|
||||
XWindowAttributes winattr;
|
||||
XSetWindowAttributes rootattr;
|
||||
u_int nwins, i;
|
||||
|
||||
sc = xcalloc(1, sizeof(*sc));
|
||||
|
||||
sc->which = which;
|
||||
sc->visual = DefaultVisual(X_Dpy, sc->which);
|
||||
sc->colormap = DefaultColormap(X_Dpy, sc->which);
|
||||
@ -84,6 +87,8 @@ screen_init(struct screen_ctx *sc, u_int which)
|
||||
if (HasRandr)
|
||||
XRRSelectInput(X_Dpy, sc->rootwin, RRScreenChangeNotifyMask);
|
||||
|
||||
TAILQ_INSERT_TAIL(&Screenq, sc, entry);
|
||||
|
||||
XSync(X_Dpy, False);
|
||||
}
|
||||
|
||||
|
10
xutil.c
10
xutil.c
@ -72,13 +72,13 @@ xu_btn_ungrab(Window win, int mask, u_int btn)
|
||||
}
|
||||
|
||||
void
|
||||
xu_ptr_getpos(Window rootwin, int *x, int *y)
|
||||
xu_ptr_getpos(Window win, int *x, int *y)
|
||||
{
|
||||
Window w0, w1;
|
||||
int tmp0, tmp1;
|
||||
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
|
||||
@ -203,11 +203,11 @@ xu_getstrprop(Window win, Atom atm, char **text) {
|
||||
}
|
||||
|
||||
int
|
||||
xu_getstate(struct client_ctx *cc, int *state)
|
||||
xu_getstate(Window win, int *state)
|
||||
{
|
||||
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)
|
||||
return (-1);
|
||||
|
||||
@ -292,7 +292,7 @@ xu_ewmh_net_supported_wm_check(struct screen_ctx *sc)
|
||||
XChangeProperty(X_Dpy, w, ewmh[_NET_SUPPORTING_WM_CHECK].atom,
|
||||
XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
|
||||
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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user