diff options
| author | Jan Djärv | 2012-08-12 11:31:53 +0200 |
|---|---|---|
| committer | Jan Djärv | 2012-08-12 11:31:53 +0200 |
| commit | c17d5a38db885685aa57bf5560e9dedb1f494819 (patch) | |
| tree | 3013fcc2b35f9c8432498e5e56b0857f1534c07f /src | |
| parent | 711f4590cddbc83c509c1c5e852ef4e528a39780 (diff) | |
| download | emacs-c17d5a38db885685aa57bf5560e9dedb1f494819.tar.gz emacs-c17d5a38db885685aa57bf5560e9dedb1f494819.zip | |
Backports for 1995-05-29T20:16:10Z!kwzh@gnu.org, 1995-05-03T21:38:13Z!rms@gnu.org and 1995-05-31T19:46:12Z!kwzh@gnu.org.
* 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#1995-05-29T20:16:10Z!kwzh@gnu.org).
* nsterm.m (keyDown:): Interpret flags without left/right bits
as the left key (Bug#1995-05-03T21:38:13Z!rms@gnu.org).
* nsterm.m (ns_read_socket): Return early if there is a modal
window (Bug#1995-05-31T19:46:12Z!kwzh@gnu.org).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/nsmenu.m | 77 | ||||
| -rw-r--r-- | src/nsterm.m | 31 |
3 files changed, 92 insertions, 34 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 963179cb08f..3a0ea19c1b1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2012-08-12 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.m (ns_read_socket): Return early if there is a modal | ||
| 4 | window (Bug#12043). | ||
| 5 | |||
| 6 | * nsmenu.m (Popdown_data): New struct. | ||
| 7 | (pop_down_menu): p->pointer is Popdown_data. Release the pool and | ||
| 8 | free Popdown_data. | ||
| 9 | (ns_popup_dialog): Use NSAutoreleasePool and pass it to pop_down_menu. | ||
| 10 | (initWithContentRect): Make imgView and contentView non-static | ||
| 11 | and autorelease them. Also autorelease img and matrix (Bug#12005). | ||
| 12 | (dealloc): Remove (Bug#12005). | ||
| 13 | |||
| 14 | * nsterm.m (keyDown:): Interpret flags without left/right bits | ||
| 15 | as the left key (Bug#11670). | ||
| 16 | |||
| 17 | * nsmenu.m (ns_update_menubar): Add braces to ambigous if-else. | ||
| 18 | |||
| 1 | 2012-08-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 19 | 2012-08-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 20 | ||
| 3 | * unexmacosx.c (copy_data_segment): Copy initialized data in | 21 | * unexmacosx.c (copy_data_segment): Copy initialized data in |
diff --git a/src/nsmenu.m b/src/nsmenu.m index 7a6434941d2..1fb795243ae 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -422,11 +422,13 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 422 | if (EQ (string, make_number (0))) // FIXME: Why??? --Stef | 422 | if (EQ (string, make_number (0))) // FIXME: Why??? --Stef |
| 423 | continue; | 423 | continue; |
| 424 | if (NILP (string)) | 424 | if (NILP (string)) |
| 425 | if (previous_strings[i][0]) | 425 | { |
| 426 | break; | 426 | if (previous_strings[i][0]) |
| 427 | else | 427 | break; |
| 428 | continue; | 428 | else |
| 429 | if (strncmp (previous_strings[i], SDATA (string), 10)) | 429 | continue; |
| 430 | } | ||
| 431 | else if (strncmp (previous_strings[i], SDATA (string), 10)) | ||
| 430 | break; | 432 | break; |
| 431 | } | 433 | } |
| 432 | 434 | ||
| @@ -1346,20 +1348,32 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1346 | 1348 | ||
| 1347 | ========================================================================== */ | 1349 | ========================================================================== */ |
| 1348 | 1350 | ||
| 1351 | struct Popdown_data | ||
| 1352 | { | ||
| 1353 | NSAutoreleasePool *pool; | ||
| 1354 | EmacsDialogPanel *dialog; | ||
| 1355 | }; | ||
| 1349 | 1356 | ||
| 1350 | static Lisp_Object | 1357 | static Lisp_Object |
| 1351 | pop_down_menu (Lisp_Object arg) | 1358 | pop_down_menu (Lisp_Object arg) |
| 1352 | { | 1359 | { |
| 1353 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 1360 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 1361 | struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer; | ||
| 1362 | |||
| 1363 | BLOCK_INPUT; | ||
| 1354 | if (popup_activated_flag) | 1364 | if (popup_activated_flag) |
| 1355 | { | 1365 | { |
| 1366 | EmacsDialogPanel *panel = unwind_data->dialog; | ||
| 1356 | popup_activated_flag = 0; | 1367 | popup_activated_flag = 0; |
| 1357 | BLOCK_INPUT; | ||
| 1358 | [NSApp endModalSession: popupSession]; | 1368 | [NSApp endModalSession: popupSession]; |
| 1359 | [((EmacsDialogPanel *) (p->pointer)) close]; | 1369 | [panel close]; |
| 1370 | [unwind_data->pool release]; | ||
| 1360 | [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; | 1371 | [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; |
| 1361 | UNBLOCK_INPUT; | ||
| 1362 | } | 1372 | } |
| 1373 | |||
| 1374 | xfree (unwind_data); | ||
| 1375 | UNBLOCK_INPUT; | ||
| 1376 | |||
| 1363 | return Qnil; | 1377 | return Qnil; |
| 1364 | } | 1378 | } |
| 1365 | 1379 | ||
| @@ -1372,6 +1386,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1372 | struct frame *f; | 1386 | struct frame *f; |
| 1373 | NSPoint p; | 1387 | NSPoint p; |
| 1374 | BOOL isQ; | 1388 | BOOL isQ; |
| 1389 | NSAutoreleasePool *pool; | ||
| 1375 | 1390 | ||
| 1376 | NSTRACE (x-popup-dialog); | 1391 | NSTRACE (x-popup-dialog); |
| 1377 | 1392 | ||
| @@ -1426,11 +1441,17 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1426 | contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); | 1441 | contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); |
| 1427 | 1442 | ||
| 1428 | BLOCK_INPUT; | 1443 | BLOCK_INPUT; |
| 1444 | pool = [[NSAutoreleasePool alloc] init]; | ||
| 1429 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents | 1445 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents |
| 1430 | isQuestion: isQ]; | 1446 | isQuestion: isQ]; |
| 1431 | { | 1447 | { |
| 1432 | int specpdl_count = SPECPDL_INDEX (); | 1448 | int specpdl_count = SPECPDL_INDEX (); |
| 1433 | record_unwind_protect (pop_down_menu, make_save_value (dialog, 0)); | 1449 | struct Popdown_data *unwind_data = xmalloc (sizeof (*unwind_data)); |
| 1450 | |||
| 1451 | unwind_data->pool = pool; | ||
| 1452 | unwind_data->dialog = dialog; | ||
| 1453 | |||
| 1454 | record_unwind_protect (pop_down_menu, make_save_value (unwind_data, 0)); | ||
| 1434 | popup_activated_flag = 1; | 1455 | popup_activated_flag = 1; |
| 1435 | tem = [dialog runDialogAt: p]; | 1456 | tem = [dialog runDialogAt: p]; |
| 1436 | unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ | 1457 | unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ |
| @@ -1473,24 +1494,22 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1473 | NSRect area; | 1494 | NSRect area; |
| 1474 | char this_cmd_name[80]; | 1495 | char this_cmd_name[80]; |
| 1475 | id cell; | 1496 | id cell; |
| 1476 | static NSImageView *imgView; | 1497 | NSImageView *imgView; |
| 1477 | static FlippedView *contentView; | 1498 | FlippedView *contentView; |
| 1478 | 1499 | NSImage *img; | |
| 1479 | if (imgView == nil) | 1500 | |
| 1480 | { | 1501 | area.origin.x = 3*SPACER; |
| 1481 | NSImage *img; | 1502 | area.origin.y = 2*SPACER; |
| 1482 | area.origin.x = 3*SPACER; | 1503 | area.size.width = ICONSIZE; |
| 1483 | area.origin.y = 2*SPACER; | 1504 | area.size.height= ICONSIZE; |
| 1484 | area.size.width = ICONSIZE; | 1505 | img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; |
| 1485 | area.size.height= ICONSIZE; | 1506 | [img setScalesWhenResized: YES]; |
| 1486 | img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; | 1507 | [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; |
| 1487 | [img setScalesWhenResized: YES]; | 1508 | imgView = [[NSImageView alloc] initWithFrame: area]; |
| 1488 | [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; | 1509 | [imgView setImage: img]; |
| 1489 | imgView = [[NSImageView alloc] initWithFrame: area]; | 1510 | [imgView setEditable: NO]; |
| 1490 | [imgView setImage: img]; | 1511 | [img autorelease]; |
| 1491 | [imgView setEditable: NO]; | 1512 | [imgView autorelease]; |
| 1492 | [img release]; | ||
| 1493 | } | ||
| 1494 | 1513 | ||
| 1495 | aStyle = NSTitledWindowMask; | 1514 | aStyle = NSTitledWindowMask; |
| 1496 | flag = YES; | 1515 | flag = YES; |
| @@ -1499,6 +1518,8 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1499 | [super initWithContentRect: contentRect styleMask: aStyle | 1518 | [super initWithContentRect: contentRect styleMask: aStyle |
| 1500 | backing: backingType defer: flag]; | 1519 | backing: backingType defer: flag]; |
| 1501 | contentView = [[FlippedView alloc] initWithFrame: [[self contentView] frame]]; | 1520 | contentView = [[FlippedView alloc] initWithFrame: [[self contentView] frame]]; |
| 1521 | [contentView autorelease]; | ||
| 1522 | |||
| 1502 | [self setContentView: contentView]; | 1523 | [self setContentView: contentView]; |
| 1503 | 1524 | ||
| 1504 | [[self contentView] setAutoresizesSubviews: YES]; | 1525 | [[self contentView] setAutoresizesSubviews: YES]; |
| @@ -1550,7 +1571,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1550 | numberOfRows: 0 | 1571 | numberOfRows: 0 |
| 1551 | numberOfColumns: 1]; | 1572 | numberOfColumns: 1]; |
| 1552 | [[self contentView] addSubview: matrix]; | 1573 | [[self contentView] addSubview: matrix]; |
| 1553 | [matrix release]; | 1574 | [matrix autorelease]; |
| 1554 | [matrix setFrameOrigin: NSMakePoint (area.origin.x, | 1575 | [matrix setFrameOrigin: NSMakePoint (area.origin.x, |
| 1555 | area.origin.y + (TEXTHEIGHT+3*SPACER))]; | 1576 | area.origin.y + (TEXTHEIGHT+3*SPACER))]; |
| 1556 | [matrix setIntercellSpacing: spacing]; | 1577 | [matrix setIntercellSpacing: spacing]; |
diff --git a/src/nsterm.m b/src/nsterm.m index aad1f3283d6..33318315889 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -3397,6 +3397,9 @@ ns_read_socket (struct terminal *terminal, int expected, | |||
| 3397 | 3397 | ||
| 3398 | /* NSTRACE (ns_read_socket); */ | 3398 | /* NSTRACE (ns_read_socket); */ |
| 3399 | 3399 | ||
| 3400 | if ([NSApp modalWindow] != nil) | ||
| 3401 | return -1; | ||
| 3402 | |||
| 3400 | if (interrupt_input_blocked) | 3403 | if (interrupt_input_blocked) |
| 3401 | { | 3404 | { |
| 3402 | interrupt_input_pending = 1; | 3405 | interrupt_input_pending = 1; |
| @@ -4731,6 +4734,8 @@ ns_term_shutdown (int sig) | |||
| 4731 | 4734 | ||
| 4732 | if (!processingCompose) | 4735 | if (!processingCompose) |
| 4733 | { | 4736 | { |
| 4737 | int is_left_key, is_right_key; | ||
| 4738 | |||
| 4734 | code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? | 4739 | code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? |
| 4735 | 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; | 4740 | 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; |
| 4736 | /* (Carbon way: [theEvent keyCode]) */ | 4741 | /* (Carbon way: [theEvent keyCode]) */ |
| @@ -4757,13 +4762,17 @@ ns_term_shutdown (int sig) | |||
| 4757 | if (flags & NSShiftKeyMask) | 4762 | if (flags & NSShiftKeyMask) |
| 4758 | emacs_event->modifiers |= shift_modifier; | 4763 | emacs_event->modifiers |= shift_modifier; |
| 4759 | 4764 | ||
| 4760 | if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask) | 4765 | is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask; |
| 4766 | is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask | ||
| 4767 | || (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask); | ||
| 4768 | |||
| 4769 | if (is_right_key) | ||
| 4761 | emacs_event->modifiers |= parse_solitary_modifier | 4770 | emacs_event->modifiers |= parse_solitary_modifier |
| 4762 | (EQ (ns_right_command_modifier, Qleft) | 4771 | (EQ (ns_right_command_modifier, Qleft) |
| 4763 | ? ns_command_modifier | 4772 | ? ns_command_modifier |
| 4764 | : ns_right_command_modifier); | 4773 | : ns_right_command_modifier); |
| 4765 | 4774 | ||
| 4766 | if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask) | 4775 | if (is_left_key) |
| 4767 | { | 4776 | { |
| 4768 | emacs_event->modifiers |= parse_solitary_modifier | 4777 | emacs_event->modifiers |= parse_solitary_modifier |
| 4769 | (ns_command_modifier); | 4778 | (ns_command_modifier); |
| @@ -4800,13 +4809,17 @@ ns_term_shutdown (int sig) | |||
| 4800 | } | 4809 | } |
| 4801 | } | 4810 | } |
| 4802 | 4811 | ||
| 4803 | if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask) | 4812 | is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask; |
| 4813 | is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask | ||
| 4814 | || (! is_right_key && (flags & NSControlKeyMask) == NSControlKeyMask); | ||
| 4815 | |||
| 4816 | if (is_right_key) | ||
| 4804 | emacs_event->modifiers |= parse_solitary_modifier | 4817 | emacs_event->modifiers |= parse_solitary_modifier |
| 4805 | (EQ (ns_right_control_modifier, Qleft) | 4818 | (EQ (ns_right_control_modifier, Qleft) |
| 4806 | ? ns_control_modifier | 4819 | ? ns_control_modifier |
| 4807 | : ns_right_control_modifier); | 4820 | : ns_right_control_modifier); |
| 4808 | 4821 | ||
| 4809 | if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask) | 4822 | if (is_left_key) |
| 4810 | emacs_event->modifiers |= parse_solitary_modifier | 4823 | emacs_event->modifiers |= parse_solitary_modifier |
| 4811 | (ns_control_modifier); | 4824 | (ns_control_modifier); |
| 4812 | 4825 | ||
| @@ -4817,7 +4830,13 @@ ns_term_shutdown (int sig) | |||
| 4817 | left_is_none = NILP (ns_alternate_modifier) | 4830 | left_is_none = NILP (ns_alternate_modifier) |
| 4818 | || EQ (ns_alternate_modifier, Qnone); | 4831 | || EQ (ns_alternate_modifier, Qnone); |
| 4819 | 4832 | ||
| 4820 | if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask) | 4833 | is_right_key = (flags & NSRightAlternateKeyMask) |
| 4834 | == NSRightAlternateKeyMask; | ||
| 4835 | is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask | ||
| 4836 | || (! is_right_key | ||
| 4837 | && (flags & NSAlternateKeyMask) == NSAlternateKeyMask); | ||
| 4838 | |||
| 4839 | if (is_right_key) | ||
| 4821 | { | 4840 | { |
| 4822 | if ((NILP (ns_right_alternate_modifier) | 4841 | if ((NILP (ns_right_alternate_modifier) |
| 4823 | || EQ (ns_right_alternate_modifier, Qnone) | 4842 | || EQ (ns_right_alternate_modifier, Qnone) |
| @@ -4837,7 +4856,7 @@ ns_term_shutdown (int sig) | |||
| 4837 | : ns_right_alternate_modifier); | 4856 | : ns_right_alternate_modifier); |
| 4838 | } | 4857 | } |
| 4839 | 4858 | ||
| 4840 | if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */ | 4859 | if (is_left_key) /* default = meta */ |
| 4841 | { | 4860 | { |
| 4842 | if (left_is_none && !fnKeysym) | 4861 | if (left_is_none && !fnKeysym) |
| 4843 | { /* accept pre-interp alt comb */ | 4862 | { /* accept pre-interp alt comb */ |