mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
This commit is contained in:
commit
0c99788f66
5
calmwm.h
5
calmwm.h
@ -385,7 +385,7 @@ struct client_ctx *client_current(void);
|
||||
void client_cycle(struct screen_ctx *, int);
|
||||
void client_cycle_leave(struct screen_ctx *,
|
||||
struct client_ctx *);
|
||||
void client_delete(struct client_ctx *);
|
||||
void client_delete(struct client_ctx *, int);
|
||||
void client_draw_border(struct client_ctx *);
|
||||
struct client_ctx *client_find(Window);
|
||||
void client_freeze(struct client_ctx *);
|
||||
@ -523,11 +523,12 @@ void conf_screen(struct screen_ctx *);
|
||||
void xev_loop(void);
|
||||
|
||||
void xu_btn_grab(Window, int, u_int);
|
||||
void xu_btn_ungrab(Window, int, u_int);
|
||||
void xu_btn_ungrab(Window);
|
||||
int xu_getprop(Window, Atom, Atom, long, unsigned char **);
|
||||
int xu_get_wm_state(Window, int *);
|
||||
int xu_getstrprop(Window, Atom, char **);
|
||||
void xu_key_grab(Window, u_int, KeySym);
|
||||
void xu_key_ungrab(Window);
|
||||
void xu_ptr_getpos(Window, int *, int *);
|
||||
int xu_ptr_grab(Window, u_int, Cursor);
|
||||
int xu_ptr_regrab(u_int, Cursor);
|
||||
|
12
client.c
12
client.c
@ -145,17 +145,19 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
|
||||
}
|
||||
|
||||
void
|
||||
client_delete(struct client_ctx *cc)
|
||||
client_delete(struct client_ctx *cc, int destroy)
|
||||
{
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct winname *wn;
|
||||
|
||||
if (destroy) {
|
||||
XGrabServer(X_Dpy);
|
||||
cc->state = WithdrawnState;
|
||||
xu_set_wm_state(cc->win, cc->state);
|
||||
XRemoveFromSaveSet(X_Dpy, cc->win);
|
||||
XSync(X_Dpy, False);
|
||||
XUngrabServer(X_Dpy);
|
||||
}
|
||||
|
||||
TAILQ_REMOVE(&sc->mruq, cc, mru_entry);
|
||||
TAILQ_REMOVE(&Clientq, cc, entry);
|
||||
@ -186,15 +188,10 @@ client_delete(struct client_ctx *cc)
|
||||
void
|
||||
client_leave(struct client_ctx *cc)
|
||||
{
|
||||
struct screen_ctx *sc;
|
||||
|
||||
if (cc == NULL)
|
||||
cc = client_current();
|
||||
if (cc == NULL)
|
||||
return;
|
||||
|
||||
sc = cc->sc;
|
||||
xu_btn_ungrab(sc->rootwin, AnyModifier, Button1);
|
||||
}
|
||||
|
||||
void
|
||||
@ -396,8 +393,6 @@ client_resize(struct client_ctx *cc, int reset)
|
||||
xu_ewmh_set_net_wm_state(cc);
|
||||
}
|
||||
|
||||
client_draw_border(cc);
|
||||
|
||||
XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x,
|
||||
cc->geom.y, cc->geom.w, cc->geom.h);
|
||||
client_config(cc);
|
||||
@ -493,7 +488,6 @@ client_unhide(struct client_ctx *cc)
|
||||
cc->flags &= ~CLIENT_HIDDEN;
|
||||
cc->state = NormalState;
|
||||
xu_set_wm_state(cc->win, cc->state);
|
||||
client_draw_border(cc);
|
||||
}
|
||||
|
||||
void
|
||||
|
4
conf.c
4
conf.c
@ -649,6 +649,8 @@ conf_grab_mouse(Window win)
|
||||
{
|
||||
struct mousebinding *mb;
|
||||
|
||||
xu_btn_ungrab(win);
|
||||
|
||||
TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
|
||||
if (mb->flags != MOUSEBIND_CTX_WIN)
|
||||
continue;
|
||||
@ -661,7 +663,7 @@ conf_grab_kbd(Window win)
|
||||
{
|
||||
struct keybinding *kb;
|
||||
|
||||
XUngrabKey(X_Dpy, AnyKey, AnyModifier, win);
|
||||
xu_key_ungrab(win);
|
||||
|
||||
TAILQ_FOREACH(kb, &Conf.keybindingq, entry)
|
||||
xu_key_grab(win, kb->modmask, kb->keysym);
|
||||
|
6
group.c
6
group.c
@ -177,7 +177,7 @@ group_movetogroup(struct client_ctx *cc, int idx)
|
||||
struct group_ctx *gc;
|
||||
|
||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
||||
err(1, "group_movetogroup: index out of range (%d)", idx);
|
||||
errx(1, "group_movetogroup: index out of range (%d)", idx);
|
||||
|
||||
gc = &sc->groups[idx];
|
||||
if (cc->group == gc)
|
||||
@ -240,7 +240,7 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
|
||||
struct group_ctx *gc;
|
||||
|
||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
||||
err(1, "group_hidetoggle: index out of range (%d)", idx);
|
||||
errx(1, "group_hidetoggle: index out of range (%d)", idx);
|
||||
|
||||
gc = &sc->groups[idx];
|
||||
group_fix_hidden_state(gc);
|
||||
@ -261,7 +261,7 @@ group_only(struct screen_ctx *sc, int idx)
|
||||
int i;
|
||||
|
||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
||||
err(1, "group_only: index out of range (%d)", idx);
|
||||
errx(1, "group_only: index out of range (%d)", idx);
|
||||
|
||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||
if (i == idx)
|
||||
|
4
kbfunc.c
4
kbfunc.c
@ -250,7 +250,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
|
||||
label = "wm";
|
||||
break;
|
||||
default:
|
||||
err(1, "kbfunc_exec: invalid cmd %d", cmd);
|
||||
errx(1, "kbfunc_exec: invalid cmd %d", cmd);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
|
||||
warn("%s", mi->text);
|
||||
break;
|
||||
default:
|
||||
err(1, "kb_func: egad, cmd changed value!");
|
||||
errx(1, "kb_func: egad, cmd changed value!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
10
mousefunc.c
10
mousefunc.c
@ -88,12 +88,9 @@ mousefunc_client_resize(struct client_ctx *cc, void *arg)
|
||||
mousefunc_sweep_draw(cc);
|
||||
|
||||
for (;;) {
|
||||
XMaskEvent(X_Dpy, MOUSEMASK|ExposureMask, &ev);
|
||||
XMaskEvent(X_Dpy, MOUSEMASK, &ev);
|
||||
|
||||
switch (ev.type) {
|
||||
case Expose:
|
||||
client_draw_border(cc);
|
||||
break;
|
||||
case MotionNotify:
|
||||
mousefunc_sweep_calc(cc, x, y,
|
||||
ev.xmotion.x_root, ev.xmotion.y_root);
|
||||
@ -143,12 +140,9 @@ mousefunc_client_move(struct client_ctx *cc, void *arg)
|
||||
xu_ptr_getpos(cc->win, &px, &py);
|
||||
|
||||
for (;;) {
|
||||
XMaskEvent(X_Dpy, MOUSEMASK|ExposureMask, &ev);
|
||||
XMaskEvent(X_Dpy, MOUSEMASK, &ev);
|
||||
|
||||
switch (ev.type) {
|
||||
case Expose:
|
||||
client_draw_border(cc);
|
||||
break;
|
||||
case MotionNotify:
|
||||
cc->geom.x = ev.xmotion.x_root - px - cc->bwidth;
|
||||
cc->geom.y = ev.xmotion.y_root - py - cc->bwidth;
|
||||
|
@ -113,7 +113,7 @@ xev_handle_unmapnotify(XEvent *ee)
|
||||
*/
|
||||
if (XCheckTypedWindowEvent(X_Dpy, cc->win,
|
||||
DestroyNotify, &ev) || e->send_event != 0) {
|
||||
client_delete(cc);
|
||||
client_delete(cc, 1);
|
||||
} else
|
||||
client_hide(cc);
|
||||
}
|
||||
@ -127,7 +127,7 @@ xev_handle_destroynotify(XEvent *ee)
|
||||
struct client_ctx *cc;
|
||||
|
||||
if ((cc = client_find(e->window)) != NULL)
|
||||
client_delete(cc);
|
||||
client_delete(cc, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
75
xutil.c
75
xutil.c
@ -32,6 +32,45 @@
|
||||
|
||||
static unsigned int ign_mods[] = { 0, LockMask, Mod2Mask, Mod2Mask | LockMask };
|
||||
|
||||
void
|
||||
xu_btn_grab(Window win, int mask, u_int btn)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
for (i = 0; i < nitems(ign_mods); i++)
|
||||
XGrabButton(X_Dpy, btn, (mask | ign_mods[i]), win,
|
||||
False, BUTTONMASK, GrabModeAsync,
|
||||
GrabModeSync, None, None);
|
||||
}
|
||||
|
||||
void
|
||||
xu_btn_ungrab(Window win)
|
||||
{
|
||||
XUngrabButton(X_Dpy, AnyButton, AnyModifier, win);
|
||||
}
|
||||
|
||||
void
|
||||
xu_key_grab(Window win, u_int mask, KeySym keysym)
|
||||
{
|
||||
KeyCode code;
|
||||
u_int i;
|
||||
|
||||
code = XKeysymToKeycode(X_Dpy, keysym);
|
||||
if ((XkbKeycodeToKeysym(X_Dpy, code, 0, 0) != keysym) &&
|
||||
(XkbKeycodeToKeysym(X_Dpy, code, 0, 1) == keysym))
|
||||
mask |= ShiftMask;
|
||||
|
||||
for (i = 0; i < nitems(ign_mods); i++)
|
||||
XGrabKey(X_Dpy, code, (mask | ign_mods[i]), win,
|
||||
True, GrabModeAsync, GrabModeAsync);
|
||||
}
|
||||
|
||||
void
|
||||
xu_key_ungrab(Window win)
|
||||
{
|
||||
XUngrabKey(X_Dpy, AnyKey, AnyModifier, win);
|
||||
}
|
||||
|
||||
int
|
||||
xu_ptr_grab(Window win, u_int mask, Cursor curs)
|
||||
{
|
||||
@ -53,26 +92,6 @@ xu_ptr_ungrab(void)
|
||||
XUngrabPointer(X_Dpy, CurrentTime);
|
||||
}
|
||||
|
||||
void
|
||||
xu_btn_grab(Window win, int mask, u_int btn)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
for (i = 0; i < nitems(ign_mods); i++)
|
||||
XGrabButton(X_Dpy, btn, (mask | ign_mods[i]), win,
|
||||
False, BUTTONMASK, GrabModeAsync,
|
||||
GrabModeSync, None, None);
|
||||
}
|
||||
|
||||
void
|
||||
xu_btn_ungrab(Window win, int mask, u_int btn)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
for (i = 0; i < nitems(ign_mods); i++)
|
||||
XUngrabButton(X_Dpy, btn, (mask | ign_mods[i]), win);
|
||||
}
|
||||
|
||||
void
|
||||
xu_ptr_getpos(Window win, int *x, int *y)
|
||||
{
|
||||
@ -89,22 +108,6 @@ xu_ptr_setpos(Window win, int x, int y)
|
||||
XWarpPointer(X_Dpy, None, win, 0, 0, 0, 0, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
xu_key_grab(Window win, u_int mask, KeySym keysym)
|
||||
{
|
||||
KeyCode code;
|
||||
u_int i;
|
||||
|
||||
code = XKeysymToKeycode(X_Dpy, keysym);
|
||||
if ((XkbKeycodeToKeysym(X_Dpy, code, 0, 0) != keysym) &&
|
||||
(XkbKeycodeToKeysym(X_Dpy, code, 0, 1) == keysym))
|
||||
mask |= ShiftMask;
|
||||
|
||||
for (i = 0; i < nitems(ign_mods); i++)
|
||||
XGrabKey(X_Dpy, code, (mask | ign_mods[i]), win,
|
||||
True, GrabModeAsync, GrabModeAsync);
|
||||
}
|
||||
|
||||
int
|
||||
xu_getprop(Window win, Atom atm, Atom type, long len, unsigned char **p)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user