[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src nsmenu.m
From: |
Adrian Robert |
Subject: |
[Emacs-diffs] emacs/src nsmenu.m |
Date: |
Sat, 07 Feb 2009 11:03:52 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Adrian Robert <arobert> 09/02/07 11:03:52
Modified files:
src : nsmenu.m
Log message:
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined
event
when modal window is active. (Bug #2152)
(applicationShouldTerminate:): Remove now-unneeded while loop
around NSRunAlertPanel.
* nsmenu.m (popupSession): New file-global variable.
(pop_down_menu): End the popupSession before closing dialog.
(ns_popup_dialog): BLOCK_INPUT around dialog presentation.
(EmacsDialogPanel-runDialogAt:): Don't place window
(superfluous),
don't query NSApp for events (just sleep instead).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsmenu.m?cvsroot=emacs&r1=1.18&r2=1.19
Patches:
Index: nsmenu.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsmenu.m,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- nsmenu.m 4 Feb 2009 11:31:29 -0000 1.18
+++ nsmenu.m 7 Feb 2009 11:03:52 -0000 1.19
@@ -73,6 +73,7 @@
/* Nonzero means a menu is currently active. */
static int popup_activated_flag;
+static NSModalSession popupSession;
/* NOTE: toolbar implementation is at end,
following complete menu implementation. */
@@ -1495,6 +1496,7 @@
struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
popup_activated_flag = 0;
BLOCK_INPUT;
+ [NSApp endModalSession: popupSession];
[((EmacsDialogPanel *) (p->pointer)) close];
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
UNBLOCK_INPUT;
@@ -1554,6 +1556,8 @@
p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2;
p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2;
+
+ BLOCK_INPUT;
dialog = [[EmacsDialogPanel alloc] initFromContents: contents
isQuestion: isQ];
{
@@ -1567,6 +1571,7 @@
[dialog close];
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
+ UNBLOCK_INPUT;
return tem;
}
@@ -1872,27 +1877,21 @@
- (Lisp_Object)runDialogAt: (NSPoint)p
{
- NSEvent *e;
- NSModalSession session;
int ret;
- [self center]; /*XXX p ignored? */
- [self orderFront: NSApp];
-
- session = [NSApp beginModalSessionForWindow: self];
+ popupSession = [NSApp beginModalSessionForWindow: self];
while (popup_activated_flag
- && (ret = [NSApp runModalSession: session]) == NSRunContinuesResponse)
+ && (ret = [NSApp runModalSession: popupSession])
+ == NSRunContinuesResponse)
{
- timer_check (1); // for timers.el, indep of atimers; might not return
- e = [NSApp nextEventMatchingMask: NSAnyEventMask
- untilDate: [NSDate dateWithTimeIntervalSinceNow:
1]
- inMode: NSModalPanelRunLoopMode
- dequeue: NO];
-/*fprintf (stderr, "ret = %d\te = %p\n", ret, e);*/
+ /* Run this for timers.el, indep of atimers; might not return.
+ TODO: use return value to avoid calling every iteration. */
+ timer_check (1);
+ [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
}
- [NSApp endModalSession: session];
+ [NSApp endModalSession: popupSession];
- { // FIXME: BIG UGLY HACK!!!
+ { /* FIXME: BIG UGLY HACK!!! */
Lisp_Object tmp;
*(EMACS_INT*)(&tmp) = ret;
return tmp;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/src nsmenu.m,
Adrian Robert <=