Compare commits
18 Commits
35b0da9202
...
linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 22cd0f5f43 | |||
| ca083f97bd | |||
|
|
d7c777b1a5 | ||
|
|
b46a21f3c5 | ||
|
|
d86d3aa419 | ||
|
|
73cef0ffb0 | ||
|
|
9eb763ab87 | ||
|
|
481894147a | ||
|
|
4a6128d5e4 | ||
|
|
c55191fdc5 | ||
|
|
4e73ce533c | ||
|
|
7af3a7b8b6 | ||
|
|
496bcc879d | ||
|
|
5e5221d82d | ||
|
|
7c22b36a23 | ||
|
|
81a08ddb89 | ||
|
|
a9eeb04606 | ||
|
|
055b84f4d4 |
17
README
17
README
@@ -130,6 +130,23 @@ Changes made between OpenBSD 6.6 and 6.7
|
|||||||
* Allowed use of window-htile and window-vtile with the "empty" group
|
* Allowed use of window-htile and window-vtile with the "empty" group
|
||||||
clients in cwm(1).
|
clients in cwm(1).
|
||||||
|
|
||||||
|
2022-04-30: Eighth public release 7.1 of portable cwm.
|
||||||
|
|
||||||
|
Changes made between OpenBSD 6.9 and 7.0
|
||||||
|
* Changed cwm(1) maximization and full-screen mode toggling to keep
|
||||||
|
the cursor within the window, preventing focus loss.
|
||||||
|
|
||||||
|
Changes made between OpenBSD 7.0 and 7.1
|
||||||
|
* Added a cwm(1) "group-last" command that shows only the previously
|
||||||
|
active group.
|
||||||
|
* Allowed bare numbers for key and mouse bindings in cwm(1).
|
||||||
|
|
||||||
|
2023-10-20: Ninth public release 7.4 of portable cwm.
|
||||||
|
|
||||||
|
Changes made between OpenBSD 7.3 and 7.4:
|
||||||
|
* Allow cwm(1) to cycle through windows of the same window class as
|
||||||
|
the active window, default key binding to M-grave, respectively
|
||||||
|
Alt-Tilde, like with other window managers.
|
||||||
|
|
||||||
--Leah Neukirchen <leah@vuxu.org>
|
--Leah Neukirchen <leah@vuxu.org>
|
||||||
|
|
||||||
|
|||||||
51
calmwm.h
51
calmwm.h
@@ -88,6 +88,7 @@ size_t strlcpy(char *, const char *, size_t);
|
|||||||
#define CWM_CYCLE_FORWARD 0x0001
|
#define CWM_CYCLE_FORWARD 0x0001
|
||||||
#define CWM_CYCLE_REVERSE 0x0002
|
#define CWM_CYCLE_REVERSE 0x0002
|
||||||
#define CWM_CYCLE_INGROUP 0x0004
|
#define CWM_CYCLE_INGROUP 0x0004
|
||||||
|
#define CWM_CYCLE_INCLASS 0x0008
|
||||||
|
|
||||||
enum cwm_status {
|
enum cwm_status {
|
||||||
CWM_QUIT,
|
CWM_QUIT,
|
||||||
@@ -235,6 +236,7 @@ struct screen_ctx {
|
|||||||
struct region_q regionq;
|
struct region_q regionq;
|
||||||
struct group_q groupq;
|
struct group_q groupq;
|
||||||
struct group_ctx *group_active;
|
struct group_ctx *group_active;
|
||||||
|
struct group_ctx *group_last;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
struct {
|
struct {
|
||||||
@@ -311,6 +313,9 @@ struct conf {
|
|||||||
int nameqlen;
|
int nameqlen;
|
||||||
int bwidth;
|
int bwidth;
|
||||||
int mamount;
|
int mamount;
|
||||||
|
int scalefactor;
|
||||||
|
int raiseonhover;
|
||||||
|
int raisedelay;
|
||||||
int snapdist;
|
int snapdist;
|
||||||
int htile;
|
int htile;
|
||||||
int vtile;
|
int vtile;
|
||||||
@@ -329,30 +334,39 @@ struct conf {
|
|||||||
|
|
||||||
/* MWM hints */
|
/* MWM hints */
|
||||||
struct mwm_hints {
|
struct mwm_hints {
|
||||||
#define MWM_HINTS_ELEMENTS 3L
|
#define MWM_HINTS_ELEMENTS 5L
|
||||||
#define MWM_FLAGS_STATUS (1<<3)
|
|
||||||
|
|
||||||
#define MWM_FLAGS_FUNCTIONS (1<<0)
|
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||||
#define MWM_FLAGS_DECORATIONS (1<<1)
|
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||||
#define MWM_FLAGS_INPUT_MODE (1<<2)
|
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
||||||
|
#define MWM_HINTS_STATUS (1L << 3)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
#define MWM_FUNCS_ALL (1<<0)
|
#define MWM_FUNC_ALL (1L << 0)
|
||||||
#define MWM_FUNCS_RESIZE (1<<1)
|
#define MWM_FUNC_RESIZE (1L << 1)
|
||||||
#define MWM_FUNCS_MOVE (1<<2)
|
#define MWM_FUNC_MOVE (1L << 2)
|
||||||
#define MWM_FUNCS_MINIMIZE (1<<3)
|
#define MWM_FUNC_MINIMIZE (1L << 3)
|
||||||
#define MWM_FUNCS_MAXIMIZE (1<<4)
|
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
||||||
#define MWM_FUNCS_CLOSE (1<<5)
|
#define MWM_FUNC_CLOSE (1L << 5)
|
||||||
unsigned long functions;
|
unsigned long functions;
|
||||||
|
|
||||||
#define MWM_DECOR_ALL (1<<0)
|
#define MWM_DECOR_ALL (1L << 0)
|
||||||
#define MWM_DECOR_BORDER (1<<1)
|
#define MWM_DECOR_BORDER (1L << 1)
|
||||||
#define MWM_DECOR_RESIZE_HANDLE (1<<2)
|
#define MWM_DECOR_RESIZEH (1L << 2)
|
||||||
#define MWM_DECOR_TITLEBAR (1<<3)
|
#define MWM_DECOR_TITLE (1L << 3)
|
||||||
#define MWM_DECOR_MENU (1<<4)
|
#define MWM_DECOR_MENU (1L << 4)
|
||||||
#define MWM_DECOR_MINIMIZE (1<<5)
|
#define MWM_DECOR_MINIMIZE (1L << 5)
|
||||||
#define MWM_DECOR_MAXIMIZE (1<<6)
|
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
||||||
unsigned long decorations;
|
unsigned long decorations;
|
||||||
|
|
||||||
|
#define MWM_INPUT_MODELESS 0
|
||||||
|
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
|
||||||
|
#define MWM_INPUT_SYSTEM_MODAL 2
|
||||||
|
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
|
||||||
|
long inputMode;
|
||||||
|
|
||||||
|
#define MWM_TEAROFF_WINDOW (1L << 0)
|
||||||
|
unsigned long status;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum cwmh {
|
enum cwmh {
|
||||||
@@ -524,6 +538,7 @@ void kbfunc_client_toggle_group(void *, struct cargs *);
|
|||||||
void kbfunc_client_movetogroup(void *, struct cargs *);
|
void kbfunc_client_movetogroup(void *, struct cargs *);
|
||||||
void kbfunc_group_toggle(void *, struct cargs *);
|
void kbfunc_group_toggle(void *, struct cargs *);
|
||||||
void kbfunc_group_only(void *, struct cargs *);
|
void kbfunc_group_only(void *, struct cargs *);
|
||||||
|
void kbfunc_group_last(void *, struct cargs *);
|
||||||
void kbfunc_group_close(void *, struct cargs *);
|
void kbfunc_group_close(void *, struct cargs *);
|
||||||
void kbfunc_group_cycle(void *, struct cargs *);
|
void kbfunc_group_cycle(void *, struct cargs *);
|
||||||
void kbfunc_group_toggle_all(void *, struct cargs *);
|
void kbfunc_group_toggle_all(void *, struct cargs *);
|
||||||
|
|||||||
14
client.c
14
client.c
@@ -596,7 +596,7 @@ client_draw_border(struct client_ctx *cc)
|
|||||||
pixel = sc->xftcolor[CWM_COLOR_BORDER_URGENCY].pixel;
|
pixel = sc->xftcolor[CWM_COLOR_BORDER_URGENCY].pixel;
|
||||||
|
|
||||||
XSetWindowBorderWidth(X_Dpy, cc->win, (unsigned int)cc->bwidth);
|
XSetWindowBorderWidth(X_Dpy, cc->win, (unsigned int)cc->bwidth);
|
||||||
XSetWindowBorder(X_Dpy, cc->win, pixel);
|
XSetWindowBorder(X_Dpy, cc->win, pixel | (0xffu << 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -849,13 +849,15 @@ client_mwm_hints(struct client_ctx *cc)
|
|||||||
|
|
||||||
if (xu_get_prop(cc->win, cwmh[_MOTIF_WM_HINTS],
|
if (xu_get_prop(cc->win, cwmh[_MOTIF_WM_HINTS],
|
||||||
cwmh[_MOTIF_WM_HINTS], MWM_HINTS_ELEMENTS,
|
cwmh[_MOTIF_WM_HINTS], MWM_HINTS_ELEMENTS,
|
||||||
(unsigned char **)&mwmh) == MWM_HINTS_ELEMENTS) {
|
(unsigned char **)&mwmh) <= 0)
|
||||||
if (mwmh->flags & MWM_FLAGS_DECORATIONS &&
|
return;
|
||||||
!(mwmh->decorations & MWM_DECOR_ALL) &&
|
|
||||||
!(mwmh->decorations & MWM_DECOR_BORDER))
|
if ((mwmh->flags & MWM_HINTS_DECORATIONS) &&
|
||||||
|
!(mwmh->decorations & MWM_DECOR_ALL)) {
|
||||||
|
if (!(mwmh->decorations & MWM_DECOR_BORDER))
|
||||||
cc->bwidth = 0;
|
cc->bwidth = 0;
|
||||||
XFree(mwmh);
|
|
||||||
}
|
}
|
||||||
|
XFree(mwmh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
12
conf.c
12
conf.c
@@ -136,9 +136,14 @@ static const struct {
|
|||||||
(CWM_CYCLE_FORWARD | CWM_CYCLE_INGROUP)) },
|
(CWM_CYCLE_FORWARD | CWM_CYCLE_INGROUP)) },
|
||||||
{ FUNC_SC(window-rcycle-ingroup, client_cycle,
|
{ FUNC_SC(window-rcycle-ingroup, client_cycle,
|
||||||
(CWM_CYCLE_REVERSE | CWM_CYCLE_INGROUP)) },
|
(CWM_CYCLE_REVERSE | CWM_CYCLE_INGROUP)) },
|
||||||
|
{ FUNC_SC(window-cycle-inclass, client_cycle,
|
||||||
|
(CWM_CYCLE_FORWARD | CWM_CYCLE_INCLASS)) },
|
||||||
|
{ FUNC_SC(window-rcycle-inclass, client_cycle,
|
||||||
|
(CWM_CYCLE_REVERSE | CWM_CYCLE_INCLASS)) },
|
||||||
|
|
||||||
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
|
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
|
||||||
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
|
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
|
||||||
|
{ FUNC_SC(group-last, group_last, 0) },
|
||||||
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
|
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
|
||||||
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
|
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
|
||||||
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
|
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
|
||||||
@@ -219,6 +224,8 @@ static const struct {
|
|||||||
{ "C-slash", "menu-cmd" },
|
{ "C-slash", "menu-cmd" },
|
||||||
{ "M-Tab", "window-cycle" },
|
{ "M-Tab", "window-cycle" },
|
||||||
{ "MS-Tab", "window-rcycle" },
|
{ "MS-Tab", "window-rcycle" },
|
||||||
|
{ "M-grave", "window-cycle-inclass" },
|
||||||
|
{ "MS-grave", "window-rcycle-inclass" },
|
||||||
{ "CM-n", "window-menu-label" },
|
{ "CM-n", "window-menu-label" },
|
||||||
{ "CM-x", "window-close" },
|
{ "CM-x", "window-close" },
|
||||||
{ "CM-a", "group-toggle-all" },
|
{ "CM-a", "group-toggle-all" },
|
||||||
@@ -281,6 +288,9 @@ conf_init(struct conf *c)
|
|||||||
c->stickygroups = 0;
|
c->stickygroups = 0;
|
||||||
c->bwidth = 1;
|
c->bwidth = 1;
|
||||||
c->mamount = 1;
|
c->mamount = 1;
|
||||||
|
c->scalefactor = 10;
|
||||||
|
c->raiseonhover = 1;
|
||||||
|
c->raisedelay = 250;
|
||||||
c->htile = 50;
|
c->htile = 50;
|
||||||
c->vtile = 50;
|
c->vtile = 50;
|
||||||
c->snapdist = 0;
|
c->snapdist = 0;
|
||||||
@@ -669,6 +679,8 @@ conf_grab_kbd(Window win)
|
|||||||
|
|
||||||
TAILQ_FOREACH(kb, &Conf.keybindq, entry) {
|
TAILQ_FOREACH(kb, &Conf.keybindq, entry) {
|
||||||
kc = XKeysymToKeycode(X_Dpy, kb->press.keysym);
|
kc = XKeysymToKeycode(X_Dpy, kb->press.keysym);
|
||||||
|
if (kc == 0)
|
||||||
|
continue;
|
||||||
if ((XkbKeycodeToKeysym(X_Dpy, kc, 0, 0) != kb->press.keysym) &&
|
if ((XkbKeycodeToKeysym(X_Dpy, kc, 0, 0) != kb->press.keysym) &&
|
||||||
(XkbKeycodeToKeysym(X_Dpy, kc, 0, 1) == kb->press.keysym))
|
(XkbKeycodeToKeysym(X_Dpy, kc, 0, 1) == kb->press.keysym))
|
||||||
kb->modmask |= ShiftMask;
|
kb->modmask |= ShiftMask;
|
||||||
|
|||||||
4
cwm.1
4
cwm.1
@@ -102,6 +102,10 @@ Label current window.
|
|||||||
Cycle through currently visible windows.
|
Cycle through currently visible windows.
|
||||||
.It Ic MS-Tab
|
.It Ic MS-Tab
|
||||||
Reverse cycle through currently visible windows.
|
Reverse cycle through currently visible windows.
|
||||||
|
.It Ic M-grave
|
||||||
|
Cycle through currently visible windows of the same window class.
|
||||||
|
.It Ic MS-grave
|
||||||
|
Reverse cycle through currently visible windows of the same window class.
|
||||||
.It Ic CM-x
|
.It Ic CM-x
|
||||||
Close current window.
|
Close current window.
|
||||||
.It Ic CM-[n]
|
.It Ic CM-[n]
|
||||||
|
|||||||
6
cwmrc.5
6
cwmrc.5
@@ -273,6 +273,8 @@ menu.
|
|||||||
Toggle visibility of group n, where n is 1-9.
|
Toggle visibility of group n, where n is 1-9.
|
||||||
.It group-only-[n]
|
.It group-only-[n]
|
||||||
Show only group n, where n is 1-9, hiding other groups.
|
Show only group n, where n is 1-9, hiding other groups.
|
||||||
|
.It group-last
|
||||||
|
Show only the previously active group.
|
||||||
.It group-close-[n]
|
.It group-close-[n]
|
||||||
Close all windows in group n, where n is 1-9.
|
Close all windows in group n, where n is 1-9.
|
||||||
.It group-toggle-all
|
.It group-toggle-all
|
||||||
@@ -293,6 +295,10 @@ Reverse cycle through windows.
|
|||||||
Forward cycle through windows in current group.
|
Forward cycle through windows in current group.
|
||||||
.It window-rcycle-ingroup
|
.It window-rcycle-ingroup
|
||||||
Reverse cycle through windows in current group.
|
Reverse cycle through windows in current group.
|
||||||
|
.It window-cycle-inclass
|
||||||
|
Forward cycle through windows of the current window class.
|
||||||
|
.It window-rcycle-inclass
|
||||||
|
Reverse cycle through windows of the current window class.
|
||||||
.It window-close
|
.It window-close
|
||||||
Close current window.
|
Close current window.
|
||||||
.It window-hide
|
.It window-hide
|
||||||
|
|||||||
3
group.c
3
group.c
@@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int idx)
|
|||||||
{
|
{
|
||||||
struct group_ctx *gc;
|
struct group_ctx *gc;
|
||||||
|
|
||||||
|
if (sc->group_last != sc->group_active)
|
||||||
|
sc->group_last = sc->group_active;
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
if (gc->num == idx)
|
if (gc->num == idx)
|
||||||
group_show(gc);
|
group_show(gc);
|
||||||
|
|||||||
23
kbfunc.c
23
kbfunc.c
@@ -57,7 +57,7 @@ kbfunc_cwm_status(void *ctx, struct cargs *cargs)
|
|||||||
static void
|
static void
|
||||||
kbfunc_amount(int flags, int amt, int *mx, int *my)
|
kbfunc_amount(int flags, int amt, int *mx, int *my)
|
||||||
{
|
{
|
||||||
#define CWM_FACTOR 10
|
#define CWM_FACTOR Conf.scalefactor
|
||||||
|
|
||||||
if (flags & CWM_BIGAMOUNT)
|
if (flags & CWM_BIGAMOUNT)
|
||||||
amt *= CWM_FACTOR;
|
amt *= CWM_FACTOR;
|
||||||
@@ -433,7 +433,9 @@ kbfunc_client_cycle(void *ctx, struct cargs *cargs)
|
|||||||
/* Only cycle visible and non-ignored windows. */
|
/* Only cycle visible and non-ignored windows. */
|
||||||
if ((newcc->flags & (CLIENT_SKIP_CYCLE)) ||
|
if ((newcc->flags & (CLIENT_SKIP_CYCLE)) ||
|
||||||
((flags & CWM_CYCLE_INGROUP) &&
|
((flags & CWM_CYCLE_INGROUP) &&
|
||||||
(newcc->gc != oldcc->gc)))
|
(newcc->gc != oldcc->gc)) ||
|
||||||
|
((flags & CWM_CYCLE_INCLASS) &&
|
||||||
|
strcmp(newcc->res_class, oldcc->res_class) != 0))
|
||||||
again = 1;
|
again = 1;
|
||||||
|
|
||||||
/* Is oldcc the only non-hidden window? */
|
/* Is oldcc the only non-hidden window? */
|
||||||
@@ -453,7 +455,16 @@ kbfunc_client_cycle(void *ctx, struct cargs *cargs)
|
|||||||
newcc->ptr.x = newcc->geom.w / 2;
|
newcc->ptr.x = newcc->geom.w / 2;
|
||||||
newcc->ptr.y = newcc->geom.h / 2;
|
newcc->ptr.y = newcc->geom.h / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When no client is active, warp pointer to last active. */
|
||||||
|
if (oldcc->flags & (CLIENT_ACTIVE))
|
||||||
client_ptr_warp(newcc);
|
client_ptr_warp(newcc);
|
||||||
|
else if (oldcc->flags & (CLIENT_SKIP_CYCLE))
|
||||||
|
client_ptr_warp(newcc);
|
||||||
|
else {
|
||||||
|
client_raise(oldcc);
|
||||||
|
client_ptr_warp(oldcc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -481,6 +492,14 @@ kbfunc_group_only(void *ctx, struct cargs *cargs)
|
|||||||
group_only(ctx, cargs->flag);
|
group_only(ctx, cargs->flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
kbfunc_group_last(void *ctx, struct cargs *cargs)
|
||||||
|
{
|
||||||
|
struct screen_ctx *sc = ctx;
|
||||||
|
|
||||||
|
group_only(ctx, sc->group_last->num);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kbfunc_group_toggle(void *ctx, struct cargs *cargs)
|
kbfunc_group_toggle(void *ctx, struct cargs *cargs)
|
||||||
{
|
{
|
||||||
|
|||||||
25
menu.c
25
menu.c
@@ -355,7 +355,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
|
|||||||
XftTextExtentsUtf8(X_Dpy, sc->xftfont,
|
XftTextExtentsUtf8(X_Dpy, sc->xftfont,
|
||||||
(const FcChar8*)mc->dispstr, strlen(mc->dispstr), &extents);
|
(const FcChar8*)mc->dispstr, strlen(mc->dispstr), &extents);
|
||||||
mc->geom.w = extents.xOff;
|
mc->geom.w = extents.xOff;
|
||||||
mc->geom.h = sc->xftfont->height + 1;
|
mc->geom.h = sc->xftfont->ascent + sc->xftfont->descent;
|
||||||
mc->num = 1;
|
mc->num = 1;
|
||||||
|
|
||||||
TAILQ_FOREACH(mi, resultq, resultentry) {
|
TAILQ_FOREACH(mi, resultq, resultentry) {
|
||||||
@@ -364,7 +364,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
|
|||||||
(const FcChar8*)mi->print,
|
(const FcChar8*)mi->print,
|
||||||
MIN(strlen(mi->print), MENU_MAXENTRY), &extents);
|
MIN(strlen(mi->print), MENU_MAXENTRY), &extents);
|
||||||
mc->geom.w = MAX(mc->geom.w, extents.xOff);
|
mc->geom.w = MAX(mc->geom.w, extents.xOff);
|
||||||
mc->geom.h += sc->xftfont->height + 1;
|
mc->geom.h += sc->xftfont->ascent + sc->xftfont->descent;
|
||||||
mc->num++;
|
mc->num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,15 +403,15 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
|
|||||||
(const FcChar8*)mc->dispstr, strlen(mc->dispstr));
|
(const FcChar8*)mc->dispstr, strlen(mc->dispstr));
|
||||||
|
|
||||||
TAILQ_FOREACH(mi, resultq, resultentry) {
|
TAILQ_FOREACH(mi, resultq, resultentry) {
|
||||||
int y = n * (sc->xftfont->height + 1) + sc->xftfont->ascent + 1;
|
int y = n * (sc->xftfont->ascent + sc->xftfont->descent);
|
||||||
|
|
||||||
/* Stop drawing when menu doesn't fit inside the screen. */
|
/* Stop drawing when menu doesn't fit inside the screen. */
|
||||||
if (mc->geom.y + y > area.h)
|
if (mc->geom.y + y >= area.h)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
XftDrawStringUtf8(mc->xftdraw,
|
XftDrawStringUtf8(mc->xftdraw,
|
||||||
&sc->xftcolor[CWM_COLOR_MENU_FONT], sc->xftfont,
|
&sc->xftcolor[CWM_COLOR_MENU_FONT], sc->xftfont,
|
||||||
0, y,
|
0, y + sc->xftfont->ascent,
|
||||||
(const FcChar8*)mi->print, strlen(mi->print));
|
(const FcChar8*)mi->print, strlen(mi->print));
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
@@ -425,7 +425,7 @@ menu_draw_entry(struct menu_ctx *mc, struct menu_q *resultq,
|
|||||||
{
|
{
|
||||||
struct screen_ctx *sc = mc->sc;
|
struct screen_ctx *sc = mc->sc;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
int color, i = 1;
|
int color, i = 1, y;
|
||||||
|
|
||||||
TAILQ_FOREACH(mi, resultq, resultentry)
|
TAILQ_FOREACH(mi, resultq, resultentry)
|
||||||
if (entry == i++)
|
if (entry == i++)
|
||||||
@@ -433,14 +433,13 @@ menu_draw_entry(struct menu_ctx *mc, struct menu_q *resultq,
|
|||||||
if (mi == NULL)
|
if (mi == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
y = entry * (sc->xftfont->ascent + sc->xftfont->descent);
|
||||||
color = (active) ? CWM_COLOR_MENU_FG : CWM_COLOR_MENU_BG;
|
color = (active) ? CWM_COLOR_MENU_FG : CWM_COLOR_MENU_BG;
|
||||||
XftDrawRect(mc->xftdraw, &sc->xftcolor[color], 0,
|
XftDrawRect(mc->xftdraw, &sc->xftcolor[color], 0, y,
|
||||||
(sc->xftfont->height + 1) * entry, mc->geom.w,
|
mc->geom.w, sc->xftfont->ascent + sc->xftfont->descent);
|
||||||
(sc->xftfont->height + 1) + sc->xftfont->descent);
|
|
||||||
color = (active) ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT;
|
color = (active) ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT;
|
||||||
XftDrawStringUtf8(mc->xftdraw,
|
XftDrawStringUtf8(mc->xftdraw,
|
||||||
&sc->xftcolor[color], sc->xftfont,
|
&sc->xftcolor[color], sc->xftfont, 0, y + sc->xftfont->ascent,
|
||||||
0, (sc->xftfont->height + 1) * entry + sc->xftfont->ascent + 1,
|
|
||||||
(const FcChar8*)mi->print, strlen(mi->print));
|
(const FcChar8*)mi->print, strlen(mi->print));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,11 +486,11 @@ menu_calc_entry(struct menu_ctx *mc, int x, int y)
|
|||||||
struct screen_ctx *sc = mc->sc;
|
struct screen_ctx *sc = mc->sc;
|
||||||
int entry;
|
int entry;
|
||||||
|
|
||||||
entry = y / (sc->xftfont->height + 1);
|
entry = y / (sc->xftfont->ascent + sc->xftfont->descent);
|
||||||
|
|
||||||
/* in bounds? */
|
/* in bounds? */
|
||||||
if (x < 0 || x > mc->geom.w || y < 0 ||
|
if (x < 0 || x > mc->geom.w || y < 0 ||
|
||||||
y > (sc->xftfont->height + 1) * mc->num ||
|
y > (sc->xftfont->ascent + sc->xftfont->descent) * mc->num ||
|
||||||
entry < 0 || entry >= mc->num)
|
entry < 0 || entry >= mc->num)
|
||||||
entry = -1;
|
entry = -1;
|
||||||
|
|
||||||
|
|||||||
65
parse.y
65
parse.y
@@ -71,9 +71,9 @@ typedef struct {
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%token BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE
|
%token BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE
|
||||||
%token FONTNAME STICKY GAP
|
%token FONTNAME STICKY RAISEONHOVER RAISEONHOVERDELAY GAP
|
||||||
%token AUTOGROUP COMMAND IGNORE WM
|
%token AUTOGROUP COMMAND IGNORE WM
|
||||||
%token YES NO BORDERWIDTH MOVEAMOUNT HTILE VTILE
|
%token YES NO BORDERWIDTH MOVEAMOUNT SCALEFACTOR HTILE VTILE
|
||||||
%token COLOR SNAPDIST
|
%token COLOR SNAPDIST
|
||||||
%token ACTIVEBORDER INACTIVEBORDER URGENCYBORDER
|
%token ACTIVEBORDER INACTIVEBORDER URGENCYBORDER
|
||||||
%token GROUPBORDER UNGROUPBORDER
|
%token GROUPBORDER UNGROUPBORDER
|
||||||
@@ -83,7 +83,7 @@ typedef struct {
|
|||||||
%token <v.string> STRING
|
%token <v.string> STRING
|
||||||
%token <v.number> NUMBER
|
%token <v.number> NUMBER
|
||||||
%type <v.number> yesno
|
%type <v.number> yesno
|
||||||
%type <v.string> string
|
%type <v.string> string numberstring
|
||||||
%%
|
%%
|
||||||
|
|
||||||
grammar : /* empty */
|
grammar : /* empty */
|
||||||
@@ -106,6 +106,17 @@ string : string STRING {
|
|||||||
| STRING
|
| STRING
|
||||||
;
|
;
|
||||||
|
|
||||||
|
numberstring : NUMBER {
|
||||||
|
char *s;
|
||||||
|
if (asprintf(&s, "%lld", $1) == -1) {
|
||||||
|
yyerror("string: asprintf");
|
||||||
|
YYERROR;
|
||||||
|
}
|
||||||
|
$$ = s;
|
||||||
|
}
|
||||||
|
| STRING
|
||||||
|
;
|
||||||
|
|
||||||
yesno : YES { $$ = 1; }
|
yesno : YES { $$ = 1; }
|
||||||
| NO { $$ = 0; }
|
| NO { $$ = 0; }
|
||||||
;
|
;
|
||||||
@@ -117,6 +128,16 @@ main : FONTNAME STRING {
|
|||||||
| STICKY yesno {
|
| STICKY yesno {
|
||||||
conf->stickygroups = $2;
|
conf->stickygroups = $2;
|
||||||
}
|
}
|
||||||
|
| RAISEONHOVER yesno {
|
||||||
|
conf->raiseonhover = $2;
|
||||||
|
}
|
||||||
|
| RAISEONHOVERDELAY NUMBER {
|
||||||
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
|
yyerror("invalid delay");
|
||||||
|
YYERROR;
|
||||||
|
}
|
||||||
|
conf->raisedelay = $2;
|
||||||
|
}
|
||||||
| BORDERWIDTH NUMBER {
|
| BORDERWIDTH NUMBER {
|
||||||
if ($2 < 0 || $2 > INT_MAX) {
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
yyerror("invalid borderwidth");
|
yyerror("invalid borderwidth");
|
||||||
@@ -145,6 +166,13 @@ main : FONTNAME STRING {
|
|||||||
}
|
}
|
||||||
conf->mamount = $2;
|
conf->mamount = $2;
|
||||||
}
|
}
|
||||||
|
| SCALEFACTOR NUMBER {
|
||||||
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
|
yyerror("invalid scalefactor");
|
||||||
|
YYERROR;
|
||||||
|
}
|
||||||
|
conf->scalefactor = $2;
|
||||||
|
}
|
||||||
| SNAPDIST NUMBER {
|
| SNAPDIST NUMBER {
|
||||||
if ($2 < 0 || $2 > INT_MAX) {
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
yyerror("invalid snapdist");
|
yyerror("invalid snapdist");
|
||||||
@@ -211,7 +239,7 @@ main : FONTNAME STRING {
|
|||||||
conf->gap.left = $4;
|
conf->gap.left = $4;
|
||||||
conf->gap.right = $5;
|
conf->gap.right = $5;
|
||||||
}
|
}
|
||||||
| BINDKEY STRING string {
|
| BINDKEY numberstring string {
|
||||||
if (!conf_bind_key(conf, $2, $3)) {
|
if (!conf_bind_key(conf, $2, $3)) {
|
||||||
yyerror("invalid bind-key: %s %s", $2, $3);
|
yyerror("invalid bind-key: %s %s", $2, $3);
|
||||||
free($2);
|
free($2);
|
||||||
@@ -221,7 +249,7 @@ main : FONTNAME STRING {
|
|||||||
free($2);
|
free($2);
|
||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| UNBINDKEY STRING {
|
| UNBINDKEY numberstring {
|
||||||
if (!conf_bind_key(conf, $2, NULL)) {
|
if (!conf_bind_key(conf, $2, NULL)) {
|
||||||
yyerror("invalid unbind-key: %s", $2);
|
yyerror("invalid unbind-key: %s", $2);
|
||||||
free($2);
|
free($2);
|
||||||
@@ -229,7 +257,7 @@ main : FONTNAME STRING {
|
|||||||
}
|
}
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| BINDMOUSE STRING string {
|
| BINDMOUSE numberstring string {
|
||||||
if (!conf_bind_mouse(conf, $2, $3)) {
|
if (!conf_bind_mouse(conf, $2, $3)) {
|
||||||
yyerror("invalid bind-mouse: %s %s", $2, $3);
|
yyerror("invalid bind-mouse: %s %s", $2, $3);
|
||||||
free($2);
|
free($2);
|
||||||
@@ -239,7 +267,7 @@ main : FONTNAME STRING {
|
|||||||
free($2);
|
free($2);
|
||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| UNBINDMOUSE STRING {
|
| UNBINDMOUSE numberstring {
|
||||||
if (!conf_bind_mouse(conf, $2, NULL)) {
|
if (!conf_bind_mouse(conf, $2, NULL)) {
|
||||||
yyerror("invalid unbind-mouse: %s", $2);
|
yyerror("invalid unbind-mouse: %s", $2);
|
||||||
free($2);
|
free($2);
|
||||||
@@ -339,6 +367,9 @@ lookup(char *s)
|
|||||||
{ "menufg", MENUFG},
|
{ "menufg", MENUFG},
|
||||||
{ "moveamount", MOVEAMOUNT},
|
{ "moveamount", MOVEAMOUNT},
|
||||||
{ "no", NO},
|
{ "no", NO},
|
||||||
|
{ "raise-delay", RAISEONHOVERDELAY},
|
||||||
|
{ "raise-on-hover", RAISEONHOVER},
|
||||||
|
{ "scalefactor", SCALEFACTOR},
|
||||||
{ "selfont", FONTSELCOLOR},
|
{ "selfont", FONTSELCOLOR},
|
||||||
{ "snapdist", SNAPDIST},
|
{ "snapdist", SNAPDIST},
|
||||||
{ "sticky", STICKY},
|
{ "sticky", STICKY},
|
||||||
@@ -376,7 +407,7 @@ lgetc(int quotec)
|
|||||||
if (parsebuf) {
|
if (parsebuf) {
|
||||||
/* Read character from the parsebuffer instead of input. */
|
/* Read character from the parsebuffer instead of input. */
|
||||||
if (parseindex >= 0) {
|
if (parseindex >= 0) {
|
||||||
c = parsebuf[parseindex++];
|
c = (unsigned char)parsebuf[parseindex++];
|
||||||
if (c != '\0')
|
if (c != '\0')
|
||||||
return (c);
|
return (c);
|
||||||
parsebuf = NULL;
|
parsebuf = NULL;
|
||||||
@@ -385,7 +416,7 @@ lgetc(int quotec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pushback_index)
|
if (pushback_index)
|
||||||
return (pushback_buffer[--pushback_index]);
|
return ((unsigned char)pushback_buffer[--pushback_index]);
|
||||||
|
|
||||||
if (quotec) {
|
if (quotec) {
|
||||||
if ((c = getc(file->stream)) == EOF) {
|
if ((c = getc(file->stream)) == EOF) {
|
||||||
@@ -426,10 +457,10 @@ lungetc(int c)
|
|||||||
if (parseindex >= 0)
|
if (parseindex >= 0)
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
if (pushback_index < MAXPUSHBACK-1)
|
if (pushback_index + 1 >= MAXPUSHBACK)
|
||||||
return (pushback_buffer[pushback_index++] = c);
|
|
||||||
else
|
|
||||||
return (EOF);
|
return (EOF);
|
||||||
|
pushback_buffer[pushback_index++] = c;
|
||||||
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -442,7 +473,7 @@ findeol(void)
|
|||||||
/* skip to either EOF or the first real EOL */
|
/* skip to either EOF or the first real EOL */
|
||||||
while (1) {
|
while (1) {
|
||||||
if (pushback_index)
|
if (pushback_index)
|
||||||
c = pushback_buffer[--pushback_index];
|
c = (unsigned char)pushback_buffer[--pushback_index];
|
||||||
else
|
else
|
||||||
c = lgetc(0);
|
c = lgetc(0);
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
@@ -516,7 +547,7 @@ yylex(void)
|
|||||||
if (c == '-' || isdigit(c)) {
|
if (c == '-' || isdigit(c)) {
|
||||||
do {
|
do {
|
||||||
*p++ = c;
|
*p++ = c;
|
||||||
if ((unsigned)(p-buf) >= sizeof(buf)) {
|
if ((size_t)(p-buf) >= sizeof(buf)) {
|
||||||
yyerror("string too long");
|
yyerror("string too long");
|
||||||
return (findeol());
|
return (findeol());
|
||||||
}
|
}
|
||||||
@@ -539,8 +570,8 @@ yylex(void)
|
|||||||
} else {
|
} else {
|
||||||
nodigits:
|
nodigits:
|
||||||
while (p > buf + 1)
|
while (p > buf + 1)
|
||||||
lungetc(*--p);
|
lungetc((unsigned char)*--p);
|
||||||
c = *--p;
|
c = (unsigned char)*--p;
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
@@ -555,7 +586,7 @@ nodigits:
|
|||||||
if (isalnum(c) || c == ':' || c == '_' || c == '*' || c == '/') {
|
if (isalnum(c) || c == ':' || c == '_' || c == '*' || c == '/') {
|
||||||
do {
|
do {
|
||||||
*p++ = c;
|
*p++ = c;
|
||||||
if ((unsigned)(p-buf) >= sizeof(buf)) {
|
if ((size_t)(p-buf) >= sizeof(buf)) {
|
||||||
yyerror("string too long");
|
yyerror("string too long");
|
||||||
return (findeol());
|
return (findeol());
|
||||||
}
|
}
|
||||||
|
|||||||
1
screen.c
1
screen.c
@@ -60,6 +60,7 @@ screen_init(int which)
|
|||||||
xu_ewmh_net_supported_wm_check(sc);
|
xu_ewmh_net_supported_wm_check(sc);
|
||||||
|
|
||||||
conf_group(sc);
|
conf_group(sc);
|
||||||
|
sc->group_last = sc->group_active;
|
||||||
screen_update_geometry(sc);
|
screen_update_geometry(sc);
|
||||||
|
|
||||||
xu_ewmh_net_desktop_names(sc);
|
xu_ewmh_net_desktop_names(sc);
|
||||||
|
|||||||
35
xevents.c
35
xevents.c
@@ -30,6 +30,7 @@
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -219,6 +220,31 @@ xev_handle_propertynotify(XEvent *ee)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void*
|
||||||
|
delay_raise(void* data)
|
||||||
|
{
|
||||||
|
struct client_ctx *cc;
|
||||||
|
Window *w = (Window*)data;
|
||||||
|
|
||||||
|
int delay = Conf.raisedelay * 1000;
|
||||||
|
usleep(delay);
|
||||||
|
if ((cc = client_find(*w)) != NULL) {
|
||||||
|
if (cc->flags & CLIENT_ACTIVE) {
|
||||||
|
client_raise(cc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(w);
|
||||||
|
|
||||||
|
XEvent e;
|
||||||
|
|
||||||
|
XNextEvent(X_Dpy, &e);
|
||||||
|
if ((e.type - Conf.xrandr_event_base) == RRScreenChangeNotify)
|
||||||
|
xev_handle_randr(&e);
|
||||||
|
else if ((e.type < LASTEvent) && (xev_handlers[e.type] != NULL))
|
||||||
|
(*xev_handlers[e.type])(&e);
|
||||||
|
pthread_exit(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xev_handle_enternotify(XEvent *ee)
|
xev_handle_enternotify(XEvent *ee)
|
||||||
{
|
{
|
||||||
@@ -231,6 +257,15 @@ xev_handle_enternotify(XEvent *ee)
|
|||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL)
|
if ((cc = client_find(e->window)) != NULL)
|
||||||
client_set_active(cc);
|
client_set_active(cc);
|
||||||
|
|
||||||
|
if (Conf.raiseonhover) {
|
||||||
|
Window *w;
|
||||||
|
w = (Window*)malloc(sizeof(Window));
|
||||||
|
memcpy(w, &e->window, sizeof(Window));
|
||||||
|
|
||||||
|
pthread_t thread_id;
|
||||||
|
pthread_create(&thread_id, NULL, delay_raise, w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user