On Wed 2010.12.15 at 18:33 +0100, Thomas Pfaff wrote:
> I sent the diff below to a few guys found in the cwm cvs log about a month
> ago but no love, so I'm posting here.
Hi Thomas,
There are a few clean-up diffs floating around the guys in the logs,
some of which has some of the stuff you have below. The clean-ups have
not been forgotten.
Cheers,
Okan
> The diff is not that important but here it is anyway. It came about when
> looking through the cwm code trying to fix a few bugs that I've uncovered
> (though I've been unsuccessful so far). More diffs like this to come, if
> anyone cares.
>
> BTW, who should I send things like this to, if not this list?
>
> Begin forwarded message:
> [...]
>
> Move xev_reconfig from xevents.c to xutil.c and rename to xu_reconfig as
> per XXX in calmwm.h. While here, sort xu_* prototypes in calmwm.h to match
> the order of definition in xutil.c.
>
> Index: calmwm.h
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.118
> diff -u -p -r1.118 calmwm.h
> --- calmwm.h 22 May 2010 22:10:31 -0000 1.118
> +++ calmwm.h 17 Nov 2010 10:38:15 -0000
> @@ -384,29 +384,27 @@ struct menu *menu_filter(struct scree
> void (*)(struct menu *, int));
> void menu_init(struct screen_ctx *);
>
> -/* XXX should be xu_ */
> -void xev_reconfig(struct client_ctx *);
> -
> void xev_loop(void);
>
> -void xu_getatoms(void);
> int xu_ptr_grab(Window, int, Cursor);
> -void xu_btn_grab(Window, int, u_int);
> int xu_ptr_regrab(int, Cursor);
> -void xu_btn_ungrab(Window, int, u_int);
> void xu_ptr_ungrab(void);
> -void xu_ptr_setpos(Window, int, int);
> +void xu_btn_grab(Window, int, u_int);
> +void xu_btn_ungrab(Window, int, u_int);
> void xu_ptr_getpos(Window, int *, int *);
> +void xu_ptr_setpos(Window, int, int);
> void xu_key_grab(Window, int, int);
> void xu_key_ungrab(Window, int, int);
> +void xu_reconfig(struct client_ctx *);
> void xu_sendmsg(Window, Atom, long);
> int xu_getprop(Window, Atom, Atom, long, u_char **);
> int xu_getstrprop(Window, Atom, char **);
> -void xu_setstate(struct client_ctx *, int);
> int xu_getstate(struct client_ctx *, int *);
> +void xu_setstate(struct client_ctx *, int);
> +void xu_getatoms(void);
> +void xu_setwmname(struct screen_ctx *);
> unsigned long xu_getcolor(struct screen_ctx *, char *);
> void xu_freecolor(struct screen_ctx *, unsigned long);
> -void xu_setwmname(struct screen_ctx *);
>
> int u_spawn(char *);
> void u_exec(char *);
> Index: client.c
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/client.c,v
> retrieving revision 1.76
> diff -u -p -r1.76 client.c
> --- client.c 22 May 2010 22:10:31 -0000 1.76
> +++ client.c 17 Nov 2010 10:38:15 -0000
> @@ -114,7 +114,7 @@ client_new(Window win, struct screen_ctx
> XAddToSaveSet(X_Dpy, cc->win);
>
> /* Notify client of its configuration. */
> - xev_reconfig(cc);
> + xu_reconfig(cc);
>
> (state == IconicState) ? client_hide(cc) : client_unhide(cc);
> xu_setstate(cc, cc->state);
> @@ -390,14 +390,14 @@ client_resize(struct client_ctx *cc)
>
> XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x,
> cc->geom.y, cc->geom.width, cc->geom.height);
> - xev_reconfig(cc);
> + xu_reconfig(cc);
> }
>
> void
> client_move(struct client_ctx *cc)
> {
> XMoveWindow(X_Dpy, cc->win, cc->geom.x, cc->geom.y);
> - xev_reconfig(cc);
> + xu_reconfig(cc);
> }
>
> void
> Index: xevents.c
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/xevents.c,v
> retrieving revision 1.50
> diff -u -p -r1.50 xevents.c
> --- xevents.c 25 Sep 2010 20:04:55 -0000 1.50
> +++ xevents.c 17 Nov 2010 10:38:15 -0000
> @@ -52,7 +52,6 @@ static void xev_handle_clientmessage(XE
> static void xev_handle_randr(XEvent *);
> static void xev_handle_mappingnotify(XEvent *);
>
> -
> void (*xev_handlers[LASTEvent])(XEvent *) = {
> [MapRequest] = xev_handle_maprequest,
> [UnmapNotify] = xev_handle_unmapnotify,
> @@ -166,7 +165,7 @@ xev_handle_configurerequest(XEvent *ee)
> wc.border_width = cc->bwidth;
>
> XConfigureWindow(X_Dpy, cc->win, e->value_mask, &wc);
> - xev_reconfig(cc);
> + xu_reconfig(cc);
> } else {
> /* let it do what it wants, it'll be ours when we map it. */
> wc.x = e->x;
> @@ -211,25 +210,6 @@ test:
> group_update_names(sc);
> }
>
> -}
> -
> -void
> -xev_reconfig(struct client_ctx *cc)
> -{
> - XConfigureEvent ce;
> -
> - ce.type = ConfigureNotify;
> - ce.event = cc->win;
> - ce.window = cc->win;
> - ce.x = cc->geom.x;
> - ce.y = cc->geom.y;
> - ce.width = cc->geom.width;
> - ce.height = cc->geom.height;
> - ce.border_width = cc->bwidth;
> - ce.above = None;
> - ce.override_redirect = 0;
> -
> - XSendEvent(X_Dpy, cc->win, False, StructureNotifyMask, (XEvent *)&ce);
> }
>
> static void
> Index: xutil.c
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/xutil.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 xutil.c
> --- xutil.c 22 May 2010 22:32:08 -0000 1.32
> +++ xutil.c 17 Nov 2010 10:38:15 -0000
> @@ -119,6 +119,25 @@ xu_key_ungrab(Window win, int mask, int
> }
>
> void
> +xu_reconfig(struct client_ctx *cc)
> +{
> + XConfigureEvent ce;
> +
> + ce.type = ConfigureNotify;
> + ce.event = cc->win;
> + ce.window = cc->win;
> + ce.x = cc->geom.x;
> + ce.y = cc->geom.y;
> + ce.width = cc->geom.width;
> + ce.height = cc->geom.height;
> + ce.border_width = cc->bwidth;
> + ce.above = None;
> + ce.override_redirect = 0;
> +
> + XSendEvent(X_Dpy, cc->win, False, StructureNotifyMask, (XEvent *)&ce);
> +}
> +
> +void
> xu_sendmsg(Window win, Atom atm, long val)
> {
> XEvent e;