Re: [fltk.bugs] [MOD] STR #2799: Menus can suddenly disappear

2012-01-01 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2799
Version: 1.3.0


A little of my own research: notes for whomever takes this on.

Starting from the top down, when someone clicks+releases in a menu,
I think it works this way:

   1) Clicking+release is handled by Fl_Menu.cxx's menuwindow::handle()
   2) This calls menuwindow::early_hide_handle()
   3) The switch() clause for FL_RELEASE uses "!Fl::event_is_click()"
  to determine if someone 'clicked and released' while moving the
  mouse in between. (When it comes to clicking buttons, a
  click+move+release is a way to "cancel" a button press)

..and Fl::event_is_click() (in Fl.H) returns e_is_click,
whose value logic in X11 relevant here is I believe managed
by set_event_xy()'s logic (in Fl_x.cxx, the X windows code),
the relevant part I think being the '> 3' in the following code:

  // turn off is_click if enough time or mouse movement has passed:
  if (abs(Fl::e_x_root-px)+abs(Fl::e_y_root-py) > 3 ||
  fl_event_time >= ptime+1000)

..which seems to allow for a "drag" of up to 3 pixels between the
push and release.

I believe the issue here is the logic for opening a menu
uses the same logic as clicking a menu item, and arguably
there should be different handling of click-drag-release for
detecting the clicking of buttons & items (where a small distance
change should 'cancel') vs. opening menus (where one should
perhaps have to drag completely off the menu item to "cancel" it).

If this is true, then perhaps the solution is to change
early_hide_handle()'s unconditional use of Fl::event_is_clicked(),
and have it use something else if opening a top-level menu.

I'm not sure if Fl_Menu_Bar and Fl_Menu_Button use the same code
for opening a menu, but that might be part of the issue, as perhaps
the needs of one is not the need of the other; Fl_Menu_Button should
probably act like a button (small mouse movement cancels menu), and
Fl_Menu_Bar should probably not.


Link: http://www.fltk.org/str.php?L2799
Version: 1.3.0

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


[fltk.bugs] [MOD] STR #2799: Menus can suddenly disappear

2012-01-01 Thread Andrew Apted

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2799
Version: 1.3.0


Clicking and releasing the mouse button should open a menu.

However if the user drags the mouse a small distance before
releasing the mouse button (but still staying on the menu button),
the menu will appear briefly but disappear before the user can
select anything on the menu, which is quite frustrating.

This is under Linux, I haven't tested Windows.
FLTK version 1.3.0

Cheers,
--
Andrew Apted


Link: http://www.fltk.org/str.php?L2799
Version: 1.3.0

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs