[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108100: Backports for 12005, 1167
From: |
Jan D. |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108100: Backports for 12005, 11670 and 12043. |
Date: |
Sun, 12 Aug 2012 11:31:53 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108100
committer: Jan D. <address@hidden>
branch nick: emacs-24
timestamp: Sun 2012-08-12 11:31:53 +0200
message:
Backports for 12005, 11670 and 12043.
* nsmenu.m (ns_update_menubar): Add braces to ambigous if-else.
* nsmenu.m (Popdown_data): New struct.
(pop_down_menu): p->pointer is Popdown_data. Release the pool and
free Popdown_data.
(ns_popup_dialog): Use NSAutoreleasePool and pass it to pop_down_menu.
(initWithContentRect): Make imgView and contentView non-static
and autorelease them. Also autorelease img and matrix.
(dealloc): Remove (Bug#12005).
* nsterm.m (keyDown:): Interpret flags without left/right bits
as the left key (Bug#11670).
* nsterm.m (ns_read_socket): Return early if there is a modal
window (Bug#12043).
modified:
src/ChangeLog
src/nsmenu.m
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-08-08 05:44:53 +0000
+++ b/src/ChangeLog 2012-08-12 09:31:53 +0000
@@ -1,3 +1,21 @@
+2012-08-12 Jan Djärv <address@hidden>
+
+ * nsterm.m (ns_read_socket): Return early if there is a modal
+ window (Bug#12043).
+
+ * nsmenu.m (Popdown_data): New struct.
+ (pop_down_menu): p->pointer is Popdown_data. Release the pool and
+ free Popdown_data.
+ (ns_popup_dialog): Use NSAutoreleasePool and pass it to pop_down_menu.
+ (initWithContentRect): Make imgView and contentView non-static
+ and autorelease them. Also autorelease img and matrix (Bug#12005).
+ (dealloc): Remove (Bug#12005).
+
+ * nsterm.m (keyDown:): Interpret flags without left/right bits
+ as the left key (Bug#11670).
+
+ * nsmenu.m (ns_update_menubar): Add braces to ambigous if-else.
+
2012-08-08 YAMAMOTO Mitsuharu <address@hidden>
* unexmacosx.c (copy_data_segment): Copy initialized data in
=== modified file 'src/nsmenu.m'
--- a/src/nsmenu.m 2012-01-19 07:21:25 +0000
+++ b/src/nsmenu.m 2012-08-12 09:31:53 +0000
@@ -422,11 +422,13 @@
if (EQ (string, make_number (0))) // FIXME: Why??? --Stef
continue;
if (NILP (string))
- if (previous_strings[i][0])
- break;
- else
- continue;
- if (strncmp (previous_strings[i], SDATA (string), 10))
+ {
+ if (previous_strings[i][0])
+ break;
+ else
+ continue;
+ }
+ else if (strncmp (previous_strings[i], SDATA (string), 10))
break;
}
@@ -1346,20 +1348,32 @@
==========================================================================
*/
+struct Popdown_data
+{
+ NSAutoreleasePool *pool;
+ EmacsDialogPanel *dialog;
+};
static Lisp_Object
pop_down_menu (Lisp_Object arg)
{
struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
+ struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer;
+
+ BLOCK_INPUT;
if (popup_activated_flag)
{
+ EmacsDialogPanel *panel = unwind_data->dialog;
popup_activated_flag = 0;
- BLOCK_INPUT;
[NSApp endModalSession: popupSession];
- [((EmacsDialogPanel *) (p->pointer)) close];
+ [panel close];
+ [unwind_data->pool release];
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
- UNBLOCK_INPUT;
}
+
+ xfree (unwind_data);
+ UNBLOCK_INPUT;
+
return Qnil;
}
@@ -1372,6 +1386,7 @@
struct frame *f;
NSPoint p;
BOOL isQ;
+ NSAutoreleasePool *pool;
NSTRACE (x-popup-dialog);
@@ -1426,11 +1441,17 @@
contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil));
BLOCK_INPUT;
+ pool = [[NSAutoreleasePool alloc] init];
dialog = [[EmacsDialogPanel alloc] initFromContents: contents
isQuestion: isQ];
{
int specpdl_count = SPECPDL_INDEX ();
- record_unwind_protect (pop_down_menu, make_save_value (dialog, 0));
+ struct Popdown_data *unwind_data = xmalloc (sizeof (*unwind_data));
+
+ unwind_data->pool = pool;
+ unwind_data->dialog = dialog;
+
+ record_unwind_protect (pop_down_menu, make_save_value (unwind_data, 0));
popup_activated_flag = 1;
tem = [dialog runDialogAt: p];
unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */
@@ -1473,24 +1494,22 @@
NSRect area;
char this_cmd_name[80];
id cell;
- static NSImageView *imgView;
- static FlippedView *contentView;
+ NSImageView *imgView;
+ FlippedView *contentView;
+ NSImage *img;
- if (imgView == nil)
- {
- NSImage *img;
- area.origin.x = 3*SPACER;
- area.origin.y = 2*SPACER;
- area.size.width = ICONSIZE;
- area.size.height= ICONSIZE;
- img = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
- [img setScalesWhenResized: YES];
- [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)];
- imgView = [[NSImageView alloc] initWithFrame: area];
- [imgView setImage: img];
- [imgView setEditable: NO];
- [img release];
- }
+ area.origin.x = 3*SPACER;
+ area.origin.y = 2*SPACER;
+ area.size.width = ICONSIZE;
+ area.size.height= ICONSIZE;
+ img = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
+ [img setScalesWhenResized: YES];
+ [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)];
+ imgView = [[NSImageView alloc] initWithFrame: area];
+ [imgView setImage: img];
+ [imgView setEditable: NO];
+ [img autorelease];
+ [imgView autorelease];
aStyle = NSTitledWindowMask;
flag = YES;
@@ -1499,6 +1518,8 @@
[super initWithContentRect: contentRect styleMask: aStyle
backing: backingType defer: flag];
contentView = [[FlippedView alloc] initWithFrame: [[self contentView]
frame]];
+ [contentView autorelease];
+
[self setContentView: contentView];
[[self contentView] setAutoresizesSubviews: YES];
@@ -1550,7 +1571,7 @@
numberOfRows: 0
numberOfColumns: 1];
[[self contentView] addSubview: matrix];
- [matrix release];
+ [matrix autorelease];
[matrix setFrameOrigin: NSMakePoint (area.origin.x,
area.origin.y + (TEXTHEIGHT+3*SPACER))];
[matrix setIntercellSpacing: spacing];
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2012-06-11 16:53:12 +0000
+++ b/src/nsterm.m 2012-08-12 09:31:53 +0000
@@ -3397,6 +3397,9 @@
/* NSTRACE (ns_read_socket); */
+ if ([NSApp modalWindow] != nil)
+ return -1;
+
if (interrupt_input_blocked)
{
interrupt_input_pending = 1;
@@ -4731,6 +4734,8 @@
if (!processingCompose)
{
+ int is_left_key, is_right_key;
+
code = ([[theEvent charactersIgnoringModifiers] length] == 0) ?
0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0];
/* (Carbon way: [theEvent keyCode]) */
@@ -4757,13 +4762,17 @@
if (flags & NSShiftKeyMask)
emacs_event->modifiers |= shift_modifier;
- if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask)
+ is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask;
+ is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask
+ || (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask);
+
+ if (is_right_key)
emacs_event->modifiers |= parse_solitary_modifier
(EQ (ns_right_command_modifier, Qleft)
? ns_command_modifier
: ns_right_command_modifier);
- if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask)
+ if (is_left_key)
{
emacs_event->modifiers |= parse_solitary_modifier
(ns_command_modifier);
@@ -4800,13 +4809,17 @@
}
}
- if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask)
+ is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask;
+ is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask
+ || (! is_right_key && (flags & NSControlKeyMask) == NSControlKeyMask);
+
+ if (is_right_key)
emacs_event->modifiers |= parse_solitary_modifier
(EQ (ns_right_control_modifier, Qleft)
? ns_control_modifier
: ns_right_control_modifier);
- if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask)
+ if (is_left_key)
emacs_event->modifiers |= parse_solitary_modifier
(ns_control_modifier);
@@ -4817,7 +4830,13 @@
left_is_none = NILP (ns_alternate_modifier)
|| EQ (ns_alternate_modifier, Qnone);
- if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)
+ is_right_key = (flags & NSRightAlternateKeyMask)
+ == NSRightAlternateKeyMask;
+ is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask
+ || (! is_right_key
+ && (flags & NSAlternateKeyMask) == NSAlternateKeyMask);
+
+ if (is_right_key)
{
if ((NILP (ns_right_alternate_modifier)
|| EQ (ns_right_alternate_modifier, Qnone)
@@ -4837,7 +4856,7 @@
: ns_right_alternate_modifier);
}
- if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /*
default = meta */
+ if (is_left_key) /* default = meta */
{
if (left_is_none && !fnKeysym)
{ /* accept pre-interp alt comb */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108100: Backports for 12005, 11670 and 12043.,
Jan D. <=