After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 51042 - flipping menu arrows
flipping menu arrows
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.2.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 25713 90464 104102 131112 346476 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2001-02-18 08:08 UTC by Sri Ramkrishna
Modified: 2011-02-04 16:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gzipped patch (1.35 KB, patch)
2001-02-18 08:09 UTC, Sri Ramkrishna
none Details | Review
Un-gziped version of above patch. (3.45 KB, patch)
2001-08-25 02:31 UTC, Owen Taylor
none Details | Review

Description Sri Ramkrishna 2001-02-18 08:08:56 UTC
This patch does:

* Makes submenu indicator arrows point in the direction that the submenu
  will pop up (left or right), rather than always right.

* Makes the submenu offset (the vertical offset of each sucessive submenu)
  a #define'd quantity, instead of magic in the middle.
  Someone should make this be user-customizable via .gtkrc etc.

* Removes hard-coding of submenus cascade right, and #define's it.
  This should also be user settable (i18n issues? tfel-ot-thgir languages
  probably should default to cascade left).

* Minor code clean up (moved an assignment that sometimes gets immediately
  by an 'if ...' into the 'else').
Comment 1 Sri Ramkrishna 2001-02-18 08:09:24 UTC
Created attachment 275 [details] [review]
gzipped patch
Comment 2 Owen Taylor 2001-08-25 02:31:12 UTC
Created attachment 960 [details] [review]
Un-gziped version of above patch.
Comment 3 Owen Taylor 2002-01-22 19:49:46 UTC
*** Bug 25713 has been marked as a duplicate of this bug. ***
Comment 4 Owen Taylor 2002-09-26 18:53:31 UTC
*** Bug 90464 has been marked as a duplicate of this bug. ***
Comment 5 Owen Taylor 2002-10-22 23:09:05 UTC
Adding Nils Barth to the CC: as the author of this patch.
Comment 6 Owen Taylor 2002-10-22 23:45:55 UTC
* For the flipping the menu indicators, there is the basic
  usability question of "should they flip". 

  [ The flipping here is - if the submenu was going
    to pop up to the left, then 

    +------------+
    |Item       >|
    +------------+
 
    +------------+
    |Item       <|
    +------------+

   I think none of Windows, Qt, Mozilla, do this, so there isn't
   much precedent. Still, it might be a cool touch; though there
   are definitely implementation challenges.

 * The implementation of this feature has in the patch has 
   the problem that it doesn't track changes in the arrow direction
   it just checks every time an expose event occurs. 
   The easiest way of reproducing this is to take a torn off
   menu with submenus and move it around the screen ... you can
   get half the submenu arrow drawn one way and half drawn
   the other way.

   This particular reproduction mechanism isn't that hard to fix..
   you watch for configure events on the tearoff toplevel, and
   when you get a configure event, you do:
    
    foreach menu_item in the menu:
      _gtk_menu_item_check_toplevel_reposition (menu_item)

   However, it's much harder to catch if the requisition of the 
   child menu changes while the menu is up... that could also
   cause the direction of arrows to change. The chance of this
   happening enough may be low enough to be not worth worrying 
   about.

 * The performance of this patch should be somewhat better than
   it was when the patch was first submitted since we cache widget
   requisitions; still I have some concerns about having to 
   compute the requisitions of the submenus as well as the
   menu itself when initially showing a menu.

 * The submenu_offset issue is should probably be a separate
   bug ... if we don't decide to simply hard-code the value
   to zero, it should be a style property. 
   (Red Hat cross-reference 
    http://bugzilla.redhat.com/bugzilla/show_bu.cgi?id=66529.
    Garrett actually wants a horizontal offset as well as
    getting rid of the vertical offset.)
 
 * The issue of cascading left for RTL languages is part of
   bug 76219. Note that the way that things flip there is
   different from here since the arrow goes on the opposite
   side of the menu item as well as pointing the other way.

 * Couple of comments on one chunk of the patch:

+	  /* The temporary requisition var is so that gtk_widget_size_request
+	   * doesn't whine; otherwise we'd just have
+	   * &(GTK_WIDGET (menu_item->submenu)->requisition) above.
+	   */
+	  GTK_WIDGET (menu_item->submenu)->requisition.width  =
requisition.width;
+	  GTK_WIDGET (menu_item->submenu)->requisition.height =
requisition.height;
+	  gtk_menu_item_position_menu (GTK_MENU (menu_item->submenu),
+	                               &dummy_a, &dummy_b, menu_item);

 - "just so it doens't whine is a bit deceptive" - passing in 
   &widget->requisition is illegal because it doesn't properly
   take into account gtk_widget_set_usize(). You can pass in 
   NULL if you don't want to get the requisition yourself.

 - Poking into the fields like that is both unnecessary and
   illegal. GTK+ will take care of it for you.
   (It's in gtk/gtksizegroup.c/do_size_request() these 
   days if you don't believe me.)
   
 - I'd probably make gtk_menu_item_position_menu() allow
   NULL for x/y/push_in rather than adding dummy variables.
   We are religious about allowing NULL for out variables
   for public GTK+ entry points, though we don't always
   do it for internal functions unless specifically needed.
Comment 7 Owen Taylor 2002-10-22 23:58:11 UTC
Red Hat reference above should have been 
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=66259.

I've filed bug 96557 for the submenu offset issue; please
use this bug only for the issue of flipping the direction
of the submenu arrow based on where the child will come
up.
Comment 8 Owen Taylor 2002-10-24 16:49:32 UTC
Moving various feature enhancements to the 2.4.0 milestone.
Comment 9 Anna Marie Dirks 2002-10-25 17:45:08 UTC
I can only address Owen's first question regarding whether the arrows
should be fixed from a usability perspective: in the screenshot shown
here, the backwardness of the arrows make us seem a bit amateurish,
no?  http://primates.ximian.com/~anna/goofy-arrows.png . 

I mean, obviously, I lack the skills to fix this bug. Therefore, I am
amateurish compared to what is needed here. But, Owen, you aren't. :)
I know there's a lot of pressure now to get 2.2 out-- for 2.4, this
seems like quite a worthy problem.

Also, the wrongly aligned arrows must be disconcerting in left to
right languages, no? 
Comment 10 Owen Taylor 2002-10-25 22:43:12 UTC
right-to-left cascades for right-to-left languages are a
somewhat different subject (bug 96637). In that case, you 
put the accelerator and arrow on the left of the text and the 
image on the right. 

 +-------------------------+
 | <  Q-Alt          TIUQ *|
 +-------------------------+

The case being discussed here is running out of space 
for a left-to-right menu cascade. I'd have trouble believing
that the current behavior is "amateurish" when it is the
behavior of Windows, MacOS, Mozilla, Qt. 

The problem with the case you show partly that there is a three
level cascade, which is a bit pathological to begin with.
(Bad UI design, really) For only a two level cascade, it's 
clearer why the second level pops up on the other side of
the menu.

I think switching to a right-to-left language style RTL cascade
when the pop up point for a context menu is near the right
edge of the screen would be weird. Maybe it might make sense for 
menus that are permanently fixed to the right side of the screen
(foot menu on a panel on the right side of the screen.) 
If you did that, how much of the menu item would you reverse?
Just turn the arrow around (as in this bug report)? Move the
arrow to the other side but leave the image/accelerator in place?
Move everything?

For the minor case of simply running out of space in a 
left-to-right cascade, menu arrow flipping is closely related
to bug 58377 ... which is the question of keynav. I think 
there are convincing reasons not to flip the keynav (for one
thing, [Left] would be the keynav for both parent and child)
so my instinct is the arrow direction probably shouldn't
flip either.
Comment 11 Dave Bordoley [Not Reading Bug Mail] 2003-01-25 16:47:38 UTC
*** Bug 104102 has been marked as a duplicate of this bug. ***
Comment 12 Matthias Clasen 2003-07-25 09:09:39 UTC
This should all be done, except for flipping the arrow when running out 


of space, which as Owen mentioned, is related to flipping the keynav 


(bug 58377). Since we decided to not flip the keynav, I guess this bug


should also be closed. Reopen if you disagree.
Comment 13 Matthias Clasen 2004-02-02 12:56:19 UTC
*** Bug 131112 has been marked as a duplicate of this bug. ***
Comment 14 Vincent Untz 2007-05-01 09:02:03 UTC
*** Bug 346476 has been marked as a duplicate of this bug. ***