mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-17 08:31:09 -08:00
* nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
dialog_return. (windowShouldClose:): Use stop instead of stopModalWithCode. (clicked:): Ditto, and also set dialog_return. (timeout_handler:): Use stop instead of abortModal. Send a dummy event. (runDialogAt:): Make ret Lisp_Object. Set it from dialog_return when modal loop returns. * nsterm.h (NSPanel): New class variable dialog_return. Fixes: debbugs:12258
This commit is contained in:
parent
de1339b0a8
commit
0f19feff25
3 changed files with 39 additions and 4 deletions
|
|
@ -1,3 +1,16 @@
|
|||
2012-08-27 Jan Djärv <jan.h.d@swipnet.se>
|
||||
|
||||
* nsterm.h (NSPanel): New class variable dialog_return.
|
||||
|
||||
* nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
|
||||
dialog_return.
|
||||
(windowShouldClose:): Use stop instead of stopModalWithCode.
|
||||
(clicked:): Ditto, and also set dialog_return (Bug#12258).
|
||||
(timeout_handler:): Use stop instead of abortModal. Send a dummy
|
||||
event.
|
||||
(runDialogAt:): Make ret Lisp_Object. Set it from dialog_return when
|
||||
modal loop returns.
|
||||
|
||||
2012-08-27 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
|
||||
|
|
|
|||
29
src/nsmenu.m
29
src/nsmenu.m
|
|
@ -1497,6 +1497,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
|
|||
FlippedView *contentView;
|
||||
NSImage *img;
|
||||
|
||||
dialog_return = Qundefined;
|
||||
area.origin.x = 3*SPACER;
|
||||
area.origin.y = 2*SPACER;
|
||||
area.size.width = ICONSIZE;
|
||||
|
|
@ -1584,7 +1585,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
|
|||
|
||||
- (BOOL)windowShouldClose: (id)sender
|
||||
{
|
||||
[NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!!
|
||||
[NSApp stop:self];
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
@ -1673,7 +1674,11 @@ void process_dialog (id window, Lisp_Object list)
|
|||
|
||||
seltag = [[sellist objectAtIndex: 0] tag];
|
||||
if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!!
|
||||
[NSApp stopModalWithCode: seltag];
|
||||
{
|
||||
dialog_return = seltag;
|
||||
[NSApp stop:self];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
@ -1756,13 +1761,27 @@ void process_dialog (id window, Lisp_Object list)
|
|||
|
||||
- (void)timeout_handler: (NSTimer *)timedEntry
|
||||
{
|
||||
NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined
|
||||
location: NSMakePoint (0, 0)
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: [[NSApp mainWindow] windowNumber]
|
||||
context: [NSApp context]
|
||||
subtype: 0
|
||||
data1: 0
|
||||
data2: 0];
|
||||
|
||||
timer_fired = 1;
|
||||
[NSApp abortModal];
|
||||
/* We use sto because stopModal/abortModal out of the main loop does not
|
||||
seem to work in 10.6. But as we use stop we must send a real event so
|
||||
the stop is seen and acted upon. */
|
||||
[NSApp stop:self];
|
||||
[NSApp postEvent: nxev atStart: NO];
|
||||
}
|
||||
|
||||
- (Lisp_Object)runDialogAt: (NSPoint)p
|
||||
{
|
||||
NSInteger ret = 0;
|
||||
Lisp_Object ret = Qundefined;
|
||||
|
||||
while (popup_activated_flag)
|
||||
{
|
||||
|
|
@ -1781,7 +1800,9 @@ void process_dialog (id window, Lisp_Object list)
|
|||
forMode: NSModalPanelRunLoopMode];
|
||||
}
|
||||
timer_fired = 0;
|
||||
dialog_return = Qundefined;
|
||||
ret = [NSApp runModalForWindow: self];
|
||||
ret = dialog_return;
|
||||
if (! timer_fired)
|
||||
{
|
||||
if (tmo != nil) [tmo invalidate]; /* Cancels timer */
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
NSMatrix *matrix;
|
||||
int rows, cols;
|
||||
int timer_fired;
|
||||
Lisp_Object dialog_return;
|
||||
}
|
||||
- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
|
||||
- addButton: (char *)str value: (Lisp_Object)val row: (int)row;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue