On 15.09.2010 14:17, MacArthur, Ian (SELEX GALILEO, UK) wrote:

> Well, the "plan" (using the term loosely...) went like this;
>
> - Figure out if we are in a submenu or not (somehow) maybe by using
> m->submenu() or similar.
>
> - If we are in a submenu, modify Fl::e_state to ensure that FL_ALT is
> asserted *before* we call Fl::test_shortcut().
>
> - Restore Fl::e_state to what it was before we modified it...
>
> Note that this is a bit of a hack, Fl::e_state ought to be a protected
> member of Fl, but as it happens it is not...
>
> So...
>
>       int old_state = Fl::e_state;
>       Fl::e_state |= FL_ALT;
>       Fl::test_shortcut(...);
>       Fl::e_state = old_state;
>
> BUT: Probably with some appropriate "#ifdef WIN32" guards around it to
> stop it spilling into the other platform builds...
>
> The idea being to make sure that in fl_shortcut.cxx, whenever we call
> Fl::test_shortcut(...) for a submenu, the FL_ALT modifier will always
> *appear* to be set, and then maybe everything will be OK.
>
> Perhaps...

[I apologize in advance for my late and less-informed response...]

I don't like the idea to modify the FL_ALT state in the menu code.
Instead I suggest to revert the change of STR #2199 and do the correct
test (for this case) in another way, maybe by testing FL_ALT explicitly
somewhere else (wherever this may be). This might be more consistent
than modifying the state to fake the FL_ALT key.

I agree, however, that we should not only revert that change w/o a
proper solution...

That said, I didn't look at the code yet, and I'm also very busy, but
maybe at the next weekend I can try to contribute more. The more code
and/or ideas we have until then, the easier we can decide. At least I
hope so.

Now, after a short look at the code and "grep test_shortcut...":

I can contribute an idea and a little statistic: We could easily
extend int Fl_Widget::test_shortcut(const char *t) (the function in
question WRT STR #2199) to accept another argument, something like
"int require_alt" as a boolean decision. This could be used depending
on the context of the caller. And here comes the statistical part:
grep shows 26 hits in FL/* and src/*.c* for _any_ form of the string
"test_shortcut". Some of these are comments, others are calling
different test_shortcut methods... Maybe that helps? Just my 2 ct.

Albrecht
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to