mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Ignore most events sent to windows that have been ordered out. Synchronize [NSPanel -sendEvent:] and [NSWindow -sendEvent:].
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18215 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
311e73aace
commit
720ddc11b5
3 changed files with 34 additions and 11 deletions
|
@ -1,3 +1,10 @@
|
|||
2003-11-26 23:55 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSWindow.m (-sendEvent:): Ignore most events sent to
|
||||
windows that have been ordered out.
|
||||
* Source/NSPanel.m (-sendEvent:): Synchronize with [NSWindow
|
||||
-sendEvent:].
|
||||
|
||||
2003-11-26 23:54 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSView.m (-autoscroll:): Document.
|
||||
|
|
|
@ -201,30 +201,35 @@ Code shared with [NSWindow -sendEvent:], remember to update both places.
|
|||
NSEventType type;
|
||||
|
||||
type = [theEvent type];
|
||||
switch (type)
|
||||
if (type == NSLeftMouseDown)
|
||||
{
|
||||
case NSLeftMouseDown:
|
||||
if (_f.visible)
|
||||
{
|
||||
BOOL wasKey = _f.is_key;
|
||||
|
||||
if ([NSApp isActive] == NO && ((NSWindow *)self) != [NSApp iconWindow])
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
if (_f.has_closed == NO)
|
||||
{
|
||||
v = [_contentView hitTest: [theEvent locationInWindow]];
|
||||
if (_f.is_key == NO)
|
||||
{
|
||||
/* NSPanel modification: check becomesKeyOnlyIfNeeded. */
|
||||
if (!_becomesKeyOnlyIfNeeded || [v needsPanelToBecomeKey])
|
||||
[self makeKeyAndOrderFront: self];
|
||||
}
|
||||
/* Activate the app *after* making the receiver key, as app
|
||||
activation tries to make the previous key window key. */
|
||||
if ([NSApp isActive] == NO && self != [NSApp iconWindow])
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
if (_firstResponder != v)
|
||||
{
|
||||
[self makeFirstResponder: v];
|
||||
}
|
||||
if (_lastView)
|
||||
DESTROY(_lastView);
|
||||
{
|
||||
DESTROY(_lastView);
|
||||
}
|
||||
if (wasKey == YES || [v acceptsFirstMouse: theEvent] == YES)
|
||||
{
|
||||
if ([NSHelpManager isContextHelpModeActive])
|
||||
|
@ -243,12 +248,10 @@ Code shared with [NSWindow -sendEvent:], remember to update both places.
|
|||
}
|
||||
}
|
||||
_lastPoint = [theEvent locationInWindow];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
[super sendEvent: theEvent];
|
||||
break;
|
||||
return;
|
||||
}
|
||||
[super sendEvent: theEvent];
|
||||
}
|
||||
|
||||
@end /* NSPanel */
|
||||
|
|
|
@ -2839,6 +2839,19 @@ resetCursorRectsForView(NSView *theView)
|
|||
NSView *v;
|
||||
NSEventType type;
|
||||
|
||||
/*
|
||||
If the backend reacts slowly, events (eg. mouse down) might arrive for a
|
||||
window that has been ordered out (and thus is logically invisible). We
|
||||
need to ignore those events. Otherwise, eg. clicking twice on a button
|
||||
that ends a modal session and closes the window with the button might
|
||||
cause the button to be pressed twice, which causes Bad Things to happen
|
||||
when it tries to stop a modal session twice.
|
||||
|
||||
We let NSAppKitDefined events through since they deal with window ordering.
|
||||
*/
|
||||
if (!_f.visible && [theEvent type] != NSAppKitDefined)
|
||||
return;
|
||||
|
||||
if (!_f.cursor_rects_valid)
|
||||
{
|
||||
[self resetCursorRects];
|
||||
|
|
Loading…
Reference in a new issue