~charles/cwm

6186b9596d7eafbcbabee21c9bfc4aa8cb68197d — Charles Daniels 1 year, 15 days ago fd94b4f
integrate window-center patch
5 files changed, 39 insertions(+), 0 deletions(-)

M README
M calmwm.h
M client.c
M conf.c
M kbfunc.c
M README => README +4 -0
@@ 24,6 24,10 @@ Changes from the upstream include:
* Fix a bug where qt would not allow the mouse to be moved out of modal
  dialog, patch curtsy of Okan Demirmen.

* [This patch](https://marc.info/?t=155668385900001&r=1&w=2) which was not
  accepted to the upstream. This adds a "window center" function which brings
  the active window to the center of the screen.

The original README distributed with chneukirchen/cwm is maintained below:

This is a port of OpenBSD's excellent cwm[0] to Linux and other

M calmwm.h => calmwm.h +2 -0
@@ 422,6 422,7 @@ void			 client_applysizehints(struct client_ctx *);
void			 client_config(struct client_ctx *);
struct client_ctx	*client_current(void);
void			 client_cycle(struct screen_ctx *, int);
void			 client_center(struct client_ctx *);
void			 client_delete(struct client_ctx *);
void			 client_draw_border(struct client_ctx *);
struct client_ctx	*client_find(Window);


@@ 509,6 510,7 @@ void			 screen_assert_clients_within(struct screen_ctx *);
void			 kbfunc_cwm_status(void *, struct cargs *);
void			 kbfunc_ptrmove(void *, struct cargs *);
void			 kbfunc_client_snap(void *, struct cargs *);
void			 kbfunc_client_center(void *, struct cargs *);
void			 kbfunc_client_move(void *, struct cargs *);
void			 kbfunc_client_resize(void *, struct cargs *);
void			 kbfunc_client_delete(void *, struct cargs *);

M client.c => client.c +25 -0
@@ 644,6 644,31 @@ client_send_delete(struct client_ctx *cc)
		XKillClient(X_Dpy, cc->win);
}


void
client_center(struct client_ctx *cc)
{

	struct screen_ctx	*sc = cc->sc;
	struct geom		 area;

	if (cc->flags & CLIENT_FREEZE)
		return;

	area = screen_area(sc,
	    cc->geom.x + cc->geom.w / 2,
	    cc->geom.y + cc->geom.h / 2, CWM_GAP);

	cc->geom.x = area.x + area.w * 0.25;
	cc->geom.y = area.y + area.h * 0.25;
	client_applysizehints(cc);
	client_resize(cc, 1);

	/* Make sure the pointer stays within the window. */
	client_ptr_inbound(cc, 0);
}


void
client_setname(struct client_ctx *cc)
{

M conf.c => conf.c +2 -0
@@ 95,6 95,7 @@ static const struct {
	{ FUNC_CC(window-snap-up-left, client_snap, (CWM_UP_LEFT)) },
	{ FUNC_CC(window-snap-down-right, client_snap, (CWM_DOWN_RIGHT)) },
	{ FUNC_CC(window-snap-down-left, client_snap, (CWM_DOWN_LEFT)) },
	{ FUNC_CC(window-center, client_center, 0) },
	{ FUNC_CC(window-move, client_move, 0) },
	{ FUNC_CC(window-move-up, client_move, (CWM_UP)) },
	{ FUNC_CC(window-move-down, client_move, (CWM_DOWN)) },


@@ 234,6 235,7 @@ static const struct {
	{ "CMS-j",	"window-resize-down-big" },
	{ "CMS-k",	"window-resize-up-big" },
	{ "CMS-l",	"window-resize-right-big" },
	{ "MS-space",	"window-center" },
},
mouse_binds[] = {
	{ "1",		"menu-window" },

M kbfunc.c => kbfunc.c +6 -0
@@ 298,6 298,12 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
}

void
kbfunc_client_center (void *ctx, struct cargs *cargs)
{
	client_center(ctx);
}

void
kbfunc_client_snap(void *ctx, struct cargs *cargs)
{
	struct client_ctx	*cc = ctx;