Hi Albrecht and Ian, I have tried one implementation that actually works fine here, let's see what you think about it.
In Fl_Menu_Item.H, I changed the find_shortcut declaration to: const Fl_Menu_Item* find_shortcut(int *ip=0, const bool &require_alt = false) const; In Fl_Widget.H, I changed the test_shortcut declaration to: static int test_shortcut(const char*, const bool &require_alt = false); In FL_Menu.cxx, I propagate the require_alt parameter in Fl_Menu_Item::find_shortcut to Fl_Widget::test_shortcut. In Fl_Menu_Bar.cxx, I send (0, true) as parameters to find_shortcut. In fl_shortcut.cxx, I only check the FL_ALT state if require_alt is true (still only for WIN32). I hope this was clear, let me know if you need the actual code files for testing. It does it for me - what do you think? Since I only set require_alt to true from Fl_Menu_Bar I think it should only be valid for top-level menus as expected. One uncertainty may be changing the API for Fl_Menu_Item::find_shortcut, but the argument is optional so maybe it's okay? /Andreas > On 15.09.2010, at 16:38, MacArthur, Ian wrote: > > >> 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. > > > > Yes - this was an idea I had too, but I was worried about breaking the > > API so I backed away from that. I guess if we provided a wrapper > > function with the old API that always called the "new" version with the > > "require_alt" hard coded appropriately, then that could be OK - most > > callers would not even know anything had changed... > > Well, this special function (or static method) is marked "Internal > use only." (if it's only this one that needs to be changed). And, > after all, it's c++ :-) -> we can add an optional argument. > > [...] > > ... The trick is that I still don't know > > which particular calling context needs to get this "right". > > Yep, that's the tricky part. > > > And of course, this is all WIN32 specific, so we need to *not* change > > the behaviour for the other platforms, too. > > Hmm, is this really true? I know the discussion in STR 2199, but I'm > not that sure that this couldn't be all the same. That said, we can > still use a *call* with "require_alt" set to 1 and ignore it, depending > on the platform in the above mentioned function - maybe... But that's > more than I can tell now w/o looking at the code more closely. > > Albrecht _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
