On Fri, 2003-10-17 at 08:49, Benhur Stein wrote:
> >> number];
> >>                         [self setinputfocus: number];
> >> +                       generic.focusRequestNumber = 0;
> >> +                       generic.desiredFocusWindow = 0;
> > 
> > Why does this cause a problem for you? You can read the comment 
> > above
> > this in the source about some of the problems this solves, although
> > there are others it solves as well.
> The problem is the focus going to the wrong window sometimes. For 
> example:
> open 2 windows of one application (say Terminal) and one window of 
> another

Can you see if the attached patch fixes this problem?




> >         }
> >        else if ([self mainWindow] != nil)
> >         {
> > -         [[self mainWindow] orderFront: self];
> > +         [[self mainWindow] makeKeyAndOrderFront: self];
> >         }
> > 
> > Why this? We don't really want to make the main window key unless 
> > it is
> > supposed to be?
> Yes, but if the application had a key window, it would have been 
> selected in the
> previous 'if'. If it doesn't have a key window and one is not set, 
> the application

OK, sounds reasonable


> To see the problem: In Terminal, do openapp Affiche (for example)
> When Affiche's menu appears, Terminal's remain onscreen. Type 
> Command-n
> and you get a new terminal window instead of a new Affiche note.
> 

I can't recreate this.  Although for some reason, when I do Command-n, a
new note comes up, but I cannot type into it without clicking on the
note.

> The other focus problem I have is with this newly created Terminal 
> window,
> it has the input focus, bu if I start typing it shows strange chars, 
> like when
> i type with right-alt pressed. I must click on the window's title 
> before
> typing, and it is very annoying, it gets me most of the times.


I can't recreate this either.


Can you send me some more descriptions of how you get these problems
along with an output of running the program with

--GNU-Debug=Focus

Thanks.
Index: NSWindow.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSWindow.m,v
retrieving revision 1.292
diff -u -r1.292 NSWindow.m
--- NSWindow.m	21 Oct 2003 03:10:24 -0000	1.292
+++ NSWindow.m	21 Oct 2003 03:40:53 -0000
@@ -3085,6 +3085,18 @@
 		  NSDebugLLog(@"Focus", @"WM take focus while hiding");
 		  break;
 		}
+	      if (self == [[NSApp mainMenu] window] && [NSApp keyWindow])
+		{
+		  /* This might occur when the window manager just wants
+		     someone to become key, so it tells the main menu
+		     (typically the first menu in the list), but since we
+		     already have a window that was key before, use that
+		     instead */
+		  NSDebugLLog(@"Focus", @"Key window is already %d",
+			      [[NSApp keyWindow] windowNumber]);
+		  [[NSApp keyWindow] sendEvent: theEvent];
+		  break;
+		}
 	      if ([self canBecomeKeyWindow] == YES)
 		{
 		  [self makeKeyWindow];
_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to