Le 14 déc. 07 à 09:40, Andreas Schik a écrit :

> Hello Quentin,
>
> On 2007-12-13 23:31:03 +0100 Quentin Mathé <[EMAIL PROTECTED]> wrote:
>
>> Le 30 nov. 07 à 11:39, Andreas Schik a écrit :
>>
>>> Hi there,
>>> I have become a real fan of the horizontal main menus and of
>>> EtoileMenuServer. However, what bothered me was that on right-  
>>> clicking the
>>> application only real context menus are poppimg up, but  no longer  
>>> the main
>>> menu, which is feature I also used a lot.
>>> Thus, i have hacked NSApplication+Hackery to enable this. In my  
>>> hack  i
>>> create a temporary vertical copy of the horizontal main menu to   
>>> pop up
>>> beneath the mouse pointer. For those who are interested in  this  
>>> (and I
>>> believe some of you are) I attach the patch for this.  The patch  
>>> is against
>>> the latest SVN.
>>
>> Initially my plan was to let the user free to decide whether he   
>> prefers to
>> use normal contextual menus or this vertical main menu as   
>> contextual menu.
>> But AppKit allows to override all menus related  methods, so you  
>> cannot
>> ensure the developer won't break the default  behavior. We could  
>> tell the
>> developer he must call a superclass  method, but AppKit  
>> documentation needs
>> to be updated then. The best  way would be to add an AppKit private  
>> method
>> that is called everytime  a contextual menu is going to be  
>> displayed, but
>> this involves  overriding many more methods (which I prefer to  
>> avoid) or
>> making a  feature request to GNUstep. So it will remain in the  
>> current state
>> unless someone is really interested to work out a solution.
>>
> I do not quite understand this. Why would the user need to decide  
> whether to use the main menu as context menu or the context menu  
> defined by the application/developer?

If contextual menus are available in an application, until he does a  
right click the user can never know in advance whether a view has an  
associated contextual menu or the main menu as contextual menu. This  
is a minor problem in GNUstep applications today because contextual  
menus are seldom used. However in applications were many contextual  
menus are defined, discovering where to click to show the main menu  
becomes highly unpredictable. In Cocoa applications, it's not uncommon  
to have contextual menus available in all views (title bars, toolbar,  
content etc.) except scrollers and splitters, so in this case the main  
menu wouldn't be easily available as a contextual menu: it isn't  
obvious at all you can get it then by clicking on a scroller or  
splitter. I'm not sure it really makes sense to have main menu  
available only on scrollers or splitters.
I suppose Étoilé will try to provide a lot of contextual menus, that's  
why I suggested some users which dislike contextual menus may prefer  
to force the use of main menu as contextual menu. Étoilé might also  
specify a default contextual menu on NSView to provide a basic set of  
actions or let you inspect the clicked element (for stuff like  
customization or scripting). Then main menu wouldn't be available at  
all as a contextual menu.

> Currently, in plain GNUstep we have both: if a view has a context  
> menu this will pop up on a right mouse click, otherwise the main  
> menu pops up. Good example for this are GNUMail and GWorkspace. I  
> would expect this behaviour in  Étoilé as well (at least if the  
> project team decides to have right click menus). My original patch  
> does exactly this and I suspect that the way you finally integrated  
> it would have the same behaviour (I couldn't test it so far.).

Yes, that's the behaviour which is now implemented in Étoilé.

> But it may well be that I simply misunderstand you. It may also well  
> be that my patch does not in all cases ensure the desired behaviour  
> of menus, as I did/could not test all cases/programs that use  
> context menus.

The only difference between your patch and my commit is the following  
one. If you define a contextual menu on the content view, no subviews  
will ever display the main menu as contextual menu. This is true for  
your patch and GNUstep implementation but in the version I committed:  
such subviews with no contextual menus would display the main menu.
However there is one downside to my version: if you have a view which  
embeds various subviews, any contextual menus defined on the parent  
view won't be inherited automatically by the subviews. This  
configuration is quite rare so I think it isn't that bad. You still  
have the possibility to override -rightMouseDown: in subview class to  
get the proper behavior (well if you have a class specific to the  
subviews and this is generally the case in such configuration).

Cheers,
Quentin.


_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss

Répondre à