>>Another thing is that when I open an open panel I still can access menu
>>entries, ie. when click on 'open palettes' in Gorm I still can open the
>>inspector etc. 
>>Doing these nasty focus games GNUstep apps generally get a little
>>'confused' and do not behave properly anymore, ie. when a window is active
>>it does not handle inputs (ie. mouse clicks) properly etc.
>>

Here's a patch which fixes this problem. It doesn't seem very 
satisfactory - basically just the  last hunk -- in the targetForAction: 
method of NSApplication, we just tell the sender (usually [NSMenu 
-update]), that there is no target for any selector when a modal dialog 
is up. This disables most menu items. We could implement 
validateMenuItem: in NSApplication, but an application could easily 
subclass NSApplication and override this method (Gorm, in fact, does this).

I would appreciate it if someone could look at it and make any suggestions.



-- 
Adam Fedor, Digital Optics            | I'm glad I hate spinach, because
http://www.doc.com                    | if I didn't, I'd eat it, and you
http://www.gnustep.org                | know how I hate the stuff.
Index: Source/NSApplication.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSApplication.m,v
retrieving revision 1.190
diff -c -r1.190 NSApplication.m
*** Source/NSApplication.m      9 Jan 2002 20:41:07 -0000       1.190
--- Source/NSApplication.m      14 Jan 2002 01:41:55 -0000
***************
*** 1120,1127 ****
--- 1120,1136 ----
  
        if (found == YES)
        {
+         NSEventType   type = [_current_event type];
+ 
          [self sendEvent: _current_event];
  
+         // update (en/disable) the services menu's items
+         if (type != NSPeriodic && type != NSMouseMoved)
+           {
+             [_listener updateServicesMenu];
+             [_main_menu update];
+           }
+ 
          /*
           *    Check to see if the window has gone away - if so, end session.
           */
***************
*** 1394,1400 ****
    if (keyWindow != nil)
      {
        resp = [keyWindow firstResponder];
!       while (resp != nil)
        {
          if ([resp respondsToSelector: aSelector])
            {
--- 1403,1409 ----
    if (keyWindow != nil)
      {
        resp = [keyWindow firstResponder];
!       while (resp != nil && resp != keyWindow)
        {
          if ([resp respondsToSelector: aSelector])
            {
***************
*** 1412,1417 ****
--- 1421,1429 ----
          return resp;
        }
      }
+ 
+   if (_session != 0)
+     return nil;
  
    mainWindow = [self mainWindow];
    if (keyWindow != mainWindow && mainWindow != nil)

Reply via email to