bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Menu code somewhat changed


From: Willem Rein Oudshoorn
Subject: [PATCH] Menu code somewhat changed
Date: 23 Feb 2003 21:02:16 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

The following patch changes slightly the mechanism
of the NSMenu (View) code.  

Changed behaviour
-----------------

* Remove highlighting explicitly after executing action.
  (I guess the restore highlighting code was put there for
   a reason.  But I could not think of any.)

* Remove the temporary menu before executing the 
  action.


Bugs fixed
----------

* #101877, Menus do no not move down.
* #100248, Ghost menu
* #101875, Menu flicker.
* Unreported bug:  When you select an a submenu
  item more than 1 level deep and release the mouse
  the submenus dissappear.  
* Spurious highlighting is removed.


Problems with fix
-----------------

In two places:  attachSubMenuAtIndex:  and detachSubMenu
it really depends on the fact that the [NSMenu menuRepresentation];
returns an NSMenuView.  Because here it directly accesses an 
instance variable of the result.  


Remaining Questions
-------------------

* What is the idea behind resetting the highlighted index
  in the method detachSubMenu?  

* Should the directly accessing the instance variable
  in detachSubMenu and attachSubMenuAtIndex: 
  be avoided?  If so, is a new set method the
  way to go?


Remarks
-------

* I really was hindered by the fact that the apple 
  documentation states the method signature of
  quite a few methods in NSMenuView.  
  For example, the question directly above this one
  would not arise if we sligthly defiated from 
  the Apple docs for this class.

* There is still the following bug.  (Also
  present in the current code).

  1 - Open an Application
  2 - Click on item with submenu
  3 - Notice that the submenu stays.
  4 - Click in submenu and move cursor
      over to parent menu.
  5 - Notice that this does NOT work, 
      you can not access items in 
      the parent menu.

  This is rather tricky to fix.  
  



Wim Oudshoorn.


-----[ ChangeLog ]-----------------------------------

2003-02-23  Willem Rein Oudshoorn  <woudshoo@xs4all.nl>

        * Source/NSMenuView.m ([NSMenuView -detachSubmenu]): 
        reset the flag _keepAttachedMenus in the menu to be detached.
        Do not reset highlighting.
        ([NSMenuView -attachSubmenuForItemAtIndex:]): Set _keepAttachedMenus 
        flag for submenu.  Remove remembering the highlighting
        ([NSMenuView -trackWithEvent:]): Rewrote method to remove menus
        before applying the action.  Rewrote logic for removin windows.
        Remove highlighting explicitly.
        ([NSMenuView -mouseDown:]): Do only restore position of NSMenu
        when it is not a rightclick menu

        * Source/NSMenu.m: Added comments
        ([NSMenu -displayTransient]): Check if _follow_transient == NO.
        ([NSMenu -closeTransient]): Check if _follow_transient == YES
        ([NSMenu -shiftOnScreen]): Rewrote method to move also upwards,
        and allow moving in both direction at the same time.

        * Headers/gnustep/gui/NSMenuView.h: moved declaration of 
        detach|attachSubmenu... to more logical place in the list.
        removed instance variable for restoring highlighting.


Attachment: menu.patch.bz2
Description: Patch for NSMenu and NSMenuView


reply via email to

[Prev in Thread] Current Thread [Next in Thread]