cvsimport
This commit is contained in:
32
calmwm.h
32
calmwm.h
@@ -259,7 +259,6 @@ struct keybinding {
|
|||||||
union arg argument;
|
union arg argument;
|
||||||
u_int modmask;
|
u_int modmask;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
int keycode;
|
|
||||||
#define KBFLAG_NEEDCLIENT 0x0001
|
#define KBFLAG_NEEDCLIENT 0x0001
|
||||||
int flags;
|
int flags;
|
||||||
int argtype;
|
int argtype;
|
||||||
@@ -268,7 +267,8 @@ TAILQ_HEAD(keybinding_q, keybinding);
|
|||||||
|
|
||||||
struct mousebinding {
|
struct mousebinding {
|
||||||
TAILQ_ENTRY(mousebinding) entry;
|
TAILQ_ENTRY(mousebinding) entry;
|
||||||
void (*callback)(struct client_ctx *, void *);
|
void (*callback)(struct client_ctx *, union arg *);
|
||||||
|
union arg argument;
|
||||||
u_int modmask;
|
u_int modmask;
|
||||||
u_int button;
|
u_int button;
|
||||||
#define MOUSEBIND_CTX_ROOT 0x0001
|
#define MOUSEBIND_CTX_ROOT 0x0001
|
||||||
@@ -496,19 +496,25 @@ void kbfunc_term(struct client_ctx *, union arg *);
|
|||||||
void kbfunc_tile(struct client_ctx *, union arg *);
|
void kbfunc_tile(struct client_ctx *, union arg *);
|
||||||
|
|
||||||
void mousefunc_client_cyclegroup(struct client_ctx *,
|
void mousefunc_client_cyclegroup(struct client_ctx *,
|
||||||
void *);
|
union arg *);
|
||||||
void mousefunc_client_grouptoggle(struct client_ctx *,
|
void mousefunc_client_grouptoggle(struct client_ctx *,
|
||||||
void *);
|
union arg *);
|
||||||
void mousefunc_client_hide(struct client_ctx *, void *);
|
void mousefunc_client_hide(struct client_ctx *,
|
||||||
void mousefunc_client_lower(struct client_ctx *, void *);
|
union arg *);
|
||||||
void mousefunc_client_move(struct client_ctx *, void *);
|
void mousefunc_client_lower(struct client_ctx *,
|
||||||
void mousefunc_client_raise(struct client_ctx *, void *);
|
union arg *);
|
||||||
|
void mousefunc_client_move(struct client_ctx *,
|
||||||
|
union arg *);
|
||||||
|
void mousefunc_client_raise(struct client_ctx *,
|
||||||
|
union arg *);
|
||||||
void mousefunc_client_rcyclegroup(struct client_ctx *,
|
void mousefunc_client_rcyclegroup(struct client_ctx *,
|
||||||
void *);
|
union arg *);
|
||||||
void mousefunc_client_resize(struct client_ctx *, void *);
|
void mousefunc_client_resize(struct client_ctx *,
|
||||||
void mousefunc_menu_cmd(struct client_ctx *, void *);
|
union arg *);
|
||||||
void mousefunc_menu_group(struct client_ctx *, void *);
|
void mousefunc_menu_cmd(struct client_ctx *, union arg *);
|
||||||
void mousefunc_menu_unhide(struct client_ctx *, void *);
|
void mousefunc_menu_group(struct client_ctx *, union arg *);
|
||||||
|
void mousefunc_menu_unhide(struct client_ctx *,
|
||||||
|
union arg *);
|
||||||
|
|
||||||
struct menu *menu_filter(struct screen_ctx *, struct menu_q *,
|
struct menu *menu_filter(struct screen_ctx *, struct menu_q *,
|
||||||
char *, char *, int,
|
char *, char *, int,
|
||||||
|
|||||||
13
client.c
13
client.c
@@ -40,7 +40,7 @@ static void client_wm_protocols(struct client_ctx *);
|
|||||||
static void client_mwm_hints(struct client_ctx *);
|
static void client_mwm_hints(struct client_ctx *);
|
||||||
static int client_inbound(struct client_ctx *, int, int);
|
static int client_inbound(struct client_ctx *, int, int);
|
||||||
|
|
||||||
struct client_ctx *_curcc = NULL;
|
struct client_ctx *curcc = NULL;
|
||||||
|
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
client_find(Window win)
|
client_find(Window win)
|
||||||
@@ -59,7 +59,7 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
int state;
|
long state;
|
||||||
|
|
||||||
if (win == None)
|
if (win == None)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -192,7 +192,7 @@ client_setactive(struct client_ctx *cc)
|
|||||||
if (!sc->cycling)
|
if (!sc->cycling)
|
||||||
client_mtf(cc);
|
client_mtf(cc);
|
||||||
|
|
||||||
_curcc = cc;
|
curcc = cc;
|
||||||
cc->active = 1;
|
cc->active = 1;
|
||||||
cc->flags &= ~CLIENT_URGENCY;
|
cc->flags &= ~CLIENT_URGENCY;
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
@@ -210,13 +210,13 @@ client_none(struct screen_ctx *sc)
|
|||||||
|
|
||||||
xu_ewmh_net_active_window(sc, none);
|
xu_ewmh_net_active_window(sc, none);
|
||||||
|
|
||||||
_curcc = NULL;
|
curcc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
client_current(void)
|
client_current(void)
|
||||||
{
|
{
|
||||||
return (_curcc);
|
return (curcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -832,6 +832,9 @@ client_applysizehints(struct client_ctx *cc)
|
|||||||
cc->geom.w = MIN(cc->geom.w, cc->hint.maxw);
|
cc->geom.w = MIN(cc->geom.w, cc->hint.maxw);
|
||||||
if (cc->hint.maxh)
|
if (cc->hint.maxh)
|
||||||
cc->geom.h = MIN(cc->geom.h, cc->hint.maxh);
|
cc->geom.h = MIN(cc->geom.h, cc->hint.maxh);
|
||||||
|
|
||||||
|
cc->geom.w = MAX(cc->geom.w, 1);
|
||||||
|
cc->geom.h = MAX(cc->geom.h, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
31
conf.c
31
conf.c
@@ -535,22 +535,24 @@ conf_unbind_kbd(struct conf *c, struct keybinding *unbind)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
char *tag;
|
char *tag;
|
||||||
void (*handler)(struct client_ctx *, void *);
|
void (*handler)(struct client_ctx *, union arg *);
|
||||||
int flags;
|
int flags;
|
||||||
|
union arg argument;
|
||||||
} name_to_mousefunc[] = {
|
} name_to_mousefunc[] = {
|
||||||
{ "window_move", mousefunc_client_move, MOUSEBIND_CTX_WIN },
|
{ "window_move", mousefunc_client_move, MOUSEBIND_CTX_WIN, {0} },
|
||||||
{ "window_resize", mousefunc_client_resize, MOUSEBIND_CTX_WIN },
|
{ "window_resize", mousefunc_client_resize, MOUSEBIND_CTX_WIN, {0} },
|
||||||
{ "window_grouptoggle", mousefunc_client_grouptoggle,
|
{ "window_grouptoggle", mousefunc_client_grouptoggle,
|
||||||
MOUSEBIND_CTX_WIN },
|
MOUSEBIND_CTX_WIN, {0} },
|
||||||
{ "window_lower", mousefunc_client_lower, MOUSEBIND_CTX_WIN },
|
{ "window_lower", mousefunc_client_lower, MOUSEBIND_CTX_WIN, {0} },
|
||||||
{ "window_raise", mousefunc_client_raise, MOUSEBIND_CTX_WIN },
|
{ "window_raise", mousefunc_client_raise, MOUSEBIND_CTX_WIN, {0} },
|
||||||
{ "window_hide", mousefunc_client_hide, MOUSEBIND_CTX_WIN },
|
{ "window_hide", mousefunc_client_hide, MOUSEBIND_CTX_WIN, {0} },
|
||||||
{ "cyclegroup", mousefunc_client_cyclegroup, MOUSEBIND_CTX_ROOT },
|
{ "cyclegroup", mousefunc_client_cyclegroup, MOUSEBIND_CTX_ROOT, {0} },
|
||||||
{ "rcyclegroup", mousefunc_client_rcyclegroup, MOUSEBIND_CTX_ROOT },
|
{ "rcyclegroup", mousefunc_client_rcyclegroup,
|
||||||
{ "menu_group", mousefunc_menu_group, MOUSEBIND_CTX_ROOT },
|
MOUSEBIND_CTX_ROOT, {0} },
|
||||||
{ "menu_unhide", mousefunc_menu_unhide, MOUSEBIND_CTX_ROOT },
|
{ "menu_group", mousefunc_menu_group, MOUSEBIND_CTX_ROOT, {0} },
|
||||||
{ "menu_cmd", mousefunc_menu_cmd, MOUSEBIND_CTX_ROOT },
|
{ "menu_unhide", mousefunc_menu_unhide, MOUSEBIND_CTX_ROOT, {0} },
|
||||||
|
{ "menu_cmd", mousefunc_menu_cmd, MOUSEBIND_CTX_ROOT, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned int mouse_btns[] = {
|
static unsigned int mouse_btns[] = {
|
||||||
@@ -597,6 +599,7 @@ conf_bind_mouse(struct conf *c, char *name, char *binding)
|
|||||||
|
|
||||||
current_binding->callback = name_to_mousefunc[i].handler;
|
current_binding->callback = name_to_mousefunc[i].handler;
|
||||||
current_binding->flags = name_to_mousefunc[i].flags;
|
current_binding->flags = name_to_mousefunc[i].flags;
|
||||||
|
current_binding->argument = name_to_mousefunc[i].argument;
|
||||||
TAILQ_INSERT_TAIL(&c->mousebindingq, current_binding, entry);
|
TAILQ_INSERT_TAIL(&c->mousebindingq, current_binding, entry);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|||||||
4
menu.c
4
menu.c
@@ -392,13 +392,13 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
|
|||||||
mc->x = xine.w - mc->width;
|
mc->x = xine.w - mc->width;
|
||||||
if (mc->x < xine.x) {
|
if (mc->x < xine.x) {
|
||||||
mc->x = xine.x;
|
mc->x = xine.x;
|
||||||
mc->width = xine.w - xine.x;
|
mc->width = MIN(mc->width, (xine.w - xine.x));
|
||||||
}
|
}
|
||||||
if (mc->y + mc->height >= xine.h)
|
if (mc->y + mc->height >= xine.h)
|
||||||
mc->y = xine.h - mc->height;
|
mc->y = xine.h - mc->height;
|
||||||
if (mc->y < xine.y) {
|
if (mc->y < xine.y) {
|
||||||
mc->y = xine.y;
|
mc->y = xine.y;
|
||||||
mc->height = xine.h - xine.y;
|
mc->height = MIN(mc->height, (xine.h - xine.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc->x != xsave || mc->y != ysave)
|
if (mc->x != xsave || mc->y != ysave)
|
||||||
|
|||||||
22
mousefunc.c
22
mousefunc.c
@@ -66,7 +66,7 @@ mousefunc_sweep_draw(struct client_ctx *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_resize(struct client_ctx *cc, void *arg)
|
mousefunc_client_resize(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
Time ltime = 0;
|
Time ltime = 0;
|
||||||
@@ -120,7 +120,7 @@ mousefunc_client_resize(struct client_ctx *cc, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_move(struct client_ctx *cc, void *arg)
|
mousefunc_client_move(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
Time ltime = 0;
|
Time ltime = 0;
|
||||||
@@ -173,50 +173,50 @@ mousefunc_client_move(struct client_ctx *cc, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_grouptoggle(struct client_ctx *cc, void *arg)
|
mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
group_sticky_toggle_enter(cc);
|
group_sticky_toggle_enter(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_lower(struct client_ctx *cc, void *arg)
|
mousefunc_client_lower(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
client_ptrsave(cc);
|
client_ptrsave(cc);
|
||||||
client_lower(cc);
|
client_lower(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_raise(struct client_ctx *cc, void *arg)
|
mousefunc_client_raise(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
client_raise(cc);
|
client_raise(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_hide(struct client_ctx *cc, void *arg)
|
mousefunc_client_hide(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
client_hide(cc);
|
client_hide(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_cyclegroup(struct client_ctx *cc, void *arg)
|
mousefunc_client_cyclegroup(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
group_cycle(cc->sc, CWM_CYCLE);
|
group_cycle(cc->sc, CWM_CYCLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_client_rcyclegroup(struct client_ctx *cc, void *arg)
|
mousefunc_client_rcyclegroup(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
group_cycle(cc->sc, CWM_RCYCLE);
|
group_cycle(cc->sc, CWM_RCYCLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_menu_group(struct client_ctx *cc, void *arg)
|
mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
group_menu(cc->sc);
|
group_menu(cc->sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct client_ctx *old_cc;
|
struct client_ctx *old_cc;
|
||||||
@@ -258,7 +258,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
|
mousefunc_menu_cmd(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
|
|||||||
14
xevents.c
14
xevents.c
@@ -246,7 +246,7 @@ xev_handle_buttonpress(XEvent *ee)
|
|||||||
cc->sc = screen_fromroot(e->window);
|
cc->sc = screen_fromroot(e->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*mb->callback)(cc, e);
|
(*mb->callback)(cc, &mb->argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -326,8 +326,11 @@ xev_handle_clientmessage(XEvent *ee)
|
|||||||
{
|
{
|
||||||
XClientMessageEvent *e = &ee->xclient;
|
XClientMessageEvent *e = &ee->xclient;
|
||||||
struct client_ctx *cc, *old_cc;
|
struct client_ctx *cc, *old_cc;
|
||||||
|
struct screen_ctx *sc;
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) == NULL)
|
sc = screen_fromroot(e->window);
|
||||||
|
|
||||||
|
if ((cc = client_find(e->window)) == NULL && e->window != sc->rootwin)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (e->message_type == cwmh[WM_CHANGE_STATE] && e->format == 32 &&
|
if (e->message_type == cwmh[WM_CHANGE_STATE] && e->format == 32 &&
|
||||||
@@ -342,9 +345,16 @@ xev_handle_clientmessage(XEvent *ee)
|
|||||||
client_ptrsave(old_cc);
|
client_ptrsave(old_cc);
|
||||||
client_ptrwarp(cc);
|
client_ptrwarp(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e->message_type == ewmh[_NET_WM_DESKTOP] && e->format == 32)
|
||||||
|
group_movetogroup(cc, e->data.l[0]);
|
||||||
|
|
||||||
if (e->message_type == ewmh[_NET_WM_STATE] && e->format == 32)
|
if (e->message_type == ewmh[_NET_WM_STATE] && e->format == 32)
|
||||||
xu_ewmh_handle_net_wm_state_msg(cc,
|
xu_ewmh_handle_net_wm_state_msg(cc,
|
||||||
e->data.l[0], e->data.l[1], e->data.l[2]);
|
e->data.l[0], e->data.l[1], e->data.l[2]);
|
||||||
|
|
||||||
|
if (e->message_type == ewmh[_NET_CURRENT_DESKTOP] && e->format == 32)
|
||||||
|
group_only(sc, e->data.l[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user