diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 200 | ||||
| -rw-r--r-- | src/alloc.c | 37 | ||||
| -rw-r--r-- | src/buffer.c | 31 | ||||
| -rw-r--r-- | src/coding.c | 4 | ||||
| -rw-r--r-- | src/data.c | 2 | ||||
| -rw-r--r-- | src/dispextern.h | 4 | ||||
| -rw-r--r-- | src/emacs.c | 4 | ||||
| -rw-r--r-- | src/eval.c | 15 | ||||
| -rw-r--r-- | src/fileio.c | 4 | ||||
| -rw-r--r-- | src/fns.c | 4 | ||||
| -rw-r--r-- | src/frame.c | 12 | ||||
| -rw-r--r-- | src/gtkutil.c | 42 | ||||
| -rw-r--r-- | src/image.c | 11 | ||||
| -rw-r--r-- | src/keyboard.c | 10 | ||||
| -rw-r--r-- | src/lisp.h | 8 | ||||
| -rw-r--r-- | src/lread.c | 6 | ||||
| -rw-r--r-- | src/mac.c | 344 | ||||
| -rw-r--r-- | src/macfns.c | 157 | ||||
| -rw-r--r-- | src/macgui.h | 28 | ||||
| -rw-r--r-- | src/macterm.c | 748 | ||||
| -rw-r--r-- | src/macterm.h | 9 | ||||
| -rw-r--r-- | src/process.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 450 | ||||
| -rw-r--r-- | src/xfaces.c | 3 | ||||
| -rw-r--r-- | src/xfns.c | 10 | ||||
| -rw-r--r-- | src/xmenu.c | 43 |
26 files changed, 1459 insertions, 729 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8d09c5bfd2f..26ea457a2fe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,203 @@ | |||
| 1 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xmenu.c (popup_get_selection): Only pop down dialogs | ||
| 4 | on C-g and Escape. | ||
| 5 | (popup_get_selection): Remove parameter down_on_keypress. | ||
| 6 | (create_and_show_popup_menu, create_and_show_dialog): Remove | ||
| 7 | parameter down_on_keypress to popup_get_selection. | ||
| 8 | |||
| 9 | 2004-12-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 10 | |||
| 11 | * dispextern.h: Change HAVE_CARBON to MAC_OS. | ||
| 12 | (struct glyph_string): Likewise. | ||
| 13 | * emacs.c (main) [MAC_OS8]: Call mac_term_init instead of | ||
| 14 | mac_initialize. | ||
| 15 | * fileio.c (Fnext_read_file_uses_dialog_p, Fread_file_name): | ||
| 16 | Change TARGET_API_MAC_CARBON to HAVE_CARBON. | ||
| 17 | * fns.c (vector): Change MAC_OSX to MAC_OS. | ||
| 18 | * frame.c (x_set_frame_parameters, x_report_frame_params) | ||
| 19 | (x_set_fullscreen): Remove #ifndef HAVE_CARBON. | ||
| 20 | (x_set_border_width, Vdefault_frame_scroll_bars): Change | ||
| 21 | HAVE_CARBON to MAC_OS. | ||
| 22 | * image.c [MAC_OS]: Include sys/stat.h. | ||
| 23 | [MAC_OS && !MAC_OSX]: Include sys/param.h, ImageCompression.h, and | ||
| 24 | QuickTimeComponents.h. | ||
| 25 | * mac.c [!MAC_OSX] (mac_wait_next_event): Add extern. | ||
| 26 | [!MAC_OSX] (select): Use mac_wait_next_event. | ||
| 27 | [!MAC_OSX] (run_mac_command): Change EXEC_SUFFIXES to | ||
| 28 | Vexec_suffixes. | ||
| 29 | [!MAC_OSX] (select, run_mac_command): Change `#ifdef | ||
| 30 | TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. | ||
| 31 | (mac_clear_font_name_table): Add extern. | ||
| 32 | (Fmac_clear_font_name_table): New defun. | ||
| 33 | (syms_of_mac): Defsubr it. | ||
| 34 | [MAC_OSX] (SELECT_POLLING_PERIOD_USEC): New define. | ||
| 35 | [MAC_OSX] (select_and_poll_event): New function. | ||
| 36 | [MAC_OSX] (sys_select): Use it. | ||
| 37 | [MAC_OSX && SELECT_USE_CFSOCKET] (socket_callback): New function. | ||
| 38 | [MAC_OSX && SELECT_USE_CFSOCKET] | ||
| 39 | (SELECT_TIMEOUT_THRESHOLD_RUNLOOP, EVENT_CLASS_SOCK): New defines. | ||
| 40 | [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Use CFSocket and | ||
| 41 | RunLoop for simultaneously monitoring two kinds of inputs, window | ||
| 42 | events and process outputs, without periodically polling. | ||
| 43 | * macfns.c (mac_initialized): Remove extern. | ||
| 44 | (stricmp): Put in #if 0. All callers changed to use xstricmp in | ||
| 45 | xfaces.c. | ||
| 46 | (strnicmp): Decrement `n' at the end of each loop, not the | ||
| 47 | beginning. | ||
| 48 | (check_mac): Use the term "Mac native windows" instead of "Mac | ||
| 49 | OS". | ||
| 50 | (check_x_display_info, x_display_info_for_name): Sync with xfns.c. | ||
| 51 | (mac_get_rdb_resource): New function (from w32reg.c). | ||
| 52 | (x_get_string_resource): Use it. | ||
| 53 | (install_window_handler): Add extern. | ||
| 54 | (mac_window): New function. | ||
| 55 | (Fx_create_frame): Use it instead of make_mac_frame. Set | ||
| 56 | parameter for Qfullscreen. Call x_wm_set_size_hint. | ||
| 57 | (Fx_open_connection, Fx_close_connection): New defuns. | ||
| 58 | (syms_of_macfns): Defsubr them. | ||
| 59 | (x_create_tip_frame) [TARGET_API_MAC_CARBON]: Add | ||
| 60 | kWindowNoUpdatesAttribute to the window attribute. | ||
| 61 | (x_create_tip_frame) [!TARGET_API_MAC_CARBON]: Use NewCWindow. | ||
| 62 | (x_create_tip_frame): Don't call ShowWindow. | ||
| 63 | (Fx_show_tip): Call ShowWindow. | ||
| 64 | (Fx_file_dialog): Change `#ifdef TARGET_API_MAC_CARBON' to `#if | ||
| 65 | TARGET_API_MAC_CARBON'. | ||
| 66 | (mac_frame_parm_handlers): Set handlers for Qfullscreen. | ||
| 67 | (syms_of_macfns) [MAC_OSX]: Initialize mac_in_use to 0. | ||
| 68 | * macgui.h [!MAC_OSX]: Don't include Controls.h. Include | ||
| 69 | Windows.h. | ||
| 70 | (Window): Typedef to WindowPtr and move outside `#if | ||
| 71 | TARGET_API_MAC_CARBON'. | ||
| 72 | (XSizeHints): New struct. | ||
| 73 | * macterm.c (x_update_begin, x_update_end) | ||
| 74 | [TARGET_API_MAC_CARBON]: Disable screen updates during update of a | ||
| 75 | frame. | ||
| 76 | (x_draw_glyph_string_background, x_draw_glyph_string_foreground) | ||
| 77 | [MAC_OS8]: Use XDrawImageString/XDrawImageString16. | ||
| 78 | (construct_mouse_click): Put in #if 0. | ||
| 79 | (x_check_fullscreen, x_check_fullscreen_move): Remove decls. | ||
| 80 | (x_scroll_bar_create, x_scroll_bar_handle_click): Change `#ifdef | ||
| 81 | TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. | ||
| 82 | (activate_scroll_bars, deactivate_scroll_bars) | ||
| 83 | [!TARGET_API_MAC_CARBON]: Use ActivateControl/DeactivateControl. | ||
| 84 | (x_make_frame_visible) [TARGET_API_MAC_CARBON]: Reposition window | ||
| 85 | if the position is neither user-specified nor program-specified. | ||
| 86 | (x_free_frame_resources): Free size_hints. | ||
| 87 | (x_wm_set_size_hint): Allocate size_hints if needed. Set | ||
| 88 | size_hints. | ||
| 89 | (mac_clear_font_name_table): New function. | ||
| 90 | (mac_do_list_fonts): Initialize font_name_table if needed. | ||
| 91 | (x_list_fonts): Don't initialize font_name_table. Add BLOCK_INPUT | ||
| 92 | around mac_do_list_fonts. | ||
| 93 | (mac_unload_font): New function. | ||
| 94 | (x_load_font): Add BLOCK_INPUT around XLoadQueryFont. | ||
| 95 | (init_mac_drag_n_drop, mac_do_receive_drag): Enclose declarations | ||
| 96 | and definitions with #if TARGET_API_MAC_CARBON. | ||
| 97 | [USE_CARBON_EVENTS] (mac_handle_window_event): Add decl. | ||
| 98 | (install_window_handler): Add decl. | ||
| 99 | (do_window_update): Add BeginUpdate/EndUpdate for the tooltip | ||
| 100 | window. Use UpdateControls. Get the rectangle that should be | ||
| 101 | updated and restrict the target of expose_frame to it. | ||
| 102 | (do_grow_window): Set minimum height/width according to | ||
| 103 | size_hints. | ||
| 104 | (do_grow_window) [TARGET_API_MAC_CARBON]: Use ResizeWindow. | ||
| 105 | (do_zoom_window): Don't use x_set_window_size. | ||
| 106 | [USE_CARBON_EVENTS] (mac_handle_window_event): New function. | ||
| 107 | (install_window_handler): New function. | ||
| 108 | [!USE_CARBON_EVENTS] (mouse_region): New variable. | ||
| 109 | [!USE_CARBON_EVENTS] (mac_wait_next_event): New function. | ||
| 110 | (XTread_socket) [USE_CARBON_EVENTS]: Move call to | ||
| 111 | GetEventDispatcherTarget inside BLOCK_INPUT. | ||
| 112 | (XTread_socket) [!USE_CARBON_EVENTS]: Use mac_wait_next_event. | ||
| 113 | Update mouse_region when mouse is moved. | ||
| 114 | (make_mac_frame): Remove. | ||
| 115 | (make_mac_terminal_frame): Put in #ifdef MAC_OS8. Initialize | ||
| 116 | mouse pointer shapes. Change values of f->left_pos and | ||
| 117 | f->top_pos. Don't use make_mac_frame. Use NewCWindow. Don't | ||
| 118 | call ShowWindow. | ||
| 119 | (mac_initialize_display_info) [MAC_OSX]: Create mac_id_name from | ||
| 120 | Vinvocation_name and Vsystem_name. | ||
| 121 | (mac_make_rdb): New function (from w32term.c). | ||
| 122 | (mac_term_init): Use it. Add BLOCK_INPUT. Error if display has | ||
| 123 | already been opened. Don't pass argument to | ||
| 124 | mac_initialize_display_info. Don't set dpyinfo->height/width. | ||
| 125 | Add entries to x_display_list and x_display_name_list. | ||
| 126 | (x_delete_display): New function. | ||
| 127 | (mac_initialize): Don't call mac_initialize_display_info. | ||
| 128 | (syms_of_macterm) [!MAC_OSX]: Don't call Fprovide. | ||
| 129 | * macterm.h (check_mac): Add extern. | ||
| 130 | (struct mac_output): New member size_hints. | ||
| 131 | (FRAME_SIZE_HINTS): New macro. | ||
| 132 | (mac_unload_font): Add extern. | ||
| 133 | * xdisp.c (expose_window, expose_frame): Remove kludges for Mac. | ||
| 134 | * xfaces.c (clear_font_table) [MAC_OS]: call mac_unload_font. | ||
| 135 | |||
| 136 | 2004-12-27 Richard M. Stallman <rms@gnu.org> | ||
| 137 | |||
| 138 | * buffer.c (Fbuffer_disable_undo): Deleted (moved to simple.el). | ||
| 139 | (syms_of_buffer): Don't defsubr it. | ||
| 140 | |||
| 141 | * process.c (list_processes_1): Set undo_list instead | ||
| 142 | of calling Fbuffer_disable_undo. | ||
| 143 | |||
| 144 | * xdisp.c (single_display_spec_string_p): Renamed from | ||
| 145 | single_display_prop_string_p. | ||
| 146 | (single_display_spec_intangible_p): Renamed from | ||
| 147 | single_display_prop_intangible_p. | ||
| 148 | (handle_single_display_spec): Renamed from handle_single_display_prop. | ||
| 149 | Rewritten to be easier to understand. | ||
| 150 | |||
| 151 | * Change in load-history format. Functions now get (defun . NAME), | ||
| 152 | and variables get just NAME. | ||
| 153 | |||
| 154 | * data.c (Fdefalias): Use (defun . FN_NAME) in LOADHIST_ATTACH. | ||
| 155 | |||
| 156 | * eval.c (Fdefun, Fdefmacro): Use (defun . FN_NAME) in LOADHIST_ATTACH. | ||
| 157 | (Fdefvaralias, Fdefvar, Fdefconst): Use just SYM in LOADHIST_ATTACH. | ||
| 158 | (Qdefvar): Var deleted. | ||
| 159 | (syms_of_eval): Don't initialze it. | ||
| 160 | |||
| 161 | * lread.c (syms_of_lread) <load-history>: Doc fix. | ||
| 162 | |||
| 163 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 164 | |||
| 165 | * xmenu.c (popup_get_selection): Pop down on C-g. | ||
| 166 | (set_frame_menubar): Install translations for Lucid/Motif/Lesstif that | ||
| 167 | pops down menu on C-g. | ||
| 168 | (xdialog_show): If dialog popped down and no button in the dialog was | ||
| 169 | pushed, call Fsignal to quit. | ||
| 170 | (xmenu_show): In no toolkit version, if menu returns NO_SELECT call | ||
| 171 | Fsignal to quit. | ||
| 172 | |||
| 173 | * xfns.c (Fx_file_dialog): Motif/Lesstif version: Pop down on C-g. | ||
| 174 | |||
| 175 | * gtkutil.c (xg_initialize): Install bindings for C-g so that | ||
| 176 | dialogs and menus pop down. | ||
| 177 | |||
| 178 | 2004-12-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 179 | |||
| 180 | * gtkutil.c (update_frame_tool_bar): Make the value of | ||
| 181 | tool-bar-button-margin control margins of images in tool bar. | ||
| 182 | |||
| 183 | * alloc.c (check_depth): New variable. | ||
| 184 | (overrun_check_malloc, overrun_check_realloc): Only add | ||
| 185 | overhead and write check pattern if check_depth is 1 (to handle | ||
| 186 | recursive calls). Increase/decrease check_depth in entry/exit. | ||
| 187 | (overrun_check_free): Only check for overhead if check_depth is 1. | ||
| 188 | Increase/decrease check_depth in entry/exit. | ||
| 189 | |||
| 190 | 2004-12-23 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 191 | |||
| 192 | * keyboard.c (input_available_signal): Call SIGNAL_THREAD_CHECK | ||
| 193 | before touching input_available_clear_time, to avoid accessing it | ||
| 194 | from multiple threads. | ||
| 195 | |||
| 196 | 2004-12-23 Jason Rumney <jasonr@gnu.org> | ||
| 197 | |||
| 198 | * image.c (__WIN32__) [HAVE_NTGUI]: Define for correct behaviour | ||
| 199 | of JPEG library. | ||
| 200 | |||
| 1 | 2004-12-22 Richard M. Stallman <rms@gnu.org> | 201 | 2004-12-22 Richard M. Stallman <rms@gnu.org> |
| 2 | 202 | ||
| 3 | * emacs.c (main): If batch mode, set Vundo_outer_limit to nil. | 203 | * emacs.c (main): If batch mode, set Vundo_outer_limit to nil. |
diff --git a/src/alloc.c b/src/alloc.c index 7a6a1344d6c..eabbf5192f4 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -602,6 +602,27 @@ static char xmalloc_overrun_check_trailer[XMALLOC_OVERRUN_CHECK_SIZE] = | |||
| 602 | ((unsigned)(ptr[-4]) << 24)) | 602 | ((unsigned)(ptr[-4]) << 24)) |
| 603 | 603 | ||
| 604 | 604 | ||
| 605 | /* The call depth in overrun_check functions. For example, this might happen: | ||
| 606 | xmalloc() | ||
| 607 | overrun_check_malloc() | ||
| 608 | -> malloc -> (via hook)_-> emacs_blocked_malloc | ||
| 609 | -> overrun_check_malloc | ||
| 610 | call malloc (hooks are NULL, so real malloc is called). | ||
| 611 | malloc returns 10000. | ||
| 612 | add overhead, return 10016. | ||
| 613 | <- (back in overrun_check_malloc) | ||
| 614 | add overhead again, return 10032 | ||
| 615 | xmalloc returns 10032. | ||
| 616 | |||
| 617 | (time passes). | ||
| 618 | |||
| 619 | xfree(10032) | ||
| 620 | overrun_check_free(10032) | ||
| 621 | decrease overhed | ||
| 622 | free(10016) <- crash, because 10000 is the original pointer. */ | ||
| 623 | |||
| 624 | static int check_depth; | ||
| 625 | |||
| 605 | /* Like malloc, but wraps allocated block with header and trailer. */ | 626 | /* Like malloc, but wraps allocated block with header and trailer. */ |
| 606 | 627 | ||
| 607 | POINTER_TYPE * | 628 | POINTER_TYPE * |
| @@ -609,15 +630,17 @@ overrun_check_malloc (size) | |||
| 609 | size_t size; | 630 | size_t size; |
| 610 | { | 631 | { |
| 611 | register unsigned char *val; | 632 | register unsigned char *val; |
| 633 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; | ||
| 612 | 634 | ||
| 613 | val = (unsigned char *) malloc (size + XMALLOC_OVERRUN_CHECK_SIZE*2); | 635 | val = (unsigned char *) malloc (size + overhead); |
| 614 | if (val) | 636 | if (val && check_depth == 1) |
| 615 | { | 637 | { |
| 616 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 638 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); |
| 617 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 639 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 618 | XMALLOC_PUT_SIZE(val, size); | 640 | XMALLOC_PUT_SIZE(val, size); |
| 619 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 641 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); |
| 620 | } | 642 | } |
| 643 | --check_depth; | ||
| 621 | return (POINTER_TYPE *)val; | 644 | return (POINTER_TYPE *)val; |
| 622 | } | 645 | } |
| 623 | 646 | ||
| @@ -631,8 +654,10 @@ overrun_check_realloc (block, size) | |||
| 631 | size_t size; | 654 | size_t size; |
| 632 | { | 655 | { |
| 633 | register unsigned char *val = (unsigned char *)block; | 656 | register unsigned char *val = (unsigned char *)block; |
| 657 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; | ||
| 634 | 658 | ||
| 635 | if (val | 659 | if (val |
| 660 | && check_depth == 1 | ||
| 636 | && bcmp (xmalloc_overrun_check_header, | 661 | && bcmp (xmalloc_overrun_check_header, |
| 637 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 662 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 638 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 663 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| @@ -647,15 +672,16 @@ overrun_check_realloc (block, size) | |||
| 647 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 672 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); |
| 648 | } | 673 | } |
| 649 | 674 | ||
| 650 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + XMALLOC_OVERRUN_CHECK_SIZE*2); | 675 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); |
| 651 | 676 | ||
| 652 | if (val) | 677 | if (val && check_depth == 1) |
| 653 | { | 678 | { |
| 654 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 679 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); |
| 655 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 680 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 656 | XMALLOC_PUT_SIZE(val, size); | 681 | XMALLOC_PUT_SIZE(val, size); |
| 657 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 682 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); |
| 658 | } | 683 | } |
| 684 | --check_depth; | ||
| 659 | return (POINTER_TYPE *)val; | 685 | return (POINTER_TYPE *)val; |
| 660 | } | 686 | } |
| 661 | 687 | ||
| @@ -667,7 +693,9 @@ overrun_check_free (block) | |||
| 667 | { | 693 | { |
| 668 | unsigned char *val = (unsigned char *)block; | 694 | unsigned char *val = (unsigned char *)block; |
| 669 | 695 | ||
| 696 | ++check_depth; | ||
| 670 | if (val | 697 | if (val |
| 698 | && check_depth == 1 | ||
| 671 | && bcmp (xmalloc_overrun_check_header, | 699 | && bcmp (xmalloc_overrun_check_header, |
| 672 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 700 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 673 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 701 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| @@ -683,6 +711,7 @@ overrun_check_free (block) | |||
| 683 | } | 711 | } |
| 684 | 712 | ||
| 685 | free (val); | 713 | free (val); |
| 714 | --check_depth; | ||
| 686 | } | 715 | } |
| 687 | 716 | ||
| 688 | #undef malloc | 717 | #undef malloc |
diff --git a/src/buffer.c b/src/buffer.c index 2d931272467..38678dc5a49 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1251,29 +1251,6 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) | |||
| 1251 | return buf; | 1251 | return buf; |
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | DEFUN ("buffer-disable-undo", Fbuffer_disable_undo, Sbuffer_disable_undo, | ||
| 1255 | 0, 1, "", | ||
| 1256 | doc: /* Make BUFFER stop keeping undo information. | ||
| 1257 | No argument or nil as argument means do this for the current buffer. */) | ||
| 1258 | (buffer) | ||
| 1259 | register Lisp_Object buffer; | ||
| 1260 | { | ||
| 1261 | Lisp_Object real_buffer; | ||
| 1262 | |||
| 1263 | if (NILP (buffer)) | ||
| 1264 | XSETBUFFER (real_buffer, current_buffer); | ||
| 1265 | else | ||
| 1266 | { | ||
| 1267 | real_buffer = Fget_buffer (buffer); | ||
| 1268 | if (NILP (real_buffer)) | ||
| 1269 | nsberror (buffer); | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | XBUFFER (real_buffer)->undo_list = Qt; | ||
| 1273 | |||
| 1274 | return Qnil; | ||
| 1275 | } | ||
| 1276 | |||
| 1277 | DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, | 1254 | DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, |
| 1278 | 0, 1, "", | 1255 | 0, 1, "", |
| 1279 | doc: /* Start keeping undo information for buffer BUFFER. | 1256 | doc: /* Start keeping undo information for buffer BUFFER. |
| @@ -5671,9 +5648,10 @@ A value of nil means to use the scroll bar width from the window's frame. */); | |||
| 5671 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", ¤t_buffer->vertical_scroll_bar_type, | 5648 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", ¤t_buffer->vertical_scroll_bar_type, |
| 5672 | Qnil, | 5649 | Qnil, |
| 5673 | doc: /* *Position of this buffer's vertical scroll bar. | 5650 | doc: /* *Position of this buffer's vertical scroll bar. |
| 5674 | A value of left or right means to place the vertical scroll bar at that side | 5651 | The value takes effect whenever you display this buffer in a window. |
| 5675 | of the window; a value of nil means that this window has no vertical scroll bar. | 5652 | A value of `left' or `right' means put the vertical scroll bar at that side |
| 5676 | A value of t means to use the vertical scroll bar type from the window's frame. */); | 5653 | of the window; a value of nil means don't show any vertical scroll bars. |
| 5654 | A value of t (the default) means do whatever the window's frame specifies. */); | ||
| 5677 | 5655 | ||
| 5678 | DEFVAR_PER_BUFFER ("indicate-empty-lines", | 5656 | DEFVAR_PER_BUFFER ("indicate-empty-lines", |
| 5679 | ¤t_buffer->indicate_empty_lines, Qnil, | 5657 | ¤t_buffer->indicate_empty_lines, Qnil, |
| @@ -5951,7 +5929,6 @@ to the default frame line height. */); | |||
| 5951 | defsubr (&Sbuffer_modified_tick); | 5929 | defsubr (&Sbuffer_modified_tick); |
| 5952 | defsubr (&Srename_buffer); | 5930 | defsubr (&Srename_buffer); |
| 5953 | defsubr (&Sother_buffer); | 5931 | defsubr (&Sother_buffer); |
| 5954 | defsubr (&Sbuffer_disable_undo); | ||
| 5955 | defsubr (&Sbuffer_enable_undo); | 5932 | defsubr (&Sbuffer_enable_undo); |
| 5956 | defsubr (&Skill_buffer); | 5933 | defsubr (&Skill_buffer); |
| 5957 | defsubr (&Sset_buffer_major_mode); | 5934 | defsubr (&Sset_buffer_major_mode); |
diff --git a/src/coding.c b/src/coding.c index 3ddd7ea957d..ce78af7d8d3 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5877,7 +5877,6 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 5877 | REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG) | 5877 | REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG) |
| 5878 | REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG | 5878 | REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG |
| 5879 | Here, we are sure that NEW >= ORIG. */ | 5879 | Here, we are sure that NEW >= ORIG. */ |
| 5880 | float ratio; | ||
| 5881 | 5880 | ||
| 5882 | if (coding->produced <= coding->consumed) | 5881 | if (coding->produced <= coding->consumed) |
| 5883 | { | 5882 | { |
| @@ -5887,7 +5886,8 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 5887 | } | 5886 | } |
| 5888 | else | 5887 | else |
| 5889 | { | 5888 | { |
| 5890 | ratio = (coding->produced - coding->consumed) / coding->consumed; | 5889 | float ratio = coding->produced - coding->consumed; |
| 5890 | ratio /= coding->consumed; | ||
| 5891 | require = len_byte * ratio; | 5891 | require = len_byte * ratio; |
| 5892 | } | 5892 | } |
| 5893 | first = 0; | 5893 | first = 0; |
diff --git a/src/data.c b/src/data.c index 811619b58b3..be1e4d33bbb 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -723,7 +723,7 @@ determined by DEFINITION. */) | |||
| 723 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) | 723 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) |
| 724 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | 724 | LOADHIST_ATTACH (Fcons (Qt, symbol)); |
| 725 | definition = Ffset (symbol, definition); | 725 | definition = Ffset (symbol, definition); |
| 726 | LOADHIST_ATTACH (symbol); | 726 | LOADHIST_ATTACH (Fcons (Qdefun, symbol)); |
| 727 | if (!NILP (docstring)) | 727 | if (!NILP (docstring)) |
| 728 | Fput (symbol, Qfunction_documentation, docstring); | 728 | Fput (symbol, Qfunction_documentation, docstring); |
| 729 | return definition; | 729 | return definition; |
diff --git a/src/dispextern.h b/src/dispextern.h index d3d70b28cf8..b7dcfb799d0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -62,7 +62,7 @@ typedef XImage *XImagePtr; | |||
| 62 | typedef HDC XImagePtr_or_DC; | 62 | typedef HDC XImagePtr_or_DC; |
| 63 | #endif | 63 | #endif |
| 64 | 64 | ||
| 65 | #ifdef HAVE_CARBON | 65 | #ifdef MAC_OS |
| 66 | #include "macgui.h" | 66 | #include "macgui.h" |
| 67 | typedef struct mac_display_info Display_Info; | 67 | typedef struct mac_display_info Display_Info; |
| 68 | /* Mac equivalent of XImage. */ | 68 | /* Mac equivalent of XImage. */ |
| @@ -1166,7 +1166,7 @@ struct glyph_string | |||
| 1166 | unsigned for_overlaps_p : 1; | 1166 | unsigned for_overlaps_p : 1; |
| 1167 | 1167 | ||
| 1168 | /* The GC to use for drawing this glyph string. */ | 1168 | /* The GC to use for drawing this glyph string. */ |
| 1169 | #if defined(HAVE_X_WINDOWS) || defined(HAVE_CARBON) | 1169 | #if defined(HAVE_X_WINDOWS) || defined(MAC_OS) |
| 1170 | GC gc; | 1170 | GC gc; |
| 1171 | #endif | 1171 | #endif |
| 1172 | #if defined(HAVE_NTGUI) | 1172 | #if defined(HAVE_NTGUI) |
diff --git a/src/emacs.c b/src/emacs.c index b16ea78b9b8..cbe386d3296 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1307,7 +1307,7 @@ main (argc, argv | |||
| 1307 | creates a full-fledge output_mac type frame. This does not | 1307 | creates a full-fledge output_mac type frame. This does not |
| 1308 | work correctly before syms_of_textprop, syms_of_macfns, | 1308 | work correctly before syms_of_textprop, syms_of_macfns, |
| 1309 | syms_of_ccl, syms_of_fontset, syms_of_xterm, syms_of_search, | 1309 | syms_of_ccl, syms_of_fontset, syms_of_xterm, syms_of_search, |
| 1310 | syms_of_frame, mac_initialize, and init_keyboard have already | 1310 | syms_of_frame, mac_term_init, and init_keyboard have already |
| 1311 | been called. */ | 1311 | been called. */ |
| 1312 | syms_of_textprop (); | 1312 | syms_of_textprop (); |
| 1313 | syms_of_macfns (); | 1313 | syms_of_macfns (); |
| @@ -1319,7 +1319,7 @@ main (argc, argv | |||
| 1319 | syms_of_search (); | 1319 | syms_of_search (); |
| 1320 | syms_of_frame (); | 1320 | syms_of_frame (); |
| 1321 | 1321 | ||
| 1322 | mac_initialize (); | 1322 | mac_term_init (build_string ("Mac"), NULL, NULL); |
| 1323 | init_keyboard (); | 1323 | init_keyboard (); |
| 1324 | #endif | 1324 | #endif |
| 1325 | 1325 | ||
diff --git a/src/eval.c b/src/eval.c index df528e3da80..9c27caa29ca 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -88,7 +88,7 @@ struct catchtag *catchlist; | |||
| 88 | int gcpro_level; | 88 | int gcpro_level; |
| 89 | #endif | 89 | #endif |
| 90 | 90 | ||
| 91 | Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun, Qdefvar; | 91 | Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun; |
| 92 | Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag; | 92 | Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag; |
| 93 | Lisp_Object Qand_rest, Qand_optional; | 93 | Lisp_Object Qand_rest, Qand_optional; |
| 94 | Lisp_Object Qdebug_on_error; | 94 | Lisp_Object Qdebug_on_error; |
| @@ -647,7 +647,7 @@ usage: (defun NAME ARGLIST [DOCSTRING] BODY...) */) | |||
| 647 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) | 647 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) |
| 648 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); | 648 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); |
| 649 | Ffset (fn_name, defn); | 649 | Ffset (fn_name, defn); |
| 650 | LOADHIST_ATTACH (fn_name); | 650 | LOADHIST_ATTACH (Fcons (Qdefun, fn_name)); |
| 651 | return fn_name; | 651 | return fn_name; |
| 652 | } | 652 | } |
| 653 | 653 | ||
| @@ -716,7 +716,7 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) | |||
| 716 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) | 716 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) |
| 717 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); | 717 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); |
| 718 | Ffset (fn_name, defn); | 718 | Ffset (fn_name, defn); |
| 719 | LOADHIST_ATTACH (fn_name); | 719 | LOADHIST_ATTACH (Fcons (Qdefun, fn_name)); |
| 720 | return fn_name; | 720 | return fn_name; |
| 721 | } | 721 | } |
| 722 | 722 | ||
| @@ -742,7 +742,7 @@ The return value is ALIASED. */) | |||
| 742 | sym->indirect_variable = 1; | 742 | sym->indirect_variable = 1; |
| 743 | sym->value = aliased; | 743 | sym->value = aliased; |
| 744 | sym->constant = SYMBOL_CONSTANT_P (aliased); | 744 | sym->constant = SYMBOL_CONSTANT_P (aliased); |
| 745 | LOADHIST_ATTACH (Fcons (Qdefvar, symbol)); | 745 | LOADHIST_ATTACH (symbol); |
| 746 | if (!NILP (docstring)) | 746 | if (!NILP (docstring)) |
| 747 | Fput (symbol, Qvariable_documentation, docstring); | 747 | Fput (symbol, Qvariable_documentation, docstring); |
| 748 | 748 | ||
| @@ -810,7 +810,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 810 | tem = Fpurecopy (tem); | 810 | tem = Fpurecopy (tem); |
| 811 | Fput (sym, Qvariable_documentation, tem); | 811 | Fput (sym, Qvariable_documentation, tem); |
| 812 | } | 812 | } |
| 813 | LOADHIST_ATTACH (Fcons (Qdefvar, sym)); | 813 | LOADHIST_ATTACH (sym); |
| 814 | } | 814 | } |
| 815 | else | 815 | else |
| 816 | /* Simple (defvar <var>) should not count as a definition at all. | 816 | /* Simple (defvar <var>) should not count as a definition at all. |
| @@ -853,7 +853,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | |||
| 853 | tem = Fpurecopy (tem); | 853 | tem = Fpurecopy (tem); |
| 854 | Fput (sym, Qvariable_documentation, tem); | 854 | Fput (sym, Qvariable_documentation, tem); |
| 855 | } | 855 | } |
| 856 | LOADHIST_ATTACH (Fcons (Qdefvar, sym)); | 856 | LOADHIST_ATTACH (sym); |
| 857 | return sym; | 857 | return sym; |
| 858 | } | 858 | } |
| 859 | 859 | ||
| @@ -3376,9 +3376,6 @@ before making `inhibit-quit' nil. */); | |||
| 3376 | Qdefun = intern ("defun"); | 3376 | Qdefun = intern ("defun"); |
| 3377 | staticpro (&Qdefun); | 3377 | staticpro (&Qdefun); |
| 3378 | 3378 | ||
| 3379 | Qdefvar = intern ("defvar"); | ||
| 3380 | staticpro (&Qdefvar); | ||
| 3381 | |||
| 3382 | Qand_rest = intern ("&rest"); | 3379 | Qand_rest = intern ("&rest"); |
| 3383 | staticpro (&Qand_rest); | 3380 | staticpro (&Qand_rest); |
| 3384 | 3381 | ||
diff --git a/src/fileio.c b/src/fileio.c index 195cff2bc8c..f038bca2865 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -6190,7 +6190,7 @@ The return value is only relevant for a call to `read-file-name' that happens | |||
| 6190 | before any other event (mouse or keypress) is handeled. */) | 6190 | before any other event (mouse or keypress) is handeled. */) |
| 6191 | () | 6191 | () |
| 6192 | { | 6192 | { |
| 6193 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) | 6193 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (HAVE_CARBON) |
| 6194 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | 6194 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
| 6195 | && use_dialog_box | 6195 | && use_dialog_box |
| 6196 | && use_file_dialog | 6196 | && use_file_dialog |
| @@ -6331,7 +6331,7 @@ and `read-file-name-function'. */) | |||
| 6331 | 6331 | ||
| 6332 | GCPRO2 (insdef, default_filename); | 6332 | GCPRO2 (insdef, default_filename); |
| 6333 | 6333 | ||
| 6334 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) | 6334 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (HAVE_CARBON) |
| 6335 | if (! NILP (Fnext_read_file_uses_dialog_p ())) | 6335 | if (! NILP (Fnext_read_file_uses_dialog_p ())) |
| 6336 | { | 6336 | { |
| 6337 | /* If DIR contains a file name, split it. */ | 6337 | /* If DIR contains a file name, split it. */ |
| @@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 26 | #endif | 26 | #endif |
| 27 | #include <time.h> | 27 | #include <time.h> |
| 28 | 28 | ||
| 29 | #ifndef MAC_OSX | 29 | #ifndef MAC_OS |
| 30 | /* On Mac OS X, defining this conflicts with precompiled headers. */ | 30 | /* On Mac OS, defining this conflicts with precompiled headers. */ |
| 31 | 31 | ||
| 32 | /* Note on some machines this defines `vector' as a typedef, | 32 | /* Note on some machines this defines `vector' as a typedef, |
| 33 | so make sure we don't use that name in this file. */ | 33 | so make sure we don't use that name in this file. */ |
diff --git a/src/frame.c b/src/frame.c index 660b9db4316..06ffc04f2d1 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3052,8 +3052,6 @@ x_set_frame_parameters (f, alist) | |||
| 3052 | XSETINT (icon_top, 0); | 3052 | XSETINT (icon_top, 0); |
| 3053 | } | 3053 | } |
| 3054 | 3054 | ||
| 3055 | #ifndef HAVE_CARBON | ||
| 3056 | /* MAC_TODO: fullscreen */ | ||
| 3057 | if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) | 3055 | if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) |
| 3058 | { | 3056 | { |
| 3059 | /* If the frame is visible already and the fullscreen parameter is | 3057 | /* If the frame is visible already and the fullscreen parameter is |
| @@ -3069,7 +3067,6 @@ x_set_frame_parameters (f, alist) | |||
| 3069 | if (new_top != f->top_pos || new_left != f->left_pos) | 3067 | if (new_top != f->top_pos || new_left != f->left_pos) |
| 3070 | x_set_offset (f, new_left, new_top, 1); | 3068 | x_set_offset (f, new_left, new_top, 1); |
| 3071 | } | 3069 | } |
| 3072 | #endif | ||
| 3073 | 3070 | ||
| 3074 | /* Don't set these parameters unless they've been explicitly | 3071 | /* Don't set these parameters unless they've been explicitly |
| 3075 | specified. The window might be mapped or resized while we're in | 3072 | specified. The window might be mapped or resized while we're in |
| @@ -3230,14 +3227,11 @@ x_report_frame_params (f, alistptr) | |||
| 3230 | store_in_alist (alistptr, Qdisplay, | 3227 | store_in_alist (alistptr, Qdisplay, |
| 3231 | XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); | 3228 | XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); |
| 3232 | 3229 | ||
| 3233 | #ifndef HAVE_CARBON | ||
| 3234 | /* A Mac Window is identified by a struct, not an integer. */ | ||
| 3235 | if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) | 3230 | if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) |
| 3236 | tem = Qnil; | 3231 | tem = Qnil; |
| 3237 | else | 3232 | else |
| 3238 | XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); | 3233 | XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); |
| 3239 | store_in_alist (alistptr, Qparent_id, tem); | 3234 | store_in_alist (alistptr, Qparent_id, tem); |
| 3240 | #endif | ||
| 3241 | } | 3235 | } |
| 3242 | 3236 | ||
| 3243 | 3237 | ||
| @@ -3249,7 +3243,6 @@ x_set_fullscreen (f, new_value, old_value) | |||
| 3249 | struct frame *f; | 3243 | struct frame *f; |
| 3250 | Lisp_Object new_value, old_value; | 3244 | Lisp_Object new_value, old_value; |
| 3251 | { | 3245 | { |
| 3252 | #ifndef HAVE_CARBON | ||
| 3253 | if (NILP (new_value)) | 3246 | if (NILP (new_value)) |
| 3254 | f->want_fullscreen = FULLSCREEN_NONE; | 3247 | f->want_fullscreen = FULLSCREEN_NONE; |
| 3255 | else if (EQ (new_value, Qfullboth)) | 3248 | else if (EQ (new_value, Qfullboth)) |
| @@ -3258,7 +3251,6 @@ x_set_fullscreen (f, new_value, old_value) | |||
| 3258 | f->want_fullscreen = FULLSCREEN_WIDTH; | 3251 | f->want_fullscreen = FULLSCREEN_WIDTH; |
| 3259 | else if (EQ (new_value, Qfullheight)) | 3252 | else if (EQ (new_value, Qfullheight)) |
| 3260 | f->want_fullscreen = FULLSCREEN_HEIGHT; | 3253 | f->want_fullscreen = FULLSCREEN_HEIGHT; |
| 3261 | #endif | ||
| 3262 | } | 3254 | } |
| 3263 | 3255 | ||
| 3264 | 3256 | ||
| @@ -3378,7 +3370,7 @@ x_set_border_width (f, arg, oldval) | |||
| 3378 | if (XINT (arg) == f->border_width) | 3370 | if (XINT (arg) == f->border_width) |
| 3379 | return; | 3371 | return; |
| 3380 | 3372 | ||
| 3381 | #ifndef HAVE_CARBON | 3373 | #ifndef MAC_OS |
| 3382 | if (FRAME_X_WINDOW (f) != 0) | 3374 | if (FRAME_X_WINDOW (f) != 0) |
| 3383 | error ("Cannot change the border width of a window"); | 3375 | error ("Cannot change the border width of a window"); |
| 3384 | #endif /* MAC_TODO */ | 3376 | #endif /* MAC_TODO */ |
| @@ -4300,7 +4292,7 @@ Setting this variable does not affect existing frames, only new ones. */); | |||
| 4300 | DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars, | 4292 | DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars, |
| 4301 | doc: /* Default position of scroll bars on this window-system. */); | 4293 | doc: /* Default position of scroll bars on this window-system. */); |
| 4302 | #ifdef HAVE_WINDOW_SYSTEM | 4294 | #ifdef HAVE_WINDOW_SYSTEM |
| 4303 | #if defined(HAVE_NTGUI) || defined(HAVE_CARBON) | 4295 | #if defined(HAVE_NTGUI) || defined(MAC_OS) |
| 4304 | /* MS-Windows has scroll bars on the right by default. */ | 4296 | /* MS-Windows has scroll bars on the right by default. */ |
| 4305 | Vdefault_frame_scroll_bars = Qright; | 4297 | Vdefault_frame_scroll_bars = Qright; |
| 4306 | #else | 4298 | #else |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 317f7824267..22919230a65 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -3356,12 +3356,37 @@ update_frame_tool_bar (f) | |||
| 3356 | GList *icon_list; | 3356 | GList *icon_list; |
| 3357 | GList *iter; | 3357 | GList *iter; |
| 3358 | struct x_output *x = f->output_data.x; | 3358 | struct x_output *x = f->output_data.x; |
| 3359 | int hmargin, vmargin; | ||
| 3359 | 3360 | ||
| 3360 | if (! FRAME_GTK_WIDGET (f)) | 3361 | if (! FRAME_GTK_WIDGET (f)) |
| 3361 | return; | 3362 | return; |
| 3362 | 3363 | ||
| 3363 | BLOCK_INPUT; | 3364 | BLOCK_INPUT; |
| 3364 | 3365 | ||
| 3366 | if (INTEGERP (Vtool_bar_button_margin) | ||
| 3367 | && XINT (Vtool_bar_button_margin) > 0) | ||
| 3368 | { | ||
| 3369 | hmargin = XFASTINT (Vtool_bar_button_margin); | ||
| 3370 | vmargin = XFASTINT (Vtool_bar_button_margin); | ||
| 3371 | } | ||
| 3372 | else if (CONSP (Vtool_bar_button_margin)) | ||
| 3373 | { | ||
| 3374 | if (INTEGERP (XCAR (Vtool_bar_button_margin)) | ||
| 3375 | && XINT (XCAR (Vtool_bar_button_margin)) > 0) | ||
| 3376 | hmargin = XFASTINT (XCAR (Vtool_bar_button_margin)); | ||
| 3377 | |||
| 3378 | if (INTEGERP (XCDR (Vtool_bar_button_margin)) | ||
| 3379 | && XINT (XCDR (Vtool_bar_button_margin)) > 0) | ||
| 3380 | vmargin = XFASTINT (XCDR (Vtool_bar_button_margin)); | ||
| 3381 | } | ||
| 3382 | |||
| 3383 | /* The natural size (i.e. when GTK uses 0 as margin) looks best, | ||
| 3384 | so take DEFAULT_TOOL_BAR_BUTTON_MARGIN to mean "default for GTK", | ||
| 3385 | i.e. zero. This means that margins less than | ||
| 3386 | DEFAULT_TOOL_BAR_BUTTON_MARGIN has no effect. */ | ||
| 3387 | hmargin = max (0, hmargin - DEFAULT_TOOL_BAR_BUTTON_MARGIN); | ||
| 3388 | vmargin = max (0, vmargin - DEFAULT_TOOL_BAR_BUTTON_MARGIN); | ||
| 3389 | |||
| 3365 | if (! x->toolbar_widget) | 3390 | if (! x->toolbar_widget) |
| 3366 | xg_create_tool_bar (f); | 3391 | xg_create_tool_bar (f); |
| 3367 | 3392 | ||
| @@ -3425,6 +3450,8 @@ update_frame_tool_bar (f) | |||
| 3425 | { | 3450 | { |
| 3426 | GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); | 3451 | GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); |
| 3427 | 3452 | ||
| 3453 | gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); | ||
| 3454 | |||
| 3428 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), | 3455 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), |
| 3429 | 0, 0, 0, | 3456 | 0, 0, 0, |
| 3430 | w, | 3457 | w, |
| @@ -3480,6 +3507,8 @@ update_frame_tool_bar (f) | |||
| 3480 | XG_TOOL_BAR_IMAGE_DATA); | 3507 | XG_TOOL_BAR_IMAGE_DATA); |
| 3481 | g_list_free (chlist); | 3508 | g_list_free (chlist); |
| 3482 | 3509 | ||
| 3510 | gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin); | ||
| 3511 | |||
| 3483 | if (old_img != img->pixmap) | 3512 | if (old_img != img->pixmap) |
| 3484 | (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); | 3513 | (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); |
| 3485 | 3514 | ||
| @@ -3549,6 +3578,8 @@ free_frame_tool_bar (f) | |||
| 3549 | void | 3578 | void |
| 3550 | xg_initialize () | 3579 | xg_initialize () |
| 3551 | { | 3580 | { |
| 3581 | GtkBindingSet *binding_set; | ||
| 3582 | |||
| 3552 | xg_ignore_gtk_scrollbar = 0; | 3583 | xg_ignore_gtk_scrollbar = 0; |
| 3553 | xg_detached_menus = 0; | 3584 | xg_detached_menus = 0; |
| 3554 | xg_menu_cb_list.prev = xg_menu_cb_list.next = | 3585 | xg_menu_cb_list.prev = xg_menu_cb_list.next = |
| @@ -3571,6 +3602,17 @@ xg_initialize () | |||
| 3571 | "gtk-key-theme-name", | 3602 | "gtk-key-theme-name", |
| 3572 | "Emacs", | 3603 | "Emacs", |
| 3573 | EMACS_CLASS); | 3604 | EMACS_CLASS); |
| 3605 | |||
| 3606 | /* Make dialogs close on C-g. Since file dialog inherits from | ||
| 3607 | dialog, this works for them also. */ | ||
| 3608 | binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_DIALOG)); | ||
| 3609 | gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, | ||
| 3610 | "close", 0); | ||
| 3611 | |||
| 3612 | /* Make menus close on C-g. */ | ||
| 3613 | binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_MENU_SHELL)); | ||
| 3614 | gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, | ||
| 3615 | "cancel", 0); | ||
| 3574 | } | 3616 | } |
| 3575 | 3617 | ||
| 3576 | #endif /* USE_GTK */ | 3618 | #endif /* USE_GTK */ |
diff --git a/src/image.c b/src/image.c index 18ffc2db3a4..9c2f6962b6e 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -83,16 +83,19 @@ typedef struct w32_bitmap_record Bitmap_Record; | |||
| 83 | 83 | ||
| 84 | #ifdef MAC_OS | 84 | #ifdef MAC_OS |
| 85 | #include "macterm.h" | 85 | #include "macterm.h" |
| 86 | #include <sys/stat.h> | ||
| 86 | #ifndef MAC_OSX | 87 | #ifndef MAC_OSX |
| 87 | #include <alloca.h> | 88 | #include <alloca.h> |
| 89 | #include <sys/param.h> | ||
| 88 | #endif | 90 | #endif |
| 89 | #ifdef MAC_OSX | 91 | #ifdef MAC_OSX |
| 90 | #include <sys/stat.h> | ||
| 91 | #include <QuickTime/QuickTime.h> | 92 | #include <QuickTime/QuickTime.h> |
| 92 | #else /* not MAC_OSX */ | 93 | #else /* not MAC_OSX */ |
| 93 | #include <Windows.h> | 94 | #include <Windows.h> |
| 94 | #include <Gestalt.h> | 95 | #include <Gestalt.h> |
| 95 | #include <TextUtils.h> | 96 | #include <TextUtils.h> |
| 97 | #include <ImageCompression.h> | ||
| 98 | #include <QuickTimeComponents.h> | ||
| 96 | #endif /* not MAC_OSX */ | 99 | #endif /* not MAC_OSX */ |
| 97 | 100 | ||
| 98 | /* MAC_TODO : Color tables on Mac. */ | 101 | /* MAC_TODO : Color tables on Mac. */ |
| @@ -6269,6 +6272,12 @@ jpeg_image_p (object) | |||
| 6269 | #undef HAVE_STDLIB_H | 6272 | #undef HAVE_STDLIB_H |
| 6270 | #endif /* HAVE_STLIB_H */ | 6273 | #endif /* HAVE_STLIB_H */ |
| 6271 | 6274 | ||
| 6275 | #if defined (HAVE_NTGUI) && !defined (__WIN32__) | ||
| 6276 | /* jpeglib.h will define boolean differently depending on __WIN32__, | ||
| 6277 | so make sure it is defined. */ | ||
| 6278 | #define __WIN32__ 1 | ||
| 6279 | #endif | ||
| 6280 | |||
| 6272 | #include <jpeglib.h> | 6281 | #include <jpeglib.h> |
| 6273 | #include <jerror.h> | 6282 | #include <jerror.h> |
| 6274 | #include <setjmp.h> | 6283 | #include <setjmp.h> |
diff --git a/src/keyboard.c b/src/keyboard.c index 122a8e6b025..5c2fbf29cae 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6910,14 +6910,16 @@ input_available_signal (signo) | |||
| 6910 | sigisheld (SIGIO); | 6910 | sigisheld (SIGIO); |
| 6911 | #endif | 6911 | #endif |
| 6912 | 6912 | ||
| 6913 | if (input_available_clear_time) | ||
| 6914 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | ||
| 6915 | |||
| 6916 | #ifdef SYNC_INPUT | 6913 | #ifdef SYNC_INPUT |
| 6917 | interrupt_input_pending = 1; | 6914 | interrupt_input_pending = 1; |
| 6918 | #else | 6915 | #else |
| 6919 | |||
| 6920 | SIGNAL_THREAD_CHECK (signo); | 6916 | SIGNAL_THREAD_CHECK (signo); |
| 6917 | #endif | ||
| 6918 | |||
| 6919 | if (input_available_clear_time) | ||
| 6920 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | ||
| 6921 | |||
| 6922 | #ifndef SYNC_INPUT | ||
| 6921 | handle_async_input (); | 6923 | handle_async_input (); |
| 6922 | #endif | 6924 | #endif |
| 6923 | 6925 | ||
diff --git a/src/lisp.h b/src/lisp.h index 59ce03435f5..b3220f43f34 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1671,8 +1671,16 @@ extern void defvar_kboard P_ ((char *, int)); | |||
| 1671 | #define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname) | 1671 | #define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname) |
| 1672 | #define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname) | 1672 | #define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname) |
| 1673 | #define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname) | 1673 | #define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname) |
| 1674 | |||
| 1675 | /* TYPE is nil for a general Lisp variable. | ||
| 1676 | An integer specifies a type; then only LIsp values | ||
| 1677 | with that type code are allowed (except that nil is allowed too). | ||
| 1678 | LNAME is the LIsp-level variable name. | ||
| 1679 | VNAME is the name of the buffer slot. | ||
| 1680 | DOC is a dummy where you write the doc string as a comment. */ | ||
| 1674 | #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ | 1681 | #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ |
| 1675 | defvar_per_buffer (lname, vname, type, 0) | 1682 | defvar_per_buffer (lname, vname, type, 0) |
| 1683 | |||
| 1676 | #define DEFVAR_KBOARD(lname, vname, doc) \ | 1684 | #define DEFVAR_KBOARD(lname, vname, doc) \ |
| 1677 | defvar_kboard (lname, \ | 1685 | defvar_kboard (lname, \ |
| 1678 | (int)((char *)(¤t_kboard->vname) \ | 1686 | (int)((char *)(¤t_kboard->vname) \ |
diff --git a/src/lread.c b/src/lread.c index 895c063d04a..42531149286 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3847,10 +3847,10 @@ when the corresponding call to `provide' is made. */); | |||
| 3847 | Each alist element is a list that starts with a file name, | 3847 | Each alist element is a list that starts with a file name, |
| 3848 | except for one element (optional) that starts with nil and describes | 3848 | except for one element (optional) that starts with nil and describes |
| 3849 | definitions evaluated from buffers not visiting files. | 3849 | definitions evaluated from buffers not visiting files. |
| 3850 | The remaining elements of each list are symbols defined as functions, | 3850 | The remaining elements of each list are symbols defined as variables |
| 3851 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', | 3851 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', |
| 3852 | `(defvar . VARIABLE), `(autoload . SYMBOL)', and `(t . SYMBOL)'. | 3852 | `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. |
| 3853 | An element `(t . SYMBOL)' precedes an entry that is just SYMBOL, | 3853 | An element `(t . SYMBOL)' precedes an entry `(defun . FUNCTION)', |
| 3854 | and means that SYMBOL was an autoload before this file redefined it | 3854 | and means that SYMBOL was an autoload before this file redefined it |
| 3855 | as a function. */); | 3855 | as a function. */); |
| 3856 | Vload_history = Qnil; | 3856 | Vload_history = Qnil; |
| @@ -845,6 +845,8 @@ check_alarm () | |||
| 845 | } | 845 | } |
| 846 | 846 | ||
| 847 | 847 | ||
| 848 | extern Boolean mac_wait_next_event (EventRecord *, UInt32, Boolean); | ||
| 849 | |||
| 848 | int | 850 | int |
| 849 | select (n, rfds, wfds, efds, timeout) | 851 | select (n, rfds, wfds, efds, timeout) |
| 850 | int n; | 852 | int n; |
| @@ -853,49 +855,24 @@ select (n, rfds, wfds, efds, timeout) | |||
| 853 | SELECT_TYPE *efds; | 855 | SELECT_TYPE *efds; |
| 854 | struct timeval *timeout; | 856 | struct timeval *timeout; |
| 855 | { | 857 | { |
| 856 | #ifdef TARGET_API_MAC_CARBON | 858 | #if TARGET_API_MAC_CARBON |
| 857 | return 1; | 859 | return 1; |
| 858 | #else /* not TARGET_API_MAC_CARBON */ | 860 | #else /* not TARGET_API_MAC_CARBON */ |
| 859 | EMACS_TIME end_time, now; | ||
| 860 | EventRecord e; | 861 | EventRecord e; |
| 862 | UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + | ||
| 863 | ((EMACS_USECS (*timeout) * 60) / 1000000); | ||
| 861 | 864 | ||
| 862 | /* Can only handle wait for keyboard input. */ | 865 | /* Can only handle wait for keyboard input. */ |
| 863 | if (n > 1 || wfds || efds) | 866 | if (n > 1 || wfds || efds) |
| 864 | return -1; | 867 | return -1; |
| 865 | 868 | ||
| 866 | EMACS_GET_TIME (end_time); | 869 | /* Also return true if an event other than a keyDown has occurred. |
| 867 | EMACS_ADD_TIME (end_time, end_time, *timeout); | 870 | This causes kbd_buffer_get_event in keyboard.c to call |
| 868 | 871 | read_avail_input which in turn calls XTread_socket to poll for | |
| 869 | do | 872 | these events. Otherwise these never get processed except but a |
| 870 | { | 873 | very slow poll timer. */ |
| 871 | /* Also return true if an event other than a keyDown has | 874 | if (FD_ISSET (0, rfds) && mac_wait_next_event (&e, sleep_time, false)) |
| 872 | occurred. This causes kbd_buffer_get_event in keyboard.c to | 875 | return 1; |
| 873 | call read_avail_input which in turn calls XTread_socket to | ||
| 874 | poll for these events. Otherwise these never get processed | ||
| 875 | except but a very slow poll timer. */ | ||
| 876 | if (FD_ISSET (0, rfds) && EventAvail (everyEvent, &e)) | ||
| 877 | return 1; | ||
| 878 | |||
| 879 | /* Also check movement of the mouse. */ | ||
| 880 | { | ||
| 881 | Point mouse_pos; | ||
| 882 | static Point old_mouse_pos = {-1, -1}; | ||
| 883 | |||
| 884 | GetMouse (&mouse_pos); | ||
| 885 | if (!EqualPt (mouse_pos, old_mouse_pos)) | ||
| 886 | { | ||
| 887 | old_mouse_pos = mouse_pos; | ||
| 888 | return 1; | ||
| 889 | } | ||
| 890 | } | ||
| 891 | |||
| 892 | WaitNextEvent (0, &e, 1UL, NULL); /* Accept no event; wait 1 | ||
| 893 | tic. by T.I. */ | ||
| 894 | |||
| 895 | EMACS_GET_TIME (now); | ||
| 896 | EMACS_SUB_TIME (now, end_time, now); | ||
| 897 | } | ||
| 898 | while (!EMACS_TIME_NEG_P (now)); | ||
| 899 | 876 | ||
| 900 | return 0; | 877 | return 0; |
| 901 | #endif /* not TARGET_API_MAC_CARBON */ | 878 | #endif /* not TARGET_API_MAC_CARBON */ |
| @@ -1996,7 +1973,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 1996 | const char *workdir; | 1973 | const char *workdir; |
| 1997 | const char *infn, *outfn, *errfn; | 1974 | const char *infn, *outfn, *errfn; |
| 1998 | { | 1975 | { |
| 1999 | #ifdef TARGET_API_MAC_CARBON | 1976 | #if TARGET_API_MAC_CARBON |
| 2000 | return -1; | 1977 | return -1; |
| 2001 | #else /* not TARGET_API_MAC_CARBON */ | 1978 | #else /* not TARGET_API_MAC_CARBON */ |
| 2002 | char macappname[MAXPATHLEN+1], macworkdir[MAXPATHLEN+1]; | 1979 | char macappname[MAXPATHLEN+1], macworkdir[MAXPATHLEN+1]; |
| @@ -2081,7 +2058,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2081 | strcat (t, newargv[0]); | 2058 | strcat (t, newargv[0]); |
| 2082 | #endif /* 0 */ | 2059 | #endif /* 0 */ |
| 2083 | Lisp_Object path; | 2060 | Lisp_Object path; |
| 2084 | openp (Vexec_path, build_string (newargv[0]), EXEC_SUFFIXES, &path, | 2061 | openp (Vexec_path, build_string (newargv[0]), Vexec_suffixes, &path, |
| 2085 | make_number (X_OK)); | 2062 | make_number (X_OK)); |
| 2086 | 2063 | ||
| 2087 | if (NILP (path)) | 2064 | if (NILP (path)) |
| @@ -2793,17 +2770,98 @@ and t is the same as `SECONDARY'. */) | |||
| 2793 | return Qnil; | 2770 | return Qnil; |
| 2794 | } | 2771 | } |
| 2795 | 2772 | ||
| 2773 | extern void mac_clear_font_name_table P_ ((void)); | ||
| 2774 | |||
| 2775 | DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_name_table, 0, 0, 0, | ||
| 2776 | doc: /* Clear the font name table. */) | ||
| 2777 | () | ||
| 2778 | { | ||
| 2779 | check_mac (); | ||
| 2780 | mac_clear_font_name_table (); | ||
| 2781 | return Qnil; | ||
| 2782 | } | ||
| 2783 | |||
| 2796 | #ifdef MAC_OSX | 2784 | #ifdef MAC_OSX |
| 2797 | #undef select | 2785 | #undef select |
| 2798 | 2786 | ||
| 2799 | extern int inhibit_window_system; | 2787 | extern int inhibit_window_system; |
| 2800 | extern int noninteractive; | 2788 | extern int noninteractive; |
| 2801 | 2789 | ||
| 2802 | /* When Emacs is started from the Finder, SELECT always immediately | 2790 | /* Unlike in X11, window events in Carbon do not come from sockets. |
| 2803 | returns as if input is present when file descriptor 0 is polled for | 2791 | So we cannot simply use `select' to monitor two kinds of inputs: |
| 2804 | input. Strangely, when Emacs is run as a GUI application from the | 2792 | window events and process outputs. We emulate such functionality |
| 2805 | command line, it blocks in the same situation. This `wrapper' of | 2793 | by regarding fd 0 as the window event channel and simultaneously |
| 2806 | the system call SELECT corrects this discrepancy. */ | 2794 | monitoring both kinds of input channels. It is implemented by |
| 2795 | dividing into some cases: | ||
| 2796 | 1. The window event channel is not involved. | ||
| 2797 | -> Use `select'. | ||
| 2798 | 2. Sockets are not involved. | ||
| 2799 | -> Use ReceiveNextEvent. | ||
| 2800 | 3. [If SELECT_USE_CFSOCKET is defined] | ||
| 2801 | Only the window event channel and socket read channels are | ||
| 2802 | involved, and timeout is not too short (greater than | ||
| 2803 | SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds). | ||
| 2804 | -> Create CFSocket for each socket and add it into the current | ||
| 2805 | event RunLoop so that an `ready-to-read' event can be posted | ||
| 2806 | to the event queue that is also used for window events. Then | ||
| 2807 | ReceiveNextEvent can wait for both kinds of inputs. | ||
| 2808 | 4. Otherwise. | ||
| 2809 | -> Periodically poll the window input channel while repeatedly | ||
| 2810 | executing `select' with a short timeout | ||
| 2811 | (SELECT_POLLING_PERIOD_USEC microseconds). */ | ||
| 2812 | |||
| 2813 | #define SELECT_POLLING_PERIOD_USEC 20000 | ||
| 2814 | #ifdef SELECT_USE_CFSOCKET | ||
| 2815 | #define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2 | ||
| 2816 | #define EVENT_CLASS_SOCK 'Sock' | ||
| 2817 | |||
| 2818 | static void | ||
| 2819 | socket_callback (s, type, address, data, info) | ||
| 2820 | CFSocketRef s; | ||
| 2821 | CFSocketCallBackType type; | ||
| 2822 | CFDataRef address; | ||
| 2823 | const void *data; | ||
| 2824 | void *info; | ||
| 2825 | { | ||
| 2826 | EventRef event; | ||
| 2827 | |||
| 2828 | CreateEvent (NULL, EVENT_CLASS_SOCK, 0, 0, kEventAttributeNone, &event); | ||
| 2829 | PostEventToQueue (GetCurrentEventQueue (), event, kEventPriorityStandard); | ||
| 2830 | ReleaseEvent (event); | ||
| 2831 | } | ||
| 2832 | #endif /* SELECT_USE_CFSOCKET */ | ||
| 2833 | |||
| 2834 | static int | ||
| 2835 | select_and_poll_event (n, rfds, wfds, efds, timeout) | ||
| 2836 | int n; | ||
| 2837 | SELECT_TYPE *rfds; | ||
| 2838 | SELECT_TYPE *wfds; | ||
| 2839 | SELECT_TYPE *efds; | ||
| 2840 | struct timeval *timeout; | ||
| 2841 | { | ||
| 2842 | int r; | ||
| 2843 | OSErr err; | ||
| 2844 | |||
| 2845 | r = select (n, rfds, wfds, efds, timeout); | ||
| 2846 | if (r != -1) | ||
| 2847 | { | ||
| 2848 | BLOCK_INPUT; | ||
| 2849 | err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, | ||
| 2850 | kEventLeaveInQueue, NULL); | ||
| 2851 | UNBLOCK_INPUT; | ||
| 2852 | if (err == noErr) | ||
| 2853 | { | ||
| 2854 | FD_SET (0, rfds); | ||
| 2855 | r++; | ||
| 2856 | } | ||
| 2857 | } | ||
| 2858 | return r; | ||
| 2859 | } | ||
| 2860 | |||
| 2861 | #ifndef MAC_OS_X_VERSION_10_2 | ||
| 2862 | #undef SELECT_INVALIDATE_CFSOCKET | ||
| 2863 | #endif | ||
| 2864 | |||
| 2807 | int | 2865 | int |
| 2808 | sys_select (n, rfds, wfds, efds, timeout) | 2866 | sys_select (n, rfds, wfds, efds, timeout) |
| 2809 | int n; | 2867 | int n; |
| @@ -2813,91 +2871,182 @@ sys_select (n, rfds, wfds, efds, timeout) | |||
| 2813 | struct timeval *timeout; | 2871 | struct timeval *timeout; |
| 2814 | { | 2872 | { |
| 2815 | OSErr err; | 2873 | OSErr err; |
| 2816 | EMACS_TIME end_time, now, remaining_time; | 2874 | int i, r; |
| 2817 | 2875 | EMACS_TIME select_timeout; | |
| 2876 | |||
| 2818 | if (inhibit_window_system || noninteractive | 2877 | if (inhibit_window_system || noninteractive |
| 2819 | || rfds == NULL || !FD_ISSET (0, rfds)) | 2878 | || rfds == NULL || !FD_ISSET (0, rfds)) |
| 2820 | return select (n, rfds, wfds, efds, timeout); | 2879 | return select (n, rfds, wfds, efds, timeout); |
| 2821 | 2880 | ||
| 2881 | FD_CLR (0, rfds); | ||
| 2882 | |||
| 2822 | if (wfds == NULL && efds == NULL) | 2883 | if (wfds == NULL && efds == NULL) |
| 2823 | { | 2884 | { |
| 2824 | int i; | 2885 | int nsocks = 0; |
| 2886 | SELECT_TYPE orfds = *rfds; | ||
| 2887 | |||
| 2888 | EventTimeout timeout_sec = | ||
| 2889 | (timeout | ||
| 2890 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 2891 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 2892 | : kEventDurationForever); | ||
| 2825 | 2893 | ||
| 2826 | for (i = 1; i < n; i++) | 2894 | for (i = 1; i < n; i++) |
| 2827 | if (FD_ISSET (i, rfds)) | 2895 | if (FD_ISSET (i, rfds)) |
| 2828 | break; | 2896 | nsocks++; |
| 2829 | if (i == n) | ||
| 2830 | { | ||
| 2831 | EventTimeout timeout_sec = | ||
| 2832 | (timeout | ||
| 2833 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 2834 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 2835 | : kEventDurationForever); | ||
| 2836 | 2897 | ||
| 2898 | if (nsocks == 0) | ||
| 2899 | { | ||
| 2837 | BLOCK_INPUT; | 2900 | BLOCK_INPUT; |
| 2838 | err = ReceiveNextEvent (0, NULL, timeout_sec, | 2901 | err = ReceiveNextEvent (0, NULL, timeout_sec, |
| 2839 | kEventLeaveInQueue, NULL); | 2902 | kEventLeaveInQueue, NULL); |
| 2840 | UNBLOCK_INPUT; | 2903 | UNBLOCK_INPUT; |
| 2841 | if (err == noErr) | 2904 | if (err == noErr) |
| 2842 | { | 2905 | { |
| 2843 | FD_ZERO (rfds); | ||
| 2844 | FD_SET (0, rfds); | 2906 | FD_SET (0, rfds); |
| 2845 | return 1; | 2907 | return 1; |
| 2846 | } | 2908 | } |
| 2847 | else | 2909 | else |
| 2848 | return 0; | 2910 | return 0; |
| 2849 | } | 2911 | } |
| 2850 | } | ||
| 2851 | 2912 | ||
| 2852 | if (timeout) | 2913 | /* Avoid initial overhead of RunLoop setup for the case that |
| 2853 | { | 2914 | some input is already available. */ |
| 2854 | remaining_time = *timeout; | 2915 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); |
| 2855 | EMACS_GET_TIME (now); | 2916 | r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); |
| 2856 | EMACS_ADD_TIME (end_time, now, remaining_time); | 2917 | if (r != 0 || timeout_sec == 0.0) |
| 2857 | } | 2918 | return r; |
| 2858 | FD_CLR (0, rfds); | ||
| 2859 | do | ||
| 2860 | { | ||
| 2861 | EMACS_TIME select_timeout; | ||
| 2862 | SELECT_TYPE orfds = *rfds; | ||
| 2863 | int r; | ||
| 2864 | 2919 | ||
| 2865 | EMACS_SET_SECS_USECS (select_timeout, 0, 20000); | 2920 | *rfds = orfds; |
| 2866 | 2921 | ||
| 2867 | if (timeout && EMACS_TIME_LT (remaining_time, select_timeout)) | 2922 | #ifdef SELECT_USE_CFSOCKET |
| 2868 | select_timeout = remaining_time; | 2923 | if (timeout_sec > 0 && timeout_sec <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) |
| 2924 | goto poll_periodically; | ||
| 2869 | 2925 | ||
| 2870 | r = select (n, &orfds, wfds, efds, &select_timeout); | 2926 | { |
| 2871 | BLOCK_INPUT; | 2927 | CFRunLoopRef runloop = |
| 2872 | err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, | 2928 | (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); |
| 2873 | kEventLeaveInQueue, NULL); | 2929 | EventTypeSpec specs[] = {{EVENT_CLASS_SOCK, 0}}; |
| 2874 | UNBLOCK_INPUT; | 2930 | #ifdef SELECT_INVALIDATE_CFSOCKET |
| 2875 | if (r > 0) | 2931 | CFSocketRef *shead, *s; |
| 2876 | { | 2932 | #else |
| 2877 | *rfds = orfds; | 2933 | CFRunLoopSourceRef *shead, *s; |
| 2878 | if (err == noErr) | 2934 | #endif |
| 2935 | |||
| 2936 | BLOCK_INPUT; | ||
| 2937 | |||
| 2938 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2939 | shead = xmalloc (sizeof (CFSocketRef) * nsocks); | ||
| 2940 | #else | ||
| 2941 | shead = xmalloc (sizeof (CFRunLoopSourceRef) * nsocks); | ||
| 2942 | #endif | ||
| 2943 | s = shead; | ||
| 2944 | for (i = 1; i < n; i++) | ||
| 2945 | if (FD_ISSET (i, rfds)) | ||
| 2879 | { | 2946 | { |
| 2880 | FD_SET (0, rfds); | 2947 | CFSocketRef socket = |
| 2881 | r++; | 2948 | CFSocketCreateWithNative (NULL, i, kCFSocketReadCallBack, |
| 2949 | socket_callback, NULL); | ||
| 2950 | CFRunLoopSourceRef source = | ||
| 2951 | CFSocketCreateRunLoopSource (NULL, socket, 0); | ||
| 2952 | |||
| 2953 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2954 | CFSocketSetSocketFlags (socket, 0); | ||
| 2955 | #endif | ||
| 2956 | CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode); | ||
| 2957 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2958 | CFRelease (source); | ||
| 2959 | *s = socket; | ||
| 2960 | #else | ||
| 2961 | CFRelease (socket); | ||
| 2962 | *s = source; | ||
| 2963 | #endif | ||
| 2964 | s++; | ||
| 2882 | } | 2965 | } |
| 2883 | return r; | ||
| 2884 | } | ||
| 2885 | else if (err == noErr) | ||
| 2886 | { | ||
| 2887 | FD_ZERO (rfds); | ||
| 2888 | FD_SET (0, rfds); | ||
| 2889 | return 1; | ||
| 2890 | } | ||
| 2891 | 2966 | ||
| 2892 | if (timeout) | 2967 | err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); |
| 2893 | { | 2968 | |
| 2894 | EMACS_GET_TIME (now); | 2969 | do |
| 2895 | EMACS_SUB_TIME (remaining_time, end_time, now); | 2970 | { |
| 2896 | } | 2971 | --s; |
| 2972 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2973 | CFSocketInvalidate (*s); | ||
| 2974 | #else | ||
| 2975 | CFRunLoopRemoveSource (runloop, *s, kCFRunLoopDefaultMode); | ||
| 2976 | #endif | ||
| 2977 | CFRelease (*s); | ||
| 2978 | } | ||
| 2979 | while (s != shead); | ||
| 2980 | |||
| 2981 | xfree (shead); | ||
| 2982 | |||
| 2983 | if (err) | ||
| 2984 | { | ||
| 2985 | FD_ZERO (rfds); | ||
| 2986 | r = 0; | ||
| 2987 | } | ||
| 2988 | else | ||
| 2989 | { | ||
| 2990 | FlushEventsMatchingListFromQueue (GetCurrentEventQueue (), | ||
| 2991 | GetEventTypeCount (specs), | ||
| 2992 | specs); | ||
| 2993 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); | ||
| 2994 | r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); | ||
| 2995 | } | ||
| 2996 | |||
| 2997 | UNBLOCK_INPUT; | ||
| 2998 | |||
| 2999 | return r; | ||
| 3000 | } | ||
| 3001 | #endif /* SELECT_USE_CFSOCKET */ | ||
| 2897 | } | 3002 | } |
| 2898 | while (!timeout || EMACS_TIME_LT (now, end_time)); | ||
| 2899 | 3003 | ||
| 2900 | return 0; | 3004 | poll_periodically: |
| 3005 | { | ||
| 3006 | EMACS_TIME end_time, now, remaining_time; | ||
| 3007 | SELECT_TYPE orfds = *rfds, owfds, oefds; | ||
| 3008 | |||
| 3009 | if (wfds) | ||
| 3010 | owfds = *wfds; | ||
| 3011 | if (efds) | ||
| 3012 | oefds = *efds; | ||
| 3013 | if (timeout) | ||
| 3014 | { | ||
| 3015 | remaining_time = *timeout; | ||
| 3016 | EMACS_GET_TIME (now); | ||
| 3017 | EMACS_ADD_TIME (end_time, now, remaining_time); | ||
| 3018 | } | ||
| 3019 | |||
| 3020 | do | ||
| 3021 | { | ||
| 3022 | EMACS_SET_SECS_USECS (select_timeout, 0, SELECT_POLLING_PERIOD_USEC); | ||
| 3023 | if (timeout && EMACS_TIME_LT (remaining_time, select_timeout)) | ||
| 3024 | select_timeout = remaining_time; | ||
| 3025 | r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); | ||
| 3026 | if (r != 0) | ||
| 3027 | return r; | ||
| 3028 | |||
| 3029 | *rfds = orfds; | ||
| 3030 | if (wfds) | ||
| 3031 | *wfds = owfds; | ||
| 3032 | if (efds) | ||
| 3033 | *efds = oefds; | ||
| 3034 | |||
| 3035 | if (timeout) | ||
| 3036 | { | ||
| 3037 | EMACS_GET_TIME (now); | ||
| 3038 | EMACS_SUB_TIME (remaining_time, end_time, now); | ||
| 3039 | } | ||
| 3040 | } | ||
| 3041 | while (!timeout || EMACS_TIME_LT (now, end_time)); | ||
| 3042 | |||
| 3043 | FD_ZERO (rfds); | ||
| 3044 | if (wfds) | ||
| 3045 | FD_ZERO (wfds); | ||
| 3046 | if (efds) | ||
| 3047 | FD_ZERO (efds); | ||
| 3048 | return 0; | ||
| 3049 | } | ||
| 2901 | } | 3050 | } |
| 2902 | 3051 | ||
| 2903 | /* Set up environment variables so that Emacs can correctly find its | 3052 | /* Set up environment variables so that Emacs can correctly find its |
| @@ -3043,6 +3192,7 @@ syms_of_mac () | |||
| 3043 | defsubr (&Smac_paste_function); | 3192 | defsubr (&Smac_paste_function); |
| 3044 | defsubr (&Smac_cut_function); | 3193 | defsubr (&Smac_cut_function); |
| 3045 | defsubr (&Sx_selection_exists_p); | 3194 | defsubr (&Sx_selection_exists_p); |
| 3195 | defsubr (&Smac_clear_font_name_table); | ||
| 3046 | 3196 | ||
| 3047 | defsubr (&Sdo_applescript); | 3197 | defsubr (&Sdo_applescript); |
| 3048 | defsubr (&Smac_file_name_to_posix); | 3198 | defsubr (&Smac_file_name_to_posix); |
diff --git a/src/macfns.c b/src/macfns.c index fdfe7a52416..dfbc5dacd5e 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -158,9 +158,7 @@ Lisp_Object Qshift; | |||
| 158 | 158 | ||
| 159 | extern Lisp_Object Vwindow_system_version; | 159 | extern Lisp_Object Vwindow_system_version; |
| 160 | 160 | ||
| 161 | extern int mac_initialized; | 161 | #if 0 /* Use xstricmp instead. */ |
| 162 | |||
| 163 | |||
| 164 | /* compare two strings ignoring case */ | 162 | /* compare two strings ignoring case */ |
| 165 | 163 | ||
| 166 | static int | 164 | static int |
| @@ -171,13 +169,14 @@ stricmp (const char *s, const char *t) | |||
| 171 | return 0; | 169 | return 0; |
| 172 | return tolower (*s) - tolower (*t); | 170 | return tolower (*s) - tolower (*t); |
| 173 | } | 171 | } |
| 172 | #endif | ||
| 174 | 173 | ||
| 175 | /* compare two strings up to n characters, ignoring case */ | 174 | /* compare two strings up to n characters, ignoring case */ |
| 176 | 175 | ||
| 177 | static int | 176 | static int |
| 178 | strnicmp (const char *s, const char *t, unsigned int n) | 177 | strnicmp (const char *s, const char *t, unsigned int n) |
| 179 | { | 178 | { |
| 180 | for ( ; n-- > 0 && tolower (*s) == tolower (*t); s++, t++) | 179 | for ( ; n > 0 && tolower (*s) == tolower (*t); n--, s++, t++) |
| 181 | if (*s == '\0') | 180 | if (*s == '\0') |
| 182 | return 0; | 181 | return 0; |
| 183 | return n == 0 ? 0 : tolower (*s) - tolower (*t); | 182 | return n == 0 ? 0 : tolower (*s) - tolower (*t); |
| @@ -190,7 +189,7 @@ void | |||
| 190 | check_mac () | 189 | check_mac () |
| 191 | { | 190 | { |
| 192 | if (! mac_in_use) | 191 | if (! mac_in_use) |
| 193 | error ("Mac OS not in use or not initialized"); | 192 | error ("Mac native windows not in use or not initialized"); |
| 194 | } | 193 | } |
| 195 | 194 | ||
| 196 | /* Nonzero if we can use mouse menus. | 195 | /* Nonzero if we can use mouse menus. |
| @@ -228,33 +227,28 @@ struct mac_display_info * | |||
| 228 | check_x_display_info (frame) | 227 | check_x_display_info (frame) |
| 229 | Lisp_Object frame; | 228 | Lisp_Object frame; |
| 230 | { | 229 | { |
| 231 | if (!mac_initialized) | 230 | struct mac_display_info *dpyinfo = NULL; |
| 232 | { | ||
| 233 | mac_initialize (); | ||
| 234 | mac_initialized = 1; | ||
| 235 | } | ||
| 236 | 231 | ||
| 237 | if (NILP (frame)) | 232 | if (NILP (frame)) |
| 238 | { | 233 | { |
| 239 | struct frame *sf = XFRAME (selected_frame); | 234 | struct frame *sf = XFRAME (selected_frame); |
| 240 | 235 | ||
| 241 | if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf)) | 236 | if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf)) |
| 242 | return FRAME_MAC_DISPLAY_INFO (sf); | 237 | dpyinfo = FRAME_MAC_DISPLAY_INFO (sf); |
| 238 | else if (x_display_list != 0) | ||
| 239 | dpyinfo = x_display_list; | ||
| 243 | else | 240 | else |
| 244 | return &one_mac_display_info; | 241 | error ("Mac native windows are not in use or not initialized"); |
| 245 | } | 242 | } |
| 246 | else if (STRINGP (frame)) | 243 | else if (STRINGP (frame)) |
| 247 | return x_display_info_for_name (frame); | 244 | dpyinfo = x_display_info_for_name (frame); |
| 248 | else | 245 | else |
| 249 | { | 246 | { |
| 250 | FRAME_PTR f; | 247 | FRAME_PTR f = check_x_frame (frame); |
| 251 | 248 | dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | |
| 252 | CHECK_LIVE_FRAME (frame); | ||
| 253 | f = XFRAME (frame); | ||
| 254 | if (! FRAME_MAC_P (f)) | ||
| 255 | error ("non-mac frame used"); | ||
| 256 | return FRAME_MAC_DISPLAY_INFO (f); | ||
| 257 | } | 249 | } |
| 250 | |||
| 251 | return dpyinfo; | ||
| 258 | } | 252 | } |
| 259 | 253 | ||
| 260 | /* Return the Emacs frame-object corresponding to a mac window. | 254 | /* Return the Emacs frame-object corresponding to a mac window. |
| @@ -1109,7 +1103,7 @@ mac_color_map_lookup (colorname) | |||
| 1109 | BLOCK_INPUT; | 1103 | BLOCK_INPUT; |
| 1110 | 1104 | ||
| 1111 | for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++) | 1105 | for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++) |
| 1112 | if (stricmp (colorname, mac_color_map[i].name) == 0) | 1106 | if (xstricmp (colorname, mac_color_map[i].name) == 0) |
| 1113 | { | 1107 | { |
| 1114 | ret = make_number (mac_color_map[i].color); | 1108 | ret = make_number (mac_color_map[i].color); |
| 1115 | break; | 1109 | break; |
| @@ -2059,13 +2053,49 @@ x_set_scroll_bar_default_width (f) | |||
| 2059 | 2053 | ||
| 2060 | /* Subroutines of creating a frame. */ | 2054 | /* Subroutines of creating a frame. */ |
| 2061 | 2055 | ||
| 2056 | static char * | ||
| 2057 | mac_get_rdb_resource (rdb, resource) | ||
| 2058 | char *rdb; | ||
| 2059 | char *resource; | ||
| 2060 | { | ||
| 2061 | char *value = rdb; | ||
| 2062 | int len = strlen (resource); | ||
| 2063 | |||
| 2064 | while (*value) | ||
| 2065 | { | ||
| 2066 | if ((strncmp (value, resource, len) == 0) && (value[len] == ':')) | ||
| 2067 | return xstrdup (&value[len + 1]); | ||
| 2068 | |||
| 2069 | value = strchr (value, '\0') + 1; | ||
| 2070 | } | ||
| 2071 | |||
| 2072 | return NULL; | ||
| 2073 | } | ||
| 2074 | |||
| 2075 | /* Retrieve the string resource specified by NAME with CLASS from | ||
| 2076 | database RDB. */ | ||
| 2077 | |||
| 2062 | char * | 2078 | char * |
| 2063 | x_get_string_resource (rdb, name, class) | 2079 | x_get_string_resource (rdb, name, class) |
| 2064 | XrmDatabase rdb; | 2080 | XrmDatabase rdb; |
| 2065 | char *name, *class; | 2081 | char *name, *class; |
| 2066 | { | 2082 | { |
| 2067 | /* MAC_TODO: implement resource strings */ | 2083 | if (rdb) |
| 2084 | { | ||
| 2085 | char *resource; | ||
| 2086 | |||
| 2087 | if (resource = mac_get_rdb_resource (rdb, name)) | ||
| 2088 | return resource; | ||
| 2089 | if (resource = mac_get_rdb_resource (rdb, class)) | ||
| 2090 | return resource; | ||
| 2091 | } | ||
| 2092 | |||
| 2093 | /* MAC_TODO: implement resource strings. (Maybe Property Lists?) */ | ||
| 2094 | #if 0 | ||
| 2095 | return mac_get_string_resource (name, class); | ||
| 2096 | #else | ||
| 2068 | return (char *)0; | 2097 | return (char *)0; |
| 2098 | #endif | ||
| 2069 | } | 2099 | } |
| 2070 | 2100 | ||
| 2071 | /* Return the value of parameter PARAM. | 2101 | /* Return the value of parameter PARAM. |
| @@ -2229,36 +2259,38 @@ XParseGeometry (string, x, y, width, height) | |||
| 2229 | } | 2259 | } |
| 2230 | 2260 | ||
| 2231 | 2261 | ||
| 2232 | #if 0 /* MAC_TODO */ | ||
| 2233 | /* Create and set up the Mac window for frame F. */ | 2262 | /* Create and set up the Mac window for frame F. */ |
| 2234 | 2263 | ||
| 2264 | extern install_window_handler (WindowPtr); | ||
| 2265 | |||
| 2235 | static void | 2266 | static void |
| 2236 | mac_window (f, window_prompting, minibuffer_only) | 2267 | mac_window (f) |
| 2237 | struct frame *f; | 2268 | struct frame *f; |
| 2238 | long window_prompting; | ||
| 2239 | int minibuffer_only; | ||
| 2240 | { | 2269 | { |
| 2241 | Rect r; | 2270 | Rect r; |
| 2242 | 2271 | ||
| 2243 | BLOCK_INPUT; | 2272 | BLOCK_INPUT; |
| 2244 | 2273 | ||
| 2245 | /* Use the resource name as the top-level window name | ||
| 2246 | for looking up resources. Make a non-Lisp copy | ||
| 2247 | for the window manager, so GC relocation won't bother it. | ||
| 2248 | |||
| 2249 | Elsewhere we specify the window name for the window manager. */ | ||
| 2250 | |||
| 2251 | { | ||
| 2252 | char *str = (char *) SDATA (Vx_resource_name); | ||
| 2253 | f->namebuf = (char *) xmalloc (strlen (str) + 1); | ||
| 2254 | strcpy (f->namebuf, str); | ||
| 2255 | } | ||
| 2256 | |||
| 2257 | SetRect (&r, f->left_pos, f->top_pos, | 2274 | SetRect (&r, f->left_pos, f->top_pos, |
| 2258 | f->left_pos + FRAME_PIXEL_WIDTH (f), | 2275 | f->left_pos + FRAME_PIXEL_WIDTH (f), |
| 2259 | f->top_pos + FRAME_PIXEL_HEIGHT (f)); | 2276 | f->top_pos + FRAME_PIXEL_HEIGHT (f)); |
| 2277 | #if TARGET_API_MAC_CARBON | ||
| 2278 | CreateNewWindow (kDocumentWindowClass, | ||
| 2279 | kWindowStandardDocumentAttributes | ||
| 2280 | /* | kWindowToolbarButtonAttribute */, | ||
| 2281 | &r, &FRAME_MAC_WINDOW (f)); | ||
| 2282 | if (FRAME_MAC_WINDOW (f)) | ||
| 2283 | { | ||
| 2284 | SetWRefCon (FRAME_MAC_WINDOW (f), (long) f->output_data.mac); | ||
| 2285 | install_window_handler (FRAME_MAC_WINDOW (f)); | ||
| 2286 | } | ||
| 2287 | #else | ||
| 2260 | FRAME_MAC_WINDOW (f) | 2288 | FRAME_MAC_WINDOW (f) |
| 2261 | = NewCWindow (NULL, &r, "\p", 1, zoomDocProc, (WindowPtr) -1, 1, (long) f->output_data.mac); | 2289 | = NewCWindow (NULL, &r, "\p", false, zoomDocProc, |
| 2290 | (WindowPtr) -1, 1, (long) f->output_data.mac); | ||
| 2291 | #endif | ||
| 2292 | /* so that update events can find this mac_output struct */ | ||
| 2293 | f->output_data.mac->mFP = f; /* point back to emacs frame */ | ||
| 2262 | 2294 | ||
| 2263 | validate_x_resource_name (); | 2295 | validate_x_resource_name (); |
| 2264 | 2296 | ||
| @@ -2276,17 +2308,11 @@ mac_window (f, window_prompting, minibuffer_only) | |||
| 2276 | x_set_name (f, name, explicit); | 2308 | x_set_name (f, name, explicit); |
| 2277 | } | 2309 | } |
| 2278 | 2310 | ||
| 2279 | ShowWindow (FRAME_MAC_WINDOW (f)); | ||
| 2280 | |||
| 2281 | UNBLOCK_INPUT; | 2311 | UNBLOCK_INPUT; |
| 2282 | 2312 | ||
| 2283 | if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 2284 | initialize_frame_menubar (f); | ||
| 2285 | |||
| 2286 | if (FRAME_MAC_WINDOW (f) == 0) | 2313 | if (FRAME_MAC_WINDOW (f) == 0) |
| 2287 | error ("Unable to create window"); | 2314 | error ("Unable to create window"); |
| 2288 | } | 2315 | } |
| 2289 | #endif /* MAC_TODO */ | ||
| 2290 | 2316 | ||
| 2291 | /* Handle the icon stuff for this window. Perhaps later we might | 2317 | /* Handle the icon stuff for this window. Perhaps later we might |
| 2292 | want an x_set_icon_position which can be called interactively as | 2318 | want an x_set_icon_position which can be called interactively as |
| @@ -2703,6 +2729,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2703 | "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); | 2729 | "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); |
| 2704 | x_default_parameter (f, parms, Qtitle, Qnil, | 2730 | x_default_parameter (f, parms, Qtitle, Qnil, |
| 2705 | "title", "Title", RES_TYPE_STRING); | 2731 | "title", "Title", RES_TYPE_STRING); |
| 2732 | x_default_parameter (f, parms, Qfullscreen, Qnil, | ||
| 2733 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); | ||
| 2706 | 2734 | ||
| 2707 | f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window; | 2735 | f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window; |
| 2708 | 2736 | ||
| @@ -2728,8 +2756,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2728 | tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); | 2756 | tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); |
| 2729 | f->no_split = minibuffer_only || EQ (tem, Qt); | 2757 | f->no_split = minibuffer_only || EQ (tem, Qt); |
| 2730 | 2758 | ||
| 2731 | /* mac_window (f, window_prompting, minibuffer_only); */ | 2759 | mac_window (f); |
| 2732 | make_mac_frame (f); | ||
| 2733 | 2760 | ||
| 2734 | x_icon (f, parms); | 2761 | x_icon (f, parms); |
| 2735 | x_make_gc (f); | 2762 | x_make_gc (f); |
| @@ -2763,14 +2790,12 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2763 | FRAME_LINES (f) = 0; | 2790 | FRAME_LINES (f) = 0; |
| 2764 | change_frame_size (f, height, width, 1, 0, 0); | 2791 | change_frame_size (f, height, width, 1, 0, 0); |
| 2765 | 2792 | ||
| 2766 | #if 0 /* MAC_TODO: when we have window manager hints */ | ||
| 2767 | /* Tell the server what size and position, etc, we want, and how | 2793 | /* Tell the server what size and position, etc, we want, and how |
| 2768 | badly we want them. This should be done after we have the menu | 2794 | badly we want them. This should be done after we have the menu |
| 2769 | bar so that its size can be taken into account. */ | 2795 | bar so that its size can be taken into account. */ |
| 2770 | BLOCK_INPUT; | 2796 | BLOCK_INPUT; |
| 2771 | x_wm_set_size_hint (f, window_prompting, 0); | 2797 | x_wm_set_size_hint (f, window_prompting, 0); |
| 2772 | UNBLOCK_INPUT; | 2798 | UNBLOCK_INPUT; |
| 2773 | #endif | ||
| 2774 | 2799 | ||
| 2775 | /* Make the window appear on the frame and enable display, unless | 2800 | /* Make the window appear on the frame and enable display, unless |
| 2776 | the caller says not to. However, with explicit parent, Emacs | 2801 | the caller says not to. However, with explicit parent, Emacs |
| @@ -3144,6 +3169,9 @@ x_display_info_for_name (name) | |||
| 3144 | 3169 | ||
| 3145 | CHECK_STRING (name); | 3170 | CHECK_STRING (name); |
| 3146 | 3171 | ||
| 3172 | if (! EQ (Vwindow_system, intern ("mac"))) | ||
| 3173 | error ("Not using Mac native windows"); | ||
| 3174 | |||
| 3147 | for (dpyinfo = &one_mac_display_info, names = x_display_name_list; | 3175 | for (dpyinfo = &one_mac_display_info, names = x_display_name_list; |
| 3148 | dpyinfo; | 3176 | dpyinfo; |
| 3149 | dpyinfo = dpyinfo->next, names = XCDR (names)) | 3177 | dpyinfo = dpyinfo->next, names = XCDR (names)) |
| @@ -3171,7 +3199,6 @@ x_display_info_for_name (name) | |||
| 3171 | return dpyinfo; | 3199 | return dpyinfo; |
| 3172 | } | 3200 | } |
| 3173 | 3201 | ||
| 3174 | #if 0 /* MAC_TODO: implement network support */ | ||
| 3175 | DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, | 3202 | DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, |
| 3176 | 1, 3, 0, | 3203 | 1, 3, 0, |
| 3177 | doc: /* Open a connection to a server. | 3204 | doc: /* Open a connection to a server. |
| @@ -3190,7 +3217,7 @@ terminate Emacs if we can't open the connection. */) | |||
| 3190 | CHECK_STRING (xrm_string); | 3217 | CHECK_STRING (xrm_string); |
| 3191 | 3218 | ||
| 3192 | if (! EQ (Vwindow_system, intern ("mac"))) | 3219 | if (! EQ (Vwindow_system, intern ("mac"))) |
| 3193 | error ("Not using Mac OS"); | 3220 | error ("Not using Mac native windows"); |
| 3194 | 3221 | ||
| 3195 | if (! NILP (xrm_string)) | 3222 | if (! NILP (xrm_string)) |
| 3196 | xrm_option = (unsigned char *) SDATA (xrm_string); | 3223 | xrm_option = (unsigned char *) SDATA (xrm_string); |
| @@ -3238,11 +3265,9 @@ If DISPLAY is nil, that stands for the selected frame's display. */) | |||
| 3238 | for (i = 0; i < dpyinfo->n_fonts; i++) | 3265 | for (i = 0; i < dpyinfo->n_fonts; i++) |
| 3239 | if (dpyinfo->font_table[i].name) | 3266 | if (dpyinfo->font_table[i].name) |
| 3240 | { | 3267 | { |
| 3241 | if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name) | 3268 | mac_unload_font (dpyinfo, dpyinfo->font_table[i].font); |
| 3242 | xfree (dpyinfo->font_table[i].full_name); | ||
| 3243 | xfree (dpyinfo->font_table[i].name); | ||
| 3244 | x_unload_font (dpyinfo, dpyinfo->font_table[i].font); | ||
| 3245 | } | 3269 | } |
| 3270 | |||
| 3246 | x_destroy_all_bitmaps (dpyinfo); | 3271 | x_destroy_all_bitmaps (dpyinfo); |
| 3247 | 3272 | ||
| 3248 | x_delete_display (dpyinfo); | 3273 | x_delete_display (dpyinfo); |
| @@ -3250,7 +3275,6 @@ If DISPLAY is nil, that stands for the selected frame's display. */) | |||
| 3250 | 3275 | ||
| 3251 | return Qnil; | 3276 | return Qnil; |
| 3252 | } | 3277 | } |
| 3253 | #endif /* 0 */ | ||
| 3254 | 3278 | ||
| 3255 | DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, | 3279 | DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, |
| 3256 | doc: /* Return the list of display names that Emacs has connections to. */) | 3280 | doc: /* Return the list of display names that Emacs has connections to. */) |
| @@ -3813,18 +3837,23 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 3813 | 3837 | ||
| 3814 | BLOCK_INPUT; | 3838 | BLOCK_INPUT; |
| 3815 | SetRect (&r, 0, 0, 1, 1); | 3839 | SetRect (&r, 0, 0, 1, 1); |
| 3840 | #if TARGET_API_MAC_CARBON | ||
| 3816 | if (CreateNewWindow (kHelpWindowClass, | 3841 | if (CreateNewWindow (kHelpWindowClass, |
| 3817 | #ifdef MAC_OS_X_VERSION_10_2 | 3842 | #ifdef MAC_OS_X_VERSION_10_2 |
| 3818 | kWindowIgnoreClicksAttribute | | 3843 | kWindowIgnoreClicksAttribute | |
| 3819 | #endif | 3844 | #endif |
| 3845 | kWindowNoUpdatesAttribute | | ||
| 3820 | kWindowNoActivatesAttribute, | 3846 | kWindowNoActivatesAttribute, |
| 3821 | &r, &tip_window) == noErr) | 3847 | &r, &tip_window) == noErr) |
| 3848 | #else | ||
| 3849 | if (tip_window = NewCWindow (NULL, &r, "\p", false, plainDBox, | ||
| 3850 | NULL, false, 0L)) | ||
| 3851 | #endif | ||
| 3822 | { | 3852 | { |
| 3823 | FRAME_MAC_WINDOW (f) = tip_window; | 3853 | FRAME_MAC_WINDOW (f) = tip_window; |
| 3824 | SetWRefCon (tip_window, (long) f->output_data.mac); | 3854 | SetWRefCon (tip_window, (long) f->output_data.mac); |
| 3825 | /* so that update events can find this mac_output struct */ | 3855 | /* so that update events can find this mac_output struct */ |
| 3826 | f->output_data.mac->mFP = f; | 3856 | f->output_data.mac->mFP = f; |
| 3827 | ShowWindow (tip_window); | ||
| 3828 | } | 3857 | } |
| 3829 | UNBLOCK_INPUT; | 3858 | UNBLOCK_INPUT; |
| 3830 | } | 3859 | } |
| @@ -4140,6 +4169,7 @@ Text larger than the specified size is clipped. */) | |||
| 4140 | BLOCK_INPUT; | 4169 | BLOCK_INPUT; |
| 4141 | MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false); | 4170 | MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false); |
| 4142 | SizeWindow (FRAME_MAC_WINDOW (f), width, height, true); | 4171 | SizeWindow (FRAME_MAC_WINDOW (f), width, height, true); |
| 4172 | ShowWindow (FRAME_MAC_WINDOW (f)); | ||
| 4143 | BringToFront (FRAME_MAC_WINDOW (f)); | 4173 | BringToFront (FRAME_MAC_WINDOW (f)); |
| 4144 | UNBLOCK_INPUT; | 4174 | UNBLOCK_INPUT; |
| 4145 | 4175 | ||
| @@ -4198,7 +4228,7 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 4198 | 4228 | ||
| 4199 | 4229 | ||
| 4200 | 4230 | ||
| 4201 | #ifdef TARGET_API_MAC_CARBON | 4231 | #if TARGET_API_MAC_CARBON |
| 4202 | /*********************************************************************** | 4232 | /*********************************************************************** |
| 4203 | File selection dialog | 4233 | File selection dialog |
| 4204 | ***********************************************************************/ | 4234 | ***********************************************************************/ |
| @@ -4405,14 +4435,19 @@ frame_parm_handler mac_frame_parm_handlers[] = | |||
| 4405 | x_set_fringe_width, | 4435 | x_set_fringe_width, |
| 4406 | x_set_fringe_width, | 4436 | x_set_fringe_width, |
| 4407 | 0, /* x_set_wait_for_wm, */ | 4437 | 0, /* x_set_wait_for_wm, */ |
| 4408 | 0, /* MAC_TODO: x_set_fullscreen, */ | 4438 | x_set_fullscreen, |
| 4409 | }; | 4439 | }; |
| 4410 | 4440 | ||
| 4411 | void | 4441 | void |
| 4412 | syms_of_macfns () | 4442 | syms_of_macfns () |
| 4413 | { | 4443 | { |
| 4414 | /* Certainly running on Mac. */ | 4444 | #ifdef MAC_OSX |
| 4445 | /* This is zero if not using Mac native windows. */ | ||
| 4446 | mac_in_use = 0; | ||
| 4447 | #else | ||
| 4448 | /* Certainly running on Mac native windows. */ | ||
| 4415 | mac_in_use = 1; | 4449 | mac_in_use = 1; |
| 4450 | #endif | ||
| 4416 | 4451 | ||
| 4417 | /* The section below is built by the lisp expression at the top of the file, | 4452 | /* The section below is built by the lisp expression at the top of the file, |
| 4418 | just above where these variables are declared. */ | 4453 | just above where these variables are declared. */ |
| @@ -4536,10 +4571,8 @@ Chinese, Japanese, and Korean. */); | |||
| 4536 | defsubr (&Sx_display_backing_store); | 4571 | defsubr (&Sx_display_backing_store); |
| 4537 | defsubr (&Sx_display_save_under); | 4572 | defsubr (&Sx_display_save_under); |
| 4538 | defsubr (&Sx_create_frame); | 4573 | defsubr (&Sx_create_frame); |
| 4539 | #if 0 /* MAC_TODO: implement network support */ | ||
| 4540 | defsubr (&Sx_open_connection); | 4574 | defsubr (&Sx_open_connection); |
| 4541 | defsubr (&Sx_close_connection); | 4575 | defsubr (&Sx_close_connection); |
| 4542 | #endif | ||
| 4543 | defsubr (&Sx_display_list); | 4576 | defsubr (&Sx_display_list); |
| 4544 | defsubr (&Sx_synchronize); | 4577 | defsubr (&Sx_synchronize); |
| 4545 | 4578 | ||
diff --git a/src/macgui.h b/src/macgui.h index e5ea665ac15..1e1447dfaa8 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -62,18 +62,17 @@ typedef unsigned long Time; | |||
| 62 | #else | 62 | #else |
| 63 | #include <QuickDraw.h> /* for WindowPtr */ | 63 | #include <QuickDraw.h> /* for WindowPtr */ |
| 64 | #include <QDOffscreen.h> /* for GWorldPtr */ | 64 | #include <QDOffscreen.h> /* for GWorldPtr */ |
| 65 | #include <Controls.h> /* for ControlHandle in xdisp.c */ | 65 | #include <Windows.h> |
| 66 | #include <Gestalt.h> | 66 | #include <Gestalt.h> |
| 67 | #endif | 67 | #endif |
| 68 | 68 | ||
| 69 | typedef WindowPtr Window; | ||
| 69 | typedef GWorldPtr Pixmap; | 70 | typedef GWorldPtr Pixmap; |
| 70 | 71 | ||
| 71 | #if TARGET_API_MAC_CARBON | 72 | #if TARGET_API_MAC_CARBON |
| 72 | typedef struct OpaqueWindowPtr *Window; | ||
| 73 | #define Cursor ThemeCursor | 73 | #define Cursor ThemeCursor |
| 74 | #define No_Cursor (-1) | 74 | #define No_Cursor (-1) |
| 75 | #else | 75 | #else |
| 76 | typedef WindowPtr Window; | ||
| 77 | #define SetPortWindowPort(w) SetPort(w) | 76 | #define SetPortWindowPort(w) SetPort(w) |
| 78 | #define Cursor CursHandle | 77 | #define Cursor CursHandle |
| 79 | #define No_Cursor (0) | 78 | #define No_Cursor (0) |
| @@ -198,6 +197,29 @@ XCreateGC (void *, Window, unsigned long, XGCValues *); | |||
| 198 | #define XNegative 0x0010 | 197 | #define XNegative 0x0010 |
| 199 | #define YNegative 0x0020 | 198 | #define YNegative 0x0020 |
| 200 | 199 | ||
| 200 | typedef struct { | ||
| 201 | long flags; /* marks which fields in this structure are defined */ | ||
| 202 | #if 0 | ||
| 203 | int x, y; /* obsolete for new window mgrs, but clients */ | ||
| 204 | int width, height; /* should set so old wm's don't mess up */ | ||
| 205 | #endif | ||
| 206 | int min_width, min_height; | ||
| 207 | #if 0 | ||
| 208 | int max_width, max_height; | ||
| 209 | #endif | ||
| 210 | int width_inc, height_inc; | ||
| 211 | #if 0 | ||
| 212 | struct { | ||
| 213 | int x; /* numerator */ | ||
| 214 | int y; /* denominator */ | ||
| 215 | } min_aspect, max_aspect; | ||
| 216 | #endif | ||
| 217 | int base_width, base_height; /* added by ICCCM version 1 */ | ||
| 218 | #if 0 | ||
| 219 | int win_gravity; /* added by ICCCM version 1 */ | ||
| 220 | #endif | ||
| 221 | } XSizeHints; | ||
| 222 | |||
| 201 | #define USPosition (1L << 0) /* user specified x, y */ | 223 | #define USPosition (1L << 0) /* user specified x, y */ |
| 202 | #define USSize (1L << 1) /* user specified width, height */ | 224 | #define USSize (1L << 1) /* user specified width, height */ |
| 203 | 225 | ||
diff --git a/src/macterm.c b/src/macterm.c index da3dcb15ee8..382400d1d85 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -1178,7 +1178,17 @@ static void | |||
| 1178 | x_update_begin (f) | 1178 | x_update_begin (f) |
| 1179 | struct frame *f; | 1179 | struct frame *f; |
| 1180 | { | 1180 | { |
| 1181 | /* Nothing to do. */ | 1181 | #if TARGET_API_MAC_CARBON |
| 1182 | /* During update of a frame, availability of input events is | ||
| 1183 | periodically checked with ReceiveNextEvent if | ||
| 1184 | redisplay-dont-pause is nil. That normally flushes window buffer | ||
| 1185 | changes for every check, and thus screen update looks waving even | ||
| 1186 | if no input is available. So we disable screen updates during | ||
| 1187 | update of a frame. */ | ||
| 1188 | BLOCK_INPUT; | ||
| 1189 | DisableScreenUpdates (); | ||
| 1190 | UNBLOCK_INPUT; | ||
| 1191 | #endif | ||
| 1182 | } | 1192 | } |
| 1183 | 1193 | ||
| 1184 | 1194 | ||
| @@ -1263,7 +1273,7 @@ mac_draw_vertical_window_border (w, x, y0, y1) | |||
| 1263 | make sure that the mouse-highlight is properly redrawn. | 1273 | make sure that the mouse-highlight is properly redrawn. |
| 1264 | 1274 | ||
| 1265 | W may be a menu bar pseudo-window in case we don't have X toolkit | 1275 | W may be a menu bar pseudo-window in case we don't have X toolkit |
| 1266 | support. Such windows don't have a cursor, so don't display it | 1276 | support. Such windows don't have a cursor, so don't display it |
| 1267 | here. */ | 1277 | here. */ |
| 1268 | 1278 | ||
| 1269 | static void | 1279 | static void |
| @@ -1327,6 +1337,9 @@ x_update_end (f) | |||
| 1327 | 1337 | ||
| 1328 | mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); | 1338 | mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); |
| 1329 | 1339 | ||
| 1340 | #if TARGET_API_MAC_CARBON | ||
| 1341 | EnableScreenUpdates (); | ||
| 1342 | #endif | ||
| 1330 | XFlush (FRAME_MAC_DISPLAY (f)); | 1343 | XFlush (FRAME_MAC_DISPLAY (f)); |
| 1331 | UNBLOCK_INPUT; | 1344 | UNBLOCK_INPUT; |
| 1332 | } | 1345 | } |
| @@ -1983,7 +1996,7 @@ x_draw_glyph_string_background (s, force_p) | |||
| 1983 | } | 1996 | } |
| 1984 | else | 1997 | else |
| 1985 | #endif | 1998 | #endif |
| 1986 | #if 0 /* defined(MAC_OS8)*/ | 1999 | #ifdef MAC_OS8 |
| 1987 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width | 2000 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width |
| 1988 | || s->font_not_found_p | 2001 | || s->font_not_found_p |
| 1989 | || s->extends_to_end_of_line_p | 2002 | || s->extends_to_end_of_line_p |
| @@ -2041,7 +2054,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2041 | for (i = 0; i < s->nchars; ++i) | 2054 | for (i = 0; i < s->nchars; ++i) |
| 2042 | char1b[i] = s->char2b[i].byte2; | 2055 | char1b[i] = s->char2b[i].byte2; |
| 2043 | 2056 | ||
| 2044 | #if 0 /* defined(MAC_OS8) */ | 2057 | #ifdef MAC_OS8 |
| 2045 | /* Draw text with XDrawString if background has already been | 2058 | /* Draw text with XDrawString if background has already been |
| 2046 | filled. Otherwise, use XDrawImageString. (Note that | 2059 | filled. Otherwise, use XDrawImageString. (Note that |
| 2047 | XDrawImageString is usually faster than XDrawString.) Always | 2060 | XDrawImageString is usually faster than XDrawString.) Always |
| @@ -2059,7 +2072,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2059 | XDrawString (s->display, s->window, s->gc, x, | 2072 | XDrawString (s->display, s->window, s->gc, x, |
| 2060 | s->ybase - boff, char1b, s->nchars); | 2073 | s->ybase - boff, char1b, s->nchars); |
| 2061 | } | 2074 | } |
| 2062 | #if 0 /* defined(MAC_OS8)*/ | 2075 | #ifdef MAC_OS8 |
| 2063 | else | 2076 | else |
| 2064 | { | 2077 | { |
| 2065 | if (s->two_byte_p) | 2078 | if (s->two_byte_p) |
| @@ -3652,6 +3665,7 @@ x_get_keysym_name (keysym) | |||
| 3652 | 3665 | ||
| 3653 | 3666 | ||
| 3654 | 3667 | ||
| 3668 | #if 0 | ||
| 3655 | /* Mouse clicks and mouse movement. Rah. */ | 3669 | /* Mouse clicks and mouse movement. Rah. */ |
| 3656 | 3670 | ||
| 3657 | /* Prepare a mouse-event in *RESULT for placement in the input queue. | 3671 | /* Prepare a mouse-event in *RESULT for placement in the input queue. |
| @@ -3685,6 +3699,7 @@ construct_mouse_click (result, event, f) | |||
| 3685 | result->arg = Qnil; | 3699 | result->arg = Qnil; |
| 3686 | return Qnil; | 3700 | return Qnil; |
| 3687 | } | 3701 | } |
| 3702 | #endif | ||
| 3688 | 3703 | ||
| 3689 | 3704 | ||
| 3690 | /* Function to report a mouse movement to the mainstream Emacs code. | 3705 | /* Function to report a mouse movement to the mainstream Emacs code. |
| @@ -3754,8 +3769,6 @@ int disable_mouse_highlight; | |||
| 3754 | 3769 | ||
| 3755 | static struct scroll_bar *x_window_to_scroll_bar (); | 3770 | static struct scroll_bar *x_window_to_scroll_bar (); |
| 3756 | static void x_scroll_bar_report_motion (); | 3771 | static void x_scroll_bar_report_motion (); |
| 3757 | static void x_check_fullscreen P_ ((struct frame *)); | ||
| 3758 | static void x_check_fullscreen_move P_ ((struct frame *)); | ||
| 3759 | static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); | 3772 | static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); |
| 3760 | 3773 | ||
| 3761 | 3774 | ||
| @@ -4017,7 +4030,7 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height) | |||
| 4017 | r.right = left + width; | 4030 | r.right = left + width; |
| 4018 | r.bottom = disp_top + disp_height; | 4031 | r.bottom = disp_top + disp_height; |
| 4019 | 4032 | ||
| 4020 | #ifdef TARGET_API_MAC_CARBON | 4033 | #if TARGET_API_MAC_CARBON |
| 4021 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, | 4034 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, |
| 4022 | kControlScrollBarProc, 0L); | 4035 | kControlScrollBarProc, 0L); |
| 4023 | #else | 4036 | #else |
| @@ -4395,7 +4408,7 @@ activate_scroll_bars (frame) | |||
| 4395 | while (! NILP (bar)) | 4408 | while (! NILP (bar)) |
| 4396 | { | 4409 | { |
| 4397 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); | 4410 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); |
| 4398 | #ifdef TARGET_API_MAC_CARBON | 4411 | #if 1 /* TARGET_API_MAC_CARBON */ |
| 4399 | ActivateControl (ch); | 4412 | ActivateControl (ch); |
| 4400 | #else | 4413 | #else |
| 4401 | SetControlMaximum (ch, | 4414 | SetControlMaximum (ch, |
| @@ -4419,10 +4432,10 @@ deactivate_scroll_bars (frame) | |||
| 4419 | while (! NILP (bar)) | 4432 | while (! NILP (bar)) |
| 4420 | { | 4433 | { |
| 4421 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); | 4434 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); |
| 4422 | #ifdef TARGET_API_MAC_CARBON | 4435 | #if 1 /* TARGET_API_MAC_CARBON */ |
| 4423 | DeactivateControl (ch); | 4436 | DeactivateControl (ch); |
| 4424 | #else | 4437 | #else |
| 4425 | SetControlMaximum (ch, XINT (-1)); | 4438 | SetControlMaximum (ch, -1); |
| 4426 | #endif | 4439 | #endif |
| 4427 | bar = XSCROLL_BAR (bar)->next; | 4440 | bar = XSCROLL_BAR (bar)->next; |
| 4428 | } | 4441 | } |
| @@ -4466,7 +4479,7 @@ x_scroll_bar_handle_click (bar, part_code, er, bufp) | |||
| 4466 | case kControlPageDownPart: | 4479 | case kControlPageDownPart: |
| 4467 | bufp->part = scroll_bar_below_handle; | 4480 | bufp->part = scroll_bar_below_handle; |
| 4468 | break; | 4481 | break; |
| 4469 | #ifdef TARGET_API_MAC_CARBON | 4482 | #if TARGET_API_MAC_CARBON |
| 4470 | default: | 4483 | default: |
| 4471 | #else | 4484 | #else |
| 4472 | case kControlIndicatorPart: | 4485 | case kControlIndicatorPart: |
| @@ -4974,13 +4987,16 @@ x_new_font (f, fontname) | |||
| 4974 | XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc, | 4987 | XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc, |
| 4975 | FRAME_FONT (f)); | 4988 | FRAME_FONT (f)); |
| 4976 | 4989 | ||
| 4990 | /* Don't change the size of a tip frame; there's no point in | ||
| 4991 | doing it because it's done in Fx_show_tip, and it leads to | ||
| 4992 | problems because the tip frame has no widget. */ | ||
| 4977 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) | 4993 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
| 4978 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); | 4994 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); |
| 4979 | } | 4995 | } |
| 4980 | 4996 | ||
| 4981 | return build_string (fontp->full_name); | 4997 | return build_string (fontp->full_name); |
| 4982 | } | 4998 | } |
| 4983 | 4999 | ||
| 4984 | /* Give frame F the fontset named FONTSETNAME as its default font, and | 5000 | /* Give frame F the fontset named FONTSETNAME as its default font, and |
| 4985 | return the full name of that fontset. FONTSETNAME may be a wildcard | 5001 | return the full name of that fontset. FONTSETNAME may be a wildcard |
| 4986 | pattern; in that case, we choose some fontset that fits the pattern. | 5002 | pattern; in that case, we choose some fontset that fits the pattern. |
| @@ -5369,6 +5385,25 @@ x_make_frame_visible (f) | |||
| 5369 | 5385 | ||
| 5370 | f->output_data.mac->asked_for_visible = 1; | 5386 | f->output_data.mac->asked_for_visible = 1; |
| 5371 | 5387 | ||
| 5388 | #if TARGET_API_MAC_CARBON | ||
| 5389 | if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) | ||
| 5390 | { | ||
| 5391 | struct frame *sf = SELECTED_FRAME (); | ||
| 5392 | if (!FRAME_MAC_P (sf)) | ||
| 5393 | RepositionWindow (FRAME_MAC_WINDOW (f), NULL, | ||
| 5394 | kWindowCenterOnMainScreen); | ||
| 5395 | else | ||
| 5396 | RepositionWindow (FRAME_MAC_WINDOW (f), | ||
| 5397 | FRAME_MAC_WINDOW (sf), | ||
| 5398 | #ifdef MAC_OS_X_VERSION_10_2 | ||
| 5399 | kWindowCascadeStartAtParentWindowScreen | ||
| 5400 | #else | ||
| 5401 | kWindowCascadeOnParentWindowScreen | ||
| 5402 | #endif | ||
| 5403 | ); | ||
| 5404 | x_real_positions (f, &f->left_pos, &f->top_pos); | ||
| 5405 | } | ||
| 5406 | #endif | ||
| 5372 | ShowWindow (FRAME_MAC_WINDOW (f)); | 5407 | ShowWindow (FRAME_MAC_WINDOW (f)); |
| 5373 | } | 5408 | } |
| 5374 | 5409 | ||
| @@ -5496,6 +5531,9 @@ x_free_frame_resources (f) | |||
| 5496 | 5531 | ||
| 5497 | x_free_gcs (f); | 5532 | x_free_gcs (f); |
| 5498 | 5533 | ||
| 5534 | if (FRAME_SIZE_HINTS (f)) | ||
| 5535 | xfree (FRAME_SIZE_HINTS (f)); | ||
| 5536 | |||
| 5499 | xfree (f->output_data.mac); | 5537 | xfree (f->output_data.mac); |
| 5500 | f->output_data.mac = NULL; | 5538 | f->output_data.mac = NULL; |
| 5501 | 5539 | ||
| @@ -5548,143 +5586,39 @@ x_wm_set_size_hint (f, flags, user_position) | |||
| 5548 | long flags; | 5586 | long flags; |
| 5549 | int user_position; | 5587 | int user_position; |
| 5550 | { | 5588 | { |
| 5551 | #if 0 /* MAC_TODO: connect this to the Appearance Manager */ | 5589 | int base_width, base_height, width_inc, height_inc; |
| 5552 | XSizeHints size_hints; | 5590 | int min_rows = 0, min_cols = 0; |
| 5553 | 5591 | XSizeHints *size_hints; | |
| 5554 | #ifdef USE_X_TOOLKIT | ||
| 5555 | Arg al[2]; | ||
| 5556 | int ac = 0; | ||
| 5557 | Dimension widget_width, widget_height; | ||
| 5558 | Window window = XtWindow (f->output_data.x->widget); | ||
| 5559 | #else /* not USE_X_TOOLKIT */ | ||
| 5560 | Window window = FRAME_X_WINDOW (f); | ||
| 5561 | #endif /* not USE_X_TOOLKIT */ | ||
| 5562 | |||
| 5563 | /* Setting PMaxSize caused various problems. */ | ||
| 5564 | size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; | ||
| 5565 | |||
| 5566 | size_hints.x = f->left_pos; | ||
| 5567 | size_hints.y = f->top_pos; | ||
| 5568 | |||
| 5569 | #ifdef USE_X_TOOLKIT | ||
| 5570 | XtSetArg (al[ac], XtNwidth, &widget_width); ac++; | ||
| 5571 | XtSetArg (al[ac], XtNheight, &widget_height); ac++; | ||
| 5572 | XtGetValues (f->output_data.x->widget, al, ac); | ||
| 5573 | size_hints.height = widget_height; | ||
| 5574 | size_hints.width = widget_width; | ||
| 5575 | #else /* not USE_X_TOOLKIT */ | ||
| 5576 | size_hints.height = FRAME_PIXEL_HEIGHT (f); | ||
| 5577 | size_hints.width = FRAME_PIXEL_WIDTH (f); | ||
| 5578 | #endif /* not USE_X_TOOLKIT */ | ||
| 5579 | |||
| 5580 | size_hints.width_inc = FRAME_COLUMN_WIDTH (f); | ||
| 5581 | size_hints.height_inc = FRAME_LINE_HEIGHT (f); | ||
| 5582 | size_hints.max_width | ||
| 5583 | = FRAME_X_DISPLAY_INFO (f)->width - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); | ||
| 5584 | size_hints.max_height | ||
| 5585 | = FRAME_X_DISPLAY_INFO (f)->height - FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); | ||
| 5586 | |||
| 5587 | /* Calculate the base and minimum sizes. | ||
| 5588 | |||
| 5589 | (When we use the X toolkit, we don't do it here. | ||
| 5590 | Instead we copy the values that the widgets are using, below.) */ | ||
| 5591 | #ifndef USE_X_TOOLKIT | ||
| 5592 | { | ||
| 5593 | int base_width, base_height; | ||
| 5594 | int min_rows = 0, min_cols = 0; | ||
| 5595 | |||
| 5596 | base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); | ||
| 5597 | base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); | ||
| 5598 | 5592 | ||
| 5599 | check_frame_size (f, &min_rows, &min_cols); | 5593 | base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); |
| 5594 | base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); | ||
| 5595 | width_inc = FRAME_COLUMN_WIDTH (f); | ||
| 5596 | height_inc = FRAME_LINE_HEIGHT (f); | ||
| 5600 | 5597 | ||
| 5601 | /* The window manager uses the base width hints to calculate the | 5598 | check_frame_size (f, &min_rows, &min_cols); |
| 5602 | current number of rows and columns in the frame while | ||
| 5603 | resizing; min_width and min_height aren't useful for this | ||
| 5604 | purpose, since they might not give the dimensions for a | ||
| 5605 | zero-row, zero-column frame. | ||
| 5606 | 5599 | ||
| 5607 | We use the base_width and base_height members if we have | 5600 | size_hints = FRAME_SIZE_HINTS (f); |
| 5608 | them; otherwise, we set the min_width and min_height members | 5601 | if (size_hints == NULL) |
| 5609 | to the size for a zero x zero frame. */ | ||
| 5610 | |||
| 5611 | #ifdef HAVE_X11R4 | ||
| 5612 | size_hints.flags |= PBaseSize; | ||
| 5613 | size_hints.base_width = base_width; | ||
| 5614 | size_hints.base_height = base_height; | ||
| 5615 | size_hints.min_width = base_width + min_cols * size_hints.width_inc; | ||
| 5616 | size_hints.min_height = base_height + min_rows * size_hints.height_inc; | ||
| 5617 | #else | ||
| 5618 | size_hints.min_width = base_width; | ||
| 5619 | size_hints.min_height = base_height; | ||
| 5620 | #endif | ||
| 5621 | } | ||
| 5622 | |||
| 5623 | /* If we don't need the old flags, we don't need the old hint at all. */ | ||
| 5624 | if (flags) | ||
| 5625 | { | 5602 | { |
| 5626 | size_hints.flags |= flags; | 5603 | size_hints = FRAME_SIZE_HINTS (f) = xmalloc (sizeof (XSizeHints)); |
| 5627 | goto no_read; | 5604 | bzero (size_hints, sizeof (XSizeHints)); |
| 5628 | } | 5605 | } |
| 5629 | #endif /* not USE_X_TOOLKIT */ | ||
| 5630 | |||
| 5631 | { | ||
| 5632 | XSizeHints hints; /* Sometimes I hate X Windows... */ | ||
| 5633 | long supplied_return; | ||
| 5634 | int value; | ||
| 5635 | |||
| 5636 | #ifdef HAVE_X11R4 | ||
| 5637 | value = XGetWMNormalHints (FRAME_X_DISPLAY (f), window, &hints, | ||
| 5638 | &supplied_return); | ||
| 5639 | #else | ||
| 5640 | value = XGetNormalHints (FRAME_X_DISPLAY (f), window, &hints); | ||
| 5641 | #endif | ||
| 5642 | |||
| 5643 | #ifdef USE_X_TOOLKIT | ||
| 5644 | size_hints.base_height = hints.base_height; | ||
| 5645 | size_hints.base_width = hints.base_width; | ||
| 5646 | size_hints.min_height = hints.min_height; | ||
| 5647 | size_hints.min_width = hints.min_width; | ||
| 5648 | #endif | ||
| 5649 | |||
| 5650 | if (flags) | ||
| 5651 | size_hints.flags |= flags; | ||
| 5652 | else | ||
| 5653 | { | ||
| 5654 | if (value == 0) | ||
| 5655 | hints.flags = 0; | ||
| 5656 | if (hints.flags & PSize) | ||
| 5657 | size_hints.flags |= PSize; | ||
| 5658 | if (hints.flags & PPosition) | ||
| 5659 | size_hints.flags |= PPosition; | ||
| 5660 | if (hints.flags & USPosition) | ||
| 5661 | size_hints.flags |= USPosition; | ||
| 5662 | if (hints.flags & USSize) | ||
| 5663 | size_hints.flags |= USSize; | ||
| 5664 | } | ||
| 5665 | } | ||
| 5666 | |||
| 5667 | #ifndef USE_X_TOOLKIT | ||
| 5668 | no_read: | ||
| 5669 | #endif | ||
| 5670 | 5606 | ||
| 5671 | #ifdef PWinGravity | 5607 | size_hints->flags |= PResizeInc | PMinSize | PBaseSize ; |
| 5672 | size_hints.win_gravity = f->win_gravity; | 5608 | size_hints->width_inc = width_inc; |
| 5673 | size_hints.flags |= PWinGravity; | 5609 | size_hints->height_inc = height_inc; |
| 5610 | size_hints->min_width = base_width + min_cols * width_inc; | ||
| 5611 | size_hints->min_height = base_height + min_rows * height_inc; | ||
| 5612 | size_hints->base_width = base_width; | ||
| 5613 | size_hints->base_height = base_height; | ||
| 5674 | 5614 | ||
| 5675 | if (user_position) | 5615 | if (flags) |
| 5616 | size_hints->flags = flags; | ||
| 5617 | else if (user_position) | ||
| 5676 | { | 5618 | { |
| 5677 | size_hints.flags &= ~ PPosition; | 5619 | size_hints->flags &= ~ PPosition; |
| 5678 | size_hints.flags |= USPosition; | 5620 | size_hints->flags |= USPosition; |
| 5679 | } | 5621 | } |
| 5680 | #endif /* PWinGravity */ | ||
| 5681 | |||
| 5682 | #ifdef HAVE_X11R4 | ||
| 5683 | XSetWMNormalHints (FRAME_X_DISPLAY (f), window, &size_hints); | ||
| 5684 | #else | ||
| 5685 | XSetNormalHints (FRAME_X_DISPLAY (f), window, &size_hints); | ||
| 5686 | #endif | ||
| 5687 | #endif /* MAC_TODO */ | ||
| 5688 | } | 5622 | } |
| 5689 | 5623 | ||
| 5690 | #if 0 /* MAC_TODO: hide application instead of iconify? */ | 5624 | #if 0 /* MAC_TODO: hide application instead of iconify? */ |
| @@ -6120,7 +6054,7 @@ init_font_name_table () | |||
| 6120 | break; | 6054 | break; |
| 6121 | sc = GetTextEncodingBase (encoding); | 6055 | sc = GetTextEncodingBase (encoding); |
| 6122 | decode_mac_font_name (name, sizeof (name), sc); | 6056 | decode_mac_font_name (name, sizeof (name), sc); |
| 6123 | 6057 | ||
| 6124 | /* Point the instance iterator at the current font family. */ | 6058 | /* Point the instance iterator at the current font family. */ |
| 6125 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) | 6059 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) |
| 6126 | break; | 6060 | break; |
| @@ -6259,6 +6193,19 @@ init_font_name_table () | |||
| 6259 | } | 6193 | } |
| 6260 | 6194 | ||
| 6261 | 6195 | ||
| 6196 | void | ||
| 6197 | mac_clear_font_name_table () | ||
| 6198 | { | ||
| 6199 | int i; | ||
| 6200 | |||
| 6201 | for (i = 0; i < font_name_count; i++) | ||
| 6202 | xfree (font_name_table[i]); | ||
| 6203 | xfree (font_name_table); | ||
| 6204 | font_name_table = NULL; | ||
| 6205 | font_name_table_size = font_name_count = 0; | ||
| 6206 | } | ||
| 6207 | |||
| 6208 | |||
| 6262 | enum xlfd_scalable_field_index | 6209 | enum xlfd_scalable_field_index |
| 6263 | { | 6210 | { |
| 6264 | XLFD_SCL_PIXEL_SIZE, | 6211 | XLFD_SCL_PIXEL_SIZE, |
| @@ -6311,6 +6258,9 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6311 | char *longest_start, *cur_start, *nonspecial; | 6258 | char *longest_start, *cur_start, *nonspecial; |
| 6312 | int longest_len, cur_len, exact; | 6259 | int longest_len, cur_len, exact; |
| 6313 | 6260 | ||
| 6261 | if (font_name_table == NULL) /* Initialize when first used. */ | ||
| 6262 | init_font_name_table (); | ||
| 6263 | |||
| 6314 | for (i = 0; i < XLFD_SCL_LAST; i++) | 6264 | for (i = 0; i < XLFD_SCL_LAST; i++) |
| 6315 | scl_val[i] = -1; | 6265 | scl_val[i] = -1; |
| 6316 | 6266 | ||
| @@ -6471,9 +6421,6 @@ x_list_fonts (struct frame *f, | |||
| 6471 | Lisp_Object newlist = Qnil, tem, key; | 6421 | Lisp_Object newlist = Qnil, tem, key; |
| 6472 | struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL; | 6422 | struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL; |
| 6473 | 6423 | ||
| 6474 | if (font_name_table == NULL) /* Initialize when first used. */ | ||
| 6475 | init_font_name_table (); | ||
| 6476 | |||
| 6477 | if (dpyinfo) | 6424 | if (dpyinfo) |
| 6478 | { | 6425 | { |
| 6479 | tem = XCDR (dpyinfo->name_list_element); | 6426 | tem = XCDR (dpyinfo->name_list_element); |
| @@ -6487,7 +6434,9 @@ x_list_fonts (struct frame *f, | |||
| 6487 | } | 6434 | } |
| 6488 | } | 6435 | } |
| 6489 | 6436 | ||
| 6437 | BLOCK_INPUT; | ||
| 6490 | newlist = mac_do_list_fonts (SDATA (pattern), maxnames); | 6438 | newlist = mac_do_list_fonts (SDATA (pattern), maxnames); |
| 6439 | UNBLOCK_INPUT; | ||
| 6491 | 6440 | ||
| 6492 | /* MAC_TODO: add code for matching outline fonts here */ | 6441 | /* MAC_TODO: add code for matching outline fonts here */ |
| 6493 | 6442 | ||
| @@ -6791,6 +6740,18 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 6791 | } | 6740 | } |
| 6792 | 6741 | ||
| 6793 | 6742 | ||
| 6743 | void | ||
| 6744 | mac_unload_font (dpyinfo, font) | ||
| 6745 | struct mac_display_info *dpyinfo; | ||
| 6746 | XFontStruct *font; | ||
| 6747 | { | ||
| 6748 | xfree (font->fontname); | ||
| 6749 | if (font->per_char) | ||
| 6750 | xfree (font->per_char); | ||
| 6751 | xfree (font); | ||
| 6752 | } | ||
| 6753 | |||
| 6754 | |||
| 6794 | /* Load font named FONTNAME of the size SIZE for frame F, and return a | 6755 | /* Load font named FONTNAME of the size SIZE for frame F, and return a |
| 6795 | pointer to the structure font_info while allocating it dynamically. | 6756 | pointer to the structure font_info while allocating it dynamically. |
| 6796 | If SIZE is 0, load any size of font. | 6757 | If SIZE is 0, load any size of font. |
| @@ -6841,7 +6802,9 @@ x_load_font (f, fontname, size) | |||
| 6841 | if (size > 0 && !NILP (font_names)) | 6802 | if (size > 0 && !NILP (font_names)) |
| 6842 | fontname = (char *) SDATA (XCAR (font_names)); | 6803 | fontname = (char *) SDATA (XCAR (font_names)); |
| 6843 | 6804 | ||
| 6805 | BLOCK_INPUT; | ||
| 6844 | font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname); | 6806 | font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname); |
| 6807 | UNBLOCK_INPUT; | ||
| 6845 | if (!font) | 6808 | if (!font) |
| 6846 | return NULL; | 6809 | return NULL; |
| 6847 | 6810 | ||
| @@ -7121,15 +7084,21 @@ do_ae_print_documents (const AppleEvent *, AppleEvent *, long); | |||
| 7121 | static pascal OSErr do_ae_open_documents (AppleEvent *, AppleEvent *, long); | 7084 | static pascal OSErr do_ae_open_documents (AppleEvent *, AppleEvent *, long); |
| 7122 | static pascal OSErr do_ae_quit_application (AppleEvent *, AppleEvent *, long); | 7085 | static pascal OSErr do_ae_quit_application (AppleEvent *, AppleEvent *, long); |
| 7123 | 7086 | ||
| 7087 | #if TARGET_API_MAC_CARBON | ||
| 7124 | /* Drag and Drop */ | 7088 | /* Drag and Drop */ |
| 7125 | static OSErr init_mac_drag_n_drop (); | 7089 | static OSErr init_mac_drag_n_drop (); |
| 7126 | static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); | 7090 | static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); |
| 7091 | #endif | ||
| 7127 | 7092 | ||
| 7128 | #if USE_CARBON_EVENTS | 7093 | #if USE_CARBON_EVENTS |
| 7129 | /* Preliminary Support for the OSX Services Menu */ | 7094 | /* Preliminary Support for the OSX Services Menu */ |
| 7130 | static OSStatus mac_handle_service_event (EventHandlerCallRef,EventRef,void*); | 7095 | static OSStatus mac_handle_service_event (EventHandlerCallRef,EventRef,void*); |
| 7131 | static void init_service_handler (); | 7096 | static void init_service_handler (); |
| 7097 | /* Window Event Handler */ | ||
| 7098 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, | ||
| 7099 | EventRef, void *); | ||
| 7132 | #endif | 7100 | #endif |
| 7101 | void install_window_handler (WindowPtr); | ||
| 7133 | 7102 | ||
| 7134 | extern void init_emacs_passwd_dir (); | 7103 | extern void init_emacs_passwd_dir (); |
| 7135 | extern int emacs_main (int, char **, char **); | 7104 | extern int emacs_main (int, char **, char **); |
| @@ -7336,12 +7305,11 @@ do_window_update (WindowPtr win) | |||
| 7336 | { | 7305 | { |
| 7337 | struct frame *f = mac_window_to_frame (win); | 7306 | struct frame *f = mac_window_to_frame (win); |
| 7338 | 7307 | ||
| 7339 | if (win == tip_window) | 7308 | BeginUpdate (win); |
| 7340 | /* The tooltip has been drawn already. Avoid the | ||
| 7341 | SET_FRAME_GARBAGED below. */ | ||
| 7342 | return; | ||
| 7343 | 7309 | ||
| 7344 | if (f) | 7310 | /* The tooltip has been drawn already. Avoid the SET_FRAME_GARBAGED |
| 7311 | below. */ | ||
| 7312 | if (win != tip_window) | ||
| 7345 | { | 7313 | { |
| 7346 | if (f->async_visible == 0) | 7314 | if (f->async_visible == 0) |
| 7347 | { | 7315 | { |
| @@ -7358,17 +7326,30 @@ do_window_update (WindowPtr win) | |||
| 7358 | } | 7326 | } |
| 7359 | else | 7327 | else |
| 7360 | { | 7328 | { |
| 7361 | BeginUpdate (win); | 7329 | Rect r; |
| 7330 | |||
| 7362 | handling_window_update = 1; | 7331 | handling_window_update = 1; |
| 7363 | 7332 | ||
| 7364 | XClearWindow (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f)); | 7333 | #if TARGET_API_MAC_CARBON |
| 7334 | { | ||
| 7335 | RgnHandle region = NewRgn (); | ||
| 7365 | 7336 | ||
| 7366 | expose_frame (f, 0, 0, 0, 0); | 7337 | GetPortVisibleRegion (GetWindowPort (win), region); |
| 7338 | UpdateControls (win, region); | ||
| 7339 | GetRegionBounds (region, &r); | ||
| 7340 | DisposeRgn (region); | ||
| 7341 | } | ||
| 7342 | #else | ||
| 7343 | UpdateControls (win, win->visRgn); | ||
| 7344 | r = (*win->visRgn)->rgnBBox; | ||
| 7345 | #endif | ||
| 7346 | expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); | ||
| 7367 | 7347 | ||
| 7368 | handling_window_update = 0; | 7348 | handling_window_update = 0; |
| 7369 | EndUpdate (win); | ||
| 7370 | } | 7349 | } |
| 7371 | } | 7350 | } |
| 7351 | |||
| 7352 | EndUpdate (win); | ||
| 7372 | } | 7353 | } |
| 7373 | 7354 | ||
| 7374 | static int | 7355 | static int |
| @@ -7530,20 +7511,43 @@ do_menu_choice (SInt32 menu_choice) | |||
| 7530 | static void | 7511 | static void |
| 7531 | do_grow_window (WindowPtr w, EventRecord *e) | 7512 | do_grow_window (WindowPtr w, EventRecord *e) |
| 7532 | { | 7513 | { |
| 7533 | long grow_size; | ||
| 7534 | Rect limit_rect; | 7514 | Rect limit_rect; |
| 7535 | int rows, columns; | 7515 | int rows, columns, width, height; |
| 7536 | struct frame *f = mac_window_to_frame (w); | 7516 | struct frame *f = mac_window_to_frame (w); |
| 7517 | XSizeHints *size_hints = FRAME_SIZE_HINTS (f); | ||
| 7518 | int min_width = MIN_DOC_SIZE, min_height = MIN_DOC_SIZE; | ||
| 7519 | #if TARGET_API_MAC_CARBON | ||
| 7520 | Rect new_rect; | ||
| 7521 | #else | ||
| 7522 | long grow_size; | ||
| 7523 | #endif | ||
| 7537 | 7524 | ||
| 7538 | SetRect(&limit_rect, MIN_DOC_SIZE, MIN_DOC_SIZE, MAX_DOC_SIZE, MAX_DOC_SIZE); | 7525 | if (size_hints->flags & PMinSize) |
| 7526 | { | ||
| 7527 | min_width = size_hints->min_width; | ||
| 7528 | min_height = size_hints->min_height; | ||
| 7529 | } | ||
| 7530 | SetRect (&limit_rect, min_width, min_height, MAX_DOC_SIZE, MAX_DOC_SIZE); | ||
| 7539 | 7531 | ||
| 7532 | #if TARGET_API_MAC_CARBON | ||
| 7533 | if (!ResizeWindow (w, e->where, &limit_rect, &new_rect)) | ||
| 7534 | return; | ||
| 7535 | height = new_rect.bottom - new_rect.top; | ||
| 7536 | width = new_rect.right - new_rect.left; | ||
| 7537 | #else | ||
| 7540 | grow_size = GrowWindow (w, e->where, &limit_rect); | 7538 | grow_size = GrowWindow (w, e->where, &limit_rect); |
| 7541 | |||
| 7542 | /* see if it really changed size */ | 7539 | /* see if it really changed size */ |
| 7543 | if (grow_size != 0) | 7540 | if (grow_size == 0) |
| 7541 | return; | ||
| 7542 | height = HiWord (grow_size); | ||
| 7543 | width = LoWord (grow_size); | ||
| 7544 | #endif | ||
| 7545 | |||
| 7546 | if (width != FRAME_PIXEL_WIDTH (f) | ||
| 7547 | || height != FRAME_PIXEL_HEIGHT (f)) | ||
| 7544 | { | 7548 | { |
| 7545 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, HiWord (grow_size)); | 7549 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); |
| 7546 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, LoWord (grow_size)); | 7550 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); |
| 7547 | 7551 | ||
| 7548 | x_set_window_size (f, 0, columns, rows); | 7552 | x_set_window_size (f, 0, columns, rows); |
| 7549 | } | 7553 | } |
| @@ -7561,7 +7565,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) | |||
| 7561 | GrafPtr save_port; | 7565 | GrafPtr save_port; |
| 7562 | Rect zoom_rect, port_rect; | 7566 | Rect zoom_rect, port_rect; |
| 7563 | Point top_left; | 7567 | Point top_left; |
| 7564 | int w_title_height, columns, rows; | 7568 | int w_title_height, columns, rows, width, height; |
| 7565 | struct frame *f = mac_window_to_frame (w); | 7569 | struct frame *f = mac_window_to_frame (w); |
| 7566 | 7570 | ||
| 7567 | #if TARGET_API_MAC_CARBON | 7571 | #if TARGET_API_MAC_CARBON |
| @@ -7636,12 +7640,26 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) | |||
| 7636 | #else | 7640 | #else |
| 7637 | port_rect = w->portRect; | 7641 | port_rect = w->portRect; |
| 7638 | #endif | 7642 | #endif |
| 7639 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top); | 7643 | height = port_rect.bottom - port_rect.top; |
| 7640 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left); | 7644 | width = port_rect.right - port_rect.left; |
| 7641 | x_set_window_size (f, 0, columns, rows); | 7645 | |
| 7646 | if (width != FRAME_PIXEL_WIDTH (f) | ||
| 7647 | || height != FRAME_PIXEL_HEIGHT (f)) | ||
| 7648 | { | ||
| 7649 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); | ||
| 7650 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); | ||
| 7651 | |||
| 7652 | change_frame_size (f, rows, columns, 0, 1, 0); | ||
| 7653 | SET_FRAME_GARBAGED (f); | ||
| 7654 | cancel_mouse_face (f); | ||
| 7655 | |||
| 7656 | FRAME_PIXEL_WIDTH (f) = width; | ||
| 7657 | FRAME_PIXEL_HEIGHT (f) = height; | ||
| 7658 | } | ||
| 7642 | x_real_positions (f, &f->left_pos, &f->top_pos); | 7659 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 7643 | } | 7660 | } |
| 7644 | 7661 | ||
| 7662 | #if TARGET_API_MAC_CARBON | ||
| 7645 | /* Initialize Drag And Drop to allow files to be dropped onto emacs frames */ | 7663 | /* Initialize Drag And Drop to allow files to be dropped onto emacs frames */ |
| 7646 | static OSErr | 7664 | static OSErr |
| 7647 | init_mac_drag_n_drop () | 7665 | init_mac_drag_n_drop () |
| @@ -7649,6 +7667,7 @@ init_mac_drag_n_drop () | |||
| 7649 | OSErr result = InstallReceiveHandler (mac_do_receive_drag, 0L, NULL); | 7667 | OSErr result = InstallReceiveHandler (mac_do_receive_drag, 0L, NULL); |
| 7650 | return result; | 7668 | return result; |
| 7651 | } | 7669 | } |
| 7670 | #endif | ||
| 7652 | 7671 | ||
| 7653 | /* Intialize AppleEvent dispatcher table for the required events. */ | 7672 | /* Intialize AppleEvent dispatcher table for the required events. */ |
| 7654 | void | 7673 | void |
| @@ -7819,7 +7838,93 @@ mac_handle_service_event (EventHandlerCallRef callRef, | |||
| 7819 | } | 7838 | } |
| 7820 | return err; | 7839 | return err; |
| 7821 | } | 7840 | } |
| 7841 | |||
| 7842 | |||
| 7843 | static pascal OSStatus | ||
| 7844 | mac_handle_window_event (next_handler, event, data) | ||
| 7845 | EventHandlerCallRef next_handler; | ||
| 7846 | EventRef event; | ||
| 7847 | void *data; | ||
| 7848 | { | ||
| 7849 | extern Lisp_Object Qcontrol; | ||
| 7850 | |||
| 7851 | WindowPtr wp; | ||
| 7852 | OSStatus result; | ||
| 7853 | UInt32 attributes; | ||
| 7854 | XSizeHints *size_hints; | ||
| 7855 | |||
| 7856 | GetEventParameter (event, kEventParamDirectObject, typeWindowRef, | ||
| 7857 | NULL, sizeof (WindowPtr), NULL, &wp); | ||
| 7858 | |||
| 7859 | switch (GetEventKind (event)) | ||
| 7860 | { | ||
| 7861 | case kEventWindowBoundsChanging: | ||
| 7862 | result = CallNextEventHandler (next_handler, event); | ||
| 7863 | if (result != eventNotHandledErr) | ||
| 7864 | return result; | ||
| 7865 | |||
| 7866 | GetEventParameter (event, kEventParamAttributes, typeUInt32, | ||
| 7867 | NULL, sizeof (UInt32), NULL, &attributes); | ||
| 7868 | size_hints = FRAME_SIZE_HINTS (mac_window_to_frame (wp)); | ||
| 7869 | if ((attributes & kWindowBoundsChangeUserResize) | ||
| 7870 | && ((size_hints->flags & (PResizeInc | PBaseSize | PMinSize)) | ||
| 7871 | == (PResizeInc | PBaseSize | PMinSize))) | ||
| 7872 | { | ||
| 7873 | Rect bounds; | ||
| 7874 | int width, height; | ||
| 7875 | |||
| 7876 | GetEventParameter (event, kEventParamCurrentBounds, | ||
| 7877 | typeQDRectangle, | ||
| 7878 | NULL, sizeof (Rect), NULL, &bounds); | ||
| 7879 | width = bounds.right - bounds.left; | ||
| 7880 | height = bounds.bottom - bounds.top; | ||
| 7881 | |||
| 7882 | if (width < size_hints->min_width) | ||
| 7883 | width = size_hints->min_width; | ||
| 7884 | else | ||
| 7885 | width = size_hints->base_width | ||
| 7886 | + (int) ((width - size_hints->base_width) | ||
| 7887 | / (float) size_hints->width_inc + .5) | ||
| 7888 | * size_hints->width_inc; | ||
| 7889 | |||
| 7890 | if (height < size_hints->min_height) | ||
| 7891 | height = size_hints->min_height; | ||
| 7892 | else | ||
| 7893 | height = size_hints->base_height | ||
| 7894 | + (int) ((height - size_hints->base_height) | ||
| 7895 | / (float) size_hints->height_inc + .5) | ||
| 7896 | * size_hints->height_inc; | ||
| 7897 | |||
| 7898 | bounds.right = bounds.left + width; | ||
| 7899 | bounds.bottom = bounds.top + height; | ||
| 7900 | SetEventParameter (event, kEventParamCurrentBounds, | ||
| 7901 | typeQDRectangle, sizeof (Rect), &bounds); | ||
| 7902 | return noErr; | ||
| 7903 | } | ||
| 7904 | break; | ||
| 7905 | } | ||
| 7906 | |||
| 7907 | return eventNotHandledErr; | ||
| 7908 | } | ||
| 7909 | #endif /* USE_CARBON_EVENTS */ | ||
| 7910 | |||
| 7911 | |||
| 7912 | void | ||
| 7913 | install_window_handler (window) | ||
| 7914 | WindowPtr window; | ||
| 7915 | { | ||
| 7916 | #if USE_CARBON_EVENTS | ||
| 7917 | EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowBoundsChanging}}; | ||
| 7918 | static EventHandlerUPP handle_window_event_UPP = NULL; | ||
| 7919 | |||
| 7920 | if (handle_window_event_UPP == NULL) | ||
| 7921 | handle_window_event_UPP = NewEventHandlerUPP (mac_handle_window_event); | ||
| 7922 | |||
| 7923 | InstallWindowEventHandler (window, handle_window_event_UPP, | ||
| 7924 | GetEventTypeCount (specs), specs, NULL, NULL); | ||
| 7822 | #endif | 7925 | #endif |
| 7926 | } | ||
| 7927 | |||
| 7823 | 7928 | ||
| 7824 | /* Open Application Apple Event */ | 7929 | /* Open Application Apple Event */ |
| 7825 | static pascal OSErr | 7930 | static pascal OSErr |
| @@ -7915,6 +8020,7 @@ descriptor_error_exit: | |||
| 7915 | } | 8020 | } |
| 7916 | 8021 | ||
| 7917 | 8022 | ||
| 8023 | #if TARGET_API_MAC_CARBON | ||
| 7918 | static pascal OSErr | 8024 | static pascal OSErr |
| 7919 | mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | 8025 | mac_do_receive_drag (WindowPtr window, void *handlerRefCon, |
| 7920 | DragReference theDrag) | 8026 | DragReference theDrag) |
| @@ -7991,6 +8097,7 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 7991 | } | 8097 | } |
| 7992 | } | 8098 | } |
| 7993 | } | 8099 | } |
| 8100 | #endif | ||
| 7994 | 8101 | ||
| 7995 | 8102 | ||
| 7996 | /* Print Document Apple Event */ | 8103 | /* Print Document Apple Event */ |
| @@ -8140,6 +8247,45 @@ keycode_to_xkeysym (int keyCode, int *xKeySym) | |||
| 8140 | return *xKeySym != 0; | 8247 | return *xKeySym != 0; |
| 8141 | } | 8248 | } |
| 8142 | 8249 | ||
| 8250 | #if !USE_CARBON_EVENTS | ||
| 8251 | static RgnHandle mouse_region = NULL; | ||
| 8252 | |||
| 8253 | Boolean | ||
| 8254 | mac_wait_next_event (er, sleep_time, dequeue) | ||
| 8255 | EventRecord *er; | ||
| 8256 | UInt32 sleep_time; | ||
| 8257 | Boolean dequeue; | ||
| 8258 | { | ||
| 8259 | static EventRecord er_buf = {nullEvent}; | ||
| 8260 | UInt32 target_tick, current_tick; | ||
| 8261 | EventMask event_mask; | ||
| 8262 | |||
| 8263 | if (mouse_region == NULL) | ||
| 8264 | mouse_region = NewRgn (); | ||
| 8265 | |||
| 8266 | event_mask = everyEvent; | ||
| 8267 | if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) | ||
| 8268 | event_mask -= highLevelEventMask; | ||
| 8269 | |||
| 8270 | current_tick = TickCount (); | ||
| 8271 | target_tick = current_tick + sleep_time; | ||
| 8272 | |||
| 8273 | if (er_buf.what == nullEvent) | ||
| 8274 | while (!WaitNextEvent (event_mask, &er_buf, | ||
| 8275 | target_tick - current_tick, mouse_region)) | ||
| 8276 | { | ||
| 8277 | current_tick = TickCount (); | ||
| 8278 | if (target_tick <= current_tick) | ||
| 8279 | return false; | ||
| 8280 | } | ||
| 8281 | |||
| 8282 | *er = er_buf; | ||
| 8283 | if (dequeue) | ||
| 8284 | er_buf.what = nullEvent; | ||
| 8285 | return true; | ||
| 8286 | } | ||
| 8287 | #endif /* not USE_CARBON_EVENTS */ | ||
| 8288 | |||
| 8143 | /* Emacs calls this whenever it wants to read an input event from the | 8289 | /* Emacs calls this whenever it wants to read an input event from the |
| 8144 | user. */ | 8290 | user. */ |
| 8145 | int | 8291 | int |
| @@ -8151,9 +8297,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8151 | int count = 0; | 8297 | int count = 0; |
| 8152 | #if USE_CARBON_EVENTS | 8298 | #if USE_CARBON_EVENTS |
| 8153 | EventRef eventRef; | 8299 | EventRef eventRef; |
| 8154 | EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget (); | 8300 | EventTargetRef toolbox_dispatcher; |
| 8155 | #else | ||
| 8156 | EventMask event_mask; | ||
| 8157 | #endif | 8301 | #endif |
| 8158 | EventRecord er; | 8302 | EventRecord er; |
| 8159 | struct mac_display_info *dpyinfo = &one_mac_display_info; | 8303 | struct mac_display_info *dpyinfo = &one_mac_display_info; |
| @@ -8184,16 +8328,14 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8184 | if (terminate_flag) | 8328 | if (terminate_flag) |
| 8185 | Fkill_emacs (make_number (1)); | 8329 | Fkill_emacs (make_number (1)); |
| 8186 | 8330 | ||
| 8187 | #if !USE_CARBON_EVENTS | 8331 | #if USE_CARBON_EVENTS |
| 8188 | event_mask = everyEvent; | 8332 | toolbox_dispatcher = GetEventDispatcherTarget (); |
| 8189 | if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) | ||
| 8190 | event_mask -= highLevelEventMask; | ||
| 8191 | 8333 | ||
| 8192 | while (WaitNextEvent (event_mask, &er, 0L, NULL)) | ||
| 8193 | #else /* USE_CARBON_EVENTS */ | ||
| 8194 | while (!ReceiveNextEvent (0, NULL, kEventDurationNoWait, | 8334 | while (!ReceiveNextEvent (0, NULL, kEventDurationNoWait, |
| 8195 | kEventRemoveFromQueue, &eventRef)) | 8335 | kEventRemoveFromQueue, &eventRef)) |
| 8196 | #endif /* USE_CARBON_EVENTS */ | 8336 | #else /* !USE_CARBON_EVENTS */ |
| 8337 | while (mac_wait_next_event (&er, 0, true)) | ||
| 8338 | #endif /* !USE_CARBON_EVENTS */ | ||
| 8197 | { | 8339 | { |
| 8198 | int do_help = 0; | 8340 | int do_help = 0; |
| 8199 | struct frame *f; | 8341 | struct frame *f; |
| @@ -8260,6 +8402,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8260 | SendEventToEventTarget (eventRef, toolbox_dispatcher); | 8402 | SendEventToEventTarget (eventRef, toolbox_dispatcher); |
| 8261 | 8403 | ||
| 8262 | break; | 8404 | break; |
| 8405 | |||
| 8263 | default: | 8406 | default: |
| 8264 | /* Send the event to the appropriate receiver. */ | 8407 | /* Send the event to the appropriate receiver. */ |
| 8265 | SendEventToEventTarget (eventRef, toolbox_dispatcher); | 8408 | SendEventToEventTarget (eventRef, toolbox_dispatcher); |
| @@ -8497,6 +8640,10 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8497 | break; | 8640 | break; |
| 8498 | 8641 | ||
| 8499 | case mouseMovedMessage: | 8642 | case mouseMovedMessage: |
| 8643 | #if !USE_CARBON_EVENTS | ||
| 8644 | SetRectRgn (mouse_region, er.where.h, er.where.v, | ||
| 8645 | er.where.h + 1, er.where.v + 1); | ||
| 8646 | #endif | ||
| 8500 | previous_help_echo_string = help_echo_string; | 8647 | previous_help_echo_string = help_echo_string; |
| 8501 | help_echo_string = help_echo_object = help_echo_window = Qnil; | 8648 | help_echo_string = help_echo_object = help_echo_window = Qnil; |
| 8502 | help_echo_pos = -1; | 8649 | help_echo_pos = -1; |
| @@ -8697,21 +8844,21 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8697 | unsigned char ch = inev.code; | 8844 | unsigned char ch = inev.code; |
| 8698 | ByteCount actual_input_length, actual_output_length; | 8845 | ByteCount actual_input_length, actual_output_length; |
| 8699 | unsigned char outbuf[32]; | 8846 | unsigned char outbuf[32]; |
| 8700 | 8847 | ||
| 8701 | convert_status = TECConvertText (converter, &ch, 1, | 8848 | convert_status = TECConvertText (converter, &ch, 1, |
| 8702 | &actual_input_length, | 8849 | &actual_input_length, |
| 8703 | outbuf, 1, | 8850 | outbuf, 1, |
| 8704 | &actual_output_length); | 8851 | &actual_output_length); |
| 8705 | if (convert_status == noErr | 8852 | if (convert_status == noErr |
| 8706 | && actual_input_length == 1 | 8853 | && actual_input_length == 1 |
| 8707 | && actual_output_length == 1) | 8854 | && actual_output_length == 1) |
| 8708 | inev.code = *outbuf; | 8855 | inev.code = *outbuf; |
| 8709 | 8856 | ||
| 8710 | /* Reset internal states of the converter object. | 8857 | /* Reset internal states of the converter object. |
| 8711 | If it fails, create another one. */ | 8858 | If it fails, create another one. */ |
| 8712 | convert_status = TECFlushText (converter, outbuf, | 8859 | convert_status = TECFlushText (converter, outbuf, |
| 8713 | sizeof (outbuf), | 8860 | sizeof (outbuf), |
| 8714 | &actual_output_length); | 8861 | &actual_output_length); |
| 8715 | if (convert_status != noErr) | 8862 | if (convert_status != noErr) |
| 8716 | { | 8863 | { |
| 8717 | TECDisposeConverter (converter); | 8864 | TECDisposeConverter (converter); |
| @@ -8719,7 +8866,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8719 | kTextEncodingMacRoman, | 8866 | kTextEncodingMacRoman, |
| 8720 | mac_keyboard_text_encoding); | 8867 | mac_keyboard_text_encoding); |
| 8721 | } | 8868 | } |
| 8722 | } | 8869 | } |
| 8723 | } | 8870 | } |
| 8724 | 8871 | ||
| 8725 | #if USE_CARBON_EVENTS | 8872 | #if USE_CARBON_EVENTS |
| @@ -8864,59 +9011,12 @@ __convert_from_newlines (unsigned char * p, size_t * n) | |||
| 8864 | } | 9011 | } |
| 8865 | #endif | 9012 | #endif |
| 8866 | 9013 | ||
| 8867 | 9014 | #ifdef MAC_OS8 | |
| 8868 | /* Initialize the struct pointed to by MW to represent a new COLS x | ||
| 8869 | ROWS Macintosh window, using font with name FONTNAME and size | ||
| 8870 | FONTSIZE. */ | ||
| 8871 | void | ||
| 8872 | make_mac_frame (FRAME_PTR fp) | ||
| 8873 | { | ||
| 8874 | mac_output *mwp; | ||
| 8875 | #if TARGET_API_MAC_CARBON | ||
| 8876 | static int making_terminal_window = 0; | ||
| 8877 | #else | ||
| 8878 | static int making_terminal_window = 1; | ||
| 8879 | #endif | ||
| 8880 | |||
| 8881 | mwp = fp->output_data.mac; | ||
| 8882 | |||
| 8883 | BLOCK_INPUT; | ||
| 8884 | if (making_terminal_window) | ||
| 8885 | { | ||
| 8886 | if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL, | ||
| 8887 | (WindowPtr) -1))) | ||
| 8888 | abort (); | ||
| 8889 | making_terminal_window = 0; | ||
| 8890 | } | ||
| 8891 | else | ||
| 8892 | { | ||
| 8893 | #if TARGET_API_MAC_CARBON | ||
| 8894 | Rect r; | ||
| 8895 | |||
| 8896 | SetRect (&r, 0, 0, 1, 1); | ||
| 8897 | if (CreateNewWindow (kDocumentWindowClass, | ||
| 8898 | kWindowStandardDocumentAttributes | ||
| 8899 | /* | kWindowToolbarButtonAttribute */, | ||
| 8900 | &r, &mwp->mWP) != noErr) | ||
| 8901 | #else | ||
| 8902 | if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1))) | ||
| 8903 | #endif | ||
| 8904 | abort (); | ||
| 8905 | } | ||
| 8906 | |||
| 8907 | SetWRefCon (mwp->mWP, (long) mwp); | ||
| 8908 | /* so that update events can find this mac_output struct */ | ||
| 8909 | mwp->mFP = fp; /* point back to emacs frame */ | ||
| 8910 | |||
| 8911 | SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false); | ||
| 8912 | UNBLOCK_INPUT; | ||
| 8913 | } | ||
| 8914 | |||
| 8915 | |||
| 8916 | void | 9015 | void |
| 8917 | make_mac_terminal_frame (struct frame *f) | 9016 | make_mac_terminal_frame (struct frame *f) |
| 8918 | { | 9017 | { |
| 8919 | Lisp_Object frame; | 9018 | Lisp_Object frame; |
| 9019 | Rect r; | ||
| 8920 | 9020 | ||
| 8921 | XSETFRAME (frame, f); | 9021 | XSETFRAME (frame, f); |
| 8922 | 9022 | ||
| @@ -8940,10 +9040,17 @@ make_mac_terminal_frame (struct frame *f) | |||
| 8940 | f->output_data.mac->mouse_pixel = 0xff00ff; | 9040 | f->output_data.mac->mouse_pixel = 0xff00ff; |
| 8941 | f->output_data.mac->cursor_foreground_pixel = 0x0000ff; | 9041 | f->output_data.mac->cursor_foreground_pixel = 0x0000ff; |
| 8942 | 9042 | ||
| 9043 | f->output_data.mac->text_cursor = GetCursor (iBeamCursor); | ||
| 9044 | f->output_data.mac->nontext_cursor = &arrow_cursor; | ||
| 9045 | f->output_data.mac->modeline_cursor = &arrow_cursor; | ||
| 9046 | f->output_data.mac->hand_cursor = &arrow_cursor; | ||
| 9047 | f->output_data.mac->hourglass_cursor = GetCursor (watchCursor); | ||
| 9048 | f->output_data.mac->horizontal_drag_cursor = &arrow_cursor; | ||
| 9049 | |||
| 8943 | FRAME_FONTSET (f) = -1; | 9050 | FRAME_FONTSET (f) = -1; |
| 8944 | f->output_data.mac->explicit_parent = 0; | 9051 | f->output_data.mac->explicit_parent = 0; |
| 8945 | f->left_pos = 4; | 9052 | f->left_pos = 8; |
| 8946 | f->top_pos = 4; | 9053 | f->top_pos = 32; |
| 8947 | f->border_width = 0; | 9054 | f->border_width = 0; |
| 8948 | 9055 | ||
| 8949 | f->internal_border_width = 0; | 9056 | f->internal_border_width = 0; |
| @@ -8954,7 +9061,20 @@ make_mac_terminal_frame (struct frame *f) | |||
| 8954 | f->new_text_cols = 0; | 9061 | f->new_text_cols = 0; |
| 8955 | f->new_text_lines = 0; | 9062 | f->new_text_lines = 0; |
| 8956 | 9063 | ||
| 8957 | make_mac_frame (f); | 9064 | SetRect (&r, f->left_pos, f->top_pos, |
| 9065 | f->left_pos + FRAME_PIXEL_WIDTH (f), | ||
| 9066 | f->top_pos + FRAME_PIXEL_HEIGHT (f)); | ||
| 9067 | |||
| 9068 | BLOCK_INPUT; | ||
| 9069 | |||
| 9070 | if (!(FRAME_MAC_WINDOW (f) = | ||
| 9071 | NewCWindow (NULL, &r, "\p", true, dBoxProc, | ||
| 9072 | (WindowPtr) -1, 1, (long) f->output_data.mac))) | ||
| 9073 | abort (); | ||
| 9074 | /* so that update events can find this mac_output struct */ | ||
| 9075 | f->output_data.mac->mFP = f; /* point back to emacs frame */ | ||
| 9076 | |||
| 9077 | UNBLOCK_INPUT; | ||
| 8958 | 9078 | ||
| 8959 | x_make_gc (f); | 9079 | x_make_gc (f); |
| 8960 | 9080 | ||
| @@ -8970,9 +9090,8 @@ make_mac_terminal_frame (struct frame *f) | |||
| 8970 | Fmodify_frame_parameters (frame, | 9090 | Fmodify_frame_parameters (frame, |
| 8971 | Fcons (Fcons (Qbackground_color, | 9091 | Fcons (Fcons (Qbackground_color, |
| 8972 | build_string ("white")), Qnil)); | 9092 | build_string ("white")), Qnil)); |
| 8973 | |||
| 8974 | ShowWindow (f->output_data.mac->mWP); | ||
| 8975 | } | 9093 | } |
| 9094 | #endif | ||
| 8976 | 9095 | ||
| 8977 | 9096 | ||
| 8978 | /*********************************************************************** | 9097 | /*********************************************************************** |
| @@ -8989,12 +9108,7 @@ mac_initialize_display_info () | |||
| 8989 | 9108 | ||
| 8990 | bzero (dpyinfo, sizeof (*dpyinfo)); | 9109 | bzero (dpyinfo, sizeof (*dpyinfo)); |
| 8991 | 9110 | ||
| 8992 | /* Put it on x_display_name_list. */ | 9111 | #ifdef MAC_OSX |
| 8993 | x_display_name_list = Fcons (Fcons (build_string ("Mac"), Qnil), | ||
| 8994 | x_display_name_list); | ||
| 8995 | dpyinfo->name_list_element = XCAR (x_display_name_list); | ||
| 8996 | |||
| 8997 | #if 0 | ||
| 8998 | dpyinfo->mac_id_name | 9112 | dpyinfo->mac_id_name |
| 8999 | = (char *) xmalloc (SCHARS (Vinvocation_name) | 9113 | = (char *) xmalloc (SCHARS (Vinvocation_name) |
| 9000 | + SCHARS (Vsystem_name) | 9114 | + SCHARS (Vsystem_name) |
| @@ -9049,6 +9163,61 @@ mac_initialize_display_info () | |||
| 9049 | dpyinfo->mouse_face_hidden = 0; | 9163 | dpyinfo->mouse_face_hidden = 0; |
| 9050 | } | 9164 | } |
| 9051 | 9165 | ||
| 9166 | /* Create an xrdb-style database of resources to supercede registry settings. | ||
| 9167 | The database is just a concatenation of C strings, finished by an additional | ||
| 9168 | \0. The string are submitted to some basic normalization, so | ||
| 9169 | |||
| 9170 | [ *]option[ *]:[ *]value... | ||
| 9171 | |||
| 9172 | becomes | ||
| 9173 | |||
| 9174 | option:value... | ||
| 9175 | |||
| 9176 | but any whitespace following value is not removed. */ | ||
| 9177 | |||
| 9178 | static char * | ||
| 9179 | mac_make_rdb (xrm_option) | ||
| 9180 | char *xrm_option; | ||
| 9181 | { | ||
| 9182 | char *buffer = xmalloc (strlen (xrm_option) + 2); | ||
| 9183 | char *current = buffer; | ||
| 9184 | char ch; | ||
| 9185 | int in_option = 1; | ||
| 9186 | int before_value = 0; | ||
| 9187 | |||
| 9188 | do { | ||
| 9189 | ch = *xrm_option++; | ||
| 9190 | |||
| 9191 | if (ch == '\n') | ||
| 9192 | { | ||
| 9193 | *current++ = '\0'; | ||
| 9194 | in_option = 1; | ||
| 9195 | before_value = 0; | ||
| 9196 | } | ||
| 9197 | else if (ch != ' ') | ||
| 9198 | { | ||
| 9199 | *current++ = ch; | ||
| 9200 | if (in_option && (ch == ':')) | ||
| 9201 | { | ||
| 9202 | in_option = 0; | ||
| 9203 | before_value = 1; | ||
| 9204 | } | ||
| 9205 | else if (before_value) | ||
| 9206 | { | ||
| 9207 | before_value = 0; | ||
| 9208 | } | ||
| 9209 | } | ||
| 9210 | else if (!(in_option || before_value)) | ||
| 9211 | { | ||
| 9212 | *current++ = ch; | ||
| 9213 | } | ||
| 9214 | } while (ch); | ||
| 9215 | |||
| 9216 | *current = '\0'; | ||
| 9217 | |||
| 9218 | return buffer; | ||
| 9219 | } | ||
| 9220 | |||
| 9052 | struct mac_display_info * | 9221 | struct mac_display_info * |
| 9053 | mac_term_init (display_name, xrm_option, resource_name) | 9222 | mac_term_init (display_name, xrm_option, resource_name) |
| 9054 | Lisp_Object display_name; | 9223 | Lisp_Object display_name; |
| @@ -9056,7 +9225,8 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 9056 | char *resource_name; | 9225 | char *resource_name; |
| 9057 | { | 9226 | { |
| 9058 | struct mac_display_info *dpyinfo; | 9227 | struct mac_display_info *dpyinfo; |
| 9059 | GDHandle main_device_handle; | 9228 | |
| 9229 | BLOCK_INPUT; | ||
| 9060 | 9230 | ||
| 9061 | if (!mac_initialized) | 9231 | if (!mac_initialized) |
| 9062 | { | 9232 | { |
| @@ -9064,17 +9234,90 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 9064 | mac_initialized = 1; | 9234 | mac_initialized = 1; |
| 9065 | } | 9235 | } |
| 9066 | 9236 | ||
| 9067 | mac_initialize_display_info (display_name); | 9237 | if (x_display_list) |
| 9238 | error ("Sorry, this version can only handle one display"); | ||
| 9239 | |||
| 9240 | mac_initialize_display_info (); | ||
| 9068 | 9241 | ||
| 9069 | dpyinfo = &one_mac_display_info; | 9242 | dpyinfo = &one_mac_display_info; |
| 9070 | 9243 | ||
| 9071 | main_device_handle = LMGetMainDevice(); | 9244 | dpyinfo->xrdb = xrm_option ? mac_make_rdb (xrm_option) : NULL; |
| 9072 | 9245 | ||
| 9073 | dpyinfo->height = (**main_device_handle).gdRect.bottom; | 9246 | /* Put this display on the chain. */ |
| 9074 | dpyinfo->width = (**main_device_handle).gdRect.right; | 9247 | dpyinfo->next = x_display_list; |
| 9248 | x_display_list = dpyinfo; | ||
| 9249 | |||
| 9250 | /* Put it on x_display_name_list. */ | ||
| 9251 | x_display_name_list = Fcons (Fcons (display_name, Qnil), | ||
| 9252 | x_display_name_list); | ||
| 9253 | dpyinfo->name_list_element = XCAR (x_display_name_list); | ||
| 9254 | |||
| 9255 | UNBLOCK_INPUT; | ||
| 9075 | 9256 | ||
| 9076 | return dpyinfo; | 9257 | return dpyinfo; |
| 9077 | } | 9258 | } |
| 9259 | /* Get rid of display DPYINFO, assuming all frames are already gone. */ | ||
| 9260 | |||
| 9261 | void | ||
| 9262 | x_delete_display (dpyinfo) | ||
| 9263 | struct mac_display_info *dpyinfo; | ||
| 9264 | { | ||
| 9265 | int i; | ||
| 9266 | |||
| 9267 | /* Discard this display from x_display_name_list and x_display_list. | ||
| 9268 | We can't use Fdelq because that can quit. */ | ||
| 9269 | if (! NILP (x_display_name_list) | ||
| 9270 | && EQ (XCAR (x_display_name_list), dpyinfo->name_list_element)) | ||
| 9271 | x_display_name_list = XCDR (x_display_name_list); | ||
| 9272 | else | ||
| 9273 | { | ||
| 9274 | Lisp_Object tail; | ||
| 9275 | |||
| 9276 | tail = x_display_name_list; | ||
| 9277 | while (CONSP (tail) && CONSP (XCDR (tail))) | ||
| 9278 | { | ||
| 9279 | if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element)) | ||
| 9280 | { | ||
| 9281 | XSETCDR (tail, XCDR (XCDR (tail))); | ||
| 9282 | break; | ||
| 9283 | } | ||
| 9284 | tail = XCDR (tail); | ||
| 9285 | } | ||
| 9286 | } | ||
| 9287 | |||
| 9288 | if (x_display_list == dpyinfo) | ||
| 9289 | x_display_list = dpyinfo->next; | ||
| 9290 | else | ||
| 9291 | { | ||
| 9292 | struct x_display_info *tail; | ||
| 9293 | |||
| 9294 | for (tail = x_display_list; tail; tail = tail->next) | ||
| 9295 | if (tail->next == dpyinfo) | ||
| 9296 | tail->next = tail->next->next; | ||
| 9297 | } | ||
| 9298 | |||
| 9299 | /* Free the font names in the font table. */ | ||
| 9300 | for (i = 0; i < dpyinfo->n_fonts; i++) | ||
| 9301 | if (dpyinfo->font_table[i].name) | ||
| 9302 | { | ||
| 9303 | if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name) | ||
| 9304 | xfree (dpyinfo->font_table[i].full_name); | ||
| 9305 | xfree (dpyinfo->font_table[i].name); | ||
| 9306 | } | ||
| 9307 | |||
| 9308 | if (dpyinfo->font_table->font_encoder) | ||
| 9309 | xfree (dpyinfo->font_table->font_encoder); | ||
| 9310 | |||
| 9311 | xfree (dpyinfo->font_table); | ||
| 9312 | xfree (dpyinfo->mac_id_name); | ||
| 9313 | |||
| 9314 | if (x_display_list == 0) | ||
| 9315 | { | ||
| 9316 | mac_clear_font_name_table (); | ||
| 9317 | bzero (dpyinfo, sizeof (*dpyinfo)); | ||
| 9318 | } | ||
| 9319 | } | ||
| 9320 | |||
| 9078 | 9321 | ||
| 9079 | #ifdef MAC_OSX | 9322 | #ifdef MAC_OSX |
| 9080 | void | 9323 | void |
| @@ -9334,7 +9577,6 @@ mac_initialize () | |||
| 9334 | #endif | 9577 | #endif |
| 9335 | 9578 | ||
| 9336 | BLOCK_INPUT; | 9579 | BLOCK_INPUT; |
| 9337 | mac_initialize_display_info (); | ||
| 9338 | 9580 | ||
| 9339 | #if TARGET_API_MAC_CARBON | 9581 | #if TARGET_API_MAC_CARBON |
| 9340 | init_required_apple_events (); | 9582 | init_required_apple_events (); |
| @@ -9372,7 +9614,9 @@ syms_of_macterm () | |||
| 9372 | Qsuper = intern ("super"); | 9614 | Qsuper = intern ("super"); |
| 9373 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); | 9615 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); |
| 9374 | 9616 | ||
| 9617 | #ifdef MAC_OSX | ||
| 9375 | Fprovide (intern ("mac-carbon"), Qnil); | 9618 | Fprovide (intern ("mac-carbon"), Qnil); |
| 9619 | #endif | ||
| 9376 | 9620 | ||
| 9377 | staticpro (&Qreverse); | 9621 | staticpro (&Qreverse); |
| 9378 | Qreverse = intern ("reverse"); | 9622 | Qreverse = intern ("reverse"); |
diff --git a/src/macterm.h b/src/macterm.h index 308a9200395..7c7d55c3790 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -218,6 +218,9 @@ struct mac_display_info | |||
| 218 | struct image_cache *image_cache; | 218 | struct image_cache *image_cache; |
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | /* This checks to make sure we have a display. */ | ||
| 222 | extern void check_mac P_ ((void)); | ||
| 223 | |||
| 221 | #define x_display_info mac_display_info | 224 | #define x_display_info mac_display_info |
| 222 | 225 | ||
| 223 | /* This is a chain of structures for all the X displays currently in use. */ | 226 | /* This is a chain of structures for all the X displays currently in use. */ |
| @@ -388,6 +391,9 @@ struct mac_output { | |||
| 388 | /* The background for which the above relief GCs were set up. | 391 | /* The background for which the above relief GCs were set up. |
| 389 | They are changed only when a different background is involved. */ | 392 | They are changed only when a different background is involved. */ |
| 390 | unsigned long relief_background; | 393 | unsigned long relief_background; |
| 394 | |||
| 395 | /* Hints for the size and the position of a window. */ | ||
| 396 | XSizeHints *size_hints; | ||
| 391 | }; | 397 | }; |
| 392 | 398 | ||
| 393 | typedef struct mac_output mac_output; | 399 | typedef struct mac_output mac_output; |
| @@ -404,6 +410,8 @@ typedef struct mac_output mac_output; | |||
| 404 | 410 | ||
| 405 | #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.mac->baseline_offset) | 411 | #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.mac->baseline_offset) |
| 406 | 412 | ||
| 413 | #define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints) | ||
| 414 | |||
| 407 | /* This gives the w32_display_info structure for the display F is on. */ | 415 | /* This gives the w32_display_info structure for the display F is on. */ |
| 408 | #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info) | 416 | #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info) |
| 409 | #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info) | 417 | #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info) |
| @@ -593,6 +601,7 @@ extern void XFreePixmap P_ ((Display *, Pixmap)); | |||
| 593 | extern void XSetForeground P_ ((Display *, GC, unsigned long)); | 601 | extern void XSetForeground P_ ((Display *, GC, unsigned long)); |
| 594 | extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, | 602 | extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, |
| 595 | int, int)); | 603 | int, int)); |
| 604 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); | ||
| 596 | 605 | ||
| 597 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 | 606 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 |
| 598 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 | 607 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 |
diff --git a/src/process.c b/src/process.c index 646b9aed6a8..c17b32eb3c5 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1290,7 +1290,7 @@ list_processes_1 (query_only) | |||
| 1290 | XSETFASTINT (minspace, 1); | 1290 | XSETFASTINT (minspace, 1); |
| 1291 | 1291 | ||
| 1292 | set_buffer_internal (XBUFFER (Vstandard_output)); | 1292 | set_buffer_internal (XBUFFER (Vstandard_output)); |
| 1293 | Fbuffer_disable_undo (Vstandard_output); | 1293 | current_buffer->undo_list = Qt; |
| 1294 | 1294 | ||
| 1295 | current_buffer->truncate_lines = Qt; | 1295 | current_buffer->truncate_lines = Qt; |
| 1296 | 1296 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index b0a8f953c9c..7cb9c0c92eb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -810,7 +810,7 @@ static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; | |||
| 810 | 810 | ||
| 811 | static void setup_for_ellipsis P_ ((struct it *, int)); | 811 | static void setup_for_ellipsis P_ ((struct it *, int)); |
| 812 | static void mark_window_display_accurate_1 P_ ((struct window *, int)); | 812 | static void mark_window_display_accurate_1 P_ ((struct window *, int)); |
| 813 | static int single_display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); | 813 | static int single_display_spec_string_p P_ ((Lisp_Object, Lisp_Object)); |
| 814 | static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); | 814 | static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); |
| 815 | static int cursor_row_p P_ ((struct window *, struct glyph_row *)); | 815 | static int cursor_row_p P_ ((struct window *, struct glyph_row *)); |
| 816 | static int redisplay_mode_lines P_ ((Lisp_Object, int)); | 816 | static int redisplay_mode_lines P_ ((Lisp_Object, int)); |
| @@ -832,7 +832,7 @@ static int store_frame_title P_ ((const unsigned char *, int, int)); | |||
| 832 | static void x_consider_frame_title P_ ((Lisp_Object)); | 832 | static void x_consider_frame_title P_ ((Lisp_Object)); |
| 833 | static void handle_stop P_ ((struct it *)); | 833 | static void handle_stop P_ ((struct it *)); |
| 834 | static int tool_bar_lines_needed P_ ((struct frame *)); | 834 | static int tool_bar_lines_needed P_ ((struct frame *)); |
| 835 | static int single_display_prop_intangible_p P_ ((Lisp_Object)); | 835 | static int single_display_spec_intangible_p P_ ((Lisp_Object)); |
| 836 | static void ensure_echo_area_buffers P_ ((void)); | 836 | static void ensure_echo_area_buffers P_ ((void)); |
| 837 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); | 837 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); |
| 838 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); | 838 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); |
| @@ -926,7 +926,7 @@ static void compute_string_pos P_ ((struct text_pos *, struct text_pos, | |||
| 926 | Lisp_Object)); | 926 | Lisp_Object)); |
| 927 | static int face_before_or_after_it_pos P_ ((struct it *, int)); | 927 | static int face_before_or_after_it_pos P_ ((struct it *, int)); |
| 928 | static int next_overlay_change P_ ((int)); | 928 | static int next_overlay_change P_ ((int)); |
| 929 | static int handle_single_display_prop P_ ((struct it *, Lisp_Object, | 929 | static int handle_single_display_spec P_ ((struct it *, Lisp_Object, |
| 930 | Lisp_Object, struct text_pos *, | 930 | Lisp_Object, struct text_pos *, |
| 931 | int)); | 931 | int)); |
| 932 | static int underlying_face_id P_ ((struct it *)); | 932 | static int underlying_face_id P_ ((struct it *)); |
| @@ -3275,7 +3275,10 @@ setup_for_ellipsis (it, len) | |||
| 3275 | ***********************************************************************/ | 3275 | ***********************************************************************/ |
| 3276 | 3276 | ||
| 3277 | /* Set up iterator IT from `display' property at its current position. | 3277 | /* Set up iterator IT from `display' property at its current position. |
| 3278 | Called from handle_stop. */ | 3278 | Called from handle_stop. |
| 3279 | We return HANDLED_RETURN if some part of the display property | ||
| 3280 | overrides the display of the buffer text itself. | ||
| 3281 | Otherwise we return HANDLED_NORMALLY. */ | ||
| 3279 | 3282 | ||
| 3280 | static enum prop_handled | 3283 | static enum prop_handled |
| 3281 | handle_display_prop (it) | 3284 | handle_display_prop (it) |
| @@ -3283,6 +3286,7 @@ handle_display_prop (it) | |||
| 3283 | { | 3286 | { |
| 3284 | Lisp_Object prop, object; | 3287 | Lisp_Object prop, object; |
| 3285 | struct text_pos *position; | 3288 | struct text_pos *position; |
| 3289 | /* Nonzero if some property replaces the display of the text itself. */ | ||
| 3286 | int display_replaced_p = 0; | 3290 | int display_replaced_p = 0; |
| 3287 | 3291 | ||
| 3288 | if (STRINGP (it->string)) | 3292 | if (STRINGP (it->string)) |
| @@ -3330,7 +3334,7 @@ handle_display_prop (it) | |||
| 3330 | { | 3334 | { |
| 3331 | for (; CONSP (prop); prop = XCDR (prop)) | 3335 | for (; CONSP (prop); prop = XCDR (prop)) |
| 3332 | { | 3336 | { |
| 3333 | if (handle_single_display_prop (it, XCAR (prop), object, | 3337 | if (handle_single_display_spec (it, XCAR (prop), object, |
| 3334 | position, display_replaced_p)) | 3338 | position, display_replaced_p)) |
| 3335 | display_replaced_p = 1; | 3339 | display_replaced_p = 1; |
| 3336 | } | 3340 | } |
| @@ -3339,13 +3343,13 @@ handle_display_prop (it) | |||
| 3339 | { | 3343 | { |
| 3340 | int i; | 3344 | int i; |
| 3341 | for (i = 0; i < ASIZE (prop); ++i) | 3345 | for (i = 0; i < ASIZE (prop); ++i) |
| 3342 | if (handle_single_display_prop (it, AREF (prop, i), object, | 3346 | if (handle_single_display_spec (it, AREF (prop, i), object, |
| 3343 | position, display_replaced_p)) | 3347 | position, display_replaced_p)) |
| 3344 | display_replaced_p = 1; | 3348 | display_replaced_p = 1; |
| 3345 | } | 3349 | } |
| 3346 | else | 3350 | else |
| 3347 | { | 3351 | { |
| 3348 | if (handle_single_display_prop (it, prop, object, position, 0)) | 3352 | if (handle_single_display_spec (it, prop, object, position, 0)) |
| 3349 | display_replaced_p = 1; | 3353 | display_replaced_p = 1; |
| 3350 | } | 3354 | } |
| 3351 | 3355 | ||
| @@ -3377,42 +3381,44 @@ display_prop_end (it, object, start_pos) | |||
| 3377 | } | 3381 | } |
| 3378 | 3382 | ||
| 3379 | 3383 | ||
| 3380 | /* Set up IT from a single `display' sub-property value PROP. OBJECT | 3384 | /* Set up IT from a single `display' specification PROP. OBJECT |
| 3381 | is the object in which the `display' property was found. *POSITION | 3385 | is the object in which the `display' property was found. *POSITION |
| 3382 | is the position at which it was found. DISPLAY_REPLACED_P non-zero | 3386 | is the position at which it was found. DISPLAY_REPLACED_P non-zero |
| 3383 | means that we previously saw a display sub-property which already | 3387 | means that we previously saw a display specification which already |
| 3384 | replaced text display with something else, for example an image; | 3388 | replaced text display with something else, for example an image; |
| 3385 | ignore such properties after the first one has been processed. | 3389 | we ignore such properties after the first one has been processed. |
| 3386 | 3390 | ||
| 3387 | If PROP is a `space' or `image' sub-property, set *POSITION to the | 3391 | If PROP is a `space' or `image' specification, and in some other |
| 3388 | end position of the `display' property. | 3392 | cases too, set *POSITION to the position where the `display' |
| 3393 | property ends. | ||
| 3389 | 3394 | ||
| 3390 | Value is non-zero if something was found which replaces the display | 3395 | Value is non-zero if something was found which replaces the display |
| 3391 | of buffer or string text. */ | 3396 | of buffer or string text. */ |
| 3392 | 3397 | ||
| 3393 | static int | 3398 | static int |
| 3394 | handle_single_display_prop (it, prop, object, position, | 3399 | handle_single_display_spec (it, spec, object, position, |
| 3395 | display_replaced_before_p) | 3400 | display_replaced_before_p) |
| 3396 | struct it *it; | 3401 | struct it *it; |
| 3397 | Lisp_Object prop; | 3402 | Lisp_Object spec; |
| 3398 | Lisp_Object object; | 3403 | Lisp_Object object; |
| 3399 | struct text_pos *position; | 3404 | struct text_pos *position; |
| 3400 | int display_replaced_before_p; | 3405 | int display_replaced_before_p; |
| 3401 | { | 3406 | { |
| 3402 | Lisp_Object value; | ||
| 3403 | int replaces_text_display_p = 0; | ||
| 3404 | Lisp_Object form; | 3407 | Lisp_Object form; |
| 3408 | Lisp_Object location, value; | ||
| 3409 | struct text_pos start_pos; | ||
| 3410 | int valid_p; | ||
| 3405 | 3411 | ||
| 3406 | /* If PROP is a list of the form `(when FORM . VALUE)', FORM is | 3412 | /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. |
| 3407 | evaluated. If the result is nil, VALUE is ignored. */ | 3413 | If the result is non-nil, use VALUE instead of SPEC. */ |
| 3408 | form = Qt; | 3414 | form = Qt; |
| 3409 | if (CONSP (prop) && EQ (XCAR (prop), Qwhen)) | 3415 | if (CONSP (spec) && EQ (XCAR (spec), Qwhen)) |
| 3410 | { | 3416 | { |
| 3411 | prop = XCDR (prop); | 3417 | spec = XCDR (spec); |
| 3412 | if (!CONSP (prop)) | 3418 | if (!CONSP (spec)) |
| 3413 | return 0; | 3419 | return 0; |
| 3414 | form = XCAR (prop); | 3420 | form = XCAR (spec); |
| 3415 | prop = XCDR (prop); | 3421 | spec = XCDR (spec); |
| 3416 | } | 3422 | } |
| 3417 | 3423 | ||
| 3418 | if (!NILP (form) && !EQ (form, Qt)) | 3424 | if (!NILP (form) && !EQ (form, Qt)) |
| @@ -3438,15 +3444,15 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3438 | if (NILP (form)) | 3444 | if (NILP (form)) |
| 3439 | return 0; | 3445 | return 0; |
| 3440 | 3446 | ||
| 3441 | if (CONSP (prop) | 3447 | /* Handle `(height HEIGHT)' specifications. */ |
| 3442 | && EQ (XCAR (prop), Qheight) | 3448 | if (CONSP (spec) |
| 3443 | && CONSP (XCDR (prop))) | 3449 | && EQ (XCAR (spec), Qheight) |
| 3450 | && CONSP (XCDR (spec))) | ||
| 3444 | { | 3451 | { |
| 3445 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3452 | if (!FRAME_WINDOW_P (it->f)) |
| 3446 | return 0; | 3453 | return 0; |
| 3447 | 3454 | ||
| 3448 | /* `(height HEIGHT)'. */ | 3455 | it->font_height = XCAR (XCDR (spec)); |
| 3449 | it->font_height = XCAR (XCDR (prop)); | ||
| 3450 | if (!NILP (it->font_height)) | 3456 | if (!NILP (it->font_height)) |
| 3451 | { | 3457 | { |
| 3452 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 3458 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| @@ -3487,7 +3493,6 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3487 | { | 3493 | { |
| 3488 | /* Evaluate IT->font_height with `height' bound to the | 3494 | /* Evaluate IT->font_height with `height' bound to the |
| 3489 | current specified height to get the new height. */ | 3495 | current specified height to get the new height. */ |
| 3490 | Lisp_Object value; | ||
| 3491 | int count = SPECPDL_INDEX (); | 3496 | int count = SPECPDL_INDEX (); |
| 3492 | 3497 | ||
| 3493 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); | 3498 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); |
| @@ -3501,29 +3506,35 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3501 | if (new_height > 0) | 3506 | if (new_height > 0) |
| 3502 | it->face_id = face_with_height (it->f, it->face_id, new_height); | 3507 | it->face_id = face_with_height (it->f, it->face_id, new_height); |
| 3503 | } | 3508 | } |
| 3509 | |||
| 3510 | return 0; | ||
| 3504 | } | 3511 | } |
| 3505 | else if (CONSP (prop) | 3512 | |
| 3506 | && EQ (XCAR (prop), Qspace_width) | 3513 | /* Handle `(space_width WIDTH)'. */ |
| 3507 | && CONSP (XCDR (prop))) | 3514 | if (CONSP (spec) |
| 3515 | && EQ (XCAR (spec), Qspace_width) | ||
| 3516 | && CONSP (XCDR (spec))) | ||
| 3508 | { | 3517 | { |
| 3509 | /* `(space_width WIDTH)'. */ | 3518 | if (!FRAME_WINDOW_P (it->f)) |
| 3510 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | ||
| 3511 | return 0; | 3519 | return 0; |
| 3512 | 3520 | ||
| 3513 | value = XCAR (XCDR (prop)); | 3521 | value = XCAR (XCDR (spec)); |
| 3514 | if (NUMBERP (value) && XFLOATINT (value) > 0) | 3522 | if (NUMBERP (value) && XFLOATINT (value) > 0) |
| 3515 | it->space_width = value; | 3523 | it->space_width = value; |
| 3524 | |||
| 3525 | return 0; | ||
| 3516 | } | 3526 | } |
| 3517 | else if (CONSP (prop) | 3527 | |
| 3518 | && EQ (XCAR (prop), Qslice)) | 3528 | /* Handle `(slice X Y WIDTH HEIGHT)'. */ |
| 3529 | if (CONSP (spec) | ||
| 3530 | && EQ (XCAR (spec), Qslice)) | ||
| 3519 | { | 3531 | { |
| 3520 | /* `(slice X Y WIDTH HEIGHT)'. */ | ||
| 3521 | Lisp_Object tem; | 3532 | Lisp_Object tem; |
| 3522 | 3533 | ||
| 3523 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3534 | if (!FRAME_WINDOW_P (it->f)) |
| 3524 | return 0; | 3535 | return 0; |
| 3525 | 3536 | ||
| 3526 | if (tem = XCDR (prop), CONSP (tem)) | 3537 | if (tem = XCDR (spec), CONSP (tem)) |
| 3527 | { | 3538 | { |
| 3528 | it->slice.x = XCAR (tem); | 3539 | it->slice.x = XCAR (tem); |
| 3529 | if (tem = XCDR (tem), CONSP (tem)) | 3540 | if (tem = XCDR (tem), CONSP (tem)) |
| @@ -3537,17 +3548,20 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3537 | } | 3548 | } |
| 3538 | } | 3549 | } |
| 3539 | } | 3550 | } |
| 3551 | |||
| 3552 | return 0; | ||
| 3540 | } | 3553 | } |
| 3541 | else if (CONSP (prop) | 3554 | |
| 3542 | && EQ (XCAR (prop), Qraise) | 3555 | /* Handle `(raise FACTOR)'. */ |
| 3543 | && CONSP (XCDR (prop))) | 3556 | if (CONSP (spec) |
| 3557 | && EQ (XCAR (spec), Qraise) | ||
| 3558 | && CONSP (XCDR (spec))) | ||
| 3544 | { | 3559 | { |
| 3545 | /* `(raise FACTOR)'. */ | ||
| 3546 | if (!FRAME_WINDOW_P (it->f)) | 3560 | if (!FRAME_WINDOW_P (it->f)) |
| 3547 | return 0; | 3561 | return 0; |
| 3548 | 3562 | ||
| 3549 | #ifdef HAVE_WINDOW_SYSTEM | 3563 | #ifdef HAVE_WINDOW_SYSTEM |
| 3550 | value = XCAR (XCDR (prop)); | 3564 | value = XCAR (XCDR (spec)); |
| 3551 | if (NUMBERP (value)) | 3565 | if (NUMBERP (value)) |
| 3552 | { | 3566 | { |
| 3553 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 3567 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| @@ -3555,188 +3569,194 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3555 | * (FONT_HEIGHT (face->font))); | 3569 | * (FONT_HEIGHT (face->font))); |
| 3556 | } | 3570 | } |
| 3557 | #endif /* HAVE_WINDOW_SYSTEM */ | 3571 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3572 | |||
| 3573 | return 0; | ||
| 3558 | } | 3574 | } |
| 3559 | else if (!it->string_from_display_prop_p) | ||
| 3560 | { | ||
| 3561 | /* `((margin left-margin) VALUE)' or `((margin right-margin) | ||
| 3562 | VALUE) or `((margin nil) VALUE)' or VALUE. */ | ||
| 3563 | Lisp_Object location, value; | ||
| 3564 | struct text_pos start_pos; | ||
| 3565 | int valid_p; | ||
| 3566 | 3575 | ||
| 3567 | /* Characters having this form of property are not displayed, so | 3576 | /* Don't handle the other kinds of display specifications |
| 3568 | we have to find the end of the property. */ | 3577 | inside a string that we got from a `display' property. */ |
| 3569 | start_pos = *position; | 3578 | if (it->string_from_display_prop_p) |
| 3570 | *position = display_prop_end (it, object, start_pos); | 3579 | return 0; |
| 3571 | value = Qnil; | ||
| 3572 | 3580 | ||
| 3573 | /* Let's stop at the new position and assume that all | 3581 | /* Characters having this form of property are not displayed, so |
| 3574 | text properties change there. */ | 3582 | we have to find the end of the property. */ |
| 3575 | it->stop_charpos = position->charpos; | 3583 | start_pos = *position; |
| 3584 | *position = display_prop_end (it, object, start_pos); | ||
| 3585 | value = Qnil; | ||
| 3576 | 3586 | ||
| 3577 | if (CONSP (prop) | 3587 | /* Stop the scan at that end position--we assume that all |
| 3578 | && (EQ (XCAR (prop), Qleft_fringe) | 3588 | text properties change there. */ |
| 3579 | || EQ (XCAR (prop), Qright_fringe)) | 3589 | it->stop_charpos = position->charpos; |
| 3580 | && CONSP (XCDR (prop))) | ||
| 3581 | { | ||
| 3582 | int face_id = DEFAULT_FACE_ID; | ||
| 3583 | int fringe_bitmap; | ||
| 3584 | 3590 | ||
| 3585 | /* Save current settings of IT so that we can restore them | 3591 | /* Handle `(left-fringe BITMAP [FACE])' |
| 3586 | when we are finished with the glyph property value. */ | 3592 | and `(right-fringe BITMAP [FACE])'. */ |
| 3593 | if (CONSP (spec) | ||
| 3594 | && (EQ (XCAR (spec), Qleft_fringe) | ||
| 3595 | || EQ (XCAR (spec), Qright_fringe)) | ||
| 3596 | && CONSP (XCDR (spec))) | ||
| 3597 | { | ||
| 3598 | int face_id = DEFAULT_FACE_ID; | ||
| 3599 | int fringe_bitmap; | ||
| 3587 | 3600 | ||
| 3588 | /* `(left-fringe BITMAP FACE)'. */ | 3601 | if (!FRAME_WINDOW_P (it->f)) |
| 3589 | if (!FRAME_WINDOW_P (it->f)) | 3602 | /* If we return here, POSITION has been advanced |
| 3590 | return 0; | 3603 | across the text with this property. */ |
| 3604 | return 0; | ||
| 3591 | 3605 | ||
| 3592 | #ifdef HAVE_WINDOW_SYSTEM | 3606 | #ifdef HAVE_WINDOW_SYSTEM |
| 3593 | value = XCAR (XCDR (prop)); | 3607 | value = XCAR (XCDR (spec)); |
| 3594 | if (!SYMBOLP (value) | 3608 | if (!SYMBOLP (value) |
| 3595 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) | 3609 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) |
| 3596 | return 0; | 3610 | /* If we return here, POSITION has been advanced |
| 3611 | across the text with this property. */ | ||
| 3612 | return 0; | ||
| 3597 | 3613 | ||
| 3598 | if (CONSP (XCDR (XCDR (prop)))) | 3614 | if (CONSP (XCDR (XCDR (spec)))) |
| 3599 | { | 3615 | { |
| 3600 | Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | 3616 | Lisp_Object face_name = XCAR (XCDR (XCDR (spec))); |
| 3601 | int face_id2 = lookup_named_face (it->f, face_name, 'A', 0); | 3617 | int face_id2 = lookup_named_face (it->f, face_name, 'A', 0); |
| 3602 | if (face_id2 >= 0) | 3618 | if (face_id2 >= 0) |
| 3603 | face_id = face_id2; | 3619 | face_id = face_id2; |
| 3604 | } | 3620 | } |
| 3605 | 3621 | ||
| 3606 | push_it (it); | 3622 | /* Save current settings of IT so that we can restore them |
| 3623 | when we are finished with the glyph property value. */ | ||
| 3607 | 3624 | ||
| 3608 | it->area = TEXT_AREA; | 3625 | push_it (it); |
| 3609 | it->what = IT_IMAGE; | ||
| 3610 | it->image_id = -1; /* no image */ | ||
| 3611 | it->position = start_pos; | ||
| 3612 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3613 | it->method = next_element_from_image; | ||
| 3614 | it->face_id = face_id; | ||
| 3615 | 3626 | ||
| 3616 | /* Say that we haven't consumed the characters with | 3627 | it->area = TEXT_AREA; |
| 3617 | `display' property yet. The call to pop_it in | 3628 | it->what = IT_IMAGE; |
| 3618 | set_iterator_to_next will clean this up. */ | 3629 | it->image_id = -1; /* no image */ |
| 3619 | *position = start_pos; | 3630 | it->position = start_pos; |
| 3631 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3632 | it->method = next_element_from_image; | ||
| 3633 | it->face_id = face_id; | ||
| 3620 | 3634 | ||
| 3621 | if (EQ (XCAR (prop), Qleft_fringe)) | 3635 | /* Say that we haven't consumed the characters with |
| 3622 | { | 3636 | `display' property yet. The call to pop_it in |
| 3623 | it->left_user_fringe_bitmap = fringe_bitmap; | 3637 | set_iterator_to_next will clean this up. */ |
| 3624 | it->left_user_fringe_face_id = face_id; | 3638 | *position = start_pos; |
| 3625 | } | ||
| 3626 | else | ||
| 3627 | { | ||
| 3628 | it->right_user_fringe_bitmap = fringe_bitmap; | ||
| 3629 | it->right_user_fringe_face_id = face_id; | ||
| 3630 | } | ||
| 3631 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3632 | return 1; | ||
| 3633 | } | ||
| 3634 | 3639 | ||
| 3635 | location = Qunbound; | 3640 | if (EQ (XCAR (spec), Qleft_fringe)) |
| 3636 | if (CONSP (prop) && CONSP (XCAR (prop))) | ||
| 3637 | { | 3641 | { |
| 3638 | Lisp_Object tem; | 3642 | it->left_user_fringe_bitmap = fringe_bitmap; |
| 3643 | it->left_user_fringe_face_id = face_id; | ||
| 3644 | } | ||
| 3645 | else | ||
| 3646 | { | ||
| 3647 | it->right_user_fringe_bitmap = fringe_bitmap; | ||
| 3648 | it->right_user_fringe_face_id = face_id; | ||
| 3649 | } | ||
| 3650 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3651 | return 1; | ||
| 3652 | } | ||
| 3639 | 3653 | ||
| 3640 | value = XCDR (prop); | 3654 | /* Prepare to handle `((margin left-margin) ...)', |
| 3641 | if (CONSP (value)) | 3655 | `((margin right-margin) ...)' and `((margin nil) ...)' |
| 3642 | value = XCAR (value); | 3656 | prefixes for display specifications. */ |
| 3657 | location = Qunbound; | ||
| 3658 | if (CONSP (spec) && CONSP (XCAR (spec))) | ||
| 3659 | { | ||
| 3660 | Lisp_Object tem; | ||
| 3643 | 3661 | ||
| 3644 | tem = XCAR (prop); | 3662 | value = XCDR (spec); |
| 3645 | if (EQ (XCAR (tem), Qmargin) | 3663 | if (CONSP (value)) |
| 3646 | && (tem = XCDR (tem), | 3664 | value = XCAR (value); |
| 3647 | tem = CONSP (tem) ? XCAR (tem) : Qnil, | ||
| 3648 | (NILP (tem) | ||
| 3649 | || EQ (tem, Qleft_margin) | ||
| 3650 | || EQ (tem, Qright_margin)))) | ||
| 3651 | location = tem; | ||
| 3652 | } | ||
| 3653 | 3665 | ||
| 3654 | if (EQ (location, Qunbound)) | 3666 | tem = XCAR (spec); |
| 3655 | { | 3667 | if (EQ (XCAR (tem), Qmargin) |
| 3656 | location = Qnil; | 3668 | && (tem = XCDR (tem), |
| 3657 | value = prop; | 3669 | tem = CONSP (tem) ? XCAR (tem) : Qnil, |
| 3658 | } | 3670 | (NILP (tem) |
| 3671 | || EQ (tem, Qleft_margin) | ||
| 3672 | || EQ (tem, Qright_margin)))) | ||
| 3673 | location = tem; | ||
| 3674 | } | ||
| 3675 | |||
| 3676 | if (EQ (location, Qunbound)) | ||
| 3677 | { | ||
| 3678 | location = Qnil; | ||
| 3679 | value = spec; | ||
| 3680 | } | ||
| 3681 | |||
| 3682 | /* After this point, VALUE is the property after any | ||
| 3683 | margin prefix has been stripped. It must be a string, | ||
| 3684 | an image specification, or `(space ...)'. | ||
| 3659 | 3685 | ||
| 3660 | valid_p = (STRINGP (value) | 3686 | LOCATION specifies where to display: `left-margin', |
| 3687 | `right-margin' or nil. */ | ||
| 3688 | |||
| 3689 | valid_p = (STRINGP (value) | ||
| 3661 | #ifdef HAVE_WINDOW_SYSTEM | 3690 | #ifdef HAVE_WINDOW_SYSTEM |
| 3662 | || (FRAME_WINDOW_P (it->f) && valid_image_p (value)) | 3691 | || (FRAME_WINDOW_P (it->f) && valid_image_p (value)) |
| 3663 | #endif /* not HAVE_WINDOW_SYSTEM */ | 3692 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 3664 | || (CONSP (value) && EQ (XCAR (value), Qspace))); | 3693 | || (CONSP (value) && EQ (XCAR (value), Qspace))); |
| 3665 | |||
| 3666 | if ((EQ (location, Qleft_margin) | ||
| 3667 | || EQ (location, Qright_margin) | ||
| 3668 | || NILP (location)) | ||
| 3669 | && valid_p | ||
| 3670 | && !display_replaced_before_p) | ||
| 3671 | { | ||
| 3672 | replaces_text_display_p = 1; | ||
| 3673 | 3694 | ||
| 3674 | /* Save current settings of IT so that we can restore them | 3695 | if (valid_p && !display_replaced_before_p) |
| 3675 | when we are finished with the glyph property value. */ | 3696 | { |
| 3676 | push_it (it); | 3697 | /* Save current settings of IT so that we can restore them |
| 3698 | when we are finished with the glyph property value. */ | ||
| 3699 | push_it (it); | ||
| 3700 | if (NILP (location)) | ||
| 3701 | it->area = TEXT_AREA; | ||
| 3702 | else if (EQ (location, Qleft_margin)) | ||
| 3703 | it->area = LEFT_MARGIN_AREA; | ||
| 3704 | else | ||
| 3705 | it->area = RIGHT_MARGIN_AREA; | ||
| 3677 | 3706 | ||
| 3678 | if (NILP (location)) | 3707 | if (STRINGP (value)) |
| 3679 | it->area = TEXT_AREA; | 3708 | { |
| 3680 | else if (EQ (location, Qleft_margin)) | 3709 | it->string = value; |
| 3681 | it->area = LEFT_MARGIN_AREA; | 3710 | it->multibyte_p = STRING_MULTIBYTE (it->string); |
| 3682 | else | 3711 | it->current.overlay_string_index = -1; |
| 3683 | it->area = RIGHT_MARGIN_AREA; | 3712 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; |
| 3713 | it->end_charpos = it->string_nchars = SCHARS (it->string); | ||
| 3714 | it->method = next_element_from_string; | ||
| 3715 | it->stop_charpos = 0; | ||
| 3716 | it->string_from_display_prop_p = 1; | ||
| 3717 | /* Say that we haven't consumed the characters with | ||
| 3718 | `display' property yet. The call to pop_it in | ||
| 3719 | set_iterator_to_next will clean this up. */ | ||
| 3720 | *position = start_pos; | ||
| 3721 | } | ||
| 3722 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) | ||
| 3723 | { | ||
| 3724 | it->method = next_element_from_stretch; | ||
| 3725 | it->object = value; | ||
| 3726 | it->current.pos = it->position = start_pos; | ||
| 3684 | 3727 | ||
| 3685 | if (STRINGP (value)) | ||
| 3686 | { | ||
| 3687 | it->string = value; | ||
| 3688 | it->multibyte_p = STRING_MULTIBYTE (it->string); | ||
| 3689 | it->current.overlay_string_index = -1; | ||
| 3690 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | ||
| 3691 | it->end_charpos = it->string_nchars = SCHARS (it->string); | ||
| 3692 | it->method = next_element_from_string; | ||
| 3693 | it->stop_charpos = 0; | ||
| 3694 | it->string_from_display_prop_p = 1; | ||
| 3695 | /* Say that we haven't consumed the characters with | ||
| 3696 | `display' property yet. The call to pop_it in | ||
| 3697 | set_iterator_to_next will clean this up. */ | ||
| 3698 | *position = start_pos; | ||
| 3699 | } | ||
| 3700 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) | ||
| 3701 | { | ||
| 3702 | it->method = next_element_from_stretch; | ||
| 3703 | it->object = value; | ||
| 3704 | it->current.pos = it->position = start_pos; | ||
| 3705 | } | ||
| 3706 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3707 | else | ||
| 3708 | { | ||
| 3709 | if (FRAME_WINDOW_P (it->f)) | ||
| 3710 | { | ||
| 3711 | it->what = IT_IMAGE; | ||
| 3712 | it->image_id = lookup_image (it->f, value); | ||
| 3713 | it->position = start_pos; | ||
| 3714 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3715 | it->method = next_element_from_image; | ||
| 3716 | } | ||
| 3717 | |||
| 3718 | /* Say that we haven't consumed the characters with | ||
| 3719 | `display' property yet. The call to pop_it in | ||
| 3720 | set_iterator_to_next will clean this up. */ | ||
| 3721 | *position = start_pos; | ||
| 3722 | } | ||
| 3723 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3724 | } | 3728 | } |
| 3729 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3725 | else | 3730 | else |
| 3726 | /* Invalid property or property not supported. Restore | 3731 | { |
| 3727 | the position to what it was before. */ | 3732 | it->what = IT_IMAGE; |
| 3728 | *position = start_pos; | 3733 | it->image_id = lookup_image (it->f, value); |
| 3734 | it->position = start_pos; | ||
| 3735 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3736 | it->method = next_element_from_image; | ||
| 3737 | |||
| 3738 | /* Say that we haven't consumed the characters with | ||
| 3739 | `display' property yet. The call to pop_it in | ||
| 3740 | set_iterator_to_next will clean this up. */ | ||
| 3741 | *position = start_pos; | ||
| 3742 | } | ||
| 3743 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3744 | |||
| 3745 | return 1; | ||
| 3729 | } | 3746 | } |
| 3730 | 3747 | ||
| 3731 | return replaces_text_display_p; | 3748 | /* Invalid property or property not supported. Restore |
| 3749 | POSITION to what it was before. */ | ||
| 3750 | *position = start_pos; | ||
| 3751 | return 0; | ||
| 3732 | } | 3752 | } |
| 3733 | 3753 | ||
| 3734 | 3754 | ||
| 3735 | /* Check if PROP is a display sub-property value whose text should be | 3755 | /* Check if SPEC is a display sub-property value whose text should be |
| 3736 | treated as intangible. */ | 3756 | treated as intangible. */ |
| 3737 | 3757 | ||
| 3738 | static int | 3758 | static int |
| 3739 | single_display_prop_intangible_p (prop) | 3759 | single_display_spec_intangible_p (prop) |
| 3740 | Lisp_Object prop; | 3760 | Lisp_Object prop; |
| 3741 | { | 3761 | { |
| 3742 | /* Skip over `when FORM'. */ | 3762 | /* Skip over `when FORM'. */ |
| @@ -3789,7 +3809,7 @@ display_prop_intangible_p (prop) | |||
| 3789 | /* A list of sub-properties. */ | 3809 | /* A list of sub-properties. */ |
| 3790 | while (CONSP (prop)) | 3810 | while (CONSP (prop)) |
| 3791 | { | 3811 | { |
| 3792 | if (single_display_prop_intangible_p (XCAR (prop))) | 3812 | if (single_display_spec_intangible_p (XCAR (prop))) |
| 3793 | return 1; | 3813 | return 1; |
| 3794 | prop = XCDR (prop); | 3814 | prop = XCDR (prop); |
| 3795 | } | 3815 | } |
| @@ -3799,11 +3819,11 @@ display_prop_intangible_p (prop) | |||
| 3799 | /* A vector of sub-properties. */ | 3819 | /* A vector of sub-properties. */ |
| 3800 | int i; | 3820 | int i; |
| 3801 | for (i = 0; i < ASIZE (prop); ++i) | 3821 | for (i = 0; i < ASIZE (prop); ++i) |
| 3802 | if (single_display_prop_intangible_p (AREF (prop, i))) | 3822 | if (single_display_spec_intangible_p (AREF (prop, i))) |
| 3803 | return 1; | 3823 | return 1; |
| 3804 | } | 3824 | } |
| 3805 | else | 3825 | else |
| 3806 | return single_display_prop_intangible_p (prop); | 3826 | return single_display_spec_intangible_p (prop); |
| 3807 | 3827 | ||
| 3808 | return 0; | 3828 | return 0; |
| 3809 | } | 3829 | } |
| @@ -3812,7 +3832,7 @@ display_prop_intangible_p (prop) | |||
| 3812 | /* Return 1 if PROP is a display sub-property value containing STRING. */ | 3832 | /* Return 1 if PROP is a display sub-property value containing STRING. */ |
| 3813 | 3833 | ||
| 3814 | static int | 3834 | static int |
| 3815 | single_display_prop_string_p (prop, string) | 3835 | single_display_spec_string_p (prop, string) |
| 3816 | Lisp_Object prop, string; | 3836 | Lisp_Object prop, string; |
| 3817 | { | 3837 | { |
| 3818 | if (EQ (string, prop)) | 3838 | if (EQ (string, prop)) |
| @@ -3857,7 +3877,7 @@ display_prop_string_p (prop, string) | |||
| 3857 | /* A list of sub-properties. */ | 3877 | /* A list of sub-properties. */ |
| 3858 | while (CONSP (prop)) | 3878 | while (CONSP (prop)) |
| 3859 | { | 3879 | { |
| 3860 | if (single_display_prop_string_p (XCAR (prop), string)) | 3880 | if (single_display_spec_string_p (XCAR (prop), string)) |
| 3861 | return 1; | 3881 | return 1; |
| 3862 | prop = XCDR (prop); | 3882 | prop = XCDR (prop); |
| 3863 | } | 3883 | } |
| @@ -3867,11 +3887,11 @@ display_prop_string_p (prop, string) | |||
| 3867 | /* A vector of sub-properties. */ | 3887 | /* A vector of sub-properties. */ |
| 3868 | int i; | 3888 | int i; |
| 3869 | for (i = 0; i < ASIZE (prop); ++i) | 3889 | for (i = 0; i < ASIZE (prop); ++i) |
| 3870 | if (single_display_prop_string_p (AREF (prop, i), string)) | 3890 | if (single_display_spec_string_p (AREF (prop, i), string)) |
| 3871 | return 1; | 3891 | return 1; |
| 3872 | } | 3892 | } |
| 3873 | else | 3893 | else |
| 3874 | return single_display_prop_string_p (prop, string); | 3894 | return single_display_spec_string_p (prop, string); |
| 3875 | 3895 | ||
| 3876 | return 0; | 3896 | return 0; |
| 3877 | } | 3897 | } |
| @@ -6624,7 +6644,7 @@ message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte) | |||
| 6624 | } | 6644 | } |
| 6625 | return 0; | 6645 | return 0; |
| 6626 | } | 6646 | } |
| 6627 | 6647 | ||
| 6628 | 6648 | ||
| 6629 | /* Display an echo area message M with a specified length of NBYTES | 6649 | /* Display an echo area message M with a specified length of NBYTES |
| 6630 | bytes. The string may include null characters. If M is 0, clear | 6650 | bytes. The string may include null characters. If M is 0, clear |
| @@ -21890,20 +21910,6 @@ expose_window (w, fr) | |||
| 21890 | } | 21910 | } |
| 21891 | } | 21911 | } |
| 21892 | 21912 | ||
| 21893 | #ifdef HAVE_CARBON | ||
| 21894 | /* Display scroll bar for this window. */ | ||
| 21895 | if (!NILP (w->vertical_scroll_bar)) | ||
| 21896 | { | ||
| 21897 | /* ++KFS: | ||
| 21898 | If this doesn't work here (maybe some header files are missing), | ||
| 21899 | make a function in macterm.c and call it to do the job! */ | ||
| 21900 | ControlHandle ch | ||
| 21901 | = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (w->vertical_scroll_bar)); | ||
| 21902 | |||
| 21903 | Draw1Control (ch); | ||
| 21904 | } | ||
| 21905 | #endif | ||
| 21906 | |||
| 21907 | return mouse_face_overwritten_p; | 21913 | return mouse_face_overwritten_p; |
| 21908 | } | 21914 | } |
| 21909 | 21915 | ||
| @@ -21962,16 +21968,6 @@ expose_frame (f, x, y, w, h) | |||
| 21962 | return; | 21968 | return; |
| 21963 | } | 21969 | } |
| 21964 | 21970 | ||
| 21965 | #ifdef HAVE_CARBON | ||
| 21966 | /* MAC_TODO: this is a kludge, but if scroll bars are not activated | ||
| 21967 | or deactivated here, for unknown reasons, activated scroll bars | ||
| 21968 | are shown in deactivated frames in some instances. */ | ||
| 21969 | if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame) | ||
| 21970 | activate_scroll_bars (f); | ||
| 21971 | else | ||
| 21972 | deactivate_scroll_bars (f); | ||
| 21973 | #endif | ||
| 21974 | |||
| 21975 | /* If basic faces haven't been realized yet, there is no point in | 21971 | /* If basic faces haven't been realized yet, there is no point in |
| 21976 | trying to redraw anything. This can happen when we get an expose | 21972 | trying to redraw anything. This can happen when we get an expose |
| 21977 | event while Emacs is starting, e.g. by moving another window. */ | 21973 | event while Emacs is starting, e.g. by moving another window. */ |
diff --git a/src/xfaces.c b/src/xfaces.c index eb5f617b4a1..a1b6b4bc775 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1075,6 +1075,9 @@ clear_font_table (dpyinfo) | |||
| 1075 | #ifdef WINDOWSNT | 1075 | #ifdef WINDOWSNT |
| 1076 | w32_unload_font (dpyinfo, font_info->font); | 1076 | w32_unload_font (dpyinfo, font_info->font); |
| 1077 | #endif | 1077 | #endif |
| 1078 | #ifdef MAC_OS | ||
| 1079 | mac_unload_font (dpyinfo, font_info->font); | ||
| 1080 | #endif | ||
| 1078 | UNBLOCK_INPUT; | 1081 | UNBLOCK_INPUT; |
| 1079 | 1082 | ||
| 1080 | /* Mark font table slot free. */ | 1083 | /* Mark font table slot free. */ |
diff --git a/src/xfns.c b/src/xfns.c index 2fe08e0a458..6a99dbf8e5b 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5278,6 +5278,16 @@ or directory must exist. ONLY-DIR-P is ignored." */) | |||
| 5278 | XEvent event; | 5278 | XEvent event; |
| 5279 | x_menu_wait_for_event (0); | 5279 | x_menu_wait_for_event (0); |
| 5280 | XtAppNextEvent (Xt_app_con, &event); | 5280 | XtAppNextEvent (Xt_app_con, &event); |
| 5281 | if (event.type == KeyPress | ||
| 5282 | && FRAME_X_DISPLAY (f) == event.xkey.display) | ||
| 5283 | { | ||
| 5284 | KeySym keysym = XLookupKeysym (&event.xkey, 0); | ||
| 5285 | |||
| 5286 | /* Pop down on C-g. */ | ||
| 5287 | if (keysym == XK_g && (event.xkey.state & ControlMask) != 0) | ||
| 5288 | XtUnmanageChild (dialog); | ||
| 5289 | } | ||
| 5290 | |||
| 5281 | (void) x_dispatch_event (&event, FRAME_X_DISPLAY (f)); | 5291 | (void) x_dispatch_event (&event, FRAME_X_DISPLAY (f)); |
| 5282 | } | 5292 | } |
| 5283 | 5293 | ||
diff --git a/src/xmenu.c b/src/xmenu.c index 45b0742df0e..774f404fd42 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -116,7 +116,7 @@ extern XtAppContext Xt_app_con; | |||
| 116 | 116 | ||
| 117 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); | 117 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); |
| 118 | static void popup_get_selection P_ ((XEvent *, struct x_display_info *, | 118 | static void popup_get_selection P_ ((XEvent *, struct x_display_info *, |
| 119 | LWLIB_ID, int, int)); | 119 | LWLIB_ID, int)); |
| 120 | 120 | ||
| 121 | /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ | 121 | /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ |
| 122 | 122 | ||
| @@ -1186,24 +1186,21 @@ x_menu_wait_for_event (void *data) | |||
| 1186 | popped down (deactivated). This is used for x-popup-menu | 1186 | popped down (deactivated). This is used for x-popup-menu |
| 1187 | and x-popup-dialog; it is not used for the menu bar. | 1187 | and x-popup-dialog; it is not used for the menu bar. |
| 1188 | 1188 | ||
| 1189 | If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed. | ||
| 1190 | |||
| 1191 | NOTE: All calls to popup_get_selection should be protected | 1189 | NOTE: All calls to popup_get_selection should be protected |
| 1192 | with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ | 1190 | with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ |
| 1193 | 1191 | ||
| 1194 | static void | 1192 | static void |
| 1195 | popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) | 1193 | popup_get_selection (initial_event, dpyinfo, id, do_timers) |
| 1196 | XEvent *initial_event; | 1194 | XEvent *initial_event; |
| 1197 | struct x_display_info *dpyinfo; | 1195 | struct x_display_info *dpyinfo; |
| 1198 | LWLIB_ID id; | 1196 | LWLIB_ID id; |
| 1199 | int do_timers; | 1197 | int do_timers; |
| 1200 | int down_on_keypress; | ||
| 1201 | { | 1198 | { |
| 1202 | XEvent event; | 1199 | XEvent event; |
| 1203 | 1200 | ||
| 1204 | while (popup_activated_flag) | 1201 | while (popup_activated_flag) |
| 1205 | { | 1202 | { |
| 1206 | if (initial_event) | 1203 | if (initial_event) |
| 1207 | { | 1204 | { |
| 1208 | event = *initial_event; | 1205 | event = *initial_event; |
| 1209 | initial_event = 0; | 1206 | initial_event = 0; |
| @@ -1232,20 +1229,15 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) | |||
| 1232 | event.xbutton.state = 0; | 1229 | event.xbutton.state = 0; |
| 1233 | #endif | 1230 | #endif |
| 1234 | } | 1231 | } |
| 1235 | /* If the user presses a key that doesn't go to the menu, | 1232 | /* Pop down on C-g and Escape. */ |
| 1236 | deactivate the menu. | ||
| 1237 | The user is likely to do that if we get wedged. | ||
| 1238 | All toolkits now pop down menus on ESC. | ||
| 1239 | For dialogs however, the focus may not be on the dialog, so | ||
| 1240 | in that case, we pop down. */ | ||
| 1241 | else if (event.type == KeyPress | 1233 | else if (event.type == KeyPress |
| 1242 | && down_on_keypress | ||
| 1243 | && dpyinfo->display == event.xbutton.display) | 1234 | && dpyinfo->display == event.xbutton.display) |
| 1244 | { | 1235 | { |
| 1245 | KeySym keysym = XLookupKeysym (&event.xkey, 0); | 1236 | KeySym keysym = XLookupKeysym (&event.xkey, 0); |
| 1246 | if (!IsModifierKey (keysym) | 1237 | |
| 1247 | && x_any_window_to_frame (dpyinfo, event.xany.window) != NULL) | 1238 | if ((keysym == XK_g && (event.xkey.state & ControlMask) != 0) |
| 1248 | popup_activated_flag = 0; | 1239 | || keysym == XK_Escape) /* Any escape, ignore modifiers. */ |
| 1240 | popup_activated_flag = 0; | ||
| 1249 | } | 1241 | } |
| 1250 | 1242 | ||
| 1251 | x_dispatch_event (&event, event.xany.display); | 1243 | x_dispatch_event (&event, event.xany.display); |
| @@ -2226,6 +2218,9 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 2226 | } | 2218 | } |
| 2227 | else | 2219 | else |
| 2228 | { | 2220 | { |
| 2221 | char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()"; | ||
| 2222 | XtTranslations override = XtParseTranslationTable (menuOverride); | ||
| 2223 | |||
| 2229 | menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, | 2224 | menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, |
| 2230 | f->output_data.x->column_widget, | 2225 | f->output_data.x->column_widget, |
| 2231 | 0, | 2226 | 0, |
| @@ -2234,6 +2229,9 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 2234 | popup_deactivate_callback, | 2229 | popup_deactivate_callback, |
| 2235 | menu_highlight_callback); | 2230 | menu_highlight_callback); |
| 2236 | f->output_data.x->menubar_widget = menubar_widget; | 2231 | f->output_data.x->menubar_widget = menubar_widget; |
| 2232 | |||
| 2233 | /* Make menu pop down on C-g. */ | ||
| 2234 | XtOverrideTranslations (menubar_widget, override); | ||
| 2237 | } | 2235 | } |
| 2238 | 2236 | ||
| 2239 | { | 2237 | { |
| @@ -2597,7 +2595,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2597 | make_number (menu_id & ~(-1 << (fact))))); | 2595 | make_number (menu_id & ~(-1 << (fact))))); |
| 2598 | 2596 | ||
| 2599 | /* Process events that apply to the menu. */ | 2597 | /* Process events that apply to the menu. */ |
| 2600 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1, 0); | 2598 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1); |
| 2601 | 2599 | ||
| 2602 | unbind_to (specpdl_count, Qnil); | 2600 | unbind_to (specpdl_count, Qnil); |
| 2603 | } | 2601 | } |
| @@ -2975,7 +2973,7 @@ create_and_show_dialog (f, first_wv) | |||
| 2975 | make_number (dialog_id & ~(-1 << (fact))))); | 2973 | make_number (dialog_id & ~(-1 << (fact))))); |
| 2976 | 2974 | ||
| 2977 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), | 2975 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), |
| 2978 | dialog_id, 1, 1); | 2976 | dialog_id, 1); |
| 2979 | 2977 | ||
| 2980 | unbind_to (count, Qnil); | 2978 | unbind_to (count, Qnil); |
| 2981 | } | 2979 | } |
| @@ -3155,6 +3153,9 @@ xdialog_show (f, keymaps, title, error) | |||
| 3155 | } | 3153 | } |
| 3156 | } | 3154 | } |
| 3157 | } | 3155 | } |
| 3156 | else | ||
| 3157 | /* Make "Cancel" equivalent to C-g. */ | ||
| 3158 | Fsignal (Qquit, Qnil); | ||
| 3158 | 3159 | ||
| 3159 | return Qnil; | 3160 | return Qnil; |
| 3160 | } | 3161 | } |
| @@ -3500,7 +3501,13 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3500 | case XM_FAILURE: | 3501 | case XM_FAILURE: |
| 3501 | *error = "Can't activate menu"; | 3502 | *error = "Can't activate menu"; |
| 3502 | case XM_IA_SELECT: | 3503 | case XM_IA_SELECT: |
| 3504 | entry = Qnil; | ||
| 3505 | break; | ||
| 3503 | case XM_NO_SELECT: | 3506 | case XM_NO_SELECT: |
| 3507 | /* Make "Cancel" equivalent to C-g unless this menu was popped up by | ||
| 3508 | a mouse press. */ | ||
| 3509 | if (! for_click) | ||
| 3510 | Fsignal (Qquit, Qnil); | ||
| 3504 | entry = Qnil; | 3511 | entry = Qnil; |
| 3505 | break; | 3512 | break; |
| 3506 | } | 3513 | } |