On Fri, Apr 04, 2008 at 09:34:14PM +0200, Alexandre Julliard wrote:
> Hi,
>
> I was having trouble making fvwm respect the initial NET_WM_STATE on a
> newly mapped window. I tracked this down to a 64-bit issue,
> ewmh_AtomGetByName() converts an array of longs to an array of CARD32,
> but callers expect to get an array of Atoms.
>
> The patch below fixes it, by making sure that all the places that use
> ewmh_AtomGetByName() to retrieve atoms use the CARD32 type.
I've committed the patch in a slightly modified version.
> Index: fvwm/ewmh.c
> ===================================================================
> RCS file: /home/cvs/fvwm/fvwm/fvwm/ewmh.c,v
> retrieving revision 1.76
> diff -u -p -r1.76 ewmh.c
> --- fvwm/ewmh.c 7 Aug 2007 20:17:43 -0000 1.76
> +++ fvwm/ewmh.c 4 Apr 2008 19:16:08 -0000
> @@ -727,7 +727,7 @@ void set_kde_sys_tray(void)
> void ewmh_AddToKdeSysTray(FvwmWindow *fw)
> {
> int size = 0;
> - Atom *val;
> + CARD32 *val;
> KstItem *t;
>
> val = ewmh_AtomGetByName(
> @@ -1510,7 +1510,7 @@ int ewmh_HandleToolBar(EWMH_CMD_ARGS)
>
> void ewmh_HandleWindowType(FvwmWindow *fw, window_style *style)
> {
> - Atom *val;
> + CARD32 *val;
> ewmh_atom *list = ewmh_atom_window_type;
> int size = 0;
> int i = 0;
> @@ -1529,7 +1529,7 @@ void ewmh_HandleWindowType(FvwmWindow *f
> return;
> }
> /* we support only one window type: the first that we support */
> - while(i < size && !found)
> + while(i < size/sizeof(*val) && !found)
> {
> list = ewmh_atom_window_type;
> while(list->name != NULL && !found)
> @@ -1605,7 +1605,7 @@ void EWMH_GetStyle(FvwmWindow *fw, windo
> static void ewmh_check_wm_pid(FvwmWindow *fw)
> {
> int size = 0;
> - Atom *val;
> + CARD32 *val;
>
> fw->ewmh_window_type = 0;
> val = ewmh_AtomGetByName(
> Index: fvwm/ewmh_events.c
> ===================================================================
> RCS file: /home/cvs/fvwm/fvwm/fvwm/ewmh_events.c,v
> retrieving revision 1.60
> diff -u -p -r1.60 ewmh_events.c
> --- fvwm/ewmh_events.c 3 Feb 2008 23:36:05 -0000 1.60
> +++ fvwm/ewmh_events.c 4 Apr 2008 19:16:08 -0000
> @@ -305,7 +305,7 @@ int ewmh_WMDesktop(EWMH_CMD_ARGS)
> if (style != NULL && ev == NULL)
> {
> /* start on desk */
> - unsigned long *val;
> + CARD32 *val;
> int size = 0;
>
> if (DO_EWMH_IGNORE_STATE_HINTS(style))
> @@ -331,11 +331,11 @@ int ewmh_WMDesktop(EWMH_CMD_ARGS)
> #if DEBUG_EWMH_INIT_STATE
> fprintf(
> stderr, "ewmh WM_DESKTOP hint for window 0x%lx "
> - "(%i,%lu,%lu)\n", FW_W(fw),
> + "(%i,%lu,%u)\n", FW_W(fw),
> HAS_EWMH_INIT_WM_DESKTOP(fw),
> fw->ewmh_hint_desktop, val[0]);
> #endif
> - if (val[0] == (unsigned long)-2 || val[0] == (unsigned long)-1)
> + if (val[0] == (CARD32)-2 || val[0] == (CARD32)-1)
> {
> S_SET_IS_STICKY_ACROSS_PAGES(SCF(*style), 1);
> S_SET_IS_STICKY_ACROSS_PAGES(SCM(*style), 1);
> @@ -473,7 +473,7 @@ int ewmh_WMState(EWMH_CMD_ARGS)
> }
> else if (style != NULL)
> {
> - Atom *val;
> + CARD32 *val;
> int size = 0;
> int i;
> ewmh_atom *list = ewmh_atom_wm_state;
> @@ -499,7 +499,7 @@ int ewmh_WMState(EWMH_CMD_ARGS)
> while(list->name != NULL)
> {
> has_hint = 0;
> - for(i = 0; i < (size / (sizeof(Atom))); i++)
> + for(i = 0; i < (size / (sizeof(*val))); i++)
> {
> if (list->atom == val[i])
> {
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt