aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2012-08-27 20:53:10 +0200
committerJan Djärv2012-08-27 20:53:10 +0200
commit0f19feff2536f40cd10c3b7201ecd89e40148626 (patch)
tree81545ee3d78c04070cafef3243dfff112fdf4927 /src
parentde1339b0a8a5b6b8bf784c816b2b974f4610e3ac (diff)
downloademacs-0f19feff2536f40cd10c3b7201ecd89e40148626.tar.gz
emacs-0f19feff2536f40cd10c3b7201ecd89e40148626.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/nsmenu.m29
-rw-r--r--src/nsterm.h1
3 files changed, 39 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 15d5211efd9..79735225542 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12012-08-27 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsterm.h (NSPanel): New class variable dialog_return.
4
5 * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
6 dialog_return.
7 (windowShouldClose:): Use stop instead of stopModalWithCode.
8 (clicked:): Ditto, and also set dialog_return (Bug#12258).
9 (timeout_handler:): Use stop instead of abortModal. Send a dummy
10 event.
11 (runDialogAt:): Make ret Lisp_Object. Set it from dialog_return when
12 modal loop returns.
13
12012-08-27 Paul Eggert <eggert@cs.ucla.edu> 142012-08-27 Paul Eggert <eggert@cs.ucla.edu>
2 15
3 * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans. 16 * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
diff --git a/src/nsmenu.m b/src/nsmenu.m
index e8a0b43a01b..ab285f26df2 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1497,6 +1497,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1497 FlippedView *contentView; 1497 FlippedView *contentView;
1498 NSImage *img; 1498 NSImage *img;
1499 1499
1500 dialog_return = Qundefined;
1500 area.origin.x = 3*SPACER; 1501 area.origin.x = 3*SPACER;
1501 area.origin.y = 2*SPACER; 1502 area.origin.y = 2*SPACER;
1502 area.size.width = ICONSIZE; 1503 area.size.width = ICONSIZE;
@@ -1584,7 +1585,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1584 1585
1585- (BOOL)windowShouldClose: (id)sender 1586- (BOOL)windowShouldClose: (id)sender
1586{ 1587{
1587 [NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!! 1588 [NSApp stop:self];
1588 return NO; 1589 return NO;
1589} 1590}
1590 1591
@@ -1673,7 +1674,11 @@ void process_dialog (id window, Lisp_Object list)
1673 1674
1674 seltag = [[sellist objectAtIndex: 0] tag]; 1675 seltag = [[sellist objectAtIndex: 0] tag];
1675 if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!! 1676 if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!!
1676 [NSApp stopModalWithCode: seltag]; 1677 {
1678 dialog_return = seltag;
1679 [NSApp stop:self];
1680 }
1681
1677 return self; 1682 return self;
1678} 1683}
1679 1684
@@ -1756,13 +1761,27 @@ void process_dialog (id window, Lisp_Object list)
1756 1761
1757- (void)timeout_handler: (NSTimer *)timedEntry 1762- (void)timeout_handler: (NSTimer *)timedEntry
1758{ 1763{
1764 NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined
1765 location: NSMakePoint (0, 0)
1766 modifierFlags: 0
1767 timestamp: 0
1768 windowNumber: [[NSApp mainWindow] windowNumber]
1769 context: [NSApp context]
1770 subtype: 0
1771 data1: 0
1772 data2: 0];
1773
1759 timer_fired = 1; 1774 timer_fired = 1;
1760 [NSApp abortModal]; 1775 /* We use sto because stopModal/abortModal out of the main loop does not
1776 seem to work in 10.6. But as we use stop we must send a real event so
1777 the stop is seen and acted upon. */
1778 [NSApp stop:self];
1779 [NSApp postEvent: nxev atStart: NO];
1761} 1780}
1762 1781
1763- (Lisp_Object)runDialogAt: (NSPoint)p 1782- (Lisp_Object)runDialogAt: (NSPoint)p
1764{ 1783{
1765 NSInteger ret = 0; 1784 Lisp_Object ret = Qundefined;
1766 1785
1767 while (popup_activated_flag) 1786 while (popup_activated_flag)
1768 { 1787 {
@@ -1781,7 +1800,9 @@ void process_dialog (id window, Lisp_Object list)
1781 forMode: NSModalPanelRunLoopMode]; 1800 forMode: NSModalPanelRunLoopMode];
1782 } 1801 }
1783 timer_fired = 0; 1802 timer_fired = 0;
1803 dialog_return = Qundefined;
1784 ret = [NSApp runModalForWindow: self]; 1804 ret = [NSApp runModalForWindow: self];
1805 ret = dialog_return;
1785 if (! timer_fired) 1806 if (! timer_fired)
1786 { 1807 {
1787 if (tmo != nil) [tmo invalidate]; /* Cancels timer */ 1808 if (tmo != nil) [tmo invalidate]; /* Cancels timer */
diff --git a/src/nsterm.h b/src/nsterm.h
index 54f4a4ec89e..72b8d13cc47 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -196,6 +196,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
196 NSMatrix *matrix; 196 NSMatrix *matrix;
197 int rows, cols; 197 int rows, cols;
198 int timer_fired; 198 int timer_fired;
199 Lisp_Object dialog_return;
199 } 200 }
200- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ; 201- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
201- addButton: (char *)str value: (Lisp_Object)val row: (int)row; 202- addButton: (char *)str value: (Lisp_Object)val row: (int)row;