Re: [AD] ALLEGRO_KEYBOARD_STATE improvement

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Without knowing much about the motivations for including it, I move
that the display member of this structure should be removed. It isn't
clear what it actually refers to (the foreground window? the window
that received the most recent event? what if there is no active
display?), and none of the drivers use it anyways.

On Sun, Oct 12, 2008 at 10:59 AM, Ryan Patterson
<cgamesplay@xxxxxxxxxx> wrote:
> In the Allegro source, there is this construct:
>
> typedef struct ALLEGRO_KEYBOARD_STATE
> {
>   struct ALLEGRO_DISPLAY *display;  /* public */
>   unsigned int __key_down__internal__[4]; /* internal */
>   /* Was using uint32_t, but some machines don't have stdint.h. */
> #if AL_KEY_MAX >= (32 * 4)
> # error __key_down__internal__ array not big enough for AL_KEY_MAX
> #endif
> } ALLEGRO_KEYBOARD_STATE;
>
> Obviously, AL_KEY_MAX isn't the right symbol to use. However, since
> ALLEGRO_KEY_MAX is no longer a preprocessor symbol at all, that error
> will never get triggered. I've written a patch that changes the size
> of the array to be statically calculated using the value of
> ALLEGRO_KEY_MAX:
>
> typedef struct ALLEGRO_KEYBOARD_STATE
> {
>   struct ALLEGRO_DISPLAY *display;  /* public */
>   unsigned int __key_down__internal__[(ALLEGRO_KEY_MAX + 7) / 8 /
> sizeof(unsigned int)]; /* internal */
>   /* Was using uint32_t, but some machines don't have stdint.h. */
> } ALLEGRO_KEYBOARD_STATE;
>
> No other files need to be changed.
>
> --
> Regards,
> Ryan Patterson <mailto:cgamesplay@xxxxxxxxxx>
>



-- 
Regards,
Ryan Patterson <mailto:cgamesplay@xxxxxxxxxx>




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/