On Thu, Aug 20, 2009 at 01:50:37PM +0200, Thomas Pfaff wrote:
> This diff adds a new command, hmaximize, that maximizes the current
> window horizontally.  I find it useful when lines displayed by
> commands are longer than my xterm; this way I can quickly maximize
> horizontally and get the whole picture without lines wrapping.
> 
> Comments?
> 
> Index: calmwm.h
> ===================================================================
> RCS file: /cvs/OpenBSD/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.2
> retrieving revision 1.2.14.4
> diff -u -p -r1.2 -r1.2.14.4
> --- calmwm.h  27 Jun 2009 08:20:23 -0000      1.2
> +++ calmwm.h  20 Aug 2009 11:23:39 -0000      1.2.14.4
> @@ -96,6 +96,8 @@ TAILQ_HEAD(screen_ctx_q, screen_ctx);
>  #define CLIENT_MAXIMIZED     0x08
>  #define CLIENT_DOVMAXIMIZE   0x10
>  #define CLIENT_VMAXIMIZED    0x20
> +#define CLIENT_DOHMAXIMIZE   0x40
> +#define CLIENT_HMAXIMIZED    0x80
>  
>  #define CLIENT_HIGHLIGHT_GROUP               1
>  #define CLIENT_HIGHLIGHT_UNGROUP     2
> @@ -347,6 +349,7 @@ void                       client_ptrsave(struct 
> client_ctx
>  void                  client_draw_border(struct client_ctx *);
>  void                  client_maximize(struct client_ctx *);
>  void                  client_vertmaximize(struct client_ctx *);
> +void                  client_horizmaximize(struct client_ctx *);
>  void                  client_map(struct client_ctx *);
>  void                  client_mtf(struct client_ctx *);
>  struct client_ctx    *client_cycle(int);
> @@ -434,6 +437,8 @@ void                       
> kbfunc_client_movetogroup(struct
>  void                  kbfunc_client_maximize(struct client_ctx *,
>                            union arg *);
>  void                  kbfunc_client_vmaximize(struct client_ctx *,
> +                          union arg *);
> +void                  kbfunc_client_hmaximize(struct client_ctx *,
>                            union arg *);
>  void                  kbfunc_reload(struct client_ctx *, union arg *);
>  void                  kbfunc_quit_wm(struct client_ctx *, union arg *);
> Index: client.c
> ===================================================================
> RCS file: /cvs/OpenBSD/xenocara/app/cwm/client.c,v
> retrieving revision 1.2
> retrieving revision 1.2.12.5
> diff -u -p -r1.2 -r1.2.12.5
> --- client.c  27 Jun 2009 08:20:23 -0000      1.2
> +++ client.c  20 Aug 2009 11:33:48 -0000      1.2.12.5
> @@ -300,10 +300,43 @@ calc:
>  }
>  
>  void
> +client_horizmaximize(struct client_ctx *cc)
> +{
> +     struct screen_ctx       *sc = CCTOSC(cc);
> +     int                      x_org = 0, xmax = sc->xmax;
> +
> +     if (cc->flags & CLIENT_HMAXIMIZED) {
> +             cc->geom = cc->savegeom;
> +     } else {
> +             if (!(cc->flags & CLIENT_MAXIMIZED))
> +                     cc->savegeom = cc->geom;

surely now there are three flags here, we need to check for
CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED, instead of just for MAXIMIZED,
else savegeom will get overwritten.

Else this looks alright.

-0-
-- 
New Hampshire law forbids you to tap your feet, nod your head, or in
any way keep time to the music in a tavern, restaurant, or cafe.

Reply via email to