discuss-gnustep
[Top][All Lists]
Advanced

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

focus problem


From: Andreas Höschler
Subject: focus problem
Date: Thu, 16 Aug 2007 12:06:30 +0200

Hi all,

I am investigating the - well known - focus problem and am currently in

NSApplication.m
=============

- (void)mouseDown:(NSEvent*)theEvent
{
  if ([theEvent clickCount] >= 2)
    {
      /* if not hidden raise windows which are possibly obscured. */

      if ([NSApp isHidden] == NO)
        {
          NSArray *windows = RETAIN(GSOrderedWindows());
          NSWindow *aWin;

        ...

[NSApp unhide: self]; // <------ shouldn't we activate the app here?

          if ([NSApp isActive] == YES)
            {
              if ([NSApp keyWindow] != nil)
                {
                  [[NSApp keyWindow] orderFront: self];
                }
              else if ([NSApp mainWindow] != nil)
                {
                  [[NSApp mainWindow] makeKeyAndOrderFront: self];
                }
              else
                {
                  /* We need give input focus to some window otherwise we'll
                     never get keyboard events. FIXME: doesn't work. */
                  NSWindow *menu_window = [[NSApp mainMenu] window];
                  NSDebugLLog(@"Focus", @"No key on activation - make menu 
key");
NSLog(@"Focus No key on activation - make menu key %@", menu_window); [GSServerForWindow(menu_window) setinputfocus:[menu_window windowNumber]];
                }
            }
        
          RELEASE(windows);
        }

Shouldn't we activate the app in all cases if the user doubleclicked the app icon? If the application has no open windows, the "We need give input focus to some window" part is called and it indeed does not work. Key events go to the previously active application though the etoile menu already shows the correct - just activated - application. Has anybody a good idea how to fix that?

Regards,

  Andreas






reply via email to

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