From d09426e14b0b7cf12b1503f955cc22ed4b33fa66 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Tue, 3 Jul 2001 18:14:35 +0000 Subject: [PATCH] Spare two method calls when on mouse down git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10282 72102866-910b-0410-8b05-ffd578937521 --- Source/NSPopUpButton.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/NSPopUpButton.m b/Source/NSPopUpButton.m index fba125c21..dc84749c0 100644 --- a/Source/NSPopUpButton.m +++ b/Source/NSPopUpButton.m @@ -317,6 +317,7 @@ Class _nspopupbuttonCellClass = 0; NSEvent *e; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSPoint p; + NSWindow *menuWindow = [mr window]; if ([self isEnabled] == NO) return; @@ -326,23 +327,23 @@ Class _nspopupbuttonCellClass = 0; // Attach the popUp [_cell attachPopUpWithFrame: _bounds - inView: self]; - + inView: self]; + p = [_window convertBaseToScreen: [theEvent locationInWindow]]; - p = [[mr window] convertScreenToBase: p]; - + p = [menuWindow convertScreenToBase: p]; + // Process events; we start menu events processing by converting // this event to the menu window, and sending it there. e = [NSEvent mouseEventWithType: [theEvent type] location: p modifierFlags: [theEvent modifierFlags] timestamp: [theEvent timestamp] - windowNumber: [[mr window] windowNumber] + windowNumber: [menuWindow windowNumber] context: nil // TODO ? eventNumber: [theEvent eventNumber] clickCount: [theEvent clickCount] pressure: [theEvent pressure]]; - [[mr window] sendEvent: e]; + [menuWindow sendEvent: e]; // Update our selected item [self synchronizeTitleAndSelectedItem];