diff options
| author | Charles A. Roelli | 2018-03-19 20:16:19 +0100 |
|---|---|---|
| committer | Charles A. Roelli | 2018-03-19 20:35:24 +0100 |
| commit | 7ff62ed221cc712bb2e310917dd303594f68a625 (patch) | |
| tree | e22ac876ef828a703e2c5630c8e6bb29e22c765a /src | |
| parent | 6d2e8fdd102d2d4f5105898c15813fd8dcd0907f (diff) | |
| download | emacs-7ff62ed221cc712bb2e310917dd303594f68a625.tar.gz emacs-7ff62ed221cc712bb2e310917dd303594f68a625.zip | |
Normalize and fix some mistakes in NS-related commentary
* lisp/term/ns-win.el (ns-insert-working-text): Normalize
commentary.
(x-file-dialog): Fix indentation.
* src/nsfns.m (ns_get_window, interpret_services_menu)
(x_set_background_color, x_set_icon_name, x_set_tool_bar_lines)
(x_set_icon_type, x_set_mouse_color, Fx_create_frame)
(ns_window_is_ancestor, Fns_popup_font_panel)
(Fx_display_visual_class, Fns_font_name, Fns_do_applescript)
(ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position)
(handlePanelKeys): Normalize commentary (also in top-level
declarations) and remove two outdated comments (one in
Fx_create_frame, the other in compute_tip_xy).
* src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record):
* src/nsselect.m:
* src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:)
(runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar)
(update_frame_tool_bar, init)
(initWithContentRect:styleMask:backing:defer:)
(initFromContents:isQuestion:, timeout_handler:)
(Fmenu_or_popup_active_p):
* src/nsimage.m (initFromXBM, initFromXBMWithDepth):
* src/nsgui.h:
* src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity)
(ns_charset_covers, ns_get_req_script, ns_findfonts)
(nsfont_list_family, nsfont_open, nsfont_encode_char)
(nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics)
(syms_of_nsfont): Normalize commentary (also in top-level
declarations).
* src/nsterm.m (ns_init_locale, ns_retain_object)
(ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView)
(x_make_frame_visible, x_iconify_frame, x_destroy_window)
(x_set_undecorated, x_set_no_focus_on_map, x_set_z_group)
(ns_index_color, ns_get_color, ns_lisp_to_color)
(note_mouse_movement, scrollbar, ns_scroll_run)
(ns_draw_fringe_bitmap, ns_draw_window_cursor)
(ns_draw_text_decoration, ns_draw_relief)
(ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image)
(ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined)
(ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break)
(ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar)
(ns_string_to_lispmod, ns_default, ns_initialize_display_info)
(ns_delete_display, ns_term_init, sendEvent:)
(applicationDidFinishLaunching:, applicationDidBecomeActive:)
(fd_handler:, setWindowClosing:, keyDown:, insertText:)
(mouseDown:, mouseMoved:, updateFrameSize:)
(windowWillResize:toSize:, windowDidResize:, windowDidResignKey:)
(initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:)
(writeSelectionToPasteboard:types:, setMiniwindowImage:)
(scrollerWidth, initFrame:window:, setFrame:, repeatScroll:)
(ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in
top-level declarations), and in ns_get_color, replace a Gmane link
with one from lists.gnu.org, which does not require JS to view the
message.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsfns.m | 114 | ||||
| -rw-r--r-- | src/nsfont.m | 124 | ||||
| -rw-r--r-- | src/nsgui.h | 10 | ||||
| -rw-r--r-- | src/nsimage.m | 28 | ||||
| -rw-r--r-- | src/nsmenu.m | 120 | ||||
| -rw-r--r-- | src/nsselect.m | 2 | ||||
| -rw-r--r-- | src/nsterm.h | 98 | ||||
| -rw-r--r-- | src/nsterm.m | 441 |
8 files changed, 469 insertions, 468 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index 6407560d89e..6df54b4eb50 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -27,7 +27,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | /* This should be the first include, as it may set up #defines affecting | 29 | /* This should be the first include, as it may set up #defines affecting |
| 30 | interpretation of even the system includes. */ | 30 | interpretation of even the system includes. */ |
| 31 | #include <config.h> | 31 | #include <config.h> |
| 32 | 32 | ||
| 33 | #include <math.h> | 33 | #include <math.h> |
| @@ -54,7 +54,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 54 | 54 | ||
| 55 | static EmacsTooltip *ns_tooltip = nil; | 55 | static EmacsTooltip *ns_tooltip = nil; |
| 56 | 56 | ||
| 57 | /* Static variables to handle applescript execution. */ | 57 | /* Static variables to handle AppleScript execution. */ |
| 58 | static Lisp_Object as_script, *as_result; | 58 | static Lisp_Object as_script, *as_result; |
| 59 | static int as_status; | 59 | static int as_status; |
| 60 | 60 | ||
| @@ -116,7 +116,7 @@ ns_get_window (Lisp_Object maybeFrame) | |||
| 116 | id view =nil, window =nil; | 116 | id view =nil, window =nil; |
| 117 | 117 | ||
| 118 | if (!FRAMEP (maybeFrame) || !FRAME_NS_P (XFRAME (maybeFrame))) | 118 | if (!FRAMEP (maybeFrame) || !FRAME_NS_P (XFRAME (maybeFrame))) |
| 119 | maybeFrame = selected_frame;/*wrong_type_argument (Qframep, maybeFrame); */ | 119 | maybeFrame = selected_frame; /* wrong_type_argument (Qframep, maybeFrame); */ |
| 120 | 120 | ||
| 121 | if (!NILP (maybeFrame)) | 121 | if (!NILP (maybeFrame)) |
| 122 | view = FRAME_NS_VIEW (XFRAME (maybeFrame)); | 122 | view = FRAME_NS_VIEW (XFRAME (maybeFrame)); |
| @@ -178,7 +178,7 @@ ns_directory_from_panel (NSSavePanel *panel) | |||
| 178 | static Lisp_Object | 178 | static Lisp_Object |
| 179 | interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) | 179 | interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) |
| 180 | /* -------------------------------------------------------------------------- | 180 | /* -------------------------------------------------------------------------- |
| 181 | Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side | 181 | Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. |
| 182 | -------------------------------------------------------------------------- */ | 182 | -------------------------------------------------------------------------- */ |
| 183 | { | 183 | { |
| 184 | int i, count; | 184 | int i, count; |
| @@ -261,7 +261,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 261 | if (FRAME_NS_VIEW (f)) | 261 | if (FRAME_NS_VIEW (f)) |
| 262 | { | 262 | { |
| 263 | update_face_from_frame_parameter (f, Qforeground_color, arg); | 263 | update_face_from_frame_parameter (f, Qforeground_color, arg); |
| 264 | /*recompute_basic_faces (f); */ | 264 | /* recompute_basic_faces (f); */ |
| 265 | if (FRAME_VISIBLE_P (f)) | 265 | if (FRAME_VISIBLE_P (f)) |
| 266 | SET_FRAME_GARBAGED (f); | 266 | SET_FRAME_GARBAGED (f); |
| 267 | } | 267 | } |
| @@ -285,8 +285,9 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 285 | error ("Unknown color"); | 285 | error ("Unknown color"); |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | /* clear the frame; in some instances the NS-internal GC appears not to | 288 | /* Clear the frame; in some instances the NS-internal GC appears not |
| 289 | update, or it does update and cannot clear old text properly */ | 289 | to update, or it does update and cannot clear old text |
| 290 | properly. */ | ||
| 290 | if (FRAME_VISIBLE_P (f)) | 291 | if (FRAME_VISIBLE_P (f)) |
| 291 | ns_clear_frame (f); | 292 | ns_clear_frame (f); |
| 292 | 293 | ||
| @@ -356,7 +357,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 356 | NSView *view = FRAME_NS_VIEW (f); | 357 | NSView *view = FRAME_NS_VIEW (f); |
| 357 | NSTRACE ("x_set_icon_name"); | 358 | NSTRACE ("x_set_icon_name"); |
| 358 | 359 | ||
| 359 | /* see if it's changed */ | 360 | /* See if it's changed. */ |
| 360 | if (STRINGP (arg)) | 361 | if (STRINGP (arg)) |
| 361 | { | 362 | { |
| 362 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | 363 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) |
| @@ -556,14 +557,14 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 556 | if (nlines) | 557 | if (nlines) |
| 557 | { | 558 | { |
| 558 | FRAME_EXTERNAL_MENU_BAR (f) = 1; | 559 | FRAME_EXTERNAL_MENU_BAR (f) = 1; |
| 559 | /* does for all frames, whereas we just want for one frame | 560 | /* Does for all frames, whereas we just want for one frame |
| 560 | [NSMenu setMenuBarVisible: YES]; */ | 561 | [NSMenu setMenuBarVisible: YES]; */ |
| 561 | } | 562 | } |
| 562 | else | 563 | else |
| 563 | { | 564 | { |
| 564 | if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | 565 | if (FRAME_EXTERNAL_MENU_BAR (f) == 1) |
| 565 | free_frame_menubar (f); | 566 | free_frame_menubar (f); |
| 566 | /* [NSMenu setMenuBarVisible: NO]; */ | 567 | /* [NSMenu setMenuBarVisible: NO]; */ |
| 567 | FRAME_EXTERNAL_MENU_BAR (f) = 0; | 568 | FRAME_EXTERNAL_MENU_BAR (f) = 0; |
| 568 | } | 569 | } |
| 569 | } | 570 | } |
| @@ -573,11 +574,11 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 573 | static void | 574 | static void |
| 574 | x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | 575 | x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) |
| 575 | { | 576 | { |
| 576 | /* Currently, when the tool bar change state, the frame is resized. | 577 | /* Currently, when the tool bar changes state, the frame is resized. |
| 577 | 578 | ||
| 578 | TODO: It would be better if this didn't occur when 1) the frame | 579 | TODO: It would be better if this didn't occur when 1) the frame |
| 579 | is full height or maximized or 2) when specified by | 580 | is full height or maximized or 2) when specified by |
| 580 | `frame-inhibit-implied-resize'. */ | 581 | `frame-inhibit-implied-resize'. */ |
| 581 | int nlines; | 582 | int nlines; |
| 582 | 583 | ||
| 583 | NSTRACE ("x_set_tool_bar_lines"); | 584 | NSTRACE ("x_set_tool_bar_lines"); |
| @@ -694,7 +695,7 @@ ns_implicitly_set_icon_type (struct frame *f) | |||
| 694 | chain = XCDR (chain)) | 695 | chain = XCDR (chain)) |
| 695 | { | 696 | { |
| 696 | elt = XCAR (chain); | 697 | elt = XCAR (chain); |
| 697 | /* special case: t means go by file type */ | 698 | /* Special case: t means go by file type. */ |
| 698 | if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (f->name)[0] == '/') | 699 | if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (f->name)[0] == '/') |
| 699 | { | 700 | { |
| 700 | NSString *str | 701 | NSString *str |
| @@ -744,7 +745,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 744 | store_frame_param (f, Qicon_type, arg); | 745 | store_frame_param (f, Qicon_type, arg); |
| 745 | } | 746 | } |
| 746 | 747 | ||
| 747 | /* do it the implicit way */ | 748 | /* Do it the implicit way. */ |
| 748 | if (NILP (arg)) | 749 | if (NILP (arg)) |
| 749 | { | 750 | { |
| 750 | ns_implicitly_set_icon_type (f); | 751 | ns_implicitly_set_icon_type (f); |
| @@ -780,7 +781,7 @@ x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 780 | static void | 781 | static void |
| 781 | x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 782 | x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) |
| 782 | { | 783 | { |
| 783 | /* don't think we can do this on Nextstep */ | 784 | /* Don't think we can do this on Nextstep. */ |
| 784 | } | 785 | } |
| 785 | 786 | ||
| 786 | 787 | ||
| @@ -809,7 +810,7 @@ ns_appkit_version_str (void) | |||
| 809 | 810 | ||
| 810 | /* This is for use by x-server-version and collapses all version info we | 811 | /* This is for use by x-server-version and collapses all version info we |
| 811 | have into a single int. For a better picture of the implementation | 812 | have into a single int. For a better picture of the implementation |
| 812 | running, use ns_appkit_version_str.*/ | 813 | running, use ns_appkit_version_str. */ |
| 813 | static int | 814 | static int |
| 814 | ns_appkit_version_int (void) | 815 | ns_appkit_version_int (void) |
| 815 | { | 816 | { |
| @@ -852,7 +853,8 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 852 | } | 853 | } |
| 853 | 854 | ||
| 854 | 855 | ||
| 855 | /* Note: see frame.c for template, also where generic functions are impl */ | 856 | /* Note: see frame.c for template, also where generic functions are |
| 857 | implemented. */ | ||
| 856 | frame_parm_handler ns_frame_parm_handlers[] = | 858 | frame_parm_handler ns_frame_parm_handlers[] = |
| 857 | { | 859 | { |
| 858 | x_set_autoraise, /* generic OK */ | 860 | x_set_autoraise, /* generic OK */ |
| @@ -896,7 +898,7 @@ frame_parm_handler ns_frame_parm_handlers[] = | |||
| 896 | #ifdef NS_IMPL_COCOA | 898 | #ifdef NS_IMPL_COCOA |
| 897 | x_set_undecorated, | 899 | x_set_undecorated, |
| 898 | #else | 900 | #else |
| 899 | 0, /*x_set_undecorated */ | 901 | 0, /* x_set_undecorated */ |
| 900 | #endif | 902 | #endif |
| 901 | x_set_parent_frame, | 903 | x_set_parent_frame, |
| 902 | 0, /* x_set_skip_taskbar */ | 904 | 0, /* x_set_skip_taskbar */ |
| @@ -1127,7 +1129,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 1127 | /* use for default font name */ | 1129 | /* use for default font name */ |
| 1128 | id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ | 1130 | id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ |
| 1129 | x_default_parameter (f, parms, Qfontsize, | 1131 | x_default_parameter (f, parms, Qfontsize, |
| 1130 | make_number (0 /*(int)[font pointSize]*/), | 1132 | make_number (0 /* (int)[font pointSize] */), |
| 1131 | "fontSize", "FontSize", RES_TYPE_NUMBER); | 1133 | "fontSize", "FontSize", RES_TYPE_NUMBER); |
| 1132 | // Remove ' Regular', not handled by backends. | 1134 | // Remove ' Regular', not handled by backends. |
| 1133 | char *fontname = xstrdup ([[font displayName] UTF8String]); | 1135 | char *fontname = xstrdup ([[font displayName] UTF8String]); |
| @@ -1170,7 +1172,6 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 1170 | "foreground", "Foreground", RES_TYPE_STRING); | 1172 | "foreground", "Foreground", RES_TYPE_STRING); |
| 1171 | x_default_parameter (f, parms, Qbackground_color, build_string ("White"), | 1173 | x_default_parameter (f, parms, Qbackground_color, build_string ("White"), |
| 1172 | "background", "Background", RES_TYPE_STRING); | 1174 | "background", "Background", RES_TYPE_STRING); |
| 1173 | /* FIXME: not supported yet in Nextstep */ | ||
| 1174 | x_default_parameter (f, parms, Qline_spacing, Qnil, | 1175 | x_default_parameter (f, parms, Qline_spacing, Qnil, |
| 1175 | "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); | 1176 | "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); |
| 1176 | x_default_parameter (f, parms, Qleft_fringe, Qnil, | 1177 | x_default_parameter (f, parms, Qleft_fringe, Qnil, |
| @@ -1252,7 +1253,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 1252 | f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !EQ (tem, Qnil)); | 1253 | f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !EQ (tem, Qnil)); |
| 1253 | 1254 | ||
| 1254 | /* NOTE: on other terms, this is done in set_mouse_color, however this | 1255 | /* NOTE: on other terms, this is done in set_mouse_color, however this |
| 1255 | was not getting called under Nextstep */ | 1256 | was not getting called under Nextstep. */ |
| 1256 | f->output_data.ns->text_cursor = [NSCursor IBeamCursor]; | 1257 | f->output_data.ns->text_cursor = [NSCursor IBeamCursor]; |
| 1257 | f->output_data.ns->nontext_cursor = [NSCursor arrowCursor]; | 1258 | f->output_data.ns->nontext_cursor = [NSCursor arrowCursor]; |
| 1258 | f->output_data.ns->modeline_cursor = [NSCursor pointingHandCursor]; | 1259 | f->output_data.ns->modeline_cursor = [NSCursor pointingHandCursor]; |
| @@ -1284,8 +1285,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 1284 | /* ns_display_info does not have a reference_count. */ | 1285 | /* ns_display_info does not have a reference_count. */ |
| 1285 | f->terminal->reference_count++; | 1286 | f->terminal->reference_count++; |
| 1286 | 1287 | ||
| 1287 | /* It is now ok to make the frame official even if we get an error below. | 1288 | /* It is now ok to make the frame official even if we get an error |
| 1288 | The frame needs to be on Vframe_list or making it visible won't work. */ | 1289 | below. The frame needs to be on Vframe_list or making it visible |
| 1290 | won't work. */ | ||
| 1289 | Vframe_list = Fcons (frame, Vframe_list); | 1291 | Vframe_list = Fcons (frame, Vframe_list); |
| 1290 | 1292 | ||
| 1291 | x_default_parameter (f, parms, Qicon_type, Qnil, | 1293 | x_default_parameter (f, parms, Qicon_type, Qnil, |
| @@ -1379,7 +1381,7 @@ x_focus_frame (struct frame *f, bool noactivate) | |||
| 1379 | 1381 | ||
| 1380 | static BOOL | 1382 | static BOOL |
| 1381 | ns_window_is_ancestor (NSWindow *win, NSWindow *candidate) | 1383 | ns_window_is_ancestor (NSWindow *win, NSWindow *candidate) |
| 1382 | /* Test whether CANDIDATE is an ancestor window of WIN. */ | 1384 | /* Test whether CANDIDATE is an ancestor window of WIN. */ |
| 1383 | { | 1385 | { |
| 1384 | if (candidate == NULL) | 1386 | if (candidate == NULL) |
| 1385 | return NO; | 1387 | return NO; |
| @@ -1408,7 +1410,8 @@ Frames are listed from topmost (first) to bottommost (last). */) | |||
| 1408 | { | 1410 | { |
| 1409 | Lisp_Object frame; | 1411 | Lisp_Object frame; |
| 1410 | 1412 | ||
| 1411 | /* Check against [win parentWindow] so that it doesn't match itself. */ | 1413 | /* Check against [win parentWindow] so that it doesn't match |
| 1414 | itself. */ | ||
| 1412 | if (parent == nil || ns_window_is_ancestor (parent, [win parentWindow])) | 1415 | if (parent == nil || ns_window_is_ancestor (parent, [win parentWindow])) |
| 1413 | { | 1416 | { |
| 1414 | XSETFRAME (frame, ((EmacsView *)[win delegate])->emacsframe); | 1417 | XSETFRAME (frame, ((EmacsView *)[win delegate])->emacsframe); |
| @@ -1453,7 +1456,7 @@ Some window managers may refuse to restack windows. */) | |||
| 1453 | 1456 | ||
| 1454 | DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel, | 1457 | DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel, |
| 1455 | 0, 1, "", | 1458 | 0, 1, "", |
| 1456 | doc: /* Pop up the font panel. */) | 1459 | doc: /* Pop up the font panel. */) |
| 1457 | (Lisp_Object frame) | 1460 | (Lisp_Object frame) |
| 1458 | { | 1461 | { |
| 1459 | struct frame *f = decode_window_system_frame (frame); | 1462 | struct frame *f = decode_window_system_frame (frame); |
| @@ -1698,8 +1701,8 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |||
| 1698 | (Lisp_Object terminal) | 1701 | (Lisp_Object terminal) |
| 1699 | { | 1702 | { |
| 1700 | check_ns_display_info (terminal); | 1703 | check_ns_display_info (terminal); |
| 1701 | /* This function has no real equivalent under NeXTstep. Return nil to | 1704 | /* This function has no real equivalent under Nextstep. Return nil to |
| 1702 | indicate this. */ | 1705 | indicate this. */ |
| 1703 | return Qnil; | 1706 | return Qnil; |
| 1704 | } | 1707 | } |
| 1705 | 1708 | ||
| @@ -1722,12 +1725,12 @@ DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, | |||
| 1722 | (Lisp_Object terminal) | 1725 | (Lisp_Object terminal) |
| 1723 | { | 1726 | { |
| 1724 | check_ns_display_info (terminal); | 1727 | check_ns_display_info (terminal); |
| 1725 | /*NOTE: it is unclear what would best correspond with "protocol"; | 1728 | /* NOTE: it is unclear what would best correspond with "protocol"; |
| 1726 | we return 10.3, meaning Panther, since this is roughly the | 1729 | we return 10.3, meaning Panther, since this is roughly the |
| 1727 | level that GNUstep's APIs correspond to. | 1730 | level that GNUstep's APIs correspond to. The last number |
| 1728 | The last number is where we distinguish between the Apple | 1731 | is where we distinguish between the Apple and GNUstep |
| 1729 | and GNUstep implementations ("distributor-specific release | 1732 | implementations ("distributor-specific release number") and |
| 1730 | number") and give int'ized versions of major.minor. */ | 1733 | give int'ized versions of major.minor. */ |
| 1731 | return list3i (10, 3, ns_appkit_version_int ()); | 1734 | return list3i (10, 3, ns_appkit_version_int ()); |
| 1732 | } | 1735 | } |
| 1733 | 1736 | ||
| @@ -1806,7 +1809,8 @@ DEFUN ("x-display-visual-class", Fx_display_visual_class, | |||
| 1806 | else if ( depth == NSBestDepth (NSCalibratedRGBColorSpace, 8, 24, NO, NULL)) | 1809 | else if ( depth == NSBestDepth (NSCalibratedRGBColorSpace, 8, 24, NO, NULL)) |
| 1807 | return intern ("direct-color"); | 1810 | return intern ("direct-color"); |
| 1808 | else | 1811 | else |
| 1809 | /* color mgmt as far as we do it is really handled by Nextstep itself anyway */ | 1812 | /* Color management as far as we do it is really handled by |
| 1813 | Nextstep itself anyway. */ | ||
| 1810 | return intern ("direct-color"); | 1814 | return intern ("direct-color"); |
| 1811 | } | 1815 | } |
| 1812 | 1816 | ||
| @@ -1932,7 +1936,7 @@ DEFUN ("ns-font-name", Fns_font_name, Sns_font_name, 1, 1, 0, | |||
| 1932 | doc: /* Determine font PostScript or family name for font NAME. | 1936 | doc: /* Determine font PostScript or family name for font NAME. |
| 1933 | NAME should be a string containing either the font name or an XLFD | 1937 | NAME should be a string containing either the font name or an XLFD |
| 1934 | font descriptor. If string contains `fontset' and not | 1938 | font descriptor. If string contains `fontset' and not |
| 1935 | `fontset-startup', it is left alone. */) | 1939 | `fontset-startup', it is left alone. */) |
| 1936 | (Lisp_Object name) | 1940 | (Lisp_Object name) |
| 1937 | { | 1941 | { |
| 1938 | char *nm; | 1942 | char *nm; |
| @@ -2049,7 +2053,7 @@ there was no result. */) | |||
| 2049 | status as function value. A zero is returned if compilation and | 2053 | status as function value. A zero is returned if compilation and |
| 2050 | execution is successful, in which case *RESULT is set to a Lisp | 2054 | execution is successful, in which case *RESULT is set to a Lisp |
| 2051 | string or a number containing the resulting script value. Otherwise, | 2055 | string or a number containing the resulting script value. Otherwise, |
| 2052 | 1 is returned. */ | 2056 | 1 is returned. */ |
| 2053 | static int | 2057 | static int |
| 2054 | ns_do_applescript (Lisp_Object script, Lisp_Object *result) | 2058 | ns_do_applescript (Lisp_Object script, Lisp_Object *result) |
| 2055 | { | 2059 | { |
| @@ -2102,7 +2106,7 @@ ns_do_applescript (Lisp_Object script, Lisp_Object *result) | |||
| 2102 | return 0; | 2106 | return 0; |
| 2103 | } | 2107 | } |
| 2104 | 2108 | ||
| 2105 | /* Helper function called from sendEvent to run applescript | 2109 | /* Helper function called from sendEvent to run AppleScript |
| 2106 | from within the main event loop. */ | 2110 | from within the main event loop. */ |
| 2107 | 2111 | ||
| 2108 | void | 2112 | void |
| @@ -2117,7 +2121,7 @@ DEFUN ("ns-do-applescript", Fns_do_applescript, Sns_do_applescript, 1, 1, 0, | |||
| 2117 | doc: /* Execute AppleScript SCRIPT and return the result. | 2121 | doc: /* Execute AppleScript SCRIPT and return the result. |
| 2118 | If compilation and execution are successful, the resulting script value | 2122 | If compilation and execution are successful, the resulting script value |
| 2119 | is returned as a string, a number or, in the case of other constructs, t. | 2123 | is returned as a string, a number or, in the case of other constructs, t. |
| 2120 | In case the execution fails, an error is signaled. */) | 2124 | In case the execution fails, an error is signaled. */) |
| 2121 | (Lisp_Object script) | 2125 | (Lisp_Object script) |
| 2122 | { | 2126 | { |
| 2123 | Lisp_Object result; | 2127 | Lisp_Object result; |
| @@ -2133,10 +2137,10 @@ In case the execution fails, an error is signaled. */) | |||
| 2133 | as_script = script; | 2137 | as_script = script; |
| 2134 | as_result = &result; | 2138 | as_result = &result; |
| 2135 | 2139 | ||
| 2136 | /* executing apple script requires the event loop to run, otherwise | 2140 | /* Executing AppleScript requires the event loop to run, otherwise |
| 2137 | errors aren't returned and executeAndReturnError hangs forever. | 2141 | errors aren't returned and executeAndReturnError hangs forever. |
| 2138 | Post an event that runs applescript and then start the event loop. | 2142 | Post an event that runs AppleScript and then start the event |
| 2139 | The event loop is exited when the script is done. */ | 2143 | loop. The event loop is exited when the script is done. */ |
| 2140 | nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined | 2144 | nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined |
| 2141 | location: NSMakePoint (0, 0) | 2145 | location: NSMakePoint (0, 0) |
| 2142 | modifierFlags: 0 | 2146 | modifierFlags: 0 |
| @@ -2149,8 +2153,8 @@ In case the execution fails, an error is signaled. */) | |||
| 2149 | 2153 | ||
| 2150 | [NSApp postEvent: nxev atStart: NO]; | 2154 | [NSApp postEvent: nxev atStart: NO]; |
| 2151 | 2155 | ||
| 2152 | // If there are other events, the event loop may exit. Keep running | 2156 | /* If there are other events, the event loop may exit. Keep running |
| 2153 | // until the script has been handled. */ | 2157 | until the script has been handled. */ |
| 2154 | ns_init_events (&ev); | 2158 | ns_init_events (&ev); |
| 2155 | while (! NILP (as_script)) | 2159 | while (! NILP (as_script)) |
| 2156 | [NSApp run]; | 2160 | [NSApp run]; |
| @@ -2203,7 +2207,7 @@ x_set_scroll_bar_default_height (struct frame *f) | |||
| 2203 | height - 1) / height; | 2207 | height - 1) / height; |
| 2204 | } | 2208 | } |
| 2205 | 2209 | ||
| 2206 | /* terms impl this instead of x-get-resource directly */ | 2210 | /* Terms implement this instead of x-get-resource directly. */ |
| 2207 | char * | 2211 | char * |
| 2208 | x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) | 2212 | x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) |
| 2209 | { | 2213 | { |
| @@ -2381,7 +2385,7 @@ ns_screen_name (CGDirectDisplayID did) | |||
| 2381 | /* CGDisplayIOServicePort is deprecated. Do it another (harder) way. | 2385 | /* CGDisplayIOServicePort is deprecated. Do it another (harder) way. |
| 2382 | 2386 | ||
| 2383 | Is this code OK for macOS < 10.9, and GNUstep? I suspect it is, | 2387 | Is this code OK for macOS < 10.9, and GNUstep? I suspect it is, |
| 2384 | in which case is it worth keeping the other method in here? */ | 2388 | in which case is it worth keeping the other method in here? */ |
| 2385 | 2389 | ||
| 2386 | if (IOMasterPort (MACH_PORT_NULL, &masterPort) != kIOReturnSuccess | 2390 | if (IOMasterPort (MACH_PORT_NULL, &masterPort) != kIOReturnSuccess |
| 2387 | || IOServiceGetMatchingServices (masterPort, | 2391 | || IOServiceGetMatchingServices (masterPort, |
| @@ -2620,7 +2624,7 @@ compute_tip_xy (struct frame *f, | |||
| 2620 | - height); | 2624 | - height); |
| 2621 | } | 2625 | } |
| 2622 | 2626 | ||
| 2623 | /* Find the screen that pt is on. */ | 2627 | /* Find the screen that pt is on. */ |
| 2624 | for (screen in [NSScreen screens]) | 2628 | for (screen in [NSScreen screens]) |
| 2625 | if (pt.x >= screen.frame.origin.x | 2629 | if (pt.x >= screen.frame.origin.x |
| 2626 | && pt.x < screen.frame.origin.x + screen.frame.size.width | 2630 | && pt.x < screen.frame.origin.x + screen.frame.size.width |
| @@ -2633,13 +2637,13 @@ compute_tip_xy (struct frame *f, | |||
| 2633 | if (CGRectContainsPoint ([screen frame], pt)) | 2637 | if (CGRectContainsPoint ([screen frame], pt)) |
| 2634 | 2638 | ||
| 2635 | which would be neater, but it causes problems building on old | 2639 | which would be neater, but it causes problems building on old |
| 2636 | versions of macOS and in GNUstep. */ | 2640 | versions of macOS and in GNUstep. */ |
| 2637 | 2641 | ||
| 2638 | /* Ensure in bounds. (Note, screen origin = lower left.) */ | 2642 | /* Ensure in bounds. (Note, screen origin = lower left.) */ |
| 2639 | if (INTEGERP (left) || INTEGERP (right)) | 2643 | if (INTEGERP (left) || INTEGERP (right)) |
| 2640 | *root_x = pt.x; | 2644 | *root_x = pt.x; |
| 2641 | else if (pt.x + XINT (dx) <= screen.frame.origin.x) | 2645 | else if (pt.x + XINT (dx) <= screen.frame.origin.x) |
| 2642 | *root_x = screen.frame.origin.x; /* Can happen for negative dx */ | 2646 | *root_x = screen.frame.origin.x; |
| 2643 | else if (pt.x + XINT (dx) + width | 2647 | else if (pt.x + XINT (dx) + width |
| 2644 | <= screen.frame.origin.x + screen.frame.size.width) | 2648 | <= screen.frame.origin.x + screen.frame.size.width) |
| 2645 | /* It fits to the right of the pointer. */ | 2649 | /* It fits to the right of the pointer. */ |
| @@ -2658,7 +2662,7 @@ compute_tip_xy (struct frame *f, | |||
| 2658 | *root_y = pt.y - height - XINT (dy); | 2662 | *root_y = pt.y - height - XINT (dy); |
| 2659 | else if (pt.y + XINT (dy) + height | 2663 | else if (pt.y + XINT (dy) + height |
| 2660 | <= screen.frame.origin.y + screen.frame.size.height) | 2664 | <= screen.frame.origin.y + screen.frame.size.height) |
| 2661 | /* It fits above the pointer */ | 2665 | /* It fits above the pointer. */ |
| 2662 | *root_y = pt.y + XINT (dy); | 2666 | *root_y = pt.y + XINT (dy); |
| 2663 | else | 2667 | else |
| 2664 | /* Put it on the top. */ | 2668 | /* Put it on the top. */ |
| @@ -2885,7 +2889,7 @@ The coordinates X and Y are interpreted in pixels relative to a position | |||
| 2885 | { | 2889 | { |
| 2886 | #ifdef NS_IMPL_COCOA | 2890 | #ifdef NS_IMPL_COCOA |
| 2887 | /* GNUstep doesn't support CGWarpMouseCursorPosition, so none of | 2891 | /* GNUstep doesn't support CGWarpMouseCursorPosition, so none of |
| 2888 | this will work. */ | 2892 | this will work. */ |
| 2889 | struct frame *f = SELECTED_FRAME (); | 2893 | struct frame *f = SELECTED_FRAME (); |
| 2890 | EmacsView *view = FRAME_NS_VIEW (f); | 2894 | EmacsView *view = FRAME_NS_VIEW (f); |
| 2891 | NSScreen *screen = [[view window] screen]; | 2895 | NSScreen *screen = [[view window] screen]; |
| @@ -2923,7 +2927,7 @@ DEFUN ("ns-mouse-absolute-pixel-position", | |||
| 2923 | doc: /* Return absolute position of mouse cursor in pixels. | 2927 | doc: /* Return absolute position of mouse cursor in pixels. |
| 2924 | The position is returned as a cons cell (X . Y) of the | 2928 | The position is returned as a cons cell (X . Y) of the |
| 2925 | coordinates of the mouse cursor position in pixels relative to a | 2929 | coordinates of the mouse cursor position in pixels relative to a |
| 2926 | position (0, 0) of the selected frame's terminal. */) | 2930 | position (0, 0) of the selected frame's terminal. */) |
| 2927 | (void) | 2931 | (void) |
| 2928 | { | 2932 | { |
| 2929 | struct frame *f = SELECTED_FRAME (); | 2933 | struct frame *f = SELECTED_FRAME (); |
| @@ -2983,8 +2987,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2983 | case NSPageDownFunctionKey: | 2987 | case NSPageDownFunctionKey: |
| 2984 | case NSEndFunctionKey: | 2988 | case NSEndFunctionKey: |
| 2985 | /* Don't send command modified keys, as those are handled in the | 2989 | /* Don't send command modified keys, as those are handled in the |
| 2986 | performKeyEquivalent method of the super class. | 2990 | performKeyEquivalent method of the super class. */ |
| 2987 | */ | ||
| 2988 | if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand)) | 2991 | if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand)) |
| 2989 | { | 2992 | { |
| 2990 | [panel sendEvent: theEvent]; | 2993 | [panel sendEvent: theEvent]; |
| @@ -2996,8 +2999,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2996 | them here. TODO: handle Emacs key bindings for copy/cut/select-all | 2999 | them here. TODO: handle Emacs key bindings for copy/cut/select-all |
| 2997 | here, paste works, because we have that in our Edit menu. | 3000 | here, paste works, because we have that in our Edit menu. |
| 2998 | I.e. refactor out code in nsterm.m, keyDown: to figure out the | 3001 | I.e. refactor out code in nsterm.m, keyDown: to figure out the |
| 2999 | correct modifier. | 3002 | correct modifier. */ |
| 3000 | */ | ||
| 3001 | case 'x': // Cut | 3003 | case 'x': // Cut |
| 3002 | case 'c': // Copy | 3004 | case 'c': // Copy |
| 3003 | case 'v': // Paste | 3005 | case 'v': // Paste |
diff --git a/src/nsfont.m b/src/nsfont.m index 8b42102a998..232e4962b73 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -21,7 +21,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | /* This should be the first include, as it may set up #defines affecting | 23 | /* This should be the first include, as it may set up #defines affecting |
| 24 | interpretation of even the system includes. */ | 24 | interpretation of even the system includes. */ |
| 25 | #include <config.h> | 25 | #include <config.h> |
| 26 | 26 | ||
| 27 | #include "lisp.h" | 27 | #include "lisp.h" |
| @@ -37,7 +37,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 37 | #include "font.h" | 37 | #include "font.h" |
| 38 | #include "termchar.h" | 38 | #include "termchar.h" |
| 39 | 39 | ||
| 40 | /* TODO: Drop once we can assume gnustep-gui 0.17.1. */ | 40 | /* TODO: Drop once we can assume gnustep-gui 0.17.1. */ |
| 41 | #ifdef NS_IMPL_GNUSTEP | 41 | #ifdef NS_IMPL_GNUSTEP |
| 42 | #import <AppKit/NSFontDescriptor.h> | 42 | #import <AppKit/NSFontDescriptor.h> |
| 43 | #endif | 43 | #endif |
| @@ -45,7 +45,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 45 | #define NSFONT_TRACE 0 | 45 | #define NSFONT_TRACE 0 |
| 46 | #define LCD_SMOOTHING_MARGIN 2 | 46 | #define LCD_SMOOTHING_MARGIN 2 |
| 47 | 47 | ||
| 48 | /* font glyph and metrics caching functions, implemented at end */ | 48 | /* Font glyph and metrics caching functions, implemented at end. */ |
| 49 | static void ns_uni_to_glyphs (struct nsfont_info *font_info, | 49 | static void ns_uni_to_glyphs (struct nsfont_info *font_info, |
| 50 | unsigned char block); | 50 | unsigned char block); |
| 51 | static void ns_glyph_metrics (struct nsfont_info *font_info, | 51 | static void ns_glyph_metrics (struct nsfont_info *font_info, |
| @@ -61,7 +61,7 @@ static void ns_glyph_metrics (struct nsfont_info *font_info, | |||
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | /* Replace spaces w/another character so emacs core font parsing routines | 63 | /* Replace spaces w/another character so emacs core font parsing routines |
| 64 | aren't thrown off. */ | 64 | aren't thrown off. */ |
| 65 | static void | 65 | static void |
| 66 | ns_escape_name (char *name) | 66 | ns_escape_name (char *name) |
| 67 | { | 67 | { |
| @@ -71,7 +71,7 @@ ns_escape_name (char *name) | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | /* Reconstruct spaces in a font family name passed through emacs. */ | 74 | /* Reconstruct spaces in a font family name passed through emacs. */ |
| 75 | static void | 75 | static void |
| 76 | ns_unescape_name (char *name) | 76 | ns_unescape_name (char *name) |
| 77 | { | 77 | { |
| @@ -81,7 +81,7 @@ ns_unescape_name (char *name) | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | /* Extract family name from a font spec. */ | 84 | /* Extract family name from a font spec. */ |
| 85 | static NSString * | 85 | static NSString * |
| 86 | ns_get_family (Lisp_Object font_spec) | 86 | ns_get_family (Lisp_Object font_spec) |
| 87 | { | 87 | { |
| @@ -103,7 +103,7 @@ ns_get_family (Lisp_Object font_spec) | |||
| 103 | /* Return 0 if attr not set, else value (which might also be 0). | 103 | /* Return 0 if attr not set, else value (which might also be 0). |
| 104 | On Leopard 0 gets returned even on descriptors where the attribute | 104 | On Leopard 0 gets returned even on descriptors where the attribute |
| 105 | was never set, so there's no way to distinguish between unspecified | 105 | was never set, so there's no way to distinguish between unspecified |
| 106 | and set to not have. Callers should assume 0 means unspecified. */ | 106 | and set to not have. Callers should assume 0 means unspecified. */ |
| 107 | static float | 107 | static float |
| 108 | ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) | 108 | ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) |
| 109 | { | 109 | { |
| @@ -114,7 +114,7 @@ ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) | |||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | /* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang | 116 | /* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang |
| 117 | to NSFont descriptor. Information under extra only needed for matching. */ | 117 | to NSFont descriptor. Information under extra only needed for matching. */ |
| 118 | #define STYLE_REF 100 | 118 | #define STYLE_REF 100 |
| 119 | static NSFontDescriptor * | 119 | static NSFontDescriptor * |
| 120 | ns_spec_to_descriptor (Lisp_Object font_spec) | 120 | ns_spec_to_descriptor (Lisp_Object font_spec) |
| @@ -125,7 +125,7 @@ ns_spec_to_descriptor (Lisp_Object font_spec) | |||
| 125 | NSString *family = ns_get_family (font_spec); | 125 | NSString *family = ns_get_family (font_spec); |
| 126 | float n; | 126 | float n; |
| 127 | 127 | ||
| 128 | /* add each attr in font_spec to fdAttrs.. */ | 128 | /* Add each attr in font_spec to fdAttrs. */ |
| 129 | n = min (FONT_WEIGHT_NUMERIC (font_spec), 200); | 129 | n = min (FONT_WEIGHT_NUMERIC (font_spec), 200); |
| 130 | if (n != -1 && n != STYLE_REF) | 130 | if (n != -1 && n != STYLE_REF) |
| 131 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] | 131 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] |
| @@ -156,7 +156,7 @@ ns_spec_to_descriptor (Lisp_Object font_spec) | |||
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | 158 | ||
| 159 | /* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc.. */ | 159 | /* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc. */ |
| 160 | static Lisp_Object | 160 | static Lisp_Object |
| 161 | ns_descriptor_to_entity (NSFontDescriptor *desc, | 161 | ns_descriptor_to_entity (NSFontDescriptor *desc, |
| 162 | Lisp_Object extra, | 162 | Lisp_Object extra, |
| @@ -168,7 +168,7 @@ ns_descriptor_to_entity (NSFontDescriptor *desc, | |||
| 168 | unsigned int traits = [desc symbolicTraits]; | 168 | unsigned int traits = [desc symbolicTraits]; |
| 169 | char *escapedFamily; | 169 | char *escapedFamily; |
| 170 | 170 | ||
| 171 | /* Shouldn't happen, but on Tiger fallback desc gets name but no family. */ | 171 | /* Shouldn't happen, but on Tiger fallback desc gets name but no family. */ |
| 172 | if (family == nil) | 172 | if (family == nil) |
| 173 | family = [desc objectForKey: NSFontNameAttribute]; | 173 | family = [desc objectForKey: NSFontNameAttribute]; |
| 174 | if (family == nil) | 174 | if (family == nil) |
| @@ -220,7 +220,7 @@ ns_descriptor_to_entity (NSFontDescriptor *desc, | |||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | 222 | ||
| 223 | /* Default font entity. */ | 223 | /* Default font entity. */ |
| 224 | static Lisp_Object | 224 | static Lisp_Object |
| 225 | ns_fallback_entity (void) | 225 | ns_fallback_entity (void) |
| 226 | { | 226 | { |
| @@ -229,7 +229,7 @@ ns_fallback_entity (void) | |||
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | 231 | ||
| 232 | /* Utility: get width of a char c in screen font SFONT */ | 232 | /* Utility: get width of a char c in screen font SFONT. */ |
| 233 | static CGFloat | 233 | static CGFloat |
| 234 | ns_char_width (NSFont *sfont, int c) | 234 | ns_char_width (NSFont *sfont, int c) |
| 235 | { | 235 | { |
| @@ -292,7 +292,7 @@ ns_ascii_average_width (NSFont *sfont) | |||
| 292 | /* Return whether set1 covers set2 to a reasonable extent given by pct. | 292 | /* Return whether set1 covers set2 to a reasonable extent given by pct. |
| 293 | We check, out of each 16 Unicode char range containing chars in set2, | 293 | We check, out of each 16 Unicode char range containing chars in set2, |
| 294 | whether at least one character is present in set1. | 294 | whether at least one character is present in set1. |
| 295 | This must be true for pct of the pairs to consider it covering. */ | 295 | This must be true for pct of the pairs to consider it covering. */ |
| 296 | static BOOL | 296 | static BOOL |
| 297 | ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct) | 297 | ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct) |
| 298 | { | 298 | { |
| @@ -312,20 +312,20 @@ ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct) | |||
| 312 | if (*bytes1 == 0) // *bytes1 & *bytes2 != *bytes2 | 312 | if (*bytes1 == 0) // *bytes1 & *bytes2 != *bytes2 |
| 313 | off++; | 313 | off++; |
| 314 | } | 314 | } |
| 315 | //fprintf(stderr, "off = %d\ttot = %d\n", off,tot); | 315 | // fprintf(stderr, "off = %d\ttot = %d\n", off,tot); |
| 316 | return (float)off / tot < 1.0F - pct; | 316 | return (float)off / tot < 1.0F - pct; |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | 319 | ||
| 320 | /* Convert :lang property to a script. Use of :lang property by font backend | 320 | /* Convert :lang property to a script. Use of :lang property by font backend |
| 321 | seems to be limited for now (2009/05) to ja, zh, and ko. */ | 321 | seems to be limited for now (2009/05) to ja, zh, and ko. */ |
| 322 | static NSString | 322 | static NSString |
| 323 | *ns_lang_to_script (Lisp_Object lang) | 323 | *ns_lang_to_script (Lisp_Object lang) |
| 324 | { | 324 | { |
| 325 | if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ja")) | 325 | if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ja")) |
| 326 | return @"han"; | 326 | return @"han"; |
| 327 | /* NOTE: ja given for any hanzi that's also a kanji, but Chinese fonts | 327 | /* NOTE: ja given for any hanzi that's also a kanji, but Chinese fonts |
| 328 | have more characters. */ | 328 | have more characters. */ |
| 329 | else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "zh")) | 329 | else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "zh")) |
| 330 | return @"han"; | 330 | return @"han"; |
| 331 | else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ko")) | 331 | else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ko")) |
| @@ -336,7 +336,7 @@ static NSString | |||
| 336 | 336 | ||
| 337 | 337 | ||
| 338 | /* Convert OTF 4-letter script code to emacs script name. (Why can't | 338 | /* Convert OTF 4-letter script code to emacs script name. (Why can't |
| 339 | everyone just use some standard Unicode names for these?) */ | 339 | everyone just use some standard Unicode names for these?) */ |
| 340 | static NSString | 340 | static NSString |
| 341 | *ns_otf_to_script (Lisp_Object otf) | 341 | *ns_otf_to_script (Lisp_Object otf) |
| 342 | { | 342 | { |
| @@ -347,7 +347,7 @@ static NSString | |||
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | 349 | ||
| 350 | /* Convert a font registry, such as */ | 350 | /* Convert a font registry. */ |
| 351 | static NSString | 351 | static NSString |
| 352 | *ns_registry_to_script (char *reg) | 352 | *ns_registry_to_script (char *reg) |
| 353 | { | 353 | { |
| @@ -368,14 +368,14 @@ static NSString | |||
| 368 | 368 | ||
| 369 | /* Searches the :script, :lang, and :otf extra-bundle properties of the spec, | 369 | /* Searches the :script, :lang, and :otf extra-bundle properties of the spec, |
| 370 | plus registry regular property, for something that can be mapped to a | 370 | plus registry regular property, for something that can be mapped to a |
| 371 | Unicode script. Empty string returned if no script spec found. */ | 371 | Unicode script. Empty string returned if no script spec found. */ |
| 372 | static NSString | 372 | static NSString |
| 373 | *ns_get_req_script (Lisp_Object font_spec) | 373 | *ns_get_req_script (Lisp_Object font_spec) |
| 374 | { | 374 | { |
| 375 | Lisp_Object reg = AREF (font_spec, FONT_REGISTRY_INDEX); | 375 | Lisp_Object reg = AREF (font_spec, FONT_REGISTRY_INDEX); |
| 376 | Lisp_Object extra = AREF (font_spec, FONT_EXTRA_INDEX); | 376 | Lisp_Object extra = AREF (font_spec, FONT_EXTRA_INDEX); |
| 377 | 377 | ||
| 378 | /* The extra-bundle properties have priority. */ | 378 | /* The extra-bundle properties have priority. */ |
| 379 | for ( ; CONSP (extra); extra = XCDR (extra)) | 379 | for ( ; CONSP (extra); extra = XCDR (extra)) |
| 380 | { | 380 | { |
| 381 | Lisp_Object tmp = XCAR (extra); | 381 | Lisp_Object tmp = XCAR (extra); |
| @@ -392,12 +392,12 @@ static NSString | |||
| 392 | } | 392 | } |
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | /* If we get here, check the charset portion of the registry. */ | 395 | /* If we get here, check the charset portion of the registry. */ |
| 396 | if (! NILP (reg)) | 396 | if (! NILP (reg)) |
| 397 | { | 397 | { |
| 398 | /* XXX: iso10646 is passed in for non-ascii latin-1 characters | 398 | /* XXX: iso10646 is passed in for non-ascii latin-1 characters |
| 399 | (which causes box rendering if we don't treat it like iso8858-1) | 399 | (which causes box rendering if we don't treat it like iso8858-1) |
| 400 | but also for ascii (which causes unnecessary font substitution). */ | 400 | but also for ascii (which causes unnecessary font substitution). */ |
| 401 | #if 0 | 401 | #if 0 |
| 402 | if (EQ (reg, Qiso10646_1)) | 402 | if (EQ (reg, Qiso10646_1)) |
| 403 | reg = Qiso8859_1; | 403 | reg = Qiso8859_1; |
| @@ -410,7 +410,7 @@ static NSString | |||
| 410 | 410 | ||
| 411 | 411 | ||
| 412 | /* This small function is static in fontset.c. If it can be made public for | 412 | /* This small function is static in fontset.c. If it can be made public for |
| 413 | all ports, remove this, but otherwise it doesn't seem worth the ifdefs. */ | 413 | all ports, remove this, but otherwise it doesn't seem worth the ifdefs. */ |
| 414 | static void | 414 | static void |
| 415 | accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val) | 415 | accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val) |
| 416 | { | 416 | { |
| @@ -425,7 +425,7 @@ accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val) | |||
| 425 | 425 | ||
| 426 | 426 | ||
| 427 | /* Use the Unicode range information in Vchar_script_table to convert a script | 427 | /* Use the Unicode range information in Vchar_script_table to convert a script |
| 428 | name into an NSCharacterSet. */ | 428 | name into an NSCharacterSet. */ |
| 429 | static NSCharacterSet | 429 | static NSCharacterSet |
| 430 | *ns_script_to_charset (NSString *scriptName) | 430 | *ns_script_to_charset (NSString *scriptName) |
| 431 | { | 431 | { |
| @@ -465,7 +465,7 @@ static NSCharacterSet | |||
| 465 | If none are found, we reduce the percentage and try again, until 5%. | 465 | If none are found, we reduce the percentage and try again, until 5%. |
| 466 | This provides a font with at least some characters if such can be found. | 466 | This provides a font with at least some characters if such can be found. |
| 467 | We don't use isSupersetOfSet: because (a) it doesn't work on Tiger, and | 467 | We don't use isSupersetOfSet: because (a) it doesn't work on Tiger, and |
| 468 | (b) need approximate match as fonts covering full Unicode ranges are rare. */ | 468 | (b) need approximate match as fonts covering full Unicode ranges are rare. */ |
| 469 | static NSSet | 469 | static NSSet |
| 470 | *ns_get_covering_families (NSString *script, float pct) | 470 | *ns_get_covering_families (NSString *script, float pct) |
| 471 | { | 471 | { |
| @@ -497,7 +497,7 @@ static NSSet | |||
| 497 | { | 497 | { |
| 498 | NSCharacterSet *fset = [[fontMgr fontWithFamily: family | 498 | NSCharacterSet *fset = [[fontMgr fontWithFamily: family |
| 499 | traits: 0 weight: 5 size: 12.0] coveredCharacterSet]; | 499 | traits: 0 weight: 5 size: 12.0] coveredCharacterSet]; |
| 500 | /* Some fonts on macOS, maybe many on GNUstep, return nil. */ | 500 | /* Some fonts on macOS, maybe many on GNUstep, return nil. */ |
| 501 | if (fset == nil) | 501 | if (fset == nil) |
| 502 | fset = [NSCharacterSet characterSetWithRange: | 502 | fset = [NSCharacterSet characterSetWithRange: |
| 503 | NSMakeRange (0, 127)]; | 503 | NSMakeRange (0, 127)]; |
| @@ -525,7 +525,7 @@ static NSSet | |||
| 525 | 525 | ||
| 526 | /* Implementation for list() and match(). List() can return nil, match() | 526 | /* Implementation for list() and match(). List() can return nil, match() |
| 527 | must return something. Strategy is to drop family name from attribute | 527 | must return something. Strategy is to drop family name from attribute |
| 528 | matching set for match. */ | 528 | matching set for match. */ |
| 529 | static Lisp_Object | 529 | static Lisp_Object |
| 530 | ns_findfonts (Lisp_Object font_spec, BOOL isMatch) | 530 | ns_findfonts (Lisp_Object font_spec, BOOL isMatch) |
| 531 | { | 531 | { |
| @@ -574,7 +574,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch) | |||
| 574 | foundItal = YES; | 574 | foundItal = YES; |
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | /* Add synthItal member if needed. */ | 577 | /* Add synthItal member if needed. */ |
| 578 | family = [fdesc objectForKey: NSFontFamilyAttribute]; | 578 | family = [fdesc objectForKey: NSFontFamilyAttribute]; |
| 579 | if (family != nil && !foundItal && XINT (Flength (list)) > 0) | 579 | if (family != nil && !foundItal && XINT (Flength (list)) > 0) |
| 580 | { | 580 | { |
| @@ -590,7 +590,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch) | |||
| 590 | 590 | ||
| 591 | unblock_input (); | 591 | unblock_input (); |
| 592 | 592 | ||
| 593 | /* Return something if was a match and nothing found. */ | 593 | /* Return something if was a match and nothing found. */ |
| 594 | if (isMatch) | 594 | if (isMatch) |
| 595 | return ns_fallback_entity (); | 595 | return ns_fallback_entity (); |
| 596 | 596 | ||
| @@ -642,7 +642,7 @@ nsfont_list (struct frame *f, Lisp_Object font_spec) | |||
| 642 | /* Return a font entity most closely matching with FONT_SPEC on | 642 | /* Return a font entity most closely matching with FONT_SPEC on |
| 643 | FRAME. The closeness is determined by the font backend, thus | 643 | FRAME. The closeness is determined by the font backend, thus |
| 644 | `face-font-selection-order' is ignored here. | 644 | `face-font-selection-order' is ignored here. |
| 645 | Properties to be considered are same as for list(). */ | 645 | Properties to be considered are same as for list(). */ |
| 646 | static Lisp_Object | 646 | static Lisp_Object |
| 647 | nsfont_match (struct frame *f, Lisp_Object font_spec) | 647 | nsfont_match (struct frame *f, Lisp_Object font_spec) |
| 648 | { | 648 | { |
| @@ -651,7 +651,7 @@ nsfont_match (struct frame *f, Lisp_Object font_spec) | |||
| 651 | 651 | ||
| 652 | 652 | ||
| 653 | /* List available families. The value is a list of family names | 653 | /* List available families. The value is a list of family names |
| 654 | (symbols). */ | 654 | (symbols). */ |
| 655 | static Lisp_Object | 655 | static Lisp_Object |
| 656 | nsfont_list_family (struct frame *f) | 656 | nsfont_list_family (struct frame *f) |
| 657 | { | 657 | { |
| @@ -664,7 +664,7 @@ nsfont_list_family (struct frame *f) | |||
| 664 | objectEnumerator]; | 664 | objectEnumerator]; |
| 665 | while ((family = [families nextObject])) | 665 | while ((family = [families nextObject])) |
| 666 | list = Fcons (intern ([family UTF8String]), list); | 666 | list = Fcons (intern ([family UTF8String]), list); |
| 667 | /* FIXME: escape the name? */ | 667 | /* FIXME: escape the name? */ |
| 668 | 668 | ||
| 669 | if (NSFONT_TRACE) | 669 | if (NSFONT_TRACE) |
| 670 | fprintf (stderr, "nsfont: list families returning %"pI"d entries\n", | 670 | fprintf (stderr, "nsfont: list families returning %"pI"d entries\n", |
| @@ -715,7 +715,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 715 | if (family == nil) | 715 | if (family == nil) |
| 716 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; | 716 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; |
| 717 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that | 717 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that |
| 718 | when setting family in ns_spec_to_descriptor(). */ | 718 | when setting family in ns_spec_to_descriptor(). */ |
| 719 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50F) | 719 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50F) |
| 720 | traits |= NSBoldFontMask; | 720 | traits |= NSBoldFontMask; |
| 721 | if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05F)) | 721 | if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05F)) |
| @@ -757,7 +757,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 757 | if (!font) | 757 | if (!font) |
| 758 | { | 758 | { |
| 759 | unblock_input (); | 759 | unblock_input (); |
| 760 | return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */ | 760 | return Qnil; /* FIXME: other terms do, but returning Qnil causes segfault. */ |
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); | 763 | font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); |
| @@ -793,7 +793,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 793 | * -2.00000405... (represented by 0xc000000220000000). Without | 793 | * -2.00000405... (represented by 0xc000000220000000). Without |
| 794 | * adjustment, the code below would round the descender to -3, | 794 | * adjustment, the code below would round the descender to -3, |
| 795 | * resulting in a font that would be one pixel higher than | 795 | * resulting in a font that would be one pixel higher than |
| 796 | * intended. */ | 796 | * intended. */ |
| 797 | CGFloat adjusted_descender = [sfont descender] + 0.0001; | 797 | CGFloat adjusted_descender = [sfont descender] + 0.0001; |
| 798 | 798 | ||
| 799 | #ifdef NS_IMPL_GNUSTEP | 799 | #ifdef NS_IMPL_GNUSTEP |
| @@ -810,7 +810,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 810 | synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask); | 810 | synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask); |
| 811 | 811 | ||
| 812 | /* Metrics etc.; some fonts return an unusually large max advance, so we | 812 | /* Metrics etc.; some fonts return an unusually large max advance, so we |
| 813 | only use it for fonts that have wide characters. */ | 813 | only use it for fonts that have wide characters. */ |
| 814 | font_info->width = ([sfont numberOfGlyphs] > 2000) ? | 814 | font_info->width = ([sfont numberOfGlyphs] > 2000) ? |
| 815 | [sfont maximumAdvancement].width : ns_char_width (sfont, '0'); | 815 | [sfont maximumAdvancement].width : ns_char_width (sfont, '0'); |
| 816 | 816 | ||
| @@ -823,7 +823,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 823 | /* max bounds */ | 823 | /* max bounds */ |
| 824 | font->ascent = font_info->max_bounds.ascent = lrint ([sfont ascender]); | 824 | font->ascent = font_info->max_bounds.ascent = lrint ([sfont ascender]); |
| 825 | /* Descender is usually negative. Use floor to avoid | 825 | /* Descender is usually negative. Use floor to avoid |
| 826 | clipping descenders. */ | 826 | clipping descenders. */ |
| 827 | font->descent = | 827 | font->descent = |
| 828 | font_info->max_bounds.descent = -lrint (floor(adjusted_descender)); | 828 | font_info->max_bounds.descent = -lrint (floor(adjusted_descender)); |
| 829 | font_info->height = | 829 | font_info->height = |
| @@ -880,7 +880,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 880 | } | 880 | } |
| 881 | 881 | ||
| 882 | 882 | ||
| 883 | /* Close FONT. */ | 883 | /* Close FONT. */ |
| 884 | static void | 884 | static void |
| 885 | nsfont_close (struct font *font) | 885 | nsfont_close (struct font *font) |
| 886 | { | 886 | { |
| @@ -911,7 +911,7 @@ nsfont_close (struct font *font) | |||
| 911 | 911 | ||
| 912 | /* If FONT_ENTITY has a glyph for character C (Unicode code point), | 912 | /* If FONT_ENTITY has a glyph for character C (Unicode code point), |
| 913 | return 1. If not, return 0. If a font must be opened to check | 913 | return 1. If not, return 0. If a font must be opened to check |
| 914 | it, return -1. */ | 914 | it, return -1. */ |
| 915 | static int | 915 | static int |
| 916 | nsfont_has_char (Lisp_Object entity, int c) | 916 | nsfont_has_char (Lisp_Object entity, int c) |
| 917 | { | 917 | { |
| @@ -920,7 +920,7 @@ nsfont_has_char (Lisp_Object entity, int c) | |||
| 920 | 920 | ||
| 921 | 921 | ||
| 922 | /* Return a glyph code of FONT for character C (Unicode code point). | 922 | /* Return a glyph code of FONT for character C (Unicode code point). |
| 923 | If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ | 923 | If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ |
| 924 | static unsigned int | 924 | static unsigned int |
| 925 | nsfont_encode_char (struct font *font, int c) | 925 | nsfont_encode_char (struct font *font, int c) |
| 926 | { | 926 | { |
| @@ -931,7 +931,7 @@ nsfont_encode_char (struct font *font, int c) | |||
| 931 | if (c > 0xFFFF) | 931 | if (c > 0xFFFF) |
| 932 | return FONT_INVALID_CODE; | 932 | return FONT_INVALID_CODE; |
| 933 | 933 | ||
| 934 | /* did we already cache this block? */ | 934 | /* Did we already cache this block? */ |
| 935 | if (!font_info->glyphs[high]) | 935 | if (!font_info->glyphs[high]) |
| 936 | ns_uni_to_glyphs (font_info, high); | 936 | ns_uni_to_glyphs (font_info, high); |
| 937 | 937 | ||
| @@ -942,7 +942,7 @@ nsfont_encode_char (struct font *font, int c) | |||
| 942 | 942 | ||
| 943 | /* Perform the size computation of glyphs of FONT and fill in members | 943 | /* Perform the size computation of glyphs of FONT and fill in members |
| 944 | of METRICS. The glyphs are specified by their glyph codes in | 944 | of METRICS. The glyphs are specified by their glyph codes in |
| 945 | CODE (length NGLYPHS). */ | 945 | CODE (length NGLYPHS). */ |
| 946 | static void | 946 | static void |
| 947 | nsfont_text_extents (struct font *font, unsigned int *code, | 947 | nsfont_text_extents (struct font *font, unsigned int *code, |
| 948 | int nglyphs, struct font_metrics *metrics) | 948 | int nglyphs, struct font_metrics *metrics) |
| @@ -985,11 +985,11 @@ nsfont_text_extents (struct font *font, unsigned int *code, | |||
| 985 | /* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | 985 | /* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel |
| 986 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, | 986 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, |
| 987 | fill the background in advance. It is assured that WITH_BACKGROUND | 987 | fill the background in advance. It is assured that WITH_BACKGROUND |
| 988 | is false when (FROM > 0 || TO < S->nchars). */ | 988 | is false when (FROM > 0 || TO < S->nchars). */ |
| 989 | static int | 989 | static int |
| 990 | nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | 990 | nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, |
| 991 | bool with_background) | 991 | bool with_background) |
| 992 | /* NOTE: focus and clip must be set */ | 992 | /* NOTE: focus and clip must be set. */ |
| 993 | { | 993 | { |
| 994 | static unsigned char cbuf[1024]; | 994 | static unsigned char cbuf[1024]; |
| 995 | unsigned char *c = cbuf; | 995 | unsigned char *c = cbuf; |
| @@ -1019,7 +1019,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1019 | if (font == NULL) | 1019 | if (font == NULL) |
| 1020 | font = (struct nsfont_info *)FRAME_FONT (s->f); | 1020 | font = (struct nsfont_info *)FRAME_FONT (s->f); |
| 1021 | 1021 | ||
| 1022 | /* Select face based on input flags */ | 1022 | /* Select face based on input flags. */ |
| 1023 | flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR : | 1023 | flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR : |
| 1024 | (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE : | 1024 | (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE : |
| 1025 | (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND : | 1025 | (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND : |
| @@ -1049,11 +1049,11 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1049 | 1049 | ||
| 1050 | /* Convert UTF-16 (?) to UTF-8 and determine advances. Note if we just ask | 1050 | /* Convert UTF-16 (?) to UTF-8 and determine advances. Note if we just ask |
| 1051 | NS to render the string, it will come out differently from the individual | 1051 | NS to render the string, it will come out differently from the individual |
| 1052 | character widths added up because of layout processing. */ | 1052 | character widths added up because of layout processing. */ |
| 1053 | { | 1053 | { |
| 1054 | int cwidth, twidth = 0; | 1054 | int cwidth, twidth = 0; |
| 1055 | int hi, lo; | 1055 | int hi, lo; |
| 1056 | /* FIXME: composition: no vertical displacement is considered. */ | 1056 | /* FIXME: composition: no vertical displacement is considered. */ |
| 1057 | t += from; /* advance into composition */ | 1057 | t += from; /* advance into composition */ |
| 1058 | for (i = from; i < to; i++, t++) | 1058 | for (i = from; i < to; i++, t++) |
| 1059 | { | 1059 | { |
| @@ -1082,14 +1082,14 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1082 | } | 1082 | } |
| 1083 | else | 1083 | else |
| 1084 | { | 1084 | { |
| 1085 | if (!font->metrics[hi]) /* FIXME: why/how can we need this now? */ | 1085 | if (!font->metrics[hi]) /* FIXME: why/how can we need this now? */ |
| 1086 | ns_glyph_metrics (font, hi); | 1086 | ns_glyph_metrics (font, hi); |
| 1087 | cwidth = font->metrics[hi][lo].width; | 1087 | cwidth = font->metrics[hi][lo].width; |
| 1088 | } | 1088 | } |
| 1089 | twidth += cwidth; | 1089 | twidth += cwidth; |
| 1090 | #ifdef NS_IMPL_GNUSTEP | 1090 | #ifdef NS_IMPL_GNUSTEP |
| 1091 | *adv++ = cwidth; | 1091 | *adv++ = cwidth; |
| 1092 | CHAR_STRING_ADVANCE (*t, c); /* this converts the char to UTF-8 */ | 1092 | CHAR_STRING_ADVANCE (*t, c); /* This converts the char to UTF-8. */ |
| 1093 | #else | 1093 | #else |
| 1094 | (*adv++).width = cwidth; | 1094 | (*adv++).width = cwidth; |
| 1095 | #endif | 1095 | #endif |
| @@ -1099,7 +1099,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1099 | *c = 0; | 1099 | *c = 0; |
| 1100 | } | 1100 | } |
| 1101 | 1101 | ||
| 1102 | /* fill background if requested */ | 1102 | /* Fill background if requested. */ |
| 1103 | if (with_background && !isComposite) | 1103 | if (with_background && !isComposite) |
| 1104 | { | 1104 | { |
| 1105 | NSRect br = r; | 1105 | NSRect br = r; |
| @@ -1119,7 +1119,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1119 | } | 1119 | } |
| 1120 | if (s->face->box == FACE_NO_BOX) | 1120 | if (s->face->box == FACE_NO_BOX) |
| 1121 | { | 1121 | { |
| 1122 | /* expand unboxed top row over internal border */ | 1122 | /* Expand unboxed top row over internal border. */ |
| 1123 | if (br.origin.y <= fibw + 1 + mbox_line_width) | 1123 | if (br.origin.y <= fibw + 1 + mbox_line_width) |
| 1124 | { | 1124 | { |
| 1125 | br.size.height += br.origin.y; | 1125 | br.size.height += br.origin.y; |
| @@ -1258,7 +1258,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1258 | ========================================================================== */ | 1258 | ========================================================================== */ |
| 1259 | 1259 | ||
| 1260 | /* Find and cache corresponding glyph codes for unicode values in given | 1260 | /* Find and cache corresponding glyph codes for unicode values in given |
| 1261 | hi-byte block of 256. */ | 1261 | hi-byte block of 256. */ |
| 1262 | static void | 1262 | static void |
| 1263 | ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) | 1263 | ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) |
| 1264 | { | 1264 | { |
| @@ -1288,7 +1288,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) | |||
| 1288 | if (!unichars || !(font_info->glyphs[block])) | 1288 | if (!unichars || !(font_info->glyphs[block])) |
| 1289 | emacs_abort (); | 1289 | emacs_abort (); |
| 1290 | 1290 | ||
| 1291 | /* create a string containing all Unicode characters in this block */ | 1291 | /* Create a string containing all Unicode characters in this block. */ |
| 1292 | for (idx = block<<8, i = 0; i < 0x100; idx++, i++) | 1292 | for (idx = block<<8, i = 0; i < 0x100; idx++, i++) |
| 1293 | if (idx < 0xD800 || idx > 0xDFFF) | 1293 | if (idx < 0xD800 || idx > 0xDFFF) |
| 1294 | unichars[i] = idx; | 1294 | unichars[i] = idx; |
| @@ -1303,7 +1303,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) | |||
| 1303 | length: 0x100 | 1303 | length: 0x100 |
| 1304 | freeWhenDone: NO]; | 1304 | freeWhenDone: NO]; |
| 1305 | NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator]; | 1305 | NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator]; |
| 1306 | /*NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */ | 1306 | /* NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */ |
| 1307 | unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs]; | 1307 | unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs]; |
| 1308 | NSUInteger gInd = 0, cInd = 0; | 1308 | NSUInteger gInd = 0, cInd = 0; |
| 1309 | 1309 | ||
| @@ -1319,9 +1319,9 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) | |||
| 1319 | g = unichars[i]; | 1319 | g = unichars[i]; |
| 1320 | #else | 1320 | #else |
| 1321 | g = glyphStorage->cglyphs[i]; | 1321 | g = glyphStorage->cglyphs[i]; |
| 1322 | /* TODO: is this a good check? maybe need to use coveredChars.. */ | 1322 | /* TODO: is this a good check? Maybe need to use coveredChars. */ |
| 1323 | if (g > numGlyphs || g == NSNullGlyph) | 1323 | if (g > numGlyphs || g == NSNullGlyph) |
| 1324 | g = INVALID_GLYPH; /* hopefully unused... */ | 1324 | g = INVALID_GLYPH; /* Hopefully unused... */ |
| 1325 | #endif | 1325 | #endif |
| 1326 | *glyphs = g; | 1326 | *glyphs = g; |
| 1327 | } | 1327 | } |
| @@ -1337,7 +1337,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) | |||
| 1337 | 1337 | ||
| 1338 | 1338 | ||
| 1339 | /* Determine and cache metrics for corresponding glyph codes in given | 1339 | /* Determine and cache metrics for corresponding glyph codes in given |
| 1340 | hi-byte block of 256. */ | 1340 | hi-byte block of 256. */ |
| 1341 | static void | 1341 | static void |
| 1342 | ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | 1342 | ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) |
| 1343 | { | 1343 | { |
| @@ -1387,16 +1387,16 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | |||
| 1387 | metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); | 1387 | metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); |
| 1388 | 1388 | ||
| 1389 | metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; | 1389 | metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; |
| 1390 | /*lrint (hshrink * [sfont ascender] + expand * hd/2); */ | 1390 | /* lrint (hshrink * [sfont ascender] + expand * hd/2); */ |
| 1391 | metrics->ascent = r.size.height - metrics->descent; | 1391 | metrics->ascent = r.size.height - metrics->descent; |
| 1392 | /*-lrint (hshrink* [sfont descender] - expand * hd/2); */ | 1392 | /* -lrint (hshrink* [sfont descender] - expand * hd/2); */ |
| 1393 | } | 1393 | } |
| 1394 | unblock_input (); | 1394 | unblock_input (); |
| 1395 | } | 1395 | } |
| 1396 | 1396 | ||
| 1397 | 1397 | ||
| 1398 | #ifdef NS_IMPL_COCOA | 1398 | #ifdef NS_IMPL_COCOA |
| 1399 | /* helper for font glyph setup */ | 1399 | /* Helper for font glyph setup. */ |
| 1400 | @implementation EmacsGlyphStorage | 1400 | @implementation EmacsGlyphStorage |
| 1401 | 1401 | ||
| 1402 | - init | 1402 | - init |
| @@ -1508,7 +1508,7 @@ syms_of_nsfont (void) | |||
| 1508 | DEFSYM (Qapple, "apple"); | 1508 | DEFSYM (Qapple, "apple"); |
| 1509 | DEFSYM (Qmedium, "medium"); | 1509 | DEFSYM (Qmedium, "medium"); |
| 1510 | DEFVAR_LISP ("ns-reg-to-script", Vns_reg_to_script, | 1510 | DEFVAR_LISP ("ns-reg-to-script", Vns_reg_to_script, |
| 1511 | doc: /* Internal use: maps font registry to Unicode script. */); | 1511 | doc: /* Internal use: maps font registry to Unicode script. */); |
| 1512 | 1512 | ||
| 1513 | ascii_printable = NULL; | 1513 | ascii_printable = NULL; |
| 1514 | } | 1514 | } |
diff --git a/src/nsgui.h b/src/nsgui.h index 92ea6350d62..4e7d7d35daa 100644 --- a/src/nsgui.h +++ b/src/nsgui.h | |||
| @@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 19 | #ifndef __NSGUI_H__ | 19 | #ifndef __NSGUI_H__ |
| 20 | #define __NSGUI_H__ | 20 | #define __NSGUI_H__ |
| 21 | 21 | ||
| 22 | /* this gets included from a couple of the plain (non-NS) .c files */ | 22 | /* This gets included from a couple of the plain (non-NS) .c files. */ |
| 23 | #ifdef __OBJC__ | 23 | #ifdef __OBJC__ |
| 24 | 24 | ||
| 25 | #ifdef NS_IMPL_COCOA | 25 | #ifdef NS_IMPL_COCOA |
| @@ -75,7 +75,7 @@ typedef unichar XChar2b; | |||
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | /* XXX: xfaces requires these structures, but the question is are we | 77 | /* XXX: xfaces requires these structures, but the question is are we |
| 78 | forced to use them? */ | 78 | forced to use them? */ |
| 79 | typedef struct _XGCValues | 79 | typedef struct _XGCValues |
| 80 | { | 80 | { |
| 81 | unsigned long foreground; | 81 | unsigned long foreground; |
| @@ -119,8 +119,8 @@ typedef int Display; | |||
| 119 | typedef Lisp_Object XrmDatabase; | 119 | typedef Lisp_Object XrmDatabase; |
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | /* some sort of attempt to normalize rectangle handling.. seems a bit much | 122 | /* Some sort of attempt to normalize rectangle handling. Seems a bit |
| 123 | for what is accomplished */ | 123 | much for what is accomplished. */ |
| 124 | typedef struct { | 124 | typedef struct { |
| 125 | int x, y; | 125 | int x, y; |
| 126 | unsigned width, height; | 126 | unsigned width, height; |
| @@ -160,7 +160,7 @@ typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect; | |||
| 160 | 160 | ||
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | /* This stuff needed by frame.c. */ | 163 | /* This stuff needed by frame.c. */ |
| 164 | #define ForgetGravity 0 | 164 | #define ForgetGravity 0 |
| 165 | #define NorthWestGravity 1 | 165 | #define NorthWestGravity 1 |
| 166 | #define NorthGravity 2 | 166 | #define NorthGravity 2 |
diff --git a/src/nsimage.m b/src/nsimage.m index e9af58b8afa..2cc205a499d 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -26,7 +26,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | /* This should be the first include, as it may set up #defines affecting | 28 | /* This should be the first include, as it may set up #defines affecting |
| 29 | interpretation of even the system includes. */ | 29 | interpretation of even the system includes. */ |
| 30 | #include <config.h> | 30 | #include <config.h> |
| 31 | 31 | ||
| 32 | #include "lisp.h" | 32 | #include "lisp.h" |
| @@ -41,7 +41,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 41 | 41 | ||
| 42 | C interface. This allows easy calling from C files. We could just | 42 | C interface. This allows easy calling from C files. We could just |
| 43 | compile everything as Objective-C, but that might mean slower | 43 | compile everything as Objective-C, but that might mean slower |
| 44 | compilation and possible difficulties on some platforms.. | 44 | compilation and possible difficulties on some platforms. |
| 45 | 45 | ||
| 46 | ========================================================================== */ | 46 | ========================================================================== */ |
| 47 | 47 | ||
| @@ -226,7 +226,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 226 | 226 | ||
| 227 | 227 | ||
| 228 | /* Create image from monochrome bitmap. If both FG and BG are 0 | 228 | /* Create image from monochrome bitmap. If both FG and BG are 0 |
| 229 | (black), set the background to white and make it transparent. */ | 229 | (black), set the background to white and make it transparent. */ |
| 230 | - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h | 230 | - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h |
| 231 | fg: (unsigned long)fg bg: (unsigned long)bg | 231 | fg: (unsigned long)fg bg: (unsigned long)bg |
| 232 | { | 232 | { |
| @@ -251,7 +251,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | { | 253 | { |
| 254 | /* pull bits out to set the (bytewise) alpha mask */ | 254 | /* Pull bits out to set the (bytewise) alpha mask. */ |
| 255 | int i, j, k; | 255 | int i, j, k; |
| 256 | unsigned char *s = bits; | 256 | unsigned char *s = bits; |
| 257 | unsigned char *rr = planes[0]; | 257 | unsigned char *rr = planes[0]; |
| @@ -362,7 +362,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | 364 | ||
| 365 | /* attempt to pull out pixmap data from a BitmapImageRep; returns NO if fails */ | 365 | /* Attempt to pull out pixmap data from a BitmapImageRep; returns NO if fails. */ |
| 366 | - (void) setPixmapData | 366 | - (void) setPixmapData |
| 367 | { | 367 | { |
| 368 | NSEnumerator *reps; | 368 | NSEnumerator *reps; |
| @@ -386,15 +386,15 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | 388 | ||
| 389 | /* note; this and next work only for image created with initForXPMWithDepth, | 389 | /* Note: this and next work only for image created with initForXPMWithDepth, |
| 390 | initFromSkipXBM, or where setPixmapData was called successfully */ | 390 | initFromSkipXBM, or where setPixmapData was called successfully. */ |
| 391 | /* return ARGB */ | 391 | /* return ARGB */ |
| 392 | - (unsigned long) getPixelAtX: (int)x Y: (int)y | 392 | - (unsigned long) getPixelAtX: (int)x Y: (int)y |
| 393 | { | 393 | { |
| 394 | if (bmRep == nil) | 394 | if (bmRep == nil) |
| 395 | return 0; | 395 | return 0; |
| 396 | 396 | ||
| 397 | /* this method is faster but won't work for bitmaps */ | 397 | /* This method is faster but won't work for bitmaps. */ |
| 398 | if (pixmapData[0] != NULL) | 398 | if (pixmapData[0] != NULL) |
| 399 | { | 399 | { |
| 400 | int loc = x + y * [self size].width; | 400 | int loc = x + y * [self size].width; |
| @@ -457,7 +457,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 457 | } | 457 | } |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | /* returns a pattern color, which is cached here */ | 460 | /* Returns a pattern color, which is cached here. */ |
| 461 | - (NSColor *)stippleMask | 461 | - (NSColor *)stippleMask |
| 462 | { | 462 | { |
| 463 | if (stippleMask == nil) | 463 | if (stippleMask == nil) |
| @@ -465,7 +465,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 465 | return stippleMask; | 465 | return stippleMask; |
| 466 | } | 466 | } |
| 467 | 467 | ||
| 468 | /* Find the first NSBitmapImageRep which has multiple frames. */ | 468 | /* Find the first NSBitmapImageRep which has multiple frames. */ |
| 469 | - (NSBitmapImageRep *)getAnimatedBitmapImageRep | 469 | - (NSBitmapImageRep *)getAnimatedBitmapImageRep |
| 470 | { | 470 | { |
| 471 | for (NSImageRep * r in [self representations]) | 471 | for (NSImageRep * r in [self representations]) |
| @@ -481,7 +481,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | /* If the image has multiple frames, get a count of them and the | 483 | /* If the image has multiple frames, get a count of them and the |
| 484 | animation delay, if available. */ | 484 | animation delay, if available. */ |
| 485 | - (Lisp_Object)getMetadata | 485 | - (Lisp_Object)getMetadata |
| 486 | { | 486 | { |
| 487 | Lisp_Object metadata = Qnil; | 487 | Lisp_Object metadata = Qnil; |
| @@ -502,7 +502,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 502 | return metadata; | 502 | return metadata; |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | /* Attempt to set the animation frame to be displayed. */ | 505 | /* Attempt to set the animation frame to be displayed. */ |
| 506 | - (BOOL)setFrame: (unsigned int) index | 506 | - (BOOL)setFrame: (unsigned int) index |
| 507 | { | 507 | { |
| 508 | NSBitmapImageRep * bm = [self getAnimatedBitmapImageRep]; | 508 | NSBitmapImageRep * bm = [self getAnimatedBitmapImageRep]; |
| @@ -511,7 +511,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 511 | { | 511 | { |
| 512 | int frames = [[bm valueForProperty:NSImageFrameCount] intValue]; | 512 | int frames = [[bm valueForProperty:NSImageFrameCount] intValue]; |
| 513 | 513 | ||
| 514 | /* If index is invalid, give up. */ | 514 | /* If index is invalid, give up. */ |
| 515 | if (index < 0 || index > frames) | 515 | if (index < 0 || index > frames) |
| 516 | return NO; | 516 | return NO; |
| 517 | 517 | ||
| @@ -520,7 +520,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | /* Setting the frame has succeeded, or the image doesn't have | 522 | /* Setting the frame has succeeded, or the image doesn't have |
| 523 | multiple frames. */ | 523 | multiple frames. */ |
| 524 | return YES; | 524 | return YES; |
| 525 | } | 525 | } |
| 526 | 526 | ||
diff --git a/src/nsmenu.m b/src/nsmenu.m index 29b0f99e642..a438952818a 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -22,7 +22,7 @@ Christian Limpach, Scott Bender, Christophe de Dinechin) and code in the | |||
| 22 | Carbon version by Yamamoto Mitsuharu. */ | 22 | Carbon version by Yamamoto Mitsuharu. */ |
| 23 | 23 | ||
| 24 | /* This should be the first include, as it may set up #defines affecting | 24 | /* This should be the first include, as it may set up #defines affecting |
| 25 | interpretation of even the system includes. */ | 25 | interpretation of even the system includes. */ |
| 26 | #include <config.h> | 26 | #include <config.h> |
| 27 | 27 | ||
| 28 | #include "lisp.h" | 28 | #include "lisp.h" |
| @@ -47,7 +47,7 @@ Carbon version by Yamamoto Mitsuharu. */ | |||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | #if 0 | 49 | #if 0 |
| 50 | /* Include lisp -> C common menu parsing code */ | 50 | /* Include lisp -> C common menu parsing code. */ |
| 51 | #define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) | 51 | #define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) |
| 52 | #include "nsmenu_common.c" | 52 | #include "nsmenu_common.c" |
| 53 | #endif | 53 | #endif |
| @@ -62,7 +62,7 @@ static int trackingMenu; | |||
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | /* NOTE: toolbar implementation is at end, | 64 | /* NOTE: toolbar implementation is at end, |
| 65 | following complete menu implementation. */ | 65 | following complete menu implementation. */ |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | /* ========================================================================== | 68 | /* ========================================================================== |
| @@ -74,7 +74,7 @@ static int trackingMenu; | |||
| 74 | 74 | ||
| 75 | /* Supposed to discard menubar and free storage. Since we share the | 75 | /* Supposed to discard menubar and free storage. Since we share the |
| 76 | menubar among frames and update its context for the focused window, | 76 | menubar among frames and update its context for the focused window, |
| 77 | there is nothing to do here. */ | 77 | there is nothing to do here. */ |
| 78 | void | 78 | void |
| 79 | free_frame_menubar (struct frame *f) | 79 | free_frame_menubar (struct frame *f) |
| 80 | { | 80 | { |
| @@ -123,7 +123,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 123 | block_input (); | 123 | block_input (); |
| 124 | pool = [[NSAutoreleasePool alloc] init]; | 124 | pool = [[NSAutoreleasePool alloc] init]; |
| 125 | 125 | ||
| 126 | /* Menu may have been created automatically; if so, discard it. */ | 126 | /* Menu may have been created automatically; if so, discard it. */ |
| 127 | if ([menu isKindOfClass: [EmacsMenu class]] == NO) | 127 | if ([menu isKindOfClass: [EmacsMenu class]] == NO) |
| 128 | { | 128 | { |
| 129 | [menu release]; | 129 | [menu release]; |
| @@ -147,7 +147,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 147 | 147 | ||
| 148 | if (deep_p) | 148 | if (deep_p) |
| 149 | { | 149 | { |
| 150 | /* Fully parse one or more of the submenus. */ | 150 | /* Fully parse one or more of the submenus. */ |
| 151 | int n = 0; | 151 | int n = 0; |
| 152 | int *submenu_start, *submenu_end; | 152 | int *submenu_start, *submenu_end; |
| 153 | bool *submenu_top_level_items; | 153 | bool *submenu_top_level_items; |
| @@ -172,8 +172,8 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 172 | set_buffer_internal_1 (XBUFFER (buffer)); | 172 | set_buffer_internal_1 (XBUFFER (buffer)); |
| 173 | 173 | ||
| 174 | /* TODO: for some reason this is not needed in other terms, | 174 | /* TODO: for some reason this is not needed in other terms, |
| 175 | but some menu updates call Info-extract-pointer which causes | 175 | but some menu updates call Info-extract-pointer which causes |
| 176 | abort-on-error if waiting-for-input. Needs further investigation. */ | 176 | abort-on-error if waiting-for-input. Needs further investigation. */ |
| 177 | owfi = waiting_for_input; | 177 | owfi = waiting_for_input; |
| 178 | waiting_for_input = 0; | 178 | waiting_for_input = 0; |
| 179 | 179 | ||
| @@ -214,10 +214,10 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 214 | break; | 214 | break; |
| 215 | 215 | ||
| 216 | /* FIXME: we'd like to only parse the needed submenu, but this | 216 | /* FIXME: we'd like to only parse the needed submenu, but this |
| 217 | was causing crashes in the _common parsing code.. need to make | 217 | was causing crashes in the _common parsing code: need to make |
| 218 | sure proper initialization done.. */ | 218 | sure proper initialization done. */ |
| 219 | /* if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string))) | 219 | /* if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string))) |
| 220 | continue; */ | 220 | continue; */ |
| 221 | 221 | ||
| 222 | submenu_start[i] = menu_items_used; | 222 | submenu_start[i] = menu_items_used; |
| 223 | 223 | ||
| @@ -267,17 +267,17 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 267 | 267 | ||
| 268 | set_buffer_internal_1 (prev); | 268 | set_buffer_internal_1 (prev); |
| 269 | 269 | ||
| 270 | /* Compare the new menu items with previous, and leave off if no change */ | 270 | /* Compare the new menu items with previous, and leave off if no change. */ |
| 271 | /* FIXME: following other terms here, but seems like this should be | 271 | /* FIXME: following other terms here, but seems like this should be |
| 272 | done before parse stage 2 above, since its results aren't used */ | 272 | done before parse stage 2 above, since its results aren't used. */ |
| 273 | if (previous_menu_items_used | 273 | if (previous_menu_items_used |
| 274 | && (!submenu || (submenu && submenu == last_submenu)) | 274 | && (!submenu || (submenu && submenu == last_submenu)) |
| 275 | && menu_items_used == previous_menu_items_used) | 275 | && menu_items_used == previous_menu_items_used) |
| 276 | { | 276 | { |
| 277 | for (i = 0; i < previous_menu_items_used; i++) | 277 | for (i = 0; i < previous_menu_items_used; i++) |
| 278 | /* FIXME: this ALWAYS fails on Buffers menu items.. something | 278 | /* FIXME: this ALWAYS fails on Buffers menu items.. something |
| 279 | about their strings causes them to change every time, so we | 279 | about their strings causes them to change every time, so we |
| 280 | double-check failures */ | 280 | double-check failures. */ |
| 281 | if (!EQ (previous_items[i], AREF (menu_items, i))) | 281 | if (!EQ (previous_items[i], AREF (menu_items, i))) |
| 282 | if (!(STRINGP (previous_items[i]) | 282 | if (!(STRINGP (previous_items[i]) |
| 283 | && STRINGP (AREF (menu_items, i)) | 283 | && STRINGP (AREF (menu_items, i)) |
| @@ -286,7 +286,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 286 | break; | 286 | break; |
| 287 | if (i == previous_menu_items_used) | 287 | if (i == previous_menu_items_used) |
| 288 | { | 288 | { |
| 289 | /* No change.. */ | 289 | /* No change. */ |
| 290 | 290 | ||
| 291 | #if NSMENUPROFILE | 291 | #if NSMENUPROFILE |
| 292 | ftime (&tb); | 292 | ftime (&tb); |
| @@ -302,16 +302,16 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 302 | return; | 302 | return; |
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| 305 | /* The menu items are different, so store them in the frame */ | 305 | /* The menu items are different, so store them in the frame. */ |
| 306 | /* FIXME: this is not correct for single-submenu case */ | 306 | /* FIXME: this is not correct for single-submenu case. */ |
| 307 | fset_menu_bar_vector (f, menu_items); | 307 | fset_menu_bar_vector (f, menu_items); |
| 308 | f->menu_bar_items_used = menu_items_used; | 308 | f->menu_bar_items_used = menu_items_used; |
| 309 | 309 | ||
| 310 | /* Calls restore_menu_items, etc., as they were outside */ | 310 | /* Calls restore_menu_items, etc., as they were outside. */ |
| 311 | unbind_to (specpdl_count, Qnil); | 311 | unbind_to (specpdl_count, Qnil); |
| 312 | 312 | ||
| 313 | /* Parse stage 2a: now GC cannot happen during the lifetime of the | 313 | /* Parse stage 2a: now GC cannot happen during the lifetime of the |
| 314 | widget_value, so it's safe to store data from a Lisp_String */ | 314 | widget_value, so it's safe to store data from a Lisp_String. */ |
| 315 | wv = first_wv->contents; | 315 | wv = first_wv->contents; |
| 316 | for (i = 0; i < ASIZE (items); i += 4) | 316 | for (i = 0; i < ASIZE (items); i += 4) |
| 317 | { | 317 | { |
| @@ -326,7 +326,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | /* Now, update the NS menu; if we have a submenu, use that, otherwise | 328 | /* Now, update the NS menu; if we have a submenu, use that, otherwise |
| 329 | create a new menu for each sub and fill it. */ | 329 | create a new menu for each sub and fill it. */ |
| 330 | if (submenu) | 330 | if (submenu) |
| 331 | { | 331 | { |
| 332 | const char *submenuTitle = [[submenu title] UTF8String]; | 332 | const char *submenuTitle = [[submenu title] UTF8String]; |
| @@ -358,7 +358,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 358 | wv->button_type = BUTTON_TYPE_NONE; | 358 | wv->button_type = BUTTON_TYPE_NONE; |
| 359 | first_wv = wv; | 359 | first_wv = wv; |
| 360 | 360 | ||
| 361 | /* Make widget-value tree w/ just the top level menu bar strings */ | 361 | /* Make widget-value tree with just the top level menu bar strings. */ |
| 362 | items = FRAME_MENU_BAR_ITEMS (f); | 362 | items = FRAME_MENU_BAR_ITEMS (f); |
| 363 | if (NILP (items)) | 363 | if (NILP (items)) |
| 364 | { | 364 | { |
| @@ -369,7 +369,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | 371 | ||
| 372 | /* check if no change.. this mechanism is a bit rough, but ready */ | 372 | /* Check if no change: this mechanism is a bit rough, but ready. */ |
| 373 | n = ASIZE (items) / 4; | 373 | n = ASIZE (items) / 4; |
| 374 | if (f == last_f && n_previous_strings == n) | 374 | if (f == last_f && n_previous_strings == n) |
| 375 | { | 375 | { |
| @@ -416,10 +416,10 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 416 | wv->call_data = (void *) (intptr_t) (-1); | 416 | wv->call_data = (void *) (intptr_t) (-1); |
| 417 | 417 | ||
| 418 | #ifdef NS_IMPL_COCOA | 418 | #ifdef NS_IMPL_COCOA |
| 419 | /* we'll update the real copy under app menu when time comes */ | 419 | /* We'll update the real copy under app menu when time comes. */ |
| 420 | if (!strcmp ("Services", wv->name)) | 420 | if (!strcmp ("Services", wv->name)) |
| 421 | { | 421 | { |
| 422 | /* but we need to make sure it will update on demand */ | 422 | /* But we need to make sure it will update on demand. */ |
| 423 | [svcsMenu setFrame: f]; | 423 | [svcsMenu setFrame: f]; |
| 424 | } | 424 | } |
| 425 | else | 425 | else |
| @@ -461,7 +461,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 461 | 461 | ||
| 462 | /* Main emacs core entry point for menubar menus: called to indicate that the | 462 | /* Main emacs core entry point for menubar menus: called to indicate that the |
| 463 | frame's menus have changed, and the *step representation should be updated | 463 | frame's menus have changed, and the *step representation should be updated |
| 464 | from Lisp. */ | 464 | from Lisp. */ |
| 465 | void | 465 | void |
| 466 | set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | 466 | set_frame_menubar (struct frame *f, bool first_time, bool deep_p) |
| 467 | { | 467 | { |
| @@ -489,7 +489,7 @@ x_activate_menubar (struct frame *f) | |||
| 489 | 489 | ||
| 490 | /* Menu that can define itself from Emacs "widget_value"s and will lazily | 490 | /* Menu that can define itself from Emacs "widget_value"s and will lazily |
| 491 | update itself when user clicked. Based on Carbon/AppKit implementation | 491 | update itself when user clicked. Based on Carbon/AppKit implementation |
| 492 | by Yamamoto Mitsuharu. */ | 492 | by Yamamoto Mitsuharu. */ |
| 493 | @implementation EmacsMenu | 493 | @implementation EmacsMenu |
| 494 | 494 | ||
| 495 | /* override designated initializer */ | 495 | /* override designated initializer */ |
| @@ -556,8 +556,8 @@ x_activate_menubar (struct frame *f) | |||
| 556 | 556 | ||
| 557 | #endif /* NS_IMPL_COCOA */ | 557 | #endif /* NS_IMPL_COCOA */ |
| 558 | 558 | ||
| 559 | /* delegate method called when a submenu is being opened: run a 'deep' call | 559 | /* Delegate method called when a submenu is being opened: run a 'deep' call |
| 560 | to set_frame_menubar */ | 560 | to set_frame_menubar. */ |
| 561 | - (void)menuNeedsUpdate: (NSMenu *)menu | 561 | - (void)menuNeedsUpdate: (NSMenu *)menu |
| 562 | { | 562 | { |
| 563 | if (!FRAME_LIVE_P (frame)) | 563 | if (!FRAME_LIVE_P (frame)) |
| @@ -664,7 +664,7 @@ x_activate_menubar (struct frame *f) | |||
| 664 | 664 | ||
| 665 | [item setEnabled: wv->enabled]; | 665 | [item setEnabled: wv->enabled]; |
| 666 | 666 | ||
| 667 | /* Draw radio buttons and tickboxes */ | 667 | /* Draw radio buttons and tickboxes. */ |
| 668 | if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || | 668 | if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || |
| 669 | wv->button_type == BUTTON_TYPE_RADIO)) | 669 | wv->button_type == BUTTON_TYPE_RADIO)) |
| 670 | [item setState: NSOnState]; | 670 | [item setState: NSOnState]; |
| @@ -735,7 +735,7 @@ x_activate_menubar (struct frame *f) | |||
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | 737 | ||
| 738 | /* adds an empty submenu and returns it */ | 738 | /* Adds an empty submenu and returns it. */ |
| 739 | - (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f | 739 | - (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f |
| 740 | { | 740 | { |
| 741 | NSString *titleStr = [NSString stringWithUTF8String: title]; | 741 | NSString *titleStr = [NSString stringWithUTF8String: title]; |
| @@ -748,7 +748,7 @@ x_activate_menubar (struct frame *f) | |||
| 748 | return submenu; | 748 | return submenu; |
| 749 | } | 749 | } |
| 750 | 750 | ||
| 751 | /* run a menu in popup mode */ | 751 | /* Run a menu in popup mode. */ |
| 752 | - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f | 752 | - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f |
| 753 | keymaps: (bool)keymaps | 753 | keymaps: (bool)keymaps |
| 754 | { | 754 | { |
| @@ -756,7 +756,7 @@ x_activate_menubar (struct frame *f) | |||
| 756 | NSEvent *e, *event; | 756 | NSEvent *e, *event; |
| 757 | long retVal; | 757 | long retVal; |
| 758 | 758 | ||
| 759 | /* p = [view convertPoint:p fromView: nil]; */ | 759 | /* p = [view convertPoint:p fromView: nil]; */ |
| 760 | p.y = NSHeight ([view frame]) - p.y; | 760 | p.y = NSHeight ([view frame]) - p.y; |
| 761 | e = [[view window] currentEvent]; | 761 | e = [[view window] currentEvent]; |
| 762 | event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown | 762 | event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown |
| @@ -765,7 +765,7 @@ x_activate_menubar (struct frame *f) | |||
| 765 | timestamp: [e timestamp] | 765 | timestamp: [e timestamp] |
| 766 | windowNumber: [[view window] windowNumber] | 766 | windowNumber: [[view window] windowNumber] |
| 767 | context: nil | 767 | context: nil |
| 768 | eventNumber: 0/*[e eventNumber] */ | 768 | eventNumber: 0 /* [e eventNumber] */ |
| 769 | clickCount: 1 | 769 | clickCount: 1 |
| 770 | pressure: 0]; | 770 | pressure: 0]; |
| 771 | 771 | ||
| @@ -811,14 +811,14 @@ ns_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 811 | first_wv = wv; | 811 | first_wv = wv; |
| 812 | 812 | ||
| 813 | #if 0 | 813 | #if 0 |
| 814 | /* FIXME: a couple of one-line differences prevent reuse */ | 814 | /* FIXME: a couple of one-line differences prevent reuse. */ |
| 815 | wv = digest_single_submenu (0, menu_items_used, 0); | 815 | wv = digest_single_submenu (0, menu_items_used, 0); |
| 816 | #else | 816 | #else |
| 817 | { | 817 | { |
| 818 | widget_value *save_wv = 0, *prev_wv = 0; | 818 | widget_value *save_wv = 0, *prev_wv = 0; |
| 819 | widget_value **submenu_stack | 819 | widget_value **submenu_stack |
| 820 | = alloca (menu_items_used * sizeof *submenu_stack); | 820 | = alloca (menu_items_used * sizeof *submenu_stack); |
| 821 | /* Lisp_Object *subprefix_stack | 821 | /* Lisp_Object *subprefix_stack |
| 822 | = alloca (menu_items_used * sizeof *subprefix_stack); */ | 822 | = alloca (menu_items_used * sizeof *subprefix_stack); */ |
| 823 | int submenu_depth = 0; | 823 | int submenu_depth = 0; |
| 824 | int first_pane = 1; | 824 | int first_pane = 1; |
| @@ -1009,8 +1009,8 @@ free_frame_tool_bar (struct frame *f) | |||
| 1009 | block_input (); | 1009 | block_input (); |
| 1010 | view->wait_for_tool_bar = NO; | 1010 | view->wait_for_tool_bar = NO; |
| 1011 | 1011 | ||
| 1012 | /* Note: This trigger an animation, which calls windowDidResize | 1012 | /* Note: This triggers an animation, which calls windowDidResize |
| 1013 | repeatedly. */ | 1013 | repeatedly. */ |
| 1014 | f->output_data.ns->in_animation = 1; | 1014 | f->output_data.ns->in_animation = 1; |
| 1015 | [[view toolbar] setVisible: NO]; | 1015 | [[view toolbar] setVisible: NO]; |
| 1016 | f->output_data.ns->in_animation = 0; | 1016 | f->output_data.ns->in_animation = 0; |
| @@ -1021,7 +1021,7 @@ free_frame_tool_bar (struct frame *f) | |||
| 1021 | void | 1021 | void |
| 1022 | update_frame_tool_bar (struct frame *f) | 1022 | update_frame_tool_bar (struct frame *f) |
| 1023 | /* -------------------------------------------------------------------------- | 1023 | /* -------------------------------------------------------------------------- |
| 1024 | Update toolbar contents | 1024 | Update toolbar contents. |
| 1025 | -------------------------------------------------------------------------- */ | 1025 | -------------------------------------------------------------------------- */ |
| 1026 | { | 1026 | { |
| 1027 | int i, k = 0; | 1027 | int i, k = 0; |
| @@ -1042,7 +1042,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1042 | [toolbar clearAll]; | 1042 | [toolbar clearAll]; |
| 1043 | #endif | 1043 | #endif |
| 1044 | 1044 | ||
| 1045 | /* update EmacsToolbar as in GtkUtils, build items list */ | 1045 | /* Update EmacsToolbar as in GtkUtils, build items list. */ |
| 1046 | for (i = 0; i < f->n_tool_bar_items; ++i) | 1046 | for (i = 0; i < f->n_tool_bar_items; ++i) |
| 1047 | { | 1047 | { |
| 1048 | #define TOOLPROP(IDX) AREF (f->tool_bar_items, \ | 1048 | #define TOOLPROP(IDX) AREF (f->tool_bar_items, \ |
| @@ -1070,7 +1070,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1070 | image = TOOLPROP (TOOL_BAR_ITEM_IMAGES); | 1070 | image = TOOLPROP (TOOL_BAR_ITEM_IMAGES); |
| 1071 | if (VECTORP (image)) | 1071 | if (VECTORP (image)) |
| 1072 | { | 1072 | { |
| 1073 | /* NS toolbar auto-computes disabled and selected images */ | 1073 | /* NS toolbar auto-computes disabled and selected images. */ |
| 1074 | idx = TOOL_BAR_IMAGE_ENABLED_SELECTED; | 1074 | idx = TOOL_BAR_IMAGE_ENABLED_SELECTED; |
| 1075 | eassert (ASIZE (image) >= idx); | 1075 | eassert (ASIZE (image) >= idx); |
| 1076 | image = AREF (image, idx); | 1076 | image = AREF (image, idx); |
| @@ -1119,7 +1119,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1119 | #ifdef NS_IMPL_COCOA | 1119 | #ifdef NS_IMPL_COCOA |
| 1120 | if ([toolbar changed]) | 1120 | if ([toolbar changed]) |
| 1121 | { | 1121 | { |
| 1122 | /* inform app that toolbar has changed */ | 1122 | /* Inform app that toolbar has changed. */ |
| 1123 | NSDictionary *dict = [toolbar configurationDictionary]; | 1123 | NSDictionary *dict = [toolbar configurationDictionary]; |
| 1124 | NSMutableDictionary *newDict = [dict mutableCopy]; | 1124 | NSMutableDictionary *newDict = [dict mutableCopy]; |
| 1125 | NSEnumerator *keys = [[dict allKeys] objectEnumerator]; | 1125 | NSEnumerator *keys = [[dict allKeys] objectEnumerator]; |
| @@ -1252,7 +1252,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | /* This overrides super's implementation, which automatically sets | 1254 | /* This overrides super's implementation, which automatically sets |
| 1255 | all items to enabled state (for some reason). */ | 1255 | all items to enabled state (for some reason). */ |
| 1256 | - (void)validateVisibleItems | 1256 | - (void)validateVisibleItems |
| 1257 | { | 1257 | { |
| 1258 | NSTRACE ("[EmacsToolbar validateVisibleItems]"); | 1258 | NSTRACE ("[EmacsToolbar validateVisibleItems]"); |
| @@ -1267,7 +1267,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1267 | { | 1267 | { |
| 1268 | NSTRACE ("[EmacsToolbar toolbar: ...]"); | 1268 | NSTRACE ("[EmacsToolbar toolbar: ...]"); |
| 1269 | 1269 | ||
| 1270 | /* look up NSToolbarItem by identifier and return... */ | 1270 | /* Look up NSToolbarItem by identifier and return... */ |
| 1271 | return [identifierToItem objectForKey: itemIdentifier]; | 1271 | return [identifierToItem objectForKey: itemIdentifier]; |
| 1272 | } | 1272 | } |
| 1273 | 1273 | ||
| @@ -1275,7 +1275,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1275 | { | 1275 | { |
| 1276 | NSTRACE ("[EmacsToolbar toolbarDefaultItemIdentifiers:]"); | 1276 | NSTRACE ("[EmacsToolbar toolbarDefaultItemIdentifiers:]"); |
| 1277 | 1277 | ||
| 1278 | /* return entire set.. */ | 1278 | /* Return entire set. */ |
| 1279 | return activeIdentifiers; | 1279 | return activeIdentifiers; |
| 1280 | } | 1280 | } |
| 1281 | 1281 | ||
| @@ -1284,7 +1284,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1284 | { | 1284 | { |
| 1285 | NSTRACE ("[EmacsToolbar toolbarAllowedItemIdentifiers:]"); | 1285 | NSTRACE ("[EmacsToolbar toolbarAllowedItemIdentifiers:]"); |
| 1286 | 1286 | ||
| 1287 | /* return entire set... */ | 1287 | /* return entire set... */ |
| 1288 | return activeIdentifiers; | 1288 | return activeIdentifiers; |
| 1289 | //return [identifierToItem allKeys]; | 1289 | //return [identifierToItem allKeys]; |
| 1290 | } | 1290 | } |
| @@ -1313,7 +1313,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1313 | ========================================================================== */ | 1313 | ========================================================================== */ |
| 1314 | 1314 | ||
| 1315 | /* Needed because NeXTstep does not provide enough control over tooltip | 1315 | /* Needed because NeXTstep does not provide enough control over tooltip |
| 1316 | display. */ | 1316 | display. */ |
| 1317 | @implementation EmacsTooltip | 1317 | @implementation EmacsTooltip |
| 1318 | 1318 | ||
| 1319 | - (instancetype)init | 1319 | - (instancetype)init |
| @@ -1323,7 +1323,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1323 | NSFont *font = [NSFont toolTipsFontOfSize: 0]; | 1323 | NSFont *font = [NSFont toolTipsFontOfSize: 0]; |
| 1324 | NSFont *sfont = [font screenFont]; | 1324 | NSFont *sfont = [font screenFont]; |
| 1325 | int height = [sfont ascender] - [sfont descender]; | 1325 | int height = [sfont ascender] - [sfont descender]; |
| 1326 | /*[font boundingRectForFont].size.height; */ | 1326 | /* [font boundingRectForFont].size.height; */ |
| 1327 | NSRect r = NSMakeRect (0, 0, 100, height+6); | 1327 | NSRect r = NSMakeRect (0, 0, 100, height+6); |
| 1328 | 1328 | ||
| 1329 | textField = [[NSTextField alloc] initWithFrame: r]; | 1329 | textField = [[NSTextField alloc] initWithFrame: r]; |
| @@ -1345,7 +1345,7 @@ update_frame_tool_bar (struct frame *f) | |||
| 1345 | [win setReleasedWhenClosed: NO]; | 1345 | [win setReleasedWhenClosed: NO]; |
| 1346 | [win setDelegate: self]; | 1346 | [win setDelegate: self]; |
| 1347 | [[win contentView] addSubview: textField]; | 1347 | [[win contentView] addSubview: textField]; |
| 1348 | /* [win setBackgroundColor: col]; */ | 1348 | /* [win setBackgroundColor: col]; */ |
| 1349 | [win setOpaque: NO]; | 1349 | [win setOpaque: NO]; |
| 1350 | 1350 | ||
| 1351 | return self; | 1351 | return self; |
| @@ -1558,7 +1558,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1558 | [self setTitle: @""]; | 1558 | [self setTitle: @""]; |
| 1559 | 1559 | ||
| 1560 | area.origin.x += ICONSIZE+2*SPACER; | 1560 | area.origin.x += ICONSIZE+2*SPACER; |
| 1561 | /* area.origin.y = TEXTHEIGHT; ICONSIZE/2-10+SPACER; */ | 1561 | /* area.origin.y = TEXTHEIGHT; ICONSIZE/2-10+SPACER; */ |
| 1562 | area.size.width = 400; | 1562 | area.size.width = 400; |
| 1563 | area.size.height= TEXTHEIGHT; | 1563 | area.size.height= TEXTHEIGHT; |
| 1564 | command = [[[NSTextField alloc] initWithFrame: area] autorelease]; | 1564 | command = [[[NSTextField alloc] initWithFrame: area] autorelease]; |
| @@ -1569,16 +1569,16 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1569 | [command setSelectable: NO]; | 1569 | [command setSelectable: NO]; |
| 1570 | [command setFont: [NSFont boldSystemFontOfSize: 13.0]]; | 1570 | [command setFont: [NSFont boldSystemFontOfSize: 13.0]]; |
| 1571 | 1571 | ||
| 1572 | /* area.origin.x = ICONSIZE+2*SPACER; | 1572 | /* area.origin.x = ICONSIZE+2*SPACER; |
| 1573 | area.origin.y = TEXTHEIGHT + 2*SPACER; | 1573 | area.origin.y = TEXTHEIGHT + 2*SPACER; |
| 1574 | area.size.width = 400; | 1574 | area.size.width = 400; |
| 1575 | area.size.height= 2; | 1575 | area.size.height= 2; |
| 1576 | tem = [[[NSBox alloc] initWithFrame: area] autorelease]; | 1576 | tem = [[[NSBox alloc] initWithFrame: area] autorelease]; |
| 1577 | [[self contentView] addSubview: tem]; | 1577 | [[self contentView] addSubview: tem]; |
| 1578 | [tem setTitlePosition: NSNoTitle]; | 1578 | [tem setTitlePosition: NSNoTitle]; |
| 1579 | [tem setAutoresizingMask: NSViewWidthSizable];*/ | 1579 | [tem setAutoresizingMask: NSViewWidthSizable]; */ |
| 1580 | 1580 | ||
| 1581 | /* area.origin.x = ICONSIZE+2*SPACER; */ | 1581 | /* area.origin.x = ICONSIZE+2*SPACER; */ |
| 1582 | area.origin.y += TEXTHEIGHT+SPACER; | 1582 | area.origin.y += TEXTHEIGHT+SPACER; |
| 1583 | area.size.width = 400; | 1583 | area.size.width = 400; |
| 1584 | area.size.height= TEXTHEIGHT; | 1584 | area.size.height= TEXTHEIGHT; |
| @@ -1746,7 +1746,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1746 | int i; | 1746 | int i; |
| 1747 | NSRect r, s, t; | 1747 | NSRect r, s, t; |
| 1748 | 1748 | ||
| 1749 | if (cols == 1 && rows > 1) /* Never told where to split */ | 1749 | if (cols == 1 && rows > 1) /* Never told where to split. */ |
| 1750 | { | 1750 | { |
| 1751 | [matrix addColumn]; | 1751 | [matrix addColumn]; |
| 1752 | for (i = 0; i < rows/2; i++) | 1752 | for (i = 0; i < rows/2; i++) |
| @@ -1810,9 +1810,9 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1810 | data2: 0]; | 1810 | data2: 0]; |
| 1811 | 1811 | ||
| 1812 | timer_fired = YES; | 1812 | timer_fired = YES; |
| 1813 | /* We use sto because stopModal/abortModal out of the main loop does not | 1813 | /* We use stop because stopModal/abortModal out of the main loop |
| 1814 | seem to work in 10.6. But as we use stop we must send a real event so | 1814 | does not seem to work in 10.6. But as we use stop we must send a |
| 1815 | the stop is seen and acted upon. */ | 1815 | real event so the stop is seen and acted upon. */ |
| 1816 | [NSApp stop:self]; | 1816 | [NSApp stop:self]; |
| 1817 | [NSApp postEvent: nxev atStart: NO]; | 1817 | [NSApp postEvent: nxev atStart: NO]; |
| 1818 | } | 1818 | } |
| @@ -1843,7 +1843,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1843 | ret = dialog_return; | 1843 | ret = dialog_return; |
| 1844 | if (! timer_fired) | 1844 | if (! timer_fired) |
| 1845 | { | 1845 | { |
| 1846 | if (tmo != nil) [tmo invalidate]; /* Cancels timer */ | 1846 | if (tmo != nil) [tmo invalidate]; /* Cancels timer. */ |
| 1847 | break; | 1847 | break; |
| 1848 | } | 1848 | } |
| 1849 | } | 1849 | } |
| @@ -1874,7 +1874,7 @@ DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 0, 0, 0, | |||
| 1874 | 1874 | ||
| 1875 | 1875 | ||
| 1876 | DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, | 1876 | DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, |
| 1877 | doc: /* SKIP: real doc in xmenu.c. */) | 1877 | doc: /* SKIP: real doc in xmenu.c. */) |
| 1878 | (void) | 1878 | (void) |
| 1879 | { | 1879 | { |
| 1880 | return popup_activated () ? Qt : Qnil; | 1880 | return popup_activated () ? Qt : Qnil; |
diff --git a/src/nsselect.m b/src/nsselect.m index d8b4e2c7af8..c72f179ab38 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -36,7 +36,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 36 | 36 | ||
| 37 | static Lisp_Object Vselection_alist; | 37 | static Lisp_Object Vselection_alist; |
| 38 | 38 | ||
| 39 | /* NSPasteboardNameGeneral is pretty much analogous to X11 CLIPBOARD */ | 39 | /* NSPasteboardNameGeneral is pretty much analogous to X11 CLIPBOARD. */ |
| 40 | static NSString *NXPrimaryPboard; | 40 | static NSString *NXPrimaryPboard; |
| 41 | static NSString *NXSecondaryPboard; | 41 | static NSString *NXSecondaryPboard; |
| 42 | 42 | ||
diff --git a/src/nsterm.h b/src/nsterm.h index df59a7dbd9a..a9635374c78 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -29,7 +29,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 29 | 29 | ||
| 30 | /* CGFloat on GNUstep may be 4 or 8 byte, but functions expect float* for some | 30 | /* CGFloat on GNUstep may be 4 or 8 byte, but functions expect float* for some |
| 31 | versions. | 31 | versions. |
| 32 | On Cocoa >= 10.5, functions expect CGFloat *. Make compatible type. */ | 32 | On Cocoa >= 10.5, functions expect CGFloat *. Make compatible type. */ |
| 33 | #ifdef NS_IMPL_COCOA | 33 | #ifdef NS_IMPL_COCOA |
| 34 | typedef CGFloat EmacsCGFloat; | 34 | typedef CGFloat EmacsCGFloat; |
| 35 | #elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22 | 35 | #elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22 |
| @@ -85,7 +85,7 @@ typedef float EmacsCGFloat; | |||
| 85 | can become misaligned, as all threads (currently) share one state. | 85 | can become misaligned, as all threads (currently) share one state. |
| 86 | This is post prominent when the EVENTS part is enabled. | 86 | This is post prominent when the EVENTS part is enabled. |
| 87 | 87 | ||
| 88 | Note that the trace system, when enabled, use the GCC/Clang | 88 | Note that the trace system, when enabled, uses the GCC/Clang |
| 89 | "cleanup" extension. */ | 89 | "cleanup" extension. */ |
| 90 | 90 | ||
| 91 | /* For example, the following is the output of `M-x | 91 | /* For example, the following is the output of `M-x |
| @@ -170,7 +170,7 @@ void nstrace_leave(int *); | |||
| 170 | void nstrace_restore_global_trace_state(int *); | 170 | void nstrace_restore_global_trace_state(int *); |
| 171 | char const * nstrace_fullscreen_type_name (int); | 171 | char const * nstrace_fullscreen_type_name (int); |
| 172 | 172 | ||
| 173 | /* printf-style trace output. Output is aligned with contained heading. */ | 173 | /* printf-style trace output. Output is aligned with contained heading. */ |
| 174 | #define NSTRACE_MSG_NO_DASHES(...) \ | 174 | #define NSTRACE_MSG_NO_DASHES(...) \ |
| 175 | do \ | 175 | do \ |
| 176 | { \ | 176 | { \ |
| @@ -192,7 +192,7 @@ char const * nstrace_fullscreen_type_name (int); | |||
| 192 | /* Macros for printing complex types. | 192 | /* Macros for printing complex types. |
| 193 | 193 | ||
| 194 | NSTRACE_FMT_what -- Printf format string for "what". | 194 | NSTRACE_FMT_what -- Printf format string for "what". |
| 195 | NSTRACE_ARG_what(x) -- Printf argument for "what". */ | 195 | NSTRACE_ARG_what(x) -- Printf argument for "what". */ |
| 196 | 196 | ||
| 197 | #define NSTRACE_FMT_SIZE "(W:%.0f H:%.0f)" | 197 | #define NSTRACE_FMT_SIZE "(W:%.0f H:%.0f)" |
| 198 | #define NSTRACE_ARG_SIZE(elt) (elt).width, (elt).height | 198 | #define NSTRACE_ARG_SIZE(elt) (elt).width, (elt).height |
| @@ -208,7 +208,7 @@ char const * nstrace_fullscreen_type_name (int); | |||
| 208 | #define NSTRACE_ARG_FSTYPE(elt) nstrace_fullscreen_type_name(elt) | 208 | #define NSTRACE_ARG_FSTYPE(elt) nstrace_fullscreen_type_name(elt) |
| 209 | 209 | ||
| 210 | 210 | ||
| 211 | /* Macros for printing complex types as extra information. */ | 211 | /* Macros for printing complex types as extra information. */ |
| 212 | 212 | ||
| 213 | #define NSTRACE_SIZE(str,size) \ | 213 | #define NSTRACE_SIZE(str,size) \ |
| 214 | NSTRACE_MSG (str ": " NSTRACE_FMT_SIZE, \ | 214 | NSTRACE_MSG (str ": " NSTRACE_FMT_SIZE, \ |
| @@ -236,7 +236,7 @@ char const * nstrace_fullscreen_type_name (int); | |||
| 236 | 236 | ||
| 237 | NSTRACE_FMT_RETURN - A string literal representing a returned | 237 | NSTRACE_FMT_RETURN - A string literal representing a returned |
| 238 | value. Useful when creating a format string | 238 | value. Useful when creating a format string |
| 239 | to printf-like constructs like NSTRACE(). */ | 239 | to printf-like constructs like NSTRACE(). */ |
| 240 | 240 | ||
| 241 | #define NSTRACE_FMT_RETURN "->>" | 241 | #define NSTRACE_FMT_RETURN "->>" |
| 242 | 242 | ||
| @@ -262,7 +262,7 @@ char const * nstrace_fullscreen_type_name (int); | |||
| 262 | NSTRACE_WHEN (cond, fmt, ...) -- Enable trace output when COND is true. | 262 | NSTRACE_WHEN (cond, fmt, ...) -- Enable trace output when COND is true. |
| 263 | 263 | ||
| 264 | NSTRACE_UNLESS (cond, fmt, ...) -- Enable trace output unless COND is | 264 | NSTRACE_UNLESS (cond, fmt, ...) -- Enable trace output unless COND is |
| 265 | true. */ | 265 | true. */ |
| 266 | 266 | ||
| 267 | 267 | ||
| 268 | 268 | ||
| @@ -278,7 +278,7 @@ char const * nstrace_fullscreen_type_name (int); | |||
| 278 | /* Unsilence called functions. | 278 | /* Unsilence called functions. |
| 279 | 279 | ||
| 280 | Concretely, this us used to allow "event" functions to be silenced | 280 | Concretely, this us used to allow "event" functions to be silenced |
| 281 | while trace output can be printed for functions they call. */ | 281 | while trace output can be printed for functions they call. */ |
| 282 | #define NSTRACE_UNSILENCE() do { nstrace_enabled_global = 1; } while(0) | 282 | #define NSTRACE_UNSILENCE() do { nstrace_enabled_global = 1; } while(0) |
| 283 | 283 | ||
| 284 | #endif /* NSTRACE_ENABLED */ | 284 | #endif /* NSTRACE_ENABLED */ |
| @@ -286,7 +286,7 @@ char const * nstrace_fullscreen_type_name (int); | |||
| 286 | #define NSTRACE(...) NSTRACE_WHEN(1, __VA_ARGS__) | 286 | #define NSTRACE(...) NSTRACE_WHEN(1, __VA_ARGS__) |
| 287 | #define NSTRACE_UNLESS(cond, ...) NSTRACE_WHEN(!(cond), __VA_ARGS__) | 287 | #define NSTRACE_UNLESS(cond, ...) NSTRACE_WHEN(!(cond), __VA_ARGS__) |
| 288 | 288 | ||
| 289 | /* Non-trace replacement versions. */ | 289 | /* Non-trace replacement versions. */ |
| 290 | #ifndef NSTRACE_WHEN | 290 | #ifndef NSTRACE_WHEN |
| 291 | #define NSTRACE_WHEN(...) | 291 | #define NSTRACE_WHEN(...) |
| 292 | #endif | 292 | #endif |
| @@ -332,7 +332,7 @@ char const * nstrace_fullscreen_type_name (int); | |||
| 332 | #endif | 332 | #endif |
| 333 | 333 | ||
| 334 | 334 | ||
| 335 | /* If the compiler doesn't support instancetype, map it to id. */ | 335 | /* If the compiler doesn't support instancetype, map it to id. */ |
| 336 | #ifndef NATIVE_OBJC_INSTANCETYPE | 336 | #ifndef NATIVE_OBJC_INSTANCETYPE |
| 337 | typedef id instancetype; | 337 | typedef id instancetype; |
| 338 | #endif | 338 | #endif |
| @@ -356,7 +356,7 @@ typedef id instancetype; | |||
| 356 | 356 | ||
| 357 | ========================================================================== */ | 357 | ========================================================================== */ |
| 358 | 358 | ||
| 359 | /* We override sendEvent: as a means to stop/start the event loop */ | 359 | /* We override sendEvent: as a means to stop/start the event loop. */ |
| 360 | @interface EmacsApp : NSApplication | 360 | @interface EmacsApp : NSApplication |
| 361 | { | 361 | { |
| 362 | #ifdef NS_IMPL_COCOA | 362 | #ifdef NS_IMPL_COCOA |
| @@ -456,7 +456,7 @@ typedef id instancetype; | |||
| 456 | #endif | 456 | #endif |
| 457 | - (int)fullscreenState; | 457 | - (int)fullscreenState; |
| 458 | 458 | ||
| 459 | /* Non-notification versions of NSView methods. Used for direct calls. */ | 459 | /* Non-notification versions of NSView methods. Used for direct calls. */ |
| 460 | - (void)windowWillEnterFullScreen; | 460 | - (void)windowWillEnterFullScreen; |
| 461 | - (void)windowDidEnterFullScreen; | 461 | - (void)windowDidEnterFullScreen; |
| 462 | - (void)windowWillExitFullScreen; | 462 | - (void)windowWillExitFullScreen; |
| @@ -465,7 +465,7 @@ typedef id instancetype; | |||
| 465 | @end | 465 | @end |
| 466 | 466 | ||
| 467 | 467 | ||
| 468 | /* Small utility used for processing resize events under Cocoa. */ | 468 | /* Small utility used for processing resize events under Cocoa. */ |
| 469 | @interface EmacsWindow : NSWindow | 469 | @interface EmacsWindow : NSWindow |
| 470 | { | 470 | { |
| 471 | NSPoint grabOffset; | 471 | NSPoint grabOffset; |
| @@ -722,7 +722,7 @@ extern NSArray *ns_send_types, *ns_return_types; | |||
| 722 | extern NSString *ns_app_name; | 722 | extern NSString *ns_app_name; |
| 723 | extern EmacsMenu *svcsMenu; | 723 | extern EmacsMenu *svcsMenu; |
| 724 | 724 | ||
| 725 | /* Apple removed the declaration, but kept the implementation */ | 725 | /* Apple removed the declaration, but kept the implementation. */ |
| 726 | #if defined (NS_IMPL_COCOA) | 726 | #if defined (NS_IMPL_COCOA) |
| 727 | @interface NSApplication (EmacsApp) | 727 | @interface NSApplication (EmacsApp) |
| 728 | - (void)setAppleMenu: (NSMenu *)menu; | 728 | - (void)setAppleMenu: (NSMenu *)menu; |
| @@ -752,8 +752,8 @@ extern EmacsMenu *svcsMenu; | |||
| 752 | #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13) | 752 | #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13) |
| 753 | #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14) | 753 | #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14) |
| 754 | 754 | ||
| 755 | /* could use list to store these, but rest of emacs has a big infrastructure | 755 | /* Could use list to store these, but rest of emacs has a big infrastructure |
| 756 | for managing a table of bitmap "records" */ | 756 | for managing a table of bitmap "records". */ |
| 757 | struct ns_bitmap_record | 757 | struct ns_bitmap_record |
| 758 | { | 758 | { |
| 759 | #ifdef __OBJC__ | 759 | #ifdef __OBJC__ |
| @@ -766,7 +766,7 @@ struct ns_bitmap_record | |||
| 766 | int height, width, depth; | 766 | int height, width, depth; |
| 767 | }; | 767 | }; |
| 768 | 768 | ||
| 769 | /* this to map between emacs color indices and NSColor objects */ | 769 | /* This maps between emacs color indices and NSColor objects. */ |
| 770 | struct ns_color_table | 770 | struct ns_color_table |
| 771 | { | 771 | { |
| 772 | ptrdiff_t size; | 772 | ptrdiff_t size; |
| @@ -790,7 +790,7 @@ struct ns_color_table | |||
| 790 | #define BLUE_FROM_ULONG(color) ((color) & 0xff) | 790 | #define BLUE_FROM_ULONG(color) ((color) & 0xff) |
| 791 | 791 | ||
| 792 | /* Do not change `* 0x101' in the following lines to `<< 8'. If | 792 | /* Do not change `* 0x101' in the following lines to `<< 8'. If |
| 793 | changed, image masks in 1-bit depth will not work. */ | 793 | changed, image masks in 1-bit depth will not work. */ |
| 794 | #define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101) | 794 | #define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101) |
| 795 | #define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101) | 795 | #define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101) |
| 796 | #define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101) | 796 | #define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101) |
| @@ -802,7 +802,7 @@ struct nsfont_info | |||
| 802 | 802 | ||
| 803 | char *name; /* PostScript name, uniquely identifies on NS systems */ | 803 | char *name; /* PostScript name, uniquely identifies on NS systems */ |
| 804 | 804 | ||
| 805 | /* The following metrics are stored as float rather than int. */ | 805 | /* The following metrics are stored as float rather than int. */ |
| 806 | 806 | ||
| 807 | float width; /* Maximum advance for the font. */ | 807 | float width; /* Maximum advance for the font. */ |
| 808 | float height; | 808 | float height; |
| @@ -823,26 +823,26 @@ struct nsfont_info | |||
| 823 | char bold, ital; /* convenience flags */ | 823 | char bold, ital; /* convenience flags */ |
| 824 | char synthItal; | 824 | char synthItal; |
| 825 | XCharStruct max_bounds; | 825 | XCharStruct max_bounds; |
| 826 | /* we compute glyph codes and metrics on-demand in blocks of 256 indexed | 826 | /* We compute glyph codes and metrics on-demand in blocks of 256 indexed |
| 827 | by hibyte, lobyte */ | 827 | by hibyte, lobyte. */ |
| 828 | unsigned short **glyphs; /* map Unicode index to glyph */ | 828 | unsigned short **glyphs; /* map Unicode index to glyph */ |
| 829 | struct font_metrics **metrics; | 829 | struct font_metrics **metrics; |
| 830 | }; | 830 | }; |
| 831 | 831 | ||
| 832 | 832 | ||
| 833 | /* init'd in ns_initialize_display_info () */ | 833 | /* Initialized in ns_initialize_display_info (). */ |
| 834 | struct ns_display_info | 834 | struct ns_display_info |
| 835 | { | 835 | { |
| 836 | /* Chain of all ns_display_info structures. */ | 836 | /* Chain of all ns_display_info structures. */ |
| 837 | struct ns_display_info *next; | 837 | struct ns_display_info *next; |
| 838 | 838 | ||
| 839 | /* The generic display parameters corresponding to this NS display. */ | 839 | /* The generic display parameters corresponding to this NS display. */ |
| 840 | struct terminal *terminal; | 840 | struct terminal *terminal; |
| 841 | 841 | ||
| 842 | /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */ | 842 | /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */ |
| 843 | Lisp_Object name_list_element; | 843 | Lisp_Object name_list_element; |
| 844 | 844 | ||
| 845 | /* The number of fonts loaded. */ | 845 | /* The number of fonts loaded. */ |
| 846 | int n_fonts; | 846 | int n_fonts; |
| 847 | 847 | ||
| 848 | /* Minimum width over all characters in all fonts in font_table. */ | 848 | /* Minimum width over all characters in all fonts in font_table. */ |
| @@ -872,10 +872,10 @@ struct ns_display_info | |||
| 872 | /* Xism */ | 872 | /* Xism */ |
| 873 | XrmDatabase xrdb; | 873 | XrmDatabase xrdb; |
| 874 | 874 | ||
| 875 | /* The cursor to use for vertical scroll bars. */ | 875 | /* The cursor to use for vertical scroll bars. */ |
| 876 | Cursor vertical_scroll_bar_cursor; | 876 | Cursor vertical_scroll_bar_cursor; |
| 877 | 877 | ||
| 878 | /* The cursor to use for horizontal scroll bars. */ | 878 | /* The cursor to use for horizontal scroll bars. */ |
| 879 | Cursor horizontal_scroll_bar_cursor; | 879 | Cursor horizontal_scroll_bar_cursor; |
| 880 | 880 | ||
| 881 | /* Information about the range of text currently shown in | 881 | /* Information about the range of text currently shown in |
| @@ -931,7 +931,7 @@ struct ns_output | |||
| 931 | void *toolbar; | 931 | void *toolbar; |
| 932 | #endif | 932 | #endif |
| 933 | 933 | ||
| 934 | /* NSCursors init'ed in initFrameFromEmacs */ | 934 | /* NSCursors are initialized in initFrameFromEmacs. */ |
| 935 | Cursor text_cursor; | 935 | Cursor text_cursor; |
| 936 | Cursor nontext_cursor; | 936 | Cursor nontext_cursor; |
| 937 | Cursor modeline_cursor; | 937 | Cursor modeline_cursor; |
| @@ -969,10 +969,10 @@ struct ns_output | |||
| 969 | scroll bars, in pixels. */ | 969 | scroll bars, in pixels. */ |
| 970 | int vertical_scroll_bar_extra; | 970 | int vertical_scroll_bar_extra; |
| 971 | 971 | ||
| 972 | /* The height of the titlebar decoration (included in NSWindow's frame). */ | 972 | /* The height of the titlebar decoration (included in NSWindow's frame). */ |
| 973 | int titlebar_height; | 973 | int titlebar_height; |
| 974 | 974 | ||
| 975 | /* The height of the toolbar if displayed, else 0. */ | 975 | /* The height of the toolbar if displayed, else 0. */ |
| 976 | int toolbar_height; | 976 | int toolbar_height; |
| 977 | 977 | ||
| 978 | /* This is the Emacs structure for the NS display this frame is on. */ | 978 | /* This is the Emacs structure for the NS display this frame is on. */ |
| @@ -981,11 +981,11 @@ struct ns_output | |||
| 981 | /* Non-zero if we are zooming (maximizing) the frame. */ | 981 | /* Non-zero if we are zooming (maximizing) the frame. */ |
| 982 | int zooming; | 982 | int zooming; |
| 983 | 983 | ||
| 984 | /* Non-zero if we are doing an animation, e.g. toggling the tool bar. */ | 984 | /* Non-zero if we are doing an animation, e.g. toggling the tool bar. */ |
| 985 | int in_animation; | 985 | int in_animation; |
| 986 | }; | 986 | }; |
| 987 | 987 | ||
| 988 | /* this dummy decl needed to support TTYs */ | 988 | /* This dummy declaration needed to support TTYs. */ |
| 989 | struct x_output | 989 | struct x_output |
| 990 | { | 990 | { |
| 991 | int unused; | 991 | int unused; |
| @@ -1024,7 +1024,7 @@ struct x_output | |||
| 1024 | #define XNS_SCROLL_BAR(vec) XSAVE_POINTER (vec, 0) | 1024 | #define XNS_SCROLL_BAR(vec) XSAVE_POINTER (vec, 0) |
| 1025 | #endif | 1025 | #endif |
| 1026 | 1026 | ||
| 1027 | /* Compute pixel height of the frame's titlebar. */ | 1027 | /* Compute pixel height of the frame's titlebar. */ |
| 1028 | #define FRAME_NS_TITLEBAR_HEIGHT(f) \ | 1028 | #define FRAME_NS_TITLEBAR_HEIGHT(f) \ |
| 1029 | (NSHeight([FRAME_NS_VIEW (f) frame]) == 0 ? \ | 1029 | (NSHeight([FRAME_NS_VIEW (f) frame]) == 0 ? \ |
| 1030 | 0 \ | 1030 | 0 \ |
| @@ -1033,7 +1033,7 @@ struct x_output | |||
| 1033 | [[FRAME_NS_VIEW (f) window] frame] \ | 1033 | [[FRAME_NS_VIEW (f) window] frame] \ |
| 1034 | styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]))) | 1034 | styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]))) |
| 1035 | 1035 | ||
| 1036 | /* Compute pixel height of the toolbar. */ | 1036 | /* Compute pixel height of the toolbar. */ |
| 1037 | #define FRAME_TOOLBAR_HEIGHT(f) \ | 1037 | #define FRAME_TOOLBAR_HEIGHT(f) \ |
| 1038 | (([[FRAME_NS_VIEW (f) window] toolbar] == nil \ | 1038 | (([[FRAME_NS_VIEW (f) window] toolbar] == nil \ |
| 1039 | || ! [[FRAME_NS_VIEW (f) window] toolbar].isVisible) ? \ | 1039 | || ! [[FRAME_NS_VIEW (f) window] toolbar].isVisible) ? \ |
| @@ -1043,7 +1043,7 @@ struct x_output | |||
| 1043 | styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]) \ | 1043 | styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]) \ |
| 1044 | - NSHeight([[[FRAME_NS_VIEW (f) window] contentView] frame]))) | 1044 | - NSHeight([[[FRAME_NS_VIEW (f) window] contentView] frame]))) |
| 1045 | 1045 | ||
| 1046 | /* Compute pixel size for vertical scroll bars */ | 1046 | /* Compute pixel size for vertical scroll bars. */ |
| 1047 | #define NS_SCROLL_BAR_WIDTH(f) \ | 1047 | #define NS_SCROLL_BAR_WIDTH(f) \ |
| 1048 | (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ | 1048 | (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ |
| 1049 | ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \ | 1049 | ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \ |
| @@ -1051,7 +1051,7 @@ struct x_output | |||
| 1051 | : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \ | 1051 | : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \ |
| 1052 | : 0) | 1052 | : 0) |
| 1053 | 1053 | ||
| 1054 | /* Compute pixel size for horizontal scroll bars */ | 1054 | /* Compute pixel size for horizontal scroll bars. */ |
| 1055 | #define NS_SCROLL_BAR_HEIGHT(f) \ | 1055 | #define NS_SCROLL_BAR_HEIGHT(f) \ |
| 1056 | (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \ | 1056 | (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \ |
| 1057 | ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 \ | 1057 | ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 \ |
| @@ -1059,22 +1059,22 @@ struct x_output | |||
| 1059 | : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))) \ | 1059 | : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))) \ |
| 1060 | : 0) | 1060 | : 0) |
| 1061 | 1061 | ||
| 1062 | /* Difference btwn char-column-calculated and actual SB widths. | 1062 | /* Difference between char-column-calculated and actual SB widths. |
| 1063 | This is only a concern for rendering when SB on left. */ | 1063 | This is only a concern for rendering when SB on left. */ |
| 1064 | #define NS_SCROLL_BAR_ADJUST(w, f) \ | 1064 | #define NS_SCROLL_BAR_ADJUST(w, f) \ |
| 1065 | (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) ? \ | 1065 | (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) ? \ |
| 1066 | (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) \ | 1066 | (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) \ |
| 1067 | - NS_SCROLL_BAR_WIDTH (f)) : 0) | 1067 | - NS_SCROLL_BAR_WIDTH (f)) : 0) |
| 1068 | 1068 | ||
| 1069 | /* Difference btwn char-line-calculated and actual SB heights. | 1069 | /* Difference between char-line-calculated and actual SB heights. |
| 1070 | This is only a concern for rendering when SB on top. */ | 1070 | This is only a concern for rendering when SB on top. */ |
| 1071 | #define NS_SCROLL_BAR_ADJUST_HORIZONTALLY(w, f) \ | 1071 | #define NS_SCROLL_BAR_ADJUST_HORIZONTALLY(w, f) \ |
| 1072 | (WINDOW_HAS_HORIZONTAL_SCROLL_BARS (w) ? \ | 1072 | (WINDOW_HAS_HORIZONTAL_SCROLL_BARS (w) ? \ |
| 1073 | (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f) \ | 1073 | (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f) \ |
| 1074 | - NS_SCROLL_BAR_HEIGHT (f)) : 0) | 1074 | - NS_SCROLL_BAR_HEIGHT (f)) : 0) |
| 1075 | 1075 | ||
| 1076 | /* Calculate system coordinates of the left and top of the parent | 1076 | /* Calculate system coordinates of the left and top of the parent |
| 1077 | window or, if there is no parent window, the screen. */ | 1077 | window or, if there is no parent window, the screen. */ |
| 1078 | #define NS_PARENT_WINDOW_LEFT_POS(f) \ | 1078 | #define NS_PARENT_WINDOW_LEFT_POS(f) \ |
| 1079 | (FRAME_PARENT_FRAME (f) != NULL \ | 1079 | (FRAME_PARENT_FRAME (f) != NULL \ |
| 1080 | ? [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window].frame.origin.x : 0) | 1080 | ? [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window].frame.origin.x : 0) |
| @@ -1094,7 +1094,7 @@ struct x_output | |||
| 1094 | #define WHITE_PIX_DEFAULT(f) 0xFFFFFF | 1094 | #define WHITE_PIX_DEFAULT(f) 0xFFFFFF |
| 1095 | 1095 | ||
| 1096 | /* First position where characters can be shown (instead of scrollbar, if | 1096 | /* First position where characters can be shown (instead of scrollbar, if |
| 1097 | it is on left. */ | 1097 | it is on left. */ |
| 1098 | #define FIRST_CHAR_POSITION(f) \ | 1098 | #define FIRST_CHAR_POSITION(f) \ |
| 1099 | (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \ | 1099 | (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \ |
| 1100 | : FRAME_SCROLL_BAR_COLS (f)) | 1100 | : FRAME_SCROLL_BAR_COLS (f)) |
| @@ -1118,7 +1118,7 @@ extern void nsfont_make_fontset_for_font (Lisp_Object name, | |||
| 1118 | struct glyph_string; | 1118 | struct glyph_string; |
| 1119 | void ns_dump_glyphstring (struct glyph_string *s) EXTERNALLY_VISIBLE; | 1119 | void ns_dump_glyphstring (struct glyph_string *s) EXTERNALLY_VISIBLE; |
| 1120 | 1120 | ||
| 1121 | /* Implemented in nsterm, published in or needed from nsfns. */ | 1121 | /* Implemented in nsterm, published in or needed from nsfns. */ |
| 1122 | extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern, | 1122 | extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern, |
| 1123 | int size, int maxnames); | 1123 | int size, int maxnames); |
| 1124 | extern void ns_clear_frame (struct frame *f); | 1124 | extern void ns_clear_frame (struct frame *f); |
| @@ -1251,13 +1251,13 @@ extern char gnustep_base_version[]; /* version tracking */ | |||
| 1251 | #define MINWIDTH 10 | 1251 | #define MINWIDTH 10 |
| 1252 | #define MINHEIGHT 10 | 1252 | #define MINHEIGHT 10 |
| 1253 | 1253 | ||
| 1254 | /* Screen max coordinate | 1254 | /* Screen max coordinate -- using larger coordinates causes |
| 1255 | Using larger coordinates causes movewindow/placewindow to abort */ | 1255 | movewindow/placewindow to abort. */ |
| 1256 | #define SCREENMAX 16000 | 1256 | #define SCREENMAX 16000 |
| 1257 | 1257 | ||
| 1258 | #define NS_SCROLL_BAR_WIDTH_DEFAULT [EmacsScroller scrollerWidth] | 1258 | #define NS_SCROLL_BAR_WIDTH_DEFAULT [EmacsScroller scrollerWidth] |
| 1259 | #define NS_SCROLL_BAR_HEIGHT_DEFAULT [EmacsScroller scrollerHeight] | 1259 | #define NS_SCROLL_BAR_HEIGHT_DEFAULT [EmacsScroller scrollerHeight] |
| 1260 | /* This is to match emacs on other platforms, ugly though it is. */ | 1260 | /* This is to match emacs on other platforms, ugly though it is. */ |
| 1261 | #define NS_SELECTION_BG_COLOR_DEFAULT @"LightGoldenrod2"; | 1261 | #define NS_SELECTION_BG_COLOR_DEFAULT @"LightGoldenrod2"; |
| 1262 | #define NS_SELECTION_FG_COLOR_DEFAULT @"Black"; | 1262 | #define NS_SELECTION_FG_COLOR_DEFAULT @"Black"; |
| 1263 | #define RESIZE_HANDLE_SIZE 12 | 1263 | #define RESIZE_HANDLE_SIZE 12 |
| @@ -1267,7 +1267,7 @@ extern char gnustep_base_version[]; /* version tracking */ | |||
| 1267 | ? (min) : (((x)>(max)) ? (max) : (x))) | 1267 | ? (min) : (((x)>(max)) ? (max) : (x))) |
| 1268 | #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX)) | 1268 | #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX)) |
| 1269 | 1269 | ||
| 1270 | /* macOS 10.7 introduces some new constants. */ | 1270 | /* macOS 10.7 introduces some new constants. */ |
| 1271 | #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_7) | 1271 | #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_7) |
| 1272 | #define NSFullScreenWindowMask (1 << 14) | 1272 | #define NSFullScreenWindowMask (1 << 14) |
| 1273 | #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) | 1273 | #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) |
| @@ -1276,7 +1276,7 @@ extern char gnustep_base_version[]; /* version tracking */ | |||
| 1276 | #define NSAppKitVersionNumber10_7 1138 | 1276 | #define NSAppKitVersionNumber10_7 1138 |
| 1277 | #endif /* !defined (MAC_OS_X_VERSION_10_7) */ | 1277 | #endif /* !defined (MAC_OS_X_VERSION_10_7) */ |
| 1278 | 1278 | ||
| 1279 | /* macOS 10.12 deprecates a bunch of constants. */ | 1279 | /* macOS 10.12 deprecates a bunch of constants. */ |
| 1280 | #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12) | 1280 | #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12) |
| 1281 | #define NSEventModifierFlagCommand NSCommandKeyMask | 1281 | #define NSEventModifierFlagCommand NSCommandKeyMask |
| 1282 | #define NSEventModifierFlagControl NSControlKeyMask | 1282 | #define NSEventModifierFlagControl NSControlKeyMask |
| @@ -1315,12 +1315,12 @@ extern char gnustep_base_version[]; /* version tracking */ | |||
| 1315 | #define NSControlSizeRegular NSRegularControlSize | 1315 | #define NSControlSizeRegular NSRegularControlSize |
| 1316 | #define NSCompositingOperationCopy NSCompositeCopy | 1316 | #define NSCompositingOperationCopy NSCompositeCopy |
| 1317 | 1317 | ||
| 1318 | /* And adds NSWindowStyleMask. */ | 1318 | /* And adds NSWindowStyleMask. */ |
| 1319 | #ifdef __OBJC__ | 1319 | #ifdef __OBJC__ |
| 1320 | typedef NSUInteger NSWindowStyleMask; | 1320 | typedef NSUInteger NSWindowStyleMask; |
| 1321 | #endif | 1321 | #endif |
| 1322 | 1322 | ||
| 1323 | /* Window tabbing mode enums are new too. */ | 1323 | /* Window tabbing mode enums are new too. */ |
| 1324 | enum NSWindowTabbingMode | 1324 | enum NSWindowTabbingMode |
| 1325 | { | 1325 | { |
| 1326 | NSWindowTabbingModeAutomatic, | 1326 | NSWindowTabbingModeAutomatic, |
diff --git a/src/nsterm.m b/src/nsterm.m index f9107c43ce1..d6c1d72a631 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -27,7 +27,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | /* This should be the first include, as it may set up #defines affecting | 29 | /* This should be the first include, as it may set up #defines affecting |
| 30 | interpretation of even the system includes. */ | 30 | interpretation of even the system includes. */ |
| 31 | #include <config.h> | 31 | #include <config.h> |
| 32 | 32 | ||
| 33 | #include <fcntl.h> | 33 | #include <fcntl.h> |
| @@ -84,7 +84,7 @@ static EmacsMenu *mainMenu; | |||
| 84 | #if NSTRACE_ENABLED | 84 | #if NSTRACE_ENABLED |
| 85 | 85 | ||
| 86 | /* The following use "volatile" since they can be accessed from | 86 | /* The following use "volatile" since they can be accessed from |
| 87 | parallel threads. */ | 87 | parallel threads. */ |
| 88 | volatile int nstrace_num = 0; | 88 | volatile int nstrace_num = 0; |
| 89 | volatile int nstrace_depth = 0; | 89 | volatile int nstrace_depth = 0; |
| 90 | 90 | ||
| @@ -93,10 +93,10 @@ volatile int nstrace_depth = 0; | |||
| 93 | 93 | ||
| 94 | TODO: This should really be a thread-local variable, to avoid that | 94 | TODO: This should really be a thread-local variable, to avoid that |
| 95 | a function with disabled trace thread silence trace output in | 95 | a function with disabled trace thread silence trace output in |
| 96 | another. However, in practice this seldom is a problem. */ | 96 | another. However, in practice this seldom is a problem. */ |
| 97 | volatile int nstrace_enabled_global = 1; | 97 | volatile int nstrace_enabled_global = 1; |
| 98 | 98 | ||
| 99 | /* Called when nstrace_enabled goes out of scope. */ | 99 | /* Called when nstrace_enabled goes out of scope. */ |
| 100 | void nstrace_leave(int * pointer_to_nstrace_enabled) | 100 | void nstrace_leave(int * pointer_to_nstrace_enabled) |
| 101 | { | 101 | { |
| 102 | if (*pointer_to_nstrace_enabled) | 102 | if (*pointer_to_nstrace_enabled) |
| @@ -106,7 +106,7 @@ void nstrace_leave(int * pointer_to_nstrace_enabled) | |||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | /* Called when nstrace_saved_enabled_global goes out of scope. */ | 109 | /* Called when nstrace_saved_enabled_global goes out of scope. */ |
| 110 | void nstrace_restore_global_trace_state(int * pointer_to_saved_enabled_global) | 110 | void nstrace_restore_global_trace_state(int * pointer_to_saved_enabled_global) |
| 111 | { | 111 | { |
| 112 | nstrace_enabled_global = *pointer_to_saved_enabled_global; | 112 | nstrace_enabled_global = *pointer_to_saved_enabled_global; |
| @@ -161,7 +161,7 @@ char const * nstrace_fullscreen_type_name (int fs_type) | |||
| 161 | { | 161 | { |
| 162 | /* FIXMES: We're checking for colorWithSRGBRed here so this will | 162 | /* FIXMES: We're checking for colorWithSRGBRed here so this will |
| 163 | only work in the same place as in the method above. It should | 163 | only work in the same place as in the method above. It should |
| 164 | really be a check whether we're on macOS 10.7 or above. */ | 164 | really be a check whether we're on macOS 10.7 or above. */ |
| 165 | #if defined (NS_IMPL_COCOA) \ | 165 | #if defined (NS_IMPL_COCOA) \ |
| 166 | && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 | 166 | && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 |
| 167 | if (ns_use_srgb_colorspace | 167 | if (ns_use_srgb_colorspace |
| @@ -185,7 +185,7 @@ char const * nstrace_fullscreen_type_name (int fs_type) | |||
| 185 | 185 | ||
| 186 | /* Convert a symbol indexed with an NSxxx value to a value as defined | 186 | /* Convert a symbol indexed with an NSxxx value to a value as defined |
| 187 | in keyboard.c (lispy_function_key). I hope this is a correct way | 187 | in keyboard.c (lispy_function_key). I hope this is a correct way |
| 188 | of doing things... */ | 188 | of doing things... */ |
| 189 | static unsigned convert_ns_to_X_keysym[] = | 189 | static unsigned convert_ns_to_X_keysym[] = |
| 190 | { | 190 | { |
| 191 | NSHomeFunctionKey, 0x50, | 191 | NSHomeFunctionKey, 0x50, |
| @@ -234,9 +234,9 @@ static unsigned convert_ns_to_X_keysym[] = | |||
| 234 | NSF23FunctionKey, 0xD4, | 234 | NSF23FunctionKey, 0xD4, |
| 235 | NSF24FunctionKey, 0xD5, | 235 | NSF24FunctionKey, 0xD5, |
| 236 | 236 | ||
| 237 | NSBackspaceCharacter, 0x08, /* 8: Not on some KBs. */ | 237 | NSBackspaceCharacter, 0x08, /* 8: Not on some KBs. */ |
| 238 | NSDeleteCharacter, 0xFF, /* 127: Big 'delete' key upper right. */ | 238 | NSDeleteCharacter, 0xFF, /* 127: Big 'delete' key upper right. */ |
| 239 | NSDeleteFunctionKey, 0x9F, /* 63272: Del forw key off main array. */ | 239 | NSDeleteFunctionKey, 0x9F, /* 63272: Del forw key off main array. */ |
| 240 | 240 | ||
| 241 | NSTabCharacter, 0x09, | 241 | NSTabCharacter, 0x09, |
| 242 | 0x19, 0x09, /* left tab->regular since pass shift */ | 242 | 0x19, 0x09, /* left tab->regular since pass shift */ |
| @@ -266,7 +266,7 @@ static unsigned convert_ns_to_X_keysym[] = | |||
| 266 | 266 | ||
| 267 | /* On macOS picks up the default NSGlobalDomain AppleAntiAliasingThreshold, | 267 | /* On macOS picks up the default NSGlobalDomain AppleAntiAliasingThreshold, |
| 268 | the maximum font size to NOT antialias. On GNUstep there is currently | 268 | the maximum font size to NOT antialias. On GNUstep there is currently |
| 269 | no way to control this behavior. */ | 269 | no way to control this behavior. */ |
| 270 | float ns_antialias_threshold; | 270 | float ns_antialias_threshold; |
| 271 | 271 | ||
| 272 | NSArray *ns_send_types = 0, *ns_return_types = 0; | 272 | NSArray *ns_send_types = 0, *ns_return_types = 0; |
| @@ -292,7 +292,7 @@ static BOOL ns_menu_bar_is_hidden = NO; | |||
| 292 | /* The number of times NSDisableScreenUpdates has been called. */ | 292 | /* The number of times NSDisableScreenUpdates has been called. */ |
| 293 | static int disable_screen_updates_count = 0; | 293 | static int disable_screen_updates_count = 0; |
| 294 | #endif | 294 | #endif |
| 295 | /*static int debug_lock = 0; */ | 295 | /* static int debug_lock = 0; */ |
| 296 | 296 | ||
| 297 | /* event loop */ | 297 | /* event loop */ |
| 298 | static BOOL send_appdefined = YES; | 298 | static BOOL send_appdefined = YES; |
| @@ -424,7 +424,7 @@ ev_modifiers_helper (unsigned int flags, unsigned int left_mask, | |||
| 424 | (([e type] == NSEventTypeRightMouseDown) || ([e type] == NSEventTypeRightMouseUp)) ? 2 : \ | 424 | (([e type] == NSEventTypeRightMouseDown) || ([e type] == NSEventTypeRightMouseUp)) ? 2 : \ |
| 425 | [e buttonNumber] - 1) | 425 | [e buttonNumber] - 1) |
| 426 | 426 | ||
| 427 | /* Convert the time field to a timestamp in milliseconds. */ | 427 | /* Convert the time field to a timestamp in milliseconds. */ |
| 428 | #define EV_TIMESTAMP(e) ([e timestamp] * 1000) | 428 | #define EV_TIMESTAMP(e) ([e timestamp] * 1000) |
| 429 | 429 | ||
| 430 | /* This is a piece of code which is common to all the event handling | 430 | /* This is a piece of code which is common to all the event handling |
| @@ -454,14 +454,14 @@ ev_modifiers_helper (unsigned int flags, unsigned int left_mask, | |||
| 454 | 454 | ||
| 455 | 455 | ||
| 456 | /* These flags will be OR'd or XOR'd with the NSWindow's styleMask | 456 | /* These flags will be OR'd or XOR'd with the NSWindow's styleMask |
| 457 | property depending on what we're doing. */ | 457 | property depending on what we're doing. */ |
| 458 | #define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \ | 458 | #define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \ |
| 459 | | NSWindowStyleMaskResizable \ | 459 | | NSWindowStyleMaskResizable \ |
| 460 | | NSWindowStyleMaskMiniaturizable \ | 460 | | NSWindowStyleMaskMiniaturizable \ |
| 461 | | NSWindowStyleMaskClosable) | 461 | | NSWindowStyleMaskClosable) |
| 462 | #define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless | 462 | #define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless |
| 463 | 463 | ||
| 464 | /* TODO: get rid of need for these forward declarations */ | 464 | /* TODO: Get rid of need for these forward declarations. */ |
| 465 | static void ns_condemn_scroll_bars (struct frame *f); | 465 | static void ns_condemn_scroll_bars (struct frame *f); |
| 466 | static void ns_judge_scroll_bars (struct frame *f); | 466 | static void ns_judge_scroll_bars (struct frame *f); |
| 467 | 467 | ||
| @@ -665,7 +665,7 @@ ns_load_path (void) | |||
| 665 | void | 665 | void |
| 666 | ns_init_locale (void) | 666 | ns_init_locale (void) |
| 667 | /* macOS doesn't set any environment variables for the locale when run | 667 | /* macOS doesn't set any environment variables for the locale when run |
| 668 | from the GUI. Get the locale from the OS and set LANG. */ | 668 | from the GUI. Get the locale from the OS and set LANG. */ |
| 669 | { | 669 | { |
| 670 | NSLocale *locale = [NSLocale currentLocale]; | 670 | NSLocale *locale = [NSLocale currentLocale]; |
| 671 | 671 | ||
| @@ -676,11 +676,11 @@ ns_init_locale (void) | |||
| 676 | /* It seems macOS should probably use UTF-8 everywhere. | 676 | /* It seems macOS should probably use UTF-8 everywhere. |
| 677 | 'localeIdentifier' does not specify the encoding, and I can't | 677 | 'localeIdentifier' does not specify the encoding, and I can't |
| 678 | find any way to get the OS to tell us which encoding to use, | 678 | find any way to get the OS to tell us which encoding to use, |
| 679 | so hard-code '.UTF-8'. */ | 679 | so hard-code '.UTF-8'. */ |
| 680 | NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8", | 680 | NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8", |
| 681 | [locale localeIdentifier]]; | 681 | [locale localeIdentifier]]; |
| 682 | 682 | ||
| 683 | /* Set LANG to locale, but not if LANG is already set. */ | 683 | /* Set LANG to locale, but not if LANG is already set. */ |
| 684 | setenv("LANG", [localeID UTF8String], 0); | 684 | setenv("LANG", [localeID UTF8String], 0); |
| 685 | } | 685 | } |
| 686 | @catch (NSException *e) | 686 | @catch (NSException *e) |
| @@ -703,7 +703,7 @@ ns_release_object (void *obj) | |||
| 703 | void | 703 | void |
| 704 | ns_retain_object (void *obj) | 704 | ns_retain_object (void *obj) |
| 705 | /* -------------------------------------------------------------------------- | 705 | /* -------------------------------------------------------------------------- |
| 706 | Retain an object (callable from C) | 706 | Retain an object (callable from C) |
| 707 | -------------------------------------------------------------------------- */ | 707 | -------------------------------------------------------------------------- */ |
| 708 | { | 708 | { |
| 709 | [(id)obj retain]; | 709 | [(id)obj retain]; |
| @@ -836,7 +836,7 @@ ns_screen_margins (NSScreen *screen) | |||
| 836 | static struct EmacsMargins | 836 | static struct EmacsMargins |
| 837 | ns_screen_margins_ignoring_hidden_dock (NSScreen *screen) | 837 | ns_screen_margins_ignoring_hidden_dock (NSScreen *screen) |
| 838 | /* The parts of SCREEN used by the operating system, excluding the parts | 838 | /* The parts of SCREEN used by the operating system, excluding the parts |
| 839 | reserved for an hidden dock. */ | 839 | reserved for a hidden dock. */ |
| 840 | { | 840 | { |
| 841 | NSTRACE ("ns_screen_margins_ignoring_hidden_dock"); | 841 | NSTRACE ("ns_screen_margins_ignoring_hidden_dock"); |
| 842 | 842 | ||
| @@ -1297,13 +1297,13 @@ ns_focus (struct frame *f, NSRect *r, int n) | |||
| 1297 | { | 1297 | { |
| 1298 | [focus_view unlockFocus]; | 1298 | [focus_view unlockFocus]; |
| 1299 | [[focus_view window] flushWindow]; | 1299 | [[focus_view window] flushWindow]; |
| 1300 | /*debug_lock--; */ | 1300 | /* debug_lock--; */ |
| 1301 | } | 1301 | } |
| 1302 | 1302 | ||
| 1303 | if (view) | 1303 | if (view) |
| 1304 | [view lockFocus]; | 1304 | [view lockFocus]; |
| 1305 | focus_view = view; | 1305 | focus_view = view; |
| 1306 | /*if (view) debug_lock++; */ | 1306 | /* if (view) debug_lock++; */ |
| 1307 | } | 1307 | } |
| 1308 | } | 1308 | } |
| 1309 | 1309 | ||
| @@ -1341,7 +1341,7 @@ ns_unfocus (struct frame *f) | |||
| 1341 | [focus_view unlockFocus]; | 1341 | [focus_view unlockFocus]; |
| 1342 | [[focus_view window] flushWindow]; | 1342 | [[focus_view window] flushWindow]; |
| 1343 | focus_view = NULL; | 1343 | focus_view = NULL; |
| 1344 | /*debug_lock--; */ | 1344 | /* debug_lock--; */ |
| 1345 | } | 1345 | } |
| 1346 | } | 1346 | } |
| 1347 | } | 1347 | } |
| @@ -1399,7 +1399,7 @@ ns_clip_to_row (struct window *w, struct glyph_row *row, | |||
| 1399 | 1399 | ||
| 1400 | @interface EmacsBell : NSImageView | 1400 | @interface EmacsBell : NSImageView |
| 1401 | { | 1401 | { |
| 1402 | // Number of currently active bell:s. | 1402 | // Number of currently active bells. |
| 1403 | unsigned int nestCount; | 1403 | unsigned int nestCount; |
| 1404 | NSView * mView; | 1404 | NSView * mView; |
| 1405 | bool isAttached; | 1405 | bool isAttached; |
| @@ -1660,7 +1660,7 @@ x_make_frame_visible (struct frame *f) | |||
| 1660 | NSTRACE ("x_make_frame_visible"); | 1660 | NSTRACE ("x_make_frame_visible"); |
| 1661 | /* XXX: at some points in past this was not needed, as the only place that | 1661 | /* XXX: at some points in past this was not needed, as the only place that |
| 1662 | called this (frame.c:Fraise_frame ()) also called raise_lower; | 1662 | called this (frame.c:Fraise_frame ()) also called raise_lower; |
| 1663 | if this ends up the case again, comment this out again. */ | 1663 | if this ends up the case again, comment this out again. */ |
| 1664 | if (!FRAME_VISIBLE_P (f)) | 1664 | if (!FRAME_VISIBLE_P (f)) |
| 1665 | { | 1665 | { |
| 1666 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | 1666 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); |
| @@ -1683,7 +1683,7 @@ x_make_frame_visible (struct frame *f) | |||
| 1683 | } | 1683 | } |
| 1684 | 1684 | ||
| 1685 | /* Making a frame invisible seems to break the parent->child | 1685 | /* Making a frame invisible seems to break the parent->child |
| 1686 | relationship, so reinstate it. */ | 1686 | relationship, so reinstate it. */ |
| 1687 | if ([window parentWindow] == nil && FRAME_PARENT_FRAME (f) != NULL) | 1687 | if ([window parentWindow] == nil && FRAME_PARENT_FRAME (f) != NULL) |
| 1688 | { | 1688 | { |
| 1689 | NSWindow *parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window]; | 1689 | NSWindow *parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window]; |
| @@ -1695,7 +1695,7 @@ x_make_frame_visible (struct frame *f) | |||
| 1695 | 1695 | ||
| 1696 | /* If the parent frame moved while the child frame was | 1696 | /* If the parent frame moved while the child frame was |
| 1697 | invisible, the child frame's position won't have been | 1697 | invisible, the child frame's position won't have been |
| 1698 | updated. Make sure it's in the right place now. */ | 1698 | updated. Make sure it's in the right place now. */ |
| 1699 | x_set_offset(f, f->left_pos, f->top_pos, 0); | 1699 | x_set_offset(f, f->left_pos, f->top_pos, 0); |
| 1700 | } | 1700 | } |
| 1701 | } | 1701 | } |
| @@ -1737,8 +1737,8 @@ x_iconify_frame (struct frame *f) | |||
| 1737 | 1737 | ||
| 1738 | if ([[view window] windowNumber] <= 0) | 1738 | if ([[view window] windowNumber] <= 0) |
| 1739 | { | 1739 | { |
| 1740 | /* the window is still deferred. Make it very small, bring it | 1740 | /* The window is still deferred. Make it very small, bring it |
| 1741 | on screen and order it out. */ | 1741 | on screen and order it out. */ |
| 1742 | NSRect s = { { 100, 100}, {0, 0} }; | 1742 | NSRect s = { { 100, 100}, {0, 0} }; |
| 1743 | NSRect t; | 1743 | NSRect t; |
| 1744 | t = [[view window] frame]; | 1744 | t = [[view window] frame]; |
| @@ -1749,7 +1749,7 @@ x_iconify_frame (struct frame *f) | |||
| 1749 | } | 1749 | } |
| 1750 | 1750 | ||
| 1751 | /* Processing input while Emacs is being minimized can cause a | 1751 | /* Processing input while Emacs is being minimized can cause a |
| 1752 | crash, so block it for the duration. */ | 1752 | crash, so block it for the duration. */ |
| 1753 | block_input(); | 1753 | block_input(); |
| 1754 | [[view window] miniaturize: NSApp]; | 1754 | [[view window] miniaturize: NSApp]; |
| 1755 | unblock_input(); | 1755 | unblock_input(); |
| @@ -1804,7 +1804,7 @@ x_destroy_window (struct frame *f) | |||
| 1804 | NSTRACE ("x_destroy_window"); | 1804 | NSTRACE ("x_destroy_window"); |
| 1805 | 1805 | ||
| 1806 | /* If this frame has a parent window, detach it as not doing so can | 1806 | /* If this frame has a parent window, detach it as not doing so can |
| 1807 | cause a crash in GNUStep. */ | 1807 | cause a crash in GNUStep. */ |
| 1808 | if (FRAME_PARENT_FRAME (f) != NULL) | 1808 | if (FRAME_PARENT_FRAME (f) != NULL) |
| 1809 | { | 1809 | { |
| 1810 | NSWindow *child = [FRAME_NS_VIEW (f) window]; | 1810 | NSWindow *child = [FRAME_NS_VIEW (f) window]; |
| @@ -1996,7 +1996,7 @@ x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value | |||
| 1996 | else | 1996 | else |
| 1997 | { | 1997 | { |
| 1998 | [window setToolbar: nil]; | 1998 | [window setToolbar: nil]; |
| 1999 | /* Do I need to release the toolbar here? */ | 1999 | /* Do I need to release the toolbar here? */ |
| 2000 | 2000 | ||
| 2001 | FRAME_UNDECORATED (f) = true; | 2001 | FRAME_UNDECORATED (f) = true; |
| 2002 | [window setStyleMask: ((window.styleMask | FRAME_UNDECORATED_FLAGS) | 2002 | [window setStyleMask: ((window.styleMask | FRAME_UNDECORATED_FLAGS) |
| @@ -2004,7 +2004,7 @@ x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value | |||
| 2004 | } | 2004 | } |
| 2005 | 2005 | ||
| 2006 | /* At this point it seems we don't have an active NSResponder, | 2006 | /* At this point it seems we don't have an active NSResponder, |
| 2007 | so some key presses (TAB) are swallowed by the system. */ | 2007 | so some key presses (TAB) are swallowed by the system. */ |
| 2008 | [window makeFirstResponder: view]; | 2008 | [window makeFirstResponder: view]; |
| 2009 | 2009 | ||
| 2010 | [view updateFrameSize: NO]; | 2010 | [view updateFrameSize: NO]; |
| @@ -2073,7 +2073,7 @@ x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_v | |||
| 2073 | * displayed for the first time and when the frame changes its state | 2073 | * displayed for the first time and when the frame changes its state |
| 2074 | * from `iconified' or `invisible' to `visible'.) | 2074 | * from `iconified' or `invisible' to `visible'.) |
| 2075 | * | 2075 | * |
| 2076 | * Some window managers may not honor this parameter. */ | 2076 | * Some window managers may not honor this parameter. */ |
| 2077 | { | 2077 | { |
| 2078 | NSTRACE ("x_set_no_focus_on_map"); | 2078 | NSTRACE ("x_set_no_focus_on_map"); |
| 2079 | 2079 | ||
| @@ -2092,7 +2092,7 @@ x_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_v | |||
| 2092 | * If non-nil, this may have the unwanted side-effect that a user cannot | 2092 | * If non-nil, this may have the unwanted side-effect that a user cannot |
| 2093 | * scroll a non-selected frame with the mouse. | 2093 | * scroll a non-selected frame with the mouse. |
| 2094 | * | 2094 | * |
| 2095 | * Some window managers may not honor this parameter. */ | 2095 | * Some window managers may not honor this parameter. */ |
| 2096 | { | 2096 | { |
| 2097 | NSTRACE ("x_set_no_accept_focus"); | 2097 | NSTRACE ("x_set_no_accept_focus"); |
| 2098 | 2098 | ||
| @@ -2109,7 +2109,7 @@ x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) | |||
| 2109 | `below' property set. If `below', F's window is displayed below | 2109 | `below' property set. If `below', F's window is displayed below |
| 2110 | all windows that do. | 2110 | all windows that do. |
| 2111 | 2111 | ||
| 2112 | Some window managers may not honor this parameter. */ | 2112 | Some window managers may not honor this parameter. */ |
| 2113 | { | 2113 | { |
| 2114 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | 2114 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); |
| 2115 | NSWindow *window = [view window]; | 2115 | NSWindow *window = [view window]; |
| @@ -2128,7 +2128,7 @@ x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) | |||
| 2128 | } | 2128 | } |
| 2129 | else if (EQ (new_value, Qabove_suspended)) | 2129 | else if (EQ (new_value, Qabove_suspended)) |
| 2130 | { | 2130 | { |
| 2131 | /* Not sure what level this should be. */ | 2131 | /* Not sure what level this should be. */ |
| 2132 | window.level = NSNormalWindowLevel + 1; | 2132 | window.level = NSNormalWindowLevel + 1; |
| 2133 | FRAME_Z_GROUP (f) = z_group_above_suspended; | 2133 | FRAME_Z_GROUP (f) = z_group_above_suspended; |
| 2134 | } | 2134 | } |
| @@ -2206,8 +2206,7 @@ ns_fullscreen_hook (struct frame *f) | |||
| 2206 | if (! [view fsIsNative] && f->want_fullscreen == FULLSCREEN_BOTH) | 2206 | if (! [view fsIsNative] && f->want_fullscreen == FULLSCREEN_BOTH) |
| 2207 | { | 2207 | { |
| 2208 | /* Old style fs don't initiate correctly if created from | 2208 | /* Old style fs don't initiate correctly if created from |
| 2209 | init/default-frame alist, so use a timer (not nice...). | 2209 | init/default-frame alist, so use a timer (not nice...). */ |
| 2210 | */ | ||
| 2211 | [NSTimer scheduledTimerWithTimeInterval: 0.5 target: view | 2210 | [NSTimer scheduledTimerWithTimeInterval: 0.5 target: view |
| 2212 | selector: @selector (handleFS) | 2211 | selector: @selector (handleFS) |
| 2213 | userInfo: nil repeats: NO]; | 2212 | userInfo: nil repeats: NO]; |
| @@ -2274,7 +2273,7 @@ ns_index_color (NSColor *color, struct frame *f) | |||
| 2274 | 2273 | ||
| 2275 | color_table->colors[idx] = color; | 2274 | color_table->colors[idx] = color; |
| 2276 | [color retain]; | 2275 | [color retain]; |
| 2277 | /*fprintf(stderr, "color_table: allocated %d\n",idx);*/ | 2276 | /* fprintf(stderr, "color_table: allocated %d\n",idx); */ |
| 2278 | return idx; | 2277 | return idx; |
| 2279 | } | 2278 | } |
| 2280 | 2279 | ||
| @@ -2286,7 +2285,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 2286 | -------------------------------------------------------------------------- */ | 2285 | -------------------------------------------------------------------------- */ |
| 2287 | /* On *Step, we attempt to mimic the X11 platform here, down to installing an | 2286 | /* On *Step, we attempt to mimic the X11 platform here, down to installing an |
| 2288 | X11 rgb.txt-compatible color list in Emacs.clr (see ns_term_init()). | 2287 | X11 rgb.txt-compatible color list in Emacs.clr (see ns_term_init()). |
| 2289 | See: http://thread.gmane.org/gmane.emacs.devel/113050/focus=113272). */ | 2288 | See https://lists.gnu.org/r/emacs-devel/2009-07/msg01203.html. */ |
| 2290 | { | 2289 | { |
| 2291 | NSColor *new = nil; | 2290 | NSColor *new = nil; |
| 2292 | static char hex[20]; | 2291 | static char hex[20]; |
| @@ -2321,8 +2320,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 2321 | else if ([nsname isEqualToString: @"ns_selection_fg_color"]) | 2320 | else if ([nsname isEqualToString: @"ns_selection_fg_color"]) |
| 2322 | { | 2321 | { |
| 2323 | /* NOTE: macOS applications normally don't set foreground | 2322 | /* NOTE: macOS applications normally don't set foreground |
| 2324 | selection, but text may be unreadable if we don't. | 2323 | selection, but text may be unreadable if we don't. */ |
| 2325 | */ | ||
| 2326 | if ((new = [NSColor selectedTextColor]) != nil) | 2324 | if ((new = [NSColor selectedTextColor]) != nil) |
| 2327 | { | 2325 | { |
| 2328 | *col = [new colorUsingDefaultColorSpace]; | 2326 | *col = [new colorUsingDefaultColorSpace]; |
| @@ -2334,7 +2332,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 2334 | name = [nsname UTF8String]; | 2332 | name = [nsname UTF8String]; |
| 2335 | } | 2333 | } |
| 2336 | 2334 | ||
| 2337 | /* First, check for some sort of numeric specification. */ | 2335 | /* First, check for some sort of numeric specification. */ |
| 2338 | hex[0] = '\0'; | 2336 | hex[0] = '\0'; |
| 2339 | 2337 | ||
| 2340 | if (name[0] == '0' || name[0] == '1' || name[0] == '.') /* RGB decimal */ | 2338 | if (name[0] == '0' || name[0] == '1' || name[0] == '.') /* RGB decimal */ |
| @@ -2384,7 +2382,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 2384 | NSColorList *clist; | 2382 | NSColorList *clist; |
| 2385 | 2383 | ||
| 2386 | #ifdef NS_IMPL_GNUSTEP | 2384 | #ifdef NS_IMPL_GNUSTEP |
| 2387 | /* XXX: who is wrong, the requestor or the implementation? */ | 2385 | /* XXX: who is wrong, the requestor or the implementation? */ |
| 2388 | if ([nsname compare: @"Highlight" options: NSCaseInsensitiveSearch] | 2386 | if ([nsname compare: @"Highlight" options: NSCaseInsensitiveSearch] |
| 2389 | == NSOrderedSame) | 2387 | == NSOrderedSame) |
| 2390 | nsname = @"highlightColor"; | 2388 | nsname = @"highlightColor"; |
| @@ -2413,7 +2411,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 2413 | int | 2411 | int |
| 2414 | ns_lisp_to_color (Lisp_Object color, NSColor **col) | 2412 | ns_lisp_to_color (Lisp_Object color, NSColor **col) |
| 2415 | /* -------------------------------------------------------------------------- | 2413 | /* -------------------------------------------------------------------------- |
| 2416 | Convert a Lisp string object to a NS color | 2414 | Convert a Lisp string object to a NS color. |
| 2417 | -------------------------------------------------------------------------- */ | 2415 | -------------------------------------------------------------------------- */ |
| 2418 | { | 2416 | { |
| 2419 | NSTRACE ("ns_lisp_to_color"); | 2417 | NSTRACE ("ns_lisp_to_color"); |
| @@ -2458,7 +2456,7 @@ ns_defined_color (struct frame *f, | |||
| 2458 | If makeIndex and alloc are nonzero put the color in the color_table, | 2456 | If makeIndex and alloc are nonzero put the color in the color_table, |
| 2459 | and set color_def pixel to the resulting index. | 2457 | and set color_def pixel to the resulting index. |
| 2460 | If makeIndex is zero, set color_def pixel to ARGB. | 2458 | If makeIndex is zero, set color_def pixel to ARGB. |
| 2461 | Return false if not found | 2459 | Return false if not found. |
| 2462 | -------------------------------------------------------------------------- */ | 2460 | -------------------------------------------------------------------------- */ |
| 2463 | { | 2461 | { |
| 2464 | NSColor *col; | 2462 | NSColor *col; |
| @@ -2531,7 +2529,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | |||
| 2531 | { | 2529 | { |
| 2532 | NSTRACE ("frame_set_mouse_pixel_position"); | 2530 | NSTRACE ("frame_set_mouse_pixel_position"); |
| 2533 | 2531 | ||
| 2534 | /* FIXME: what about GNUstep? */ | 2532 | /* FIXME: what about GNUstep? */ |
| 2535 | #ifdef NS_IMPL_COCOA | 2533 | #ifdef NS_IMPL_COCOA |
| 2536 | CGPoint mouse_pos = | 2534 | CGPoint mouse_pos = |
| 2537 | CGPointMake(f->left_pos + pix_x, | 2535 | CGPointMake(f->left_pos + pix_x, |
| @@ -2552,15 +2550,15 @@ note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) | |||
| 2552 | struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); | 2550 | struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); |
| 2553 | NSRect *r; | 2551 | NSRect *r; |
| 2554 | 2552 | ||
| 2555 | // NSTRACE ("note_mouse_movement"); | 2553 | // NSTRACE ("note_mouse_movement"); |
| 2556 | 2554 | ||
| 2557 | dpyinfo->last_mouse_motion_frame = frame; | 2555 | dpyinfo->last_mouse_motion_frame = frame; |
| 2558 | r = &dpyinfo->last_mouse_glyph; | 2556 | r = &dpyinfo->last_mouse_glyph; |
| 2559 | 2557 | ||
| 2560 | /* Note, this doesn't get called for enter/leave, since we don't have a | 2558 | /* Note, this doesn't get called for enter/leave, since we don't have a |
| 2561 | position. Those are taken care of in the corresponding NSView methods. */ | 2559 | position. Those are taken care of in the corresponding NSView methods. */ |
| 2562 | 2560 | ||
| 2563 | /* has movement gone beyond last rect we were tracking? */ | 2561 | /* Has movement gone beyond last rect we were tracking? */ |
| 2564 | if (x < r->origin.x || x >= r->origin.x + r->size.width | 2562 | if (x < r->origin.x || x >= r->origin.x + r->size.width |
| 2565 | || y < r->origin.y || y >= r->origin.y + r->size.height) | 2563 | || y < r->origin.y || y >= r->origin.y + r->size.height) |
| 2566 | { | 2564 | { |
| @@ -2584,7 +2582,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2584 | External (hook): inform emacs about mouse position and hit parts. | 2582 | External (hook): inform emacs about mouse position and hit parts. |
| 2585 | If a scrollbar is being dragged, set bar_window, part, x, y, time. | 2583 | If a scrollbar is being dragged, set bar_window, part, x, y, time. |
| 2586 | x & y should be position in the scrollbar (the whole bar, not the handle) | 2584 | x & y should be position in the scrollbar (the whole bar, not the handle) |
| 2587 | and length of scrollbar respectively | 2585 | and length of scrollbar respectively. |
| 2588 | -------------------------------------------------------------------------- */ | 2586 | -------------------------------------------------------------------------- */ |
| 2589 | { | 2587 | { |
| 2590 | id view; | 2588 | id view; |
| @@ -2703,7 +2701,7 @@ ns_convert_key (unsigned code) | |||
| 2703 | { | 2701 | { |
| 2704 | const unsigned last_keysym = ARRAYELTS (convert_ns_to_X_keysym); | 2702 | const unsigned last_keysym = ARRAYELTS (convert_ns_to_X_keysym); |
| 2705 | unsigned keysym; | 2703 | unsigned keysym; |
| 2706 | /* An array would be faster, but less easy to read. */ | 2704 | /* An array would be faster, but less easy to read. */ |
| 2707 | for (keysym = 0; keysym < last_keysym; keysym += 2) | 2705 | for (keysym = 0; keysym < last_keysym; keysym += 2) |
| 2708 | if (code == convert_ns_to_X_keysym[keysym]) | 2706 | if (code == convert_ns_to_X_keysym[keysym]) |
| 2709 | return 0xFF00 | convert_ns_to_X_keysym[keysym+1]; | 2707 | return 0xFF00 | convert_ns_to_X_keysym[keysym+1]; |
| @@ -2900,7 +2898,7 @@ ns_copy_bits (struct frame *f, NSRect src, NSRect dest) | |||
| 2900 | static void | 2898 | static void |
| 2901 | ns_scroll_run (struct window *w, struct run *run) | 2899 | ns_scroll_run (struct window *w, struct run *run) |
| 2902 | /* -------------------------------------------------------------------------- | 2900 | /* -------------------------------------------------------------------------- |
| 2903 | External (RIF): Insert or delete n lines at line vpos | 2901 | External (RIF): Insert or delete n lines at line vpos. |
| 2904 | -------------------------------------------------------------------------- */ | 2902 | -------------------------------------------------------------------------- */ |
| 2905 | { | 2903 | { |
| 2906 | struct frame *f = XFRAME (w->frame); | 2904 | struct frame *f = XFRAME (w->frame); |
| @@ -3146,7 +3144,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 3146 | 3144 | ||
| 3147 | NSRectClip (r); | 3145 | NSRectClip (r); |
| 3148 | /* Since we composite the bitmap instead of just blitting it, we need | 3146 | /* Since we composite the bitmap instead of just blitting it, we need |
| 3149 | to erase the whole background. */ | 3147 | to erase the whole background. */ |
| 3150 | [ns_lookup_indexed_color(face->background, f) set]; | 3148 | [ns_lookup_indexed_color(face->background, f) set]; |
| 3151 | NSRectFill (r); | 3149 | NSRectFill (r); |
| 3152 | 3150 | ||
| @@ -3239,17 +3237,17 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 3239 | get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); | 3237 | get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); |
| 3240 | 3238 | ||
| 3241 | /* The above get_phys_cursor_geometry call set w->phys_cursor_width | 3239 | /* The above get_phys_cursor_geometry call set w->phys_cursor_width |
| 3242 | to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ | 3240 | to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ |
| 3243 | if (cursor_type == BAR_CURSOR) | 3241 | if (cursor_type == BAR_CURSOR) |
| 3244 | { | 3242 | { |
| 3245 | if (cursor_width < 1) | 3243 | if (cursor_width < 1) |
| 3246 | cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); | 3244 | cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); |
| 3247 | 3245 | ||
| 3248 | /* The bar cursor should never be wider than the glyph. */ | 3246 | /* The bar cursor should never be wider than the glyph. */ |
| 3249 | if (cursor_width < w->phys_cursor_width) | 3247 | if (cursor_width < w->phys_cursor_width) |
| 3250 | w->phys_cursor_width = cursor_width; | 3248 | w->phys_cursor_width = cursor_width; |
| 3251 | } | 3249 | } |
| 3252 | /* If we have an HBAR, "cursor_width" MAY specify height. */ | 3250 | /* If we have an HBAR, "cursor_width" MAY specify height. */ |
| 3253 | else if (cursor_type == HBAR_CURSOR) | 3251 | else if (cursor_type == HBAR_CURSOR) |
| 3254 | { | 3252 | { |
| 3255 | cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width; | 3253 | cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width; |
| @@ -3264,7 +3262,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 3264 | r.size.height = h; | 3262 | r.size.height = h; |
| 3265 | r.size.width = w->phys_cursor_width; | 3263 | r.size.width = w->phys_cursor_width; |
| 3266 | 3264 | ||
| 3267 | /* Prevent the cursor from being drawn outside the text area. */ | 3265 | /* Prevent the cursor from being drawn outside the text area. */ |
| 3268 | ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1); if remove */ | 3266 | ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1); if remove */ |
| 3269 | 3267 | ||
| 3270 | 3268 | ||
| @@ -3282,8 +3280,8 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 3282 | /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph | 3280 | /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph |
| 3283 | atomic. Cleaner ways of doing this should be investigated. | 3281 | atomic. Cleaner ways of doing this should be investigated. |
| 3284 | One way would be to set a global variable DRAWING_CURSOR | 3282 | One way would be to set a global variable DRAWING_CURSOR |
| 3285 | when making the call to draw_phys..(), don't focus in that | 3283 | when making the call to draw_phys..(), don't focus in that |
| 3286 | case, then move the ns_unfocus() here after that call. */ | 3284 | case, then move the ns_unfocus() here after that call. */ |
| 3287 | NSDisableScreenUpdates (); | 3285 | NSDisableScreenUpdates (); |
| 3288 | #endif | 3286 | #endif |
| 3289 | 3287 | ||
| @@ -3503,7 +3501,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 3503 | if (s->for_overlaps) | 3501 | if (s->for_overlaps) |
| 3504 | return; | 3502 | return; |
| 3505 | 3503 | ||
| 3506 | /* Do underline. */ | 3504 | /* Do underline. */ |
| 3507 | if (face->underline_p) | 3505 | if (face->underline_p) |
| 3508 | { | 3506 | { |
| 3509 | if (s->face->underline_type == FACE_UNDER_WAVE) | 3507 | if (s->face->underline_type == FACE_UNDER_WAVE) |
| @@ -3521,7 +3519,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 3521 | NSRect r; | 3519 | NSRect r; |
| 3522 | unsigned long thickness, position; | 3520 | unsigned long thickness, position; |
| 3523 | 3521 | ||
| 3524 | /* If the prev was underlined, match its appearance. */ | 3522 | /* If the prev was underlined, match its appearance. */ |
| 3525 | if (s->prev && s->prev->face->underline_p | 3523 | if (s->prev && s->prev->face->underline_p |
| 3526 | && s->prev->face->underline_type == FACE_UNDER_LINE | 3524 | && s->prev->face->underline_type == FACE_UNDER_LINE |
| 3527 | && s->prev->underline_thickness > 0) | 3525 | && s->prev->underline_thickness > 0) |
| @@ -3549,11 +3547,11 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 3549 | use_underline_position_properties = | 3547 | use_underline_position_properties = |
| 3550 | !(NILP (val) || EQ (val, Qunbound)); | 3548 | !(NILP (val) || EQ (val, Qunbound)); |
| 3551 | 3549 | ||
| 3552 | /* Use underline thickness of font, defaulting to 1. */ | 3550 | /* Use underline thickness of font, defaulting to 1. */ |
| 3553 | thickness = (font && font->underline_thickness > 0) | 3551 | thickness = (font && font->underline_thickness > 0) |
| 3554 | ? font->underline_thickness : 1; | 3552 | ? font->underline_thickness : 1; |
| 3555 | 3553 | ||
| 3556 | /* Determine the offset of underlining from the baseline. */ | 3554 | /* Determine the offset of underlining from the baseline. */ |
| 3557 | if (underline_at_descent_line) | 3555 | if (underline_at_descent_line) |
| 3558 | position = descent - thickness; | 3556 | position = descent - thickness; |
| 3559 | else if (use_underline_position_properties | 3557 | else if (use_underline_position_properties |
| @@ -3566,7 +3564,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 3566 | 3564 | ||
| 3567 | position = max (position, minimum_offset); | 3565 | position = max (position, minimum_offset); |
| 3568 | 3566 | ||
| 3569 | /* Ensure underlining is not cropped. */ | 3567 | /* Ensure underlining is not cropped. */ |
| 3570 | if (descent <= position) | 3568 | if (descent <= position) |
| 3571 | { | 3569 | { |
| 3572 | position = descent - 1; | 3570 | position = descent - 1; |
| @@ -3589,7 +3587,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 3589 | } | 3587 | } |
| 3590 | } | 3588 | } |
| 3591 | /* Do overline. We follow other terms in using a thickness of 1 | 3589 | /* Do overline. We follow other terms in using a thickness of 1 |
| 3592 | and ignoring overline_margin. */ | 3590 | and ignoring overline_margin. */ |
| 3593 | if (face->overline_p) | 3591 | if (face->overline_p) |
| 3594 | { | 3592 | { |
| 3595 | NSRect r; | 3593 | NSRect r; |
| @@ -3603,7 +3601,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 3603 | } | 3601 | } |
| 3604 | 3602 | ||
| 3605 | /* Do strike-through. We follow other terms for thickness and | 3603 | /* Do strike-through. We follow other terms for thickness and |
| 3606 | vertical position.*/ | 3604 | vertical position. */ |
| 3607 | if (face->strike_through_p) | 3605 | if (face->strike_through_p) |
| 3608 | { | 3606 | { |
| 3609 | NSRect r; | 3607 | NSRect r; |
| @@ -3710,7 +3708,7 @@ ns_draw_relief (NSRect r, int thickness, char raised_p, | |||
| 3710 | 3708 | ||
| 3711 | [(raised_p ? lightCol : darkCol) set]; | 3709 | [(raised_p ? lightCol : darkCol) set]; |
| 3712 | 3710 | ||
| 3713 | /* TODO: mitering. Using NSBezierPath doesn't work because of color switch. */ | 3711 | /* TODO: mitering. Using NSBezierPath doesn't work because of color switch. */ |
| 3714 | 3712 | ||
| 3715 | /* top */ | 3713 | /* top */ |
| 3716 | sr.size.height = thickness; | 3714 | sr.size.height = thickness; |
| @@ -3784,7 +3782,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s) | |||
| 3784 | 3782 | ||
| 3785 | r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height); | 3783 | r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height); |
| 3786 | 3784 | ||
| 3787 | /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ | 3785 | /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ |
| 3788 | if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) | 3786 | if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) |
| 3789 | { | 3787 | { |
| 3790 | ns_draw_box (r, abs (thickness), | 3788 | ns_draw_box (r, abs (thickness), |
| @@ -3887,7 +3885,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) | |||
| 3887 | 3885 | ||
| 3888 | /* Draw BG: if we need larger area than image itself cleared, do that, | 3886 | /* Draw BG: if we need larger area than image itself cleared, do that, |
| 3889 | otherwise, since we composite the image under NS (instead of mucking | 3887 | otherwise, since we composite the image under NS (instead of mucking |
| 3890 | with its background color), we must clear just the image area. */ | 3888 | with its background color), we must clear just the image area. */ |
| 3891 | if (s->hl == DRAW_MOUSE_FACE) | 3889 | if (s->hl == DRAW_MOUSE_FACE) |
| 3892 | { | 3890 | { |
| 3893 | face = FACE_FROM_ID_OR_NULL (s->f, | 3891 | face = FACE_FROM_ID_OR_NULL (s->f, |
| @@ -3913,7 +3911,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) | |||
| 3913 | 3911 | ||
| 3914 | NSRectFill (br); | 3912 | NSRectFill (br); |
| 3915 | 3913 | ||
| 3916 | /* Draw the image.. do we need to draw placeholder if img ==nil? */ | 3914 | /* Draw the image... do we need to draw placeholder if img == nil? */ |
| 3917 | if (img != nil) | 3915 | if (img != nil) |
| 3918 | { | 3916 | { |
| 3919 | #ifdef NS_IMPL_COCOA | 3917 | #ifdef NS_IMPL_COCOA |
| @@ -3939,11 +3937,11 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) | |||
| 3939 | if (s->w->phys_cursor_type == FILLED_BOX_CURSOR) | 3937 | if (s->w->phys_cursor_type == FILLED_BOX_CURSOR) |
| 3940 | tdCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); | 3938 | tdCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); |
| 3941 | else | 3939 | else |
| 3942 | /* Currently on NS img->mask is always 0. Since | 3940 | /* Currently on NS img->mask is always 0. Since |
| 3943 | get_window_cursor_type specifies a hollow box cursor when on | 3941 | get_window_cursor_type specifies a hollow box cursor when on |
| 3944 | a non-masked image we never reach this clause. But we put it | 3942 | a non-masked image we never reach this clause. But we put it |
| 3945 | in, in anticipation of better support for image masks on | 3943 | in, in anticipation of better support for image masks on |
| 3946 | NS. */ | 3944 | NS. */ |
| 3947 | tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); | 3945 | tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); |
| 3948 | } | 3946 | } |
| 3949 | else | 3947 | else |
| @@ -3951,7 +3949,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) | |||
| 3951 | tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); | 3949 | tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); |
| 3952 | } | 3950 | } |
| 3953 | 3951 | ||
| 3954 | /* Draw underline, overline, strike-through. */ | 3952 | /* Draw underline, overline, strike-through. */ |
| 3955 | ns_draw_text_decoration (s, face, tdCol, br.size.width, br.origin.x); | 3953 | ns_draw_text_decoration (s, face, tdCol, br.size.width, br.origin.x); |
| 3956 | 3954 | ||
| 3957 | /* Draw relief, if requested */ | 3955 | /* Draw relief, if requested */ |
| @@ -4046,14 +4044,14 @@ ns_dumpglyphs_stretch (struct glyph_string *s) | |||
| 4046 | a partially-visible bottom row will clear part of the | 4044 | a partially-visible bottom row will clear part of the |
| 4047 | modeline, and another where list-buffers headers and similar | 4045 | modeline, and another where list-buffers headers and similar |
| 4048 | rows erroneously have visible_height set to 0. Not sure | 4046 | rows erroneously have visible_height set to 0. Not sure |
| 4049 | where this is coming from as other terms seem not to show. */ | 4047 | where this is coming from as other terms seem not to show. */ |
| 4050 | r[i].size.height = min (s->height, s->row->visible_height); | 4048 | r[i].size.height = min (s->height, s->row->visible_height); |
| 4051 | } | 4049 | } |
| 4052 | 4050 | ||
| 4053 | [bgCol set]; | 4051 | [bgCol set]; |
| 4054 | 4052 | ||
| 4055 | /* NOTE: under NS this is NOT used to draw cursors, but we must avoid | 4053 | /* NOTE: under NS this is NOT used to draw cursors, but we must avoid |
| 4056 | overwriting cursor (usually when cursor on a tab) */ | 4054 | overwriting cursor (usually when cursor on a tab). */ |
| 4057 | if (s->hl == DRAW_CURSOR) | 4055 | if (s->hl == DRAW_CURSOR) |
| 4058 | { | 4056 | { |
| 4059 | CGFloat x, width; | 4057 | CGFloat x, width; |
| @@ -4065,7 +4063,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) | |||
| 4065 | 4063 | ||
| 4066 | NSRectFill (r[i]); | 4064 | NSRectFill (r[i]); |
| 4067 | 4065 | ||
| 4068 | /* Draw overlining, etc. on the cursor. */ | 4066 | /* Draw overlining, etc. on the cursor. */ |
| 4069 | if (s->w->phys_cursor_type == FILLED_BOX_CURSOR) | 4067 | if (s->w->phys_cursor_type == FILLED_BOX_CURSOR) |
| 4070 | ns_draw_text_decoration (s, face, bgCol, width, x); | 4068 | ns_draw_text_decoration (s, face, bgCol, width, x); |
| 4071 | else | 4069 | else |
| @@ -4077,7 +4075,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) | |||
| 4077 | } | 4075 | } |
| 4078 | 4076 | ||
| 4079 | /* Draw overlining, etc. on the stretch glyph (or the part | 4077 | /* Draw overlining, etc. on the stretch glyph (or the part |
| 4080 | of the stretch glyph after the cursor). */ | 4078 | of the stretch glyph after the cursor). */ |
| 4081 | ns_draw_text_decoration (s, face, fgCol, r[i].size.width, | 4079 | ns_draw_text_decoration (s, face, fgCol, r[i].size.width, |
| 4082 | r[i].origin.x); | 4080 | r[i].origin.x); |
| 4083 | } | 4081 | } |
| @@ -4304,7 +4302,7 @@ ns_draw_glyph_string (struct glyph_string *s) | |||
| 4304 | : FRAME_FOREGROUND_COLOR (s->f)); | 4302 | : FRAME_FOREGROUND_COLOR (s->f)); |
| 4305 | [col set]; | 4303 | [col set]; |
| 4306 | 4304 | ||
| 4307 | /* Draw underline, overline, strike-through. */ | 4305 | /* Draw underline, overline, strike-through. */ |
| 4308 | ns_draw_text_decoration (s, s->face, col, s->width, s->x); | 4306 | ns_draw_text_decoration (s, s->face, col, s->width, s->x); |
| 4309 | } | 4307 | } |
| 4310 | 4308 | ||
| @@ -4338,7 +4336,7 @@ ns_draw_glyph_string (struct glyph_string *s) | |||
| 4338 | emacs_abort (); | 4336 | emacs_abort (); |
| 4339 | } | 4337 | } |
| 4340 | 4338 | ||
| 4341 | /* Draw box if not done already. */ | 4339 | /* Draw box if not done already. */ |
| 4342 | if (!s->for_overlaps && !box_drawn_p && s->face->box != FACE_NO_BOX) | 4340 | if (!s->for_overlaps && !box_drawn_p && s->face->box != FACE_NO_BOX) |
| 4343 | { | 4341 | { |
| 4344 | n = ns_get_glyph_string_clip_rect (s, r); | 4342 | n = ns_get_glyph_string_clip_rect (s, r); |
| @@ -4381,8 +4379,8 @@ ns_send_appdefined (int value) | |||
| 4381 | } | 4379 | } |
| 4382 | 4380 | ||
| 4383 | /* Only post this event if we haven't already posted one. This will end | 4381 | /* Only post this event if we haven't already posted one. This will end |
| 4384 | the [NXApp run] main loop after having processed all events queued at | 4382 | the [NXApp run] main loop after having processed all events queued at |
| 4385 | this moment. */ | 4383 | this moment. */ |
| 4386 | 4384 | ||
| 4387 | #ifdef NS_IMPL_COCOA | 4385 | #ifdef NS_IMPL_COCOA |
| 4388 | if (! send_appdefined) | 4386 | if (! send_appdefined) |
| @@ -4405,7 +4403,7 @@ ns_send_appdefined (int value) | |||
| 4405 | /* We only need one NX_APPDEFINED event to stop NXApp from running. */ | 4403 | /* We only need one NX_APPDEFINED event to stop NXApp from running. */ |
| 4406 | send_appdefined = NO; | 4404 | send_appdefined = NO; |
| 4407 | 4405 | ||
| 4408 | /* Don't need wakeup timer any more */ | 4406 | /* Don't need wakeup timer any more. */ |
| 4409 | if (timed_entry) | 4407 | if (timed_entry) |
| 4410 | { | 4408 | { |
| 4411 | [timed_entry invalidate]; | 4409 | [timed_entry invalidate]; |
| @@ -4459,7 +4457,7 @@ check_native_fs () | |||
| 4459 | void | 4457 | void |
| 4460 | ns_check_menu_open (NSMenu *menu) | 4458 | ns_check_menu_open (NSMenu *menu) |
| 4461 | { | 4459 | { |
| 4462 | /* Click in menu bar? */ | 4460 | /* Click in menu bar? */ |
| 4463 | NSArray *a = [[NSApp mainMenu] itemArray]; | 4461 | NSArray *a = [[NSApp mainMenu] itemArray]; |
| 4464 | int i; | 4462 | int i; |
| 4465 | BOOL found = NO; | 4463 | BOOL found = NO; |
| @@ -4555,19 +4553,19 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 4555 | ns_init_events (&ev); | 4553 | ns_init_events (&ev); |
| 4556 | q_event_ptr = hold_quit; | 4554 | q_event_ptr = hold_quit; |
| 4557 | 4555 | ||
| 4558 | /* we manage autorelease pools by allocate/reallocate each time around | 4556 | /* We manage autorelease pools by allocate/reallocate each time around |
| 4559 | the loop; strict nesting is occasionally violated but seems not to | 4557 | the loop; strict nesting is occasionally violated but seems not to |
| 4560 | matter.. earlier methods using full nesting caused major memory leaks */ | 4558 | matter... earlier methods using full nesting caused major memory leaks. */ |
| 4561 | [outerpool release]; | 4559 | [outerpool release]; |
| 4562 | outerpool = [[NSAutoreleasePool alloc] init]; | 4560 | outerpool = [[NSAutoreleasePool alloc] init]; |
| 4563 | 4561 | ||
| 4564 | /* If have pending open-file requests, attend to the next one of those. */ | 4562 | /* If have pending open-file requests, attend to the next one of those. */ |
| 4565 | if (ns_pending_files && [ns_pending_files count] != 0 | 4563 | if (ns_pending_files && [ns_pending_files count] != 0 |
| 4566 | && [(EmacsApp *)NSApp openFile: [ns_pending_files objectAtIndex: 0]]) | 4564 | && [(EmacsApp *)NSApp openFile: [ns_pending_files objectAtIndex: 0]]) |
| 4567 | { | 4565 | { |
| 4568 | [ns_pending_files removeObjectAtIndex: 0]; | 4566 | [ns_pending_files removeObjectAtIndex: 0]; |
| 4569 | } | 4567 | } |
| 4570 | /* Deal with pending service requests. */ | 4568 | /* Deal with pending service requests. */ |
| 4571 | else if (ns_pending_service_names && [ns_pending_service_names count] != 0 | 4569 | else if (ns_pending_service_names && [ns_pending_service_names count] != 0 |
| 4572 | && [(EmacsApp *) | 4570 | && [(EmacsApp *) |
| 4573 | NSApp fulfillService: [ns_pending_service_names objectAtIndex: 0] | 4571 | NSApp fulfillService: [ns_pending_service_names objectAtIndex: 0] |
| @@ -4620,7 +4618,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4620 | 4618 | ||
| 4621 | if (hold_event_q.nr > 0) | 4619 | if (hold_event_q.nr > 0) |
| 4622 | { | 4620 | { |
| 4623 | /* We already have events pending. */ | 4621 | /* We already have events pending. */ |
| 4624 | raise (SIGIO); | 4622 | raise (SIGIO); |
| 4625 | errno = EINTR; | 4623 | errno = EINTR; |
| 4626 | return -1; | 4624 | return -1; |
| @@ -4672,13 +4670,13 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4672 | 4670 | ||
| 4673 | pthread_mutex_unlock (&select_mutex); | 4671 | pthread_mutex_unlock (&select_mutex); |
| 4674 | 4672 | ||
| 4675 | /* Inform fd_handler that select should be called */ | 4673 | /* Inform fd_handler that select should be called. */ |
| 4676 | c = 'g'; | 4674 | c = 'g'; |
| 4677 | emacs_write_sig (selfds[1], &c, 1); | 4675 | emacs_write_sig (selfds[1], &c, 1); |
| 4678 | } | 4676 | } |
| 4679 | else if (nr == 0 && timeout) | 4677 | else if (nr == 0 && timeout) |
| 4680 | { | 4678 | { |
| 4681 | /* No file descriptor, just a timeout, no need to wake fd_handler */ | 4679 | /* No file descriptor, just a timeout, no need to wake fd_handler. */ |
| 4682 | double time = timespectod (*timeout); | 4680 | double time = timespectod (*timeout); |
| 4683 | timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time | 4681 | timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time |
| 4684 | target: NSApp | 4682 | target: NSApp |
| @@ -4690,7 +4688,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4690 | } | 4688 | } |
| 4691 | else /* No timeout and no file descriptors, can this happen? */ | 4689 | else /* No timeout and no file descriptors, can this happen? */ |
| 4692 | { | 4690 | { |
| 4693 | /* Send appdefined so we exit from the loop */ | 4691 | /* Send appdefined so we exit from the loop. */ |
| 4694 | ns_send_appdefined (-1); | 4692 | ns_send_appdefined (-1); |
| 4695 | } | 4693 | } |
| 4696 | 4694 | ||
| @@ -4715,7 +4713,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4715 | 4713 | ||
| 4716 | if (t == -2) | 4714 | if (t == -2) |
| 4717 | { | 4715 | { |
| 4718 | /* The NX_APPDEFINED event we received was a timeout. */ | 4716 | /* The NX_APPDEFINED event we received was a timeout. */ |
| 4719 | result = 0; | 4717 | result = 0; |
| 4720 | } | 4718 | } |
| 4721 | else if (t == -1) | 4719 | else if (t == -1) |
| @@ -4727,7 +4725,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4727 | } | 4725 | } |
| 4728 | else | 4726 | else |
| 4729 | { | 4727 | { |
| 4730 | /* Received back from select () in fd_handler; copy the results */ | 4728 | /* Received back from select () in fd_handler; copy the results. */ |
| 4731 | pthread_mutex_lock (&select_mutex); | 4729 | pthread_mutex_lock (&select_mutex); |
| 4732 | if (readfds) *readfds = select_readfds; | 4730 | if (readfds) *readfds = select_readfds; |
| 4733 | if (writefds) *writefds = select_writefds; | 4731 | if (writefds) *writefds = select_writefds; |
| @@ -4747,11 +4745,11 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4747 | #ifdef HAVE_PTHREAD | 4745 | #ifdef HAVE_PTHREAD |
| 4748 | void | 4746 | void |
| 4749 | ns_run_loop_break () | 4747 | ns_run_loop_break () |
| 4750 | /* Break out of the NS run loop in ns_select or ns_read_socket. */ | 4748 | /* Break out of the NS run loop in ns_select or ns_read_socket. */ |
| 4751 | { | 4749 | { |
| 4752 | NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_run_loop_break"); | 4750 | NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_run_loop_break"); |
| 4753 | 4751 | ||
| 4754 | /* If we don't have a GUI, don't send the event. */ | 4752 | /* If we don't have a GUI, don't send the event. */ |
| 4755 | if (NSApp != NULL) | 4753 | if (NSApp != NULL) |
| 4756 | ns_send_appdefined(-1); | 4754 | ns_send_appdefined(-1); |
| 4757 | } | 4755 | } |
| @@ -4781,7 +4779,7 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 4781 | int top, left, height, width; | 4779 | int top, left, height, width; |
| 4782 | BOOL update_p = YES; | 4780 | BOOL update_p = YES; |
| 4783 | 4781 | ||
| 4784 | /* optimization; display engine sends WAY too many of these.. */ | 4782 | /* Optimization; display engine sends WAY too many of these. */ |
| 4785 | if (!NILP (window->vertical_scroll_bar)) | 4783 | if (!NILP (window->vertical_scroll_bar)) |
| 4786 | { | 4784 | { |
| 4787 | bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); | 4785 | bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); |
| @@ -4808,14 +4806,14 @@ ns_set_vertical_scroll_bar (struct window *window, | |||
| 4808 | left = WINDOW_SCROLL_BAR_AREA_X (window); | 4806 | left = WINDOW_SCROLL_BAR_AREA_X (window); |
| 4809 | 4807 | ||
| 4810 | r = NSMakeRect (left, top, width, height); | 4808 | r = NSMakeRect (left, top, width, height); |
| 4811 | /* the parent view is flipped, so we need to flip y value */ | 4809 | /* The parent view is flipped, so we need to flip y value. */ |
| 4812 | v = [view frame]; | 4810 | v = [view frame]; |
| 4813 | r.origin.y = (v.size.height - r.size.height - r.origin.y); | 4811 | r.origin.y = (v.size.height - r.size.height - r.origin.y); |
| 4814 | 4812 | ||
| 4815 | XSETWINDOW (win, window); | 4813 | XSETWINDOW (win, window); |
| 4816 | block_input (); | 4814 | block_input (); |
| 4817 | 4815 | ||
| 4818 | /* we want at least 5 lines to display a scrollbar */ | 4816 | /* We want at least 5 lines to display a scrollbar. */ |
| 4819 | if (WINDOW_TOTAL_LINES (window) < 5) | 4817 | if (WINDOW_TOTAL_LINES (window) < 5) |
| 4820 | { | 4818 | { |
| 4821 | if (!NILP (window->vertical_scroll_bar)) | 4819 | if (!NILP (window->vertical_scroll_bar)) |
| @@ -4863,7 +4861,7 @@ static void | |||
| 4863 | ns_set_horizontal_scroll_bar (struct window *window, | 4861 | ns_set_horizontal_scroll_bar (struct window *window, |
| 4864 | int portion, int whole, int position) | 4862 | int portion, int whole, int position) |
| 4865 | /* -------------------------------------------------------------------------- | 4863 | /* -------------------------------------------------------------------------- |
| 4866 | External (hook): Update or add scrollbar | 4864 | External (hook): Update or add scrollbar. |
| 4867 | -------------------------------------------------------------------------- */ | 4865 | -------------------------------------------------------------------------- */ |
| 4868 | { | 4866 | { |
| 4869 | Lisp_Object win; | 4867 | Lisp_Object win; |
| @@ -4875,7 +4873,7 @@ ns_set_horizontal_scroll_bar (struct window *window, | |||
| 4875 | int window_x, window_width; | 4873 | int window_x, window_width; |
| 4876 | BOOL update_p = YES; | 4874 | BOOL update_p = YES; |
| 4877 | 4875 | ||
| 4878 | /* optimization; display engine sends WAY too many of these.. */ | 4876 | /* Optimization; display engine sends WAY too many of these. */ |
| 4879 | if (!NILP (window->horizontal_scroll_bar)) | 4877 | if (!NILP (window->horizontal_scroll_bar)) |
| 4880 | { | 4878 | { |
| 4881 | bar = XNS_SCROLL_BAR (window->horizontal_scroll_bar); | 4879 | bar = XNS_SCROLL_BAR (window->horizontal_scroll_bar); |
| @@ -4902,7 +4900,7 @@ ns_set_horizontal_scroll_bar (struct window *window, | |||
| 4902 | top = WINDOW_SCROLL_BAR_AREA_Y (window); | 4900 | top = WINDOW_SCROLL_BAR_AREA_Y (window); |
| 4903 | 4901 | ||
| 4904 | r = NSMakeRect (left, top, width, height); | 4902 | r = NSMakeRect (left, top, width, height); |
| 4905 | /* the parent view is flipped, so we need to flip y value */ | 4903 | /* The parent view is flipped, so we need to flip y value. */ |
| 4906 | v = [view frame]; | 4904 | v = [view frame]; |
| 4907 | r.origin.y = (v.size.height - r.size.height - r.origin.y); | 4905 | r.origin.y = (v.size.height - r.size.height - r.origin.y); |
| 4908 | 4906 | ||
| @@ -4934,7 +4932,7 @@ ns_set_horizontal_scroll_bar (struct window *window, | |||
| 4934 | 4932 | ||
| 4935 | /* If there are both horizontal and vertical scroll-bars they leave | 4933 | /* If there are both horizontal and vertical scroll-bars they leave |
| 4936 | a square that belongs to neither. We need to clear it otherwise | 4934 | a square that belongs to neither. We need to clear it otherwise |
| 4937 | it fills with junk. */ | 4935 | it fills with junk. */ |
| 4938 | if (!NILP (window->vertical_scroll_bar)) | 4936 | if (!NILP (window->vertical_scroll_bar)) |
| 4939 | ns_clear_frame_area (f, WINDOW_SCROLL_BAR_AREA_X (window), top, | 4937 | ns_clear_frame_area (f, WINDOW_SCROLL_BAR_AREA_X (window), top, |
| 4940 | NS_SCROLL_BAR_HEIGHT (f), height); | 4938 | NS_SCROLL_BAR_HEIGHT (f), height); |
| @@ -5057,7 +5055,7 @@ x_display_pixel_width (struct ns_display_info *dpyinfo) | |||
| 5057 | 5055 | ||
| 5058 | static Lisp_Object ns_string_to_lispmod (const char *s) | 5056 | static Lisp_Object ns_string_to_lispmod (const char *s) |
| 5059 | /* -------------------------------------------------------------------------- | 5057 | /* -------------------------------------------------------------------------- |
| 5060 | Convert modifier name to lisp symbol | 5058 | Convert modifier name to lisp symbol. |
| 5061 | -------------------------------------------------------------------------- */ | 5059 | -------------------------------------------------------------------------- */ |
| 5062 | { | 5060 | { |
| 5063 | if (!strncmp (SSDATA (SYMBOL_NAME (Qmeta)), s, 10)) | 5061 | if (!strncmp (SSDATA (SYMBOL_NAME (Qmeta)), s, 10)) |
| @@ -5082,7 +5080,7 @@ ns_default (const char *parameter, Lisp_Object *result, | |||
| 5082 | Lisp_Object yesval, Lisp_Object noval, | 5080 | Lisp_Object yesval, Lisp_Object noval, |
| 5083 | BOOL is_float, BOOL is_modstring) | 5081 | BOOL is_float, BOOL is_modstring) |
| 5084 | /* -------------------------------------------------------------------------- | 5082 | /* -------------------------------------------------------------------------- |
| 5085 | Check a parameter value in user's preferences | 5083 | Check a parameter value in user's preferences. |
| 5086 | -------------------------------------------------------------------------- */ | 5084 | -------------------------------------------------------------------------- */ |
| 5087 | { | 5085 | { |
| 5088 | const char *value = ns_get_defaults_value (parameter); | 5086 | const char *value = ns_get_defaults_value (parameter); |
| @@ -5123,7 +5121,7 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) | |||
| 5123 | dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); | 5121 | dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); |
| 5124 | dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); | 5122 | dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); |
| 5125 | dpyinfo->color_table->colors = NULL; | 5123 | dpyinfo->color_table->colors = NULL; |
| 5126 | dpyinfo->root_window = 42; /* a placeholder.. */ | 5124 | dpyinfo->root_window = 42; /* A placeholder. */ |
| 5127 | dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; | 5125 | dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; |
| 5128 | dpyinfo->n_fonts = 0; | 5126 | dpyinfo->n_fonts = 0; |
| 5129 | dpyinfo->smallest_font_height = 1; | 5127 | dpyinfo->smallest_font_height = 1; |
| @@ -5133,11 +5131,11 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) | |||
| 5133 | } | 5131 | } |
| 5134 | 5132 | ||
| 5135 | 5133 | ||
| 5136 | /* This and next define (many of the) public functions in this file. */ | 5134 | /* This and next define (many of the) public functions in this file. */ |
| 5137 | /* x_... are generic versions in xdisp.c that we, and other terms, get away | 5135 | /* x_... are generic versions in xdisp.c that we, and other terms, get away |
| 5138 | with using despite presence in the "system dependent" redisplay | 5136 | with using despite presence in the "system dependent" redisplay |
| 5139 | interface. In addition, many of the ns_ methods have code that is | 5137 | interface. In addition, many of the ns_ methods have code that is |
| 5140 | shared with all terms, indicating need for further refactoring. */ | 5138 | shared with all terms, indicating need for further refactoring. */ |
| 5141 | extern frame_parm_handler ns_frame_parm_handlers[]; | 5139 | extern frame_parm_handler ns_frame_parm_handlers[]; |
| 5142 | static struct redisplay_interface ns_redisplay_interface = | 5140 | static struct redisplay_interface ns_redisplay_interface = |
| 5143 | { | 5141 | { |
| @@ -5173,11 +5171,11 @@ static struct redisplay_interface ns_redisplay_interface = | |||
| 5173 | static void | 5171 | static void |
| 5174 | ns_delete_display (struct ns_display_info *dpyinfo) | 5172 | ns_delete_display (struct ns_display_info *dpyinfo) |
| 5175 | { | 5173 | { |
| 5176 | /* TODO... */ | 5174 | /* TODO... */ |
| 5177 | } | 5175 | } |
| 5178 | 5176 | ||
| 5179 | 5177 | ||
| 5180 | /* This function is called when the last frame on a display is deleted. */ | 5178 | /* This function is called when the last frame on a display is deleted. */ |
| 5181 | static void | 5179 | static void |
| 5182 | ns_delete_terminal (struct terminal *terminal) | 5180 | ns_delete_terminal (struct terminal *terminal) |
| 5183 | { | 5181 | { |
| @@ -5285,9 +5283,9 @@ ns_term_init (Lisp_Object display_name) | |||
| 5285 | ns_pending_service_names = [[NSMutableArray alloc] init]; | 5283 | ns_pending_service_names = [[NSMutableArray alloc] init]; |
| 5286 | ns_pending_service_args = [[NSMutableArray alloc] init]; | 5284 | ns_pending_service_args = [[NSMutableArray alloc] init]; |
| 5287 | 5285 | ||
| 5288 | /* Start app and create the main menu, window, view. | 5286 | /* Start app and create the main menu, window, view. |
| 5289 | Needs to be here because ns_initialize_display_info () uses AppKit classes. | 5287 | Needs to be here because ns_initialize_display_info () uses AppKit classes. |
| 5290 | The view will then ask the NSApp to stop and return to Emacs. */ | 5288 | The view will then ask the NSApp to stop and return to Emacs. */ |
| 5291 | [EmacsApp sharedApplication]; | 5289 | [EmacsApp sharedApplication]; |
| 5292 | if (NSApp == nil) | 5290 | if (NSApp == nil) |
| 5293 | return NULL; | 5291 | return NULL; |
| @@ -5377,7 +5375,7 @@ ns_term_init (Lisp_Object display_name) | |||
| 5377 | #ifdef NS_IMPL_GNUSTEP | 5375 | #ifdef NS_IMPL_GNUSTEP |
| 5378 | Vwindow_system_version = build_string (gnustep_base_version); | 5376 | Vwindow_system_version = build_string (gnustep_base_version); |
| 5379 | #else | 5377 | #else |
| 5380 | /*PSnextrelease (128, c); */ | 5378 | /* PSnextrelease (128, c); */ |
| 5381 | char c[DBL_BUFSIZE_BOUND]; | 5379 | char c[DBL_BUFSIZE_BOUND]; |
| 5382 | int len = dtoastr (c, sizeof c, 0, 0, NSAppKitVersionNumber); | 5380 | int len = dtoastr (c, sizeof c, 0, 0, NSAppKitVersionNumber); |
| 5383 | Vwindow_system_version = make_unibyte_string (c, len); | 5381 | Vwindow_system_version = make_unibyte_string (c, len); |
| @@ -5463,7 +5461,7 @@ ns_term_init (Lisp_Object display_name) | |||
| 5463 | #endif /* macOS menu setup */ | 5461 | #endif /* macOS menu setup */ |
| 5464 | 5462 | ||
| 5465 | /* Register our external input/output types, used for determining | 5463 | /* Register our external input/output types, used for determining |
| 5466 | applicable services and also drag/drop eligibility. */ | 5464 | applicable services and also drag/drop eligibility. */ |
| 5467 | 5465 | ||
| 5468 | NSTRACE_MSG ("Input/output types"); | 5466 | NSTRACE_MSG ("Input/output types"); |
| 5469 | 5467 | ||
| @@ -5633,9 +5631,9 @@ ns_term_shutdown (int sig) | |||
| 5633 | NSString *fstr = represented_filename; | 5631 | NSString *fstr = represented_filename; |
| 5634 | NSView *view = FRAME_NS_VIEW (represented_frame); | 5632 | NSView *view = FRAME_NS_VIEW (represented_frame); |
| 5635 | #ifdef NS_IMPL_COCOA | 5633 | #ifdef NS_IMPL_COCOA |
| 5636 | /* work around a bug observed on 10.3 and later where | 5634 | /* Work around a bug observed on 10.3 and later where |
| 5637 | setTitleWithRepresentedFilename does not clear out previous state | 5635 | setTitleWithRepresentedFilename does not clear out previous state |
| 5638 | if given filename does not exist */ | 5636 | if given filename does not exist. */ |
| 5639 | if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr]) | 5637 | if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr]) |
| 5640 | [[view window] setRepresentedFilename: @""]; | 5638 | [[view window] setRepresentedFilename: @""]; |
| 5641 | #endif | 5639 | #endif |
| @@ -5673,7 +5671,7 @@ ns_term_shutdown (int sig) | |||
| 5673 | /* Events posted by ns_send_appdefined interrupt the run loop here. | 5671 | /* Events posted by ns_send_appdefined interrupt the run loop here. |
| 5674 | But, if a modal window is up, an appdefined can still come through, | 5672 | But, if a modal window is up, an appdefined can still come through, |
| 5675 | (e.g., from a makeKeyWindow event) but stopping self also stops the | 5673 | (e.g., from a makeKeyWindow event) but stopping self also stops the |
| 5676 | modal loop. Just defer it until later. */ | 5674 | modal loop. Just defer it until later. */ |
| 5677 | if ([NSApp modalWindow] == nil) | 5675 | if ([NSApp modalWindow] == nil) |
| 5678 | { | 5676 | { |
| 5679 | last_appdefined_event_data = [theEvent data1]; | 5677 | last_appdefined_event_data = [theEvent data1]; |
| @@ -5738,7 +5736,7 @@ ns_term_shutdown (int sig) | |||
| 5738 | } | 5736 | } |
| 5739 | 5737 | ||
| 5740 | 5738 | ||
| 5741 | /* Open a file (used by below, after going into queue read by ns_read_socket) */ | 5739 | /* Open a file (used by below, after going into queue read by ns_read_socket). */ |
| 5742 | - (BOOL) openFile: (NSString *)fileName | 5740 | - (BOOL) openFile: (NSString *)fileName |
| 5743 | { | 5741 | { |
| 5744 | NSTRACE ("[EmacsApp openFile:]"); | 5742 | NSTRACE ("[EmacsApp openFile:]"); |
| @@ -5768,7 +5766,7 @@ ns_term_shutdown (int sig) | |||
| 5768 | 5766 | ||
| 5769 | - (void)applicationDidFinishLaunching: (NSNotification *)notification | 5767 | - (void)applicationDidFinishLaunching: (NSNotification *)notification |
| 5770 | /* -------------------------------------------------------------------------- | 5768 | /* -------------------------------------------------------------------------- |
| 5771 | When application is loaded, terminate event loop in ns_term_init | 5769 | When application is loaded, terminate event loop in ns_term_init. |
| 5772 | -------------------------------------------------------------------------- */ | 5770 | -------------------------------------------------------------------------- */ |
| 5773 | { | 5771 | { |
| 5774 | NSTRACE ("[EmacsApp applicationDidFinishLaunching:]"); | 5772 | NSTRACE ("[EmacsApp applicationDidFinishLaunching:]"); |
| @@ -5791,7 +5789,7 @@ ns_term_shutdown (int sig) | |||
| 5791 | if ([NSApp activationPolicy] == NSApplicationActivationPolicyProhibited) { | 5789 | if ([NSApp activationPolicy] == NSApplicationActivationPolicyProhibited) { |
| 5792 | /* Set the app's activation policy to regular when we run outside | 5790 | /* Set the app's activation policy to regular when we run outside |
| 5793 | of a bundle. This is already done for us by Info.plist when we | 5791 | of a bundle. This is already done for us by Info.plist when we |
| 5794 | run inside a bundle. */ | 5792 | run inside a bundle. */ |
| 5795 | [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; | 5793 | [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; |
| 5796 | [NSApp setApplicationIconImage: | 5794 | [NSApp setApplicationIconImage: |
| 5797 | [EmacsImage | 5795 | [EmacsImage |
| @@ -5895,7 +5893,7 @@ not_in_argv (NSString *arg) | |||
| 5895 | return 1; | 5893 | return 1; |
| 5896 | } | 5894 | } |
| 5897 | 5895 | ||
| 5898 | /* Notification from the Workspace to open a file */ | 5896 | /* Notification from the Workspace to open a file. */ |
| 5899 | - (BOOL)application: sender openFile: (NSString *)file | 5897 | - (BOOL)application: sender openFile: (NSString *)file |
| 5900 | { | 5898 | { |
| 5901 | if (ns_do_open_file || not_in_argv (file)) | 5899 | if (ns_do_open_file || not_in_argv (file)) |
| @@ -5904,7 +5902,7 @@ not_in_argv (NSString *arg) | |||
| 5904 | } | 5902 | } |
| 5905 | 5903 | ||
| 5906 | 5904 | ||
| 5907 | /* Open a file as a temporary file */ | 5905 | /* Open a file as a temporary file. */ |
| 5908 | - (BOOL)application: sender openTempFile: (NSString *)file | 5906 | - (BOOL)application: sender openTempFile: (NSString *)file |
| 5909 | { | 5907 | { |
| 5910 | if (ns_do_open_file || not_in_argv (file)) | 5908 | if (ns_do_open_file || not_in_argv (file)) |
| @@ -5913,7 +5911,7 @@ not_in_argv (NSString *arg) | |||
| 5913 | } | 5911 | } |
| 5914 | 5912 | ||
| 5915 | 5913 | ||
| 5916 | /* Notification from the Workspace to open a file noninteractively (?) */ | 5914 | /* Notification from the Workspace to open a file noninteractively (?). */ |
| 5917 | - (BOOL)application: sender openFileWithoutUI: (NSString *)file | 5915 | - (BOOL)application: sender openFileWithoutUI: (NSString *)file |
| 5918 | { | 5916 | { |
| 5919 | if (ns_do_open_file || not_in_argv (file)) | 5917 | if (ns_do_open_file || not_in_argv (file)) |
| @@ -5921,7 +5919,7 @@ not_in_argv (NSString *arg) | |||
| 5921 | return YES; | 5919 | return YES; |
| 5922 | } | 5920 | } |
| 5923 | 5921 | ||
| 5924 | /* Notification from the Workspace to open multiple files */ | 5922 | /* Notification from the Workspace to open multiple files. */ |
| 5925 | - (void)application: sender openFiles: (NSArray *)fileList | 5923 | - (void)application: sender openFiles: (NSArray *)fileList |
| 5926 | { | 5924 | { |
| 5927 | NSEnumerator *files = [fileList objectEnumerator]; | 5925 | NSEnumerator *files = [fileList objectEnumerator]; |
| @@ -5945,11 +5943,11 @@ not_in_argv (NSString *arg) | |||
| 5945 | } | 5943 | } |
| 5946 | 5944 | ||
| 5947 | 5945 | ||
| 5948 | /* TODO: these may help w/IO switching btwn terminal and NSApp */ | 5946 | /* TODO: these may help w/IO switching between terminal and NSApp. */ |
| 5949 | - (void)applicationWillBecomeActive: (NSNotification *)notification | 5947 | - (void)applicationWillBecomeActive: (NSNotification *)notification |
| 5950 | { | 5948 | { |
| 5951 | NSTRACE ("[EmacsApp applicationWillBecomeActive:]"); | 5949 | NSTRACE ("[EmacsApp applicationWillBecomeActive:]"); |
| 5952 | //ns_app_active=YES; | 5950 | // ns_app_active=YES; |
| 5953 | } | 5951 | } |
| 5954 | 5952 | ||
| 5955 | - (void)applicationDidBecomeActive: (NSNotification *)notification | 5953 | - (void)applicationDidBecomeActive: (NSNotification *)notification |
| @@ -5960,7 +5958,7 @@ not_in_argv (NSString *arg) | |||
| 5960 | if (! applicationDidFinishLaunchingCalled) | 5958 | if (! applicationDidFinishLaunchingCalled) |
| 5961 | [self applicationDidFinishLaunching:notification]; | 5959 | [self applicationDidFinishLaunching:notification]; |
| 5962 | #endif | 5960 | #endif |
| 5963 | //ns_app_active=YES; | 5961 | // ns_app_active=YES; |
| 5964 | 5962 | ||
| 5965 | ns_update_auto_hide_menu_bar (); | 5963 | ns_update_auto_hide_menu_bar (); |
| 5966 | // No constraining takes place when the application is not active. | 5964 | // No constraining takes place when the application is not active. |
| @@ -5970,7 +5968,7 @@ not_in_argv (NSString *arg) | |||
| 5970 | { | 5968 | { |
| 5971 | NSTRACE ("[EmacsApp applicationDidResignActive:]"); | 5969 | NSTRACE ("[EmacsApp applicationDidResignActive:]"); |
| 5972 | 5970 | ||
| 5973 | //ns_app_active=NO; | 5971 | // ns_app_active=NO; |
| 5974 | ns_send_appdefined (-1); | 5972 | ns_send_appdefined (-1); |
| 5975 | } | 5973 | } |
| 5976 | 5974 | ||
| @@ -5988,7 +5986,7 @@ not_in_argv (NSString *arg) | |||
| 5988 | The timeout specified to ns_select has passed. | 5986 | The timeout specified to ns_select has passed. |
| 5989 | -------------------------------------------------------------------------- */ | 5987 | -------------------------------------------------------------------------- */ |
| 5990 | { | 5988 | { |
| 5991 | /*NSTRACE ("timeout_handler"); */ | 5989 | /* NSTRACE ("timeout_handler"); */ |
| 5992 | ns_send_appdefined (-2); | 5990 | ns_send_appdefined (-2); |
| 5993 | } | 5991 | } |
| 5994 | 5992 | ||
| @@ -5999,7 +5997,7 @@ not_in_argv (NSString *arg) | |||
| 5999 | 5997 | ||
| 6000 | - (void)fd_handler:(id)unused | 5998 | - (void)fd_handler:(id)unused |
| 6001 | /* -------------------------------------------------------------------------- | 5999 | /* -------------------------------------------------------------------------- |
| 6002 | Check data waiting on file descriptors and terminate if so | 6000 | Check data waiting on file descriptors and terminate if so. |
| 6003 | -------------------------------------------------------------------------- */ | 6001 | -------------------------------------------------------------------------- */ |
| 6004 | { | 6002 | { |
| 6005 | int result; | 6003 | int result; |
| @@ -6094,7 +6092,7 @@ not_in_argv (NSString *arg) | |||
| 6094 | 6092 | ||
| 6095 | ========================================================================== */ | 6093 | ========================================================================== */ |
| 6096 | 6094 | ||
| 6097 | /* called from system: queue for next pass through event loop */ | 6095 | /* Called from system: queue for next pass through event loop. */ |
| 6098 | - (void)requestService: (NSPasteboard *)pboard | 6096 | - (void)requestService: (NSPasteboard *)pboard |
| 6099 | userData: (NSString *)userData | 6097 | userData: (NSString *)userData |
| 6100 | error: (NSString **)error | 6098 | error: (NSString **)error |
| @@ -6105,7 +6103,7 @@ not_in_argv (NSString *arg) | |||
| 6105 | } | 6103 | } |
| 6106 | 6104 | ||
| 6107 | 6105 | ||
| 6108 | /* called from ns_read_socket to clear queue */ | 6106 | /* Called from ns_read_socket to clear queue. */ |
| 6109 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg | 6107 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg |
| 6110 | { | 6108 | { |
| 6111 | struct frame *emacsframe = SELECTED_FRAME (); | 6109 | struct frame *emacsframe = SELECTED_FRAME (); |
| @@ -6139,7 +6137,7 @@ not_in_argv (NSString *arg) | |||
| 6139 | 6137 | ||
| 6140 | @implementation EmacsView | 6138 | @implementation EmacsView |
| 6141 | 6139 | ||
| 6142 | /* needed to inform when window closed from LISP */ | 6140 | /* Needed to inform when window closed from lisp. */ |
| 6143 | - (void) setWindowClosing: (BOOL)closing | 6141 | - (void) setWindowClosing: (BOOL)closing |
| 6144 | { | 6142 | { |
| 6145 | NSTRACE ("[EmacsView setWindowClosing:%d]", closing); | 6143 | NSTRACE ("[EmacsView setWindowClosing:%d]", closing); |
| @@ -6158,7 +6156,7 @@ not_in_argv (NSString *arg) | |||
| 6158 | } | 6156 | } |
| 6159 | 6157 | ||
| 6160 | 6158 | ||
| 6161 | /* called on font panel selection */ | 6159 | /* Called on font panel selection. */ |
| 6162 | - (void)changeFont: (id)sender | 6160 | - (void)changeFont: (id)sender |
| 6163 | { | 6161 | { |
| 6164 | NSEvent *e = [[self window] currentEvent]; | 6162 | NSEvent *e = [[self window] currentEvent]; |
| @@ -6226,7 +6224,7 @@ not_in_argv (NSString *arg) | |||
| 6226 | 6224 | ||
| 6227 | 6225 | ||
| 6228 | /*****************************************************************************/ | 6226 | /*****************************************************************************/ |
| 6229 | /* Keyboard handling. */ | 6227 | /* Keyboard handling. */ |
| 6230 | #define NS_KEYLOG 0 | 6228 | #define NS_KEYLOG 0 |
| 6231 | 6229 | ||
| 6232 | - (void)keyDown: (NSEvent *)theEvent | 6230 | - (void)keyDown: (NSEvent *)theEvent |
| @@ -6239,7 +6237,7 @@ not_in_argv (NSString *arg) | |||
| 6239 | 6237 | ||
| 6240 | NSTRACE ("[EmacsView keyDown:]"); | 6238 | NSTRACE ("[EmacsView keyDown:]"); |
| 6241 | 6239 | ||
| 6242 | /* Rhapsody and macOS give up and down events for the arrow keys */ | 6240 | /* Rhapsody and macOS give up and down events for the arrow keys. */ |
| 6243 | if (ns_fake_keydown == YES) | 6241 | if (ns_fake_keydown == YES) |
| 6244 | ns_fake_keydown = NO; | 6242 | ns_fake_keydown = NO; |
| 6245 | else if ([theEvent type] != NSEventTypeKeyDown) | 6243 | else if ([theEvent type] != NSEventTypeKeyDown) |
| @@ -6250,7 +6248,7 @@ not_in_argv (NSString *arg) | |||
| 6250 | 6248 | ||
| 6251 | if (![[self window] isKeyWindow] | 6249 | if (![[self window] isKeyWindow] |
| 6252 | && [[theEvent window] isKindOfClass: [EmacsWindow class]] | 6250 | && [[theEvent window] isKindOfClass: [EmacsWindow class]] |
| 6253 | /* we must avoid an infinite loop here. */ | 6251 | /* We must avoid an infinite loop here. */ |
| 6254 | && (EmacsView *)[[theEvent window] delegate] != self) | 6252 | && (EmacsView *)[[theEvent window] delegate] != self) |
| 6255 | { | 6253 | { |
| 6256 | /* XXX: There is an occasional condition in which, when Emacs display | 6254 | /* XXX: There is an occasional condition in which, when Emacs display |
| @@ -6258,7 +6256,7 @@ not_in_argv (NSString *arg) | |||
| 6258 | selects it, then processes some interrupt-driven input | 6256 | selects it, then processes some interrupt-driven input |
| 6259 | (dispnew.c:3878), OS will send the event to the correct NSWindow, but | 6257 | (dispnew.c:3878), OS will send the event to the correct NSWindow, but |
| 6260 | for some reason that window has its first responder set to the NSView | 6258 | for some reason that window has its first responder set to the NSView |
| 6261 | most recently updated (I guess), which is not the correct one. */ | 6259 | most recently updated (I guess), which is not the correct one. */ |
| 6262 | [(EmacsView *)[[theEvent window] delegate] keyDown: theEvent]; | 6260 | [(EmacsView *)[[theEvent window] delegate] keyDown: theEvent]; |
| 6263 | return; | 6261 | return; |
| 6264 | } | 6262 | } |
| @@ -6281,10 +6279,9 @@ not_in_argv (NSString *arg) | |||
| 6281 | code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? | 6279 | code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? |
| 6282 | 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; | 6280 | 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; |
| 6283 | 6281 | ||
| 6284 | /* is it a "function key"? */ | 6282 | /* Is it a "function key"? */ |
| 6285 | /* Note: Sometimes a plain key will have the NSEventModifierFlagNumericPad | 6283 | /* Note: Sometimes a plain key will have the NSEventModifierFlagNumericPad |
| 6286 | flag set (this is probably a bug in the OS). | 6284 | flag set (this is probably a bug in the OS). */ |
| 6287 | */ | ||
| 6288 | if (code < 0x00ff && (flags&NSEventModifierFlagNumericPad)) | 6285 | if (code < 0x00ff && (flags&NSEventModifierFlagNumericPad)) |
| 6289 | { | 6286 | { |
| 6290 | fnKeysym = ns_convert_key ([theEvent keyCode] | NSEventModifierFlagNumericPad); | 6287 | fnKeysym = ns_convert_key ([theEvent keyCode] | NSEventModifierFlagNumericPad); |
| @@ -6297,14 +6294,13 @@ not_in_argv (NSString *arg) | |||
| 6297 | if (fnKeysym) | 6294 | if (fnKeysym) |
| 6298 | { | 6295 | { |
| 6299 | /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', | 6296 | /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', |
| 6300 | because Emacs treats Delete and KP-Delete same (in simple.el). */ | 6297 | because Emacs treats Delete and KP-Delete same (in simple.el). */ |
| 6301 | if ((fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) | 6298 | if ((fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) |
| 6302 | #ifdef NS_IMPL_GNUSTEP | 6299 | #ifdef NS_IMPL_GNUSTEP |
| 6303 | /* GNUstep uses incompatible keycodes, even for those that are | 6300 | /* GNUstep uses incompatible keycodes, even for those that are |
| 6304 | supposed to be hardware independent. Just check for delete. | 6301 | supposed to be hardware independent. Just check for delete. |
| 6305 | Keypad delete does not have keysym 0xFFFF. | 6302 | Keypad delete does not have keysym 0xFFFF. |
| 6306 | See https://savannah.gnu.org/bugs/?25395 | 6303 | See https://savannah.gnu.org/bugs/?25395 */ |
| 6307 | */ | ||
| 6308 | || (fnKeysym == 0xFFFF && code == 127) | 6304 | || (fnKeysym == 0xFFFF && code == 127) |
| 6309 | #endif | 6305 | #endif |
| 6310 | ) | 6306 | ) |
| @@ -6336,7 +6332,7 @@ not_in_argv (NSString *arg) | |||
| 6336 | hasn't. Also some combinations of fn and a function key | 6332 | hasn't. Also some combinations of fn and a function key |
| 6337 | return a different key than was pressed (e.g. fn-<left> gives | 6333 | return a different key than was pressed (e.g. fn-<left> gives |
| 6338 | <home>). We need to unset the fn modifier in these cases. | 6334 | <home>). We need to unset the fn modifier in these cases. |
| 6339 | FIXME: Can we avoid setting it in the first place. */ | 6335 | FIXME: Can we avoid setting it in the first place? */ |
| 6340 | if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK)) | 6336 | if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK)) |
| 6341 | emacs_event->modifiers ^= parse_solitary_modifier (ns_function_modifier); | 6337 | emacs_event->modifiers ^= parse_solitary_modifier (ns_function_modifier); |
| 6342 | 6338 | ||
| @@ -6412,12 +6408,12 @@ not_in_argv (NSString *arg) | |||
| 6412 | } | 6408 | } |
| 6413 | 6409 | ||
| 6414 | 6410 | ||
| 6415 | /* <NSTextInput> implementation (called through super interpretKeyEvents:]). */ | 6411 | /* <NSTextInput> implementation (called through [super interpretKeyEvents:]). */ |
| 6416 | 6412 | ||
| 6417 | 6413 | ||
| 6418 | /* <NSTextInput>: called when done composing; | 6414 | /* <NSTextInput>: called when done composing; |
| 6419 | NOTE: also called when we delete over working text, followed immed. | 6415 | NOTE: also called when we delete over working text, followed |
| 6420 | by doCommandBySelector: deleteBackward: */ | 6416 | immediately by doCommandBySelector: deleteBackward: */ |
| 6421 | - (void)insertText: (id)aString | 6417 | - (void)insertText: (id)aString |
| 6422 | { | 6418 | { |
| 6423 | NSString *s; | 6419 | NSString *s; |
| @@ -6439,7 +6435,7 @@ not_in_argv (NSString *arg) | |||
| 6439 | if (!emacs_event) | 6435 | if (!emacs_event) |
| 6440 | return; | 6436 | return; |
| 6441 | 6437 | ||
| 6442 | /* first, clear any working text */ | 6438 | /* First, clear any working text. */ |
| 6443 | if (workingText != nil) | 6439 | if (workingText != nil) |
| 6444 | [self deleteWorkingText]; | 6440 | [self deleteWorkingText]; |
| 6445 | 6441 | ||
| @@ -6448,7 +6444,7 @@ not_in_argv (NSString *arg) | |||
| 6448 | However, we probably can't use SAFE_NALLOCA here because it might | 6444 | However, we probably can't use SAFE_NALLOCA here because it might |
| 6449 | exit nonlocally. */ | 6445 | exit nonlocally. */ |
| 6450 | 6446 | ||
| 6451 | /* now insert the string as keystrokes */ | 6447 | /* Now insert the string as keystrokes. */ |
| 6452 | for (NSUInteger i = 0; i < len; i++) | 6448 | for (NSUInteger i = 0; i < len; i++) |
| 6453 | { | 6449 | { |
| 6454 | NSUInteger code = [s characterAtIndex:i]; | 6450 | NSUInteger code = [s characterAtIndex:i]; |
| @@ -6461,7 +6457,7 @@ not_in_argv (NSString *arg) | |||
| 6461 | ++i; | 6457 | ++i; |
| 6462 | } | 6458 | } |
| 6463 | } | 6459 | } |
| 6464 | /* TODO: still need this? */ | 6460 | /* TODO: still need this? */ |
| 6465 | if (code == 0x2DC) | 6461 | if (code == 0x2DC) |
| 6466 | code = '~'; /* 0x7E */ | 6462 | code = '~'; /* 0x7E */ |
| 6467 | if (code != 32) /* Space */ | 6463 | if (code != 32) /* Space */ |
| @@ -6474,7 +6470,7 @@ not_in_argv (NSString *arg) | |||
| 6474 | } | 6470 | } |
| 6475 | 6471 | ||
| 6476 | 6472 | ||
| 6477 | /* <NSTextInput>: inserts display of composing characters */ | 6473 | /* <NSTextInput>: inserts display of composing characters. */ |
| 6478 | - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange | 6474 | - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange |
| 6479 | { | 6475 | { |
| 6480 | NSString *str = [aString respondsToSelector: @selector (string)] ? | 6476 | NSString *str = [aString respondsToSelector: @selector (string)] ? |
| @@ -6506,7 +6502,7 @@ not_in_argv (NSString *arg) | |||
| 6506 | } | 6502 | } |
| 6507 | 6503 | ||
| 6508 | 6504 | ||
| 6509 | /* delete display of composing characters [not in <NSTextInput>] */ | 6505 | /* Delete display of composing characters [not in <NSTextInput>]. */ |
| 6510 | - (void)deleteWorkingText | 6506 | - (void)deleteWorkingText |
| 6511 | { | 6507 | { |
| 6512 | NSTRACE ("[EmacsView deleteWorkingText]"); | 6508 | NSTRACE ("[EmacsView deleteWorkingText]"); |
| @@ -6559,7 +6555,7 @@ not_in_argv (NSString *arg) | |||
| 6559 | } | 6555 | } |
| 6560 | 6556 | ||
| 6561 | 6557 | ||
| 6562 | /* used to position char selection windows, etc. */ | 6558 | /* Used to position char selection windows, etc. */ |
| 6563 | - (NSRect)firstRectForCharacterRange: (NSRange)theRange | 6559 | - (NSRect)firstRectForCharacterRange: (NSRange)theRange |
| 6564 | { | 6560 | { |
| 6565 | NSRect rect; | 6561 | NSRect rect; |
| @@ -6619,8 +6615,8 @@ not_in_argv (NSString *arg) | |||
| 6619 | processingCompose = NO; | 6615 | processingCompose = NO; |
| 6620 | if (aSelector == @selector (deleteBackward:)) | 6616 | if (aSelector == @selector (deleteBackward:)) |
| 6621 | { | 6617 | { |
| 6622 | /* happens when user backspaces over an ongoing composition: | 6618 | /* Happens when user backspaces over an ongoing composition: |
| 6623 | throw a 'delete' into the event queue */ | 6619 | throw a 'delete' into the event queue. */ |
| 6624 | if (!emacs_event) | 6620 | if (!emacs_event) |
| 6625 | return; | 6621 | return; |
| 6626 | emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT; | 6622 | emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT; |
| @@ -6665,7 +6661,7 @@ not_in_argv (NSString *arg) | |||
| 6665 | return str; | 6661 | return str; |
| 6666 | } | 6662 | } |
| 6667 | 6663 | ||
| 6668 | /* End <NSTextInput> impl. */ | 6664 | /* End <NSTextInput> implementation. */ |
| 6669 | /*****************************************************************************/ | 6665 | /*****************************************************************************/ |
| 6670 | 6666 | ||
| 6671 | 6667 | ||
| @@ -6683,8 +6679,8 @@ not_in_argv (NSString *arg) | |||
| 6683 | return; | 6679 | return; |
| 6684 | 6680 | ||
| 6685 | dpyinfo->last_mouse_frame = emacsframe; | 6681 | dpyinfo->last_mouse_frame = emacsframe; |
| 6686 | /* appears to be needed to prevent spurious movement events generated on | 6682 | /* Appears to be needed to prevent spurious movement events generated on |
| 6687 | button clicks */ | 6683 | button clicks. */ |
| 6688 | emacsframe->mouse_moved = 0; | 6684 | emacsframe->mouse_moved = 0; |
| 6689 | 6685 | ||
| 6690 | if ([theEvent type] == NSEventTypeScrollWheel) | 6686 | if ([theEvent type] == NSEventTypeScrollWheel) |
| @@ -6803,7 +6799,8 @@ not_in_argv (NSString *arg) | |||
| 6803 | #if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | 6799 | #if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070 |
| 6804 | { | 6800 | { |
| 6805 | CGFloat delta = [theEvent deltaY]; | 6801 | CGFloat delta = [theEvent deltaY]; |
| 6806 | /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ | 6802 | /* Mac notebooks send wheel events with delta equal to 0 |
| 6803 | when trackpad scrolling. */ | ||
| 6807 | if (delta == 0) | 6804 | if (delta == 0) |
| 6808 | { | 6805 | { |
| 6809 | delta = [theEvent deltaX]; | 6806 | delta = [theEvent deltaX]; |
| @@ -6880,7 +6877,7 @@ not_in_argv (NSString *arg) | |||
| 6880 | } | 6877 | } |
| 6881 | 6878 | ||
| 6882 | 6879 | ||
| 6883 | /* Tell emacs the mouse has moved. */ | 6880 | /* Tell emacs the mouse has moved. */ |
| 6884 | - (void)mouseMoved: (NSEvent *)e | 6881 | - (void)mouseMoved: (NSEvent *)e |
| 6885 | { | 6882 | { |
| 6886 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); | 6883 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); |
| @@ -6895,14 +6892,14 @@ not_in_argv (NSString *arg) | |||
| 6895 | dpyinfo->last_mouse_motion_x = pt.x; | 6892 | dpyinfo->last_mouse_motion_x = pt.x; |
| 6896 | dpyinfo->last_mouse_motion_y = pt.y; | 6893 | dpyinfo->last_mouse_motion_y = pt.y; |
| 6897 | 6894 | ||
| 6898 | /* update any mouse face */ | 6895 | /* Update any mouse face. */ |
| 6899 | if (hlinfo->mouse_face_hidden) | 6896 | if (hlinfo->mouse_face_hidden) |
| 6900 | { | 6897 | { |
| 6901 | hlinfo->mouse_face_hidden = 0; | 6898 | hlinfo->mouse_face_hidden = 0; |
| 6902 | clear_mouse_face (hlinfo); | 6899 | clear_mouse_face (hlinfo); |
| 6903 | } | 6900 | } |
| 6904 | 6901 | ||
| 6905 | /* tooltip handling */ | 6902 | /* Tooltip handling. */ |
| 6906 | previous_help_echo_string = help_echo_string; | 6903 | previous_help_echo_string = help_echo_string; |
| 6907 | help_echo_string = Qnil; | 6904 | help_echo_string = Qnil; |
| 6908 | 6905 | ||
| @@ -6937,7 +6934,7 @@ not_in_argv (NSString *arg) | |||
| 6937 | { | 6934 | { |
| 6938 | /* NOTE: help_echo_{window,pos,object} are set in xdisp.c | 6935 | /* NOTE: help_echo_{window,pos,object} are set in xdisp.c |
| 6939 | (note_mouse_highlight), which is called through the | 6936 | (note_mouse_highlight), which is called through the |
| 6940 | note_mouse_movement () call above */ | 6937 | note_mouse_movement () call above. */ |
| 6941 | any_help_event_p = YES; | 6938 | any_help_event_p = YES; |
| 6942 | gen_help_event (help_echo_string, frame, help_echo_window, | 6939 | gen_help_event (help_echo_string, frame, help_echo_window, |
| 6943 | help_echo_object, help_echo_pos); | 6940 | help_echo_object, help_echo_pos); |
| @@ -7021,7 +7018,7 @@ not_in_argv (NSString *arg) | |||
| 7021 | if (wait_for_tool_bar) | 7018 | if (wait_for_tool_bar) |
| 7022 | { | 7019 | { |
| 7023 | /* The toolbar height is always 0 in fullscreen and undecorated | 7020 | /* The toolbar height is always 0 in fullscreen and undecorated |
| 7024 | frames, so don't wait for it to become available. */ | 7021 | frames, so don't wait for it to become available. */ |
| 7025 | if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0 | 7022 | if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0 |
| 7026 | && FRAME_UNDECORATED (emacsframe) == false | 7023 | && FRAME_UNDECORATED (emacsframe) == false |
| 7027 | && ! [self isFullscreen]) | 7024 | && ! [self isFullscreen]) |
| @@ -7069,7 +7066,7 @@ not_in_argv (NSString *arg) | |||
| 7069 | wr = NSMakeRect (0, 0, neww, newh); | 7066 | wr = NSMakeRect (0, 0, neww, newh); |
| 7070 | [view setFrame: wr]; | 7067 | [view setFrame: wr]; |
| 7071 | 7068 | ||
| 7072 | // to do: consider using [NSNotificationCenter postNotificationName:]. | 7069 | // To do: consider using [NSNotificationCenter postNotificationName:]. |
| 7073 | [self windowDidMove: // Update top/left. | 7070 | [self windowDidMove: // Update top/left. |
| 7074 | [NSNotification notificationWithName:NSWindowDidMoveNotification | 7071 | [NSNotification notificationWithName:NSWindowDidMoveNotification |
| 7075 | object:[view window]]]; | 7072 | object:[view window]]]; |
| @@ -7081,7 +7078,7 @@ not_in_argv (NSString *arg) | |||
| 7081 | } | 7078 | } |
| 7082 | 7079 | ||
| 7083 | - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize | 7080 | - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize |
| 7084 | /* normalize frame to gridded text size */ | 7081 | /* Normalize frame to gridded text size. */ |
| 7085 | { | 7082 | { |
| 7086 | int extra = 0; | 7083 | int extra = 0; |
| 7087 | 7084 | ||
| @@ -7123,7 +7120,7 @@ not_in_argv (NSString *arg) | |||
| 7123 | rows = MINHEIGHT; | 7120 | rows = MINHEIGHT; |
| 7124 | #ifdef NS_IMPL_COCOA | 7121 | #ifdef NS_IMPL_COCOA |
| 7125 | { | 7122 | { |
| 7126 | /* this sets window title to have size in it; the wm does this under GS */ | 7123 | /* This sets window title to have size in it; the wm does this under GS. */ |
| 7127 | NSRect r = [[self window] frame]; | 7124 | NSRect r = [[self window] frame]; |
| 7128 | if (r.size.height == frameSize.height && r.size.width == frameSize.width) | 7125 | if (r.size.height == frameSize.height && r.size.width == frameSize.width) |
| 7129 | { | 7126 | { |
| @@ -7157,12 +7154,12 @@ not_in_argv (NSString *arg) | |||
| 7157 | 7154 | ||
| 7158 | NSTRACE_MSG ("cols: %d rows: %d", cols, rows); | 7155 | NSTRACE_MSG ("cols: %d rows: %d", cols, rows); |
| 7159 | 7156 | ||
| 7160 | /* Restrict the new size to the text gird. | 7157 | /* Restrict the new size to the text grid. |
| 7161 | 7158 | ||
| 7162 | Don't restrict the width if the user only adjusted the height, and | 7159 | Don't restrict the width if the user only adjusted the height, and |
| 7163 | vice versa. (Without this, the frame would shrink, and move | 7160 | vice versa. (Without this, the frame would shrink, and move |
| 7164 | slightly, if the window was resized by dragging one of its | 7161 | slightly, if the window was resized by dragging one of its |
| 7165 | borders.) */ | 7162 | borders.) */ |
| 7166 | if (!frame_resize_pixelwise) | 7163 | if (!frame_resize_pixelwise) |
| 7167 | { | 7164 | { |
| 7168 | NSRect r = [[self window] frame]; | 7165 | NSRect r = [[self window] frame]; |
| @@ -7214,8 +7211,8 @@ not_in_argv (NSString *arg) | |||
| 7214 | NSWindow *theWindow = [notification object]; | 7211 | NSWindow *theWindow = [notification object]; |
| 7215 | 7212 | ||
| 7216 | /* In GNUstep, at least currently, it's possible to get a didResize | 7213 | /* In GNUstep, at least currently, it's possible to get a didResize |
| 7217 | without getting a willResize.. therefore we need to act as if we got | 7214 | without getting a willResize, therefore we need to act as if we got |
| 7218 | the willResize now */ | 7215 | the willResize now. */ |
| 7219 | NSSize sz = [theWindow frame].size; | 7216 | NSSize sz = [theWindow frame].size; |
| 7220 | sz = [self windowWillResize: theWindow toSize: sz]; | 7217 | sz = [self windowWillResize: theWindow toSize: sz]; |
| 7221 | #endif /* NS_IMPL_GNUSTEP */ | 7218 | #endif /* NS_IMPL_GNUSTEP */ |
| @@ -7286,7 +7283,7 @@ not_in_argv (NSString *arg) | |||
| 7286 | ns_frame_rehighlight (emacsframe); | 7283 | ns_frame_rehighlight (emacsframe); |
| 7287 | 7284 | ||
| 7288 | /* FIXME: for some reason needed on second and subsequent clicks away | 7285 | /* FIXME: for some reason needed on second and subsequent clicks away |
| 7289 | from sole-frame Emacs to get hollow box to show */ | 7286 | from sole-frame Emacs to get hollow box to show. */ |
| 7290 | if (!windowClosing && [[self window] isVisible] == YES) | 7287 | if (!windowClosing && [[self window] isVisible] == YES) |
| 7291 | { | 7288 | { |
| 7292 | x_update_cursor (emacsframe, 1); | 7289 | x_update_cursor (emacsframe, 1); |
| @@ -7518,7 +7515,7 @@ not_in_argv (NSString *arg) | |||
| 7518 | 7515 | ||
| 7519 | /* macOS Sierra automatically enables tabbed windows. We can't | 7516 | /* macOS Sierra automatically enables tabbed windows. We can't |
| 7520 | allow this to be enabled until it's available on a Free system. | 7517 | allow this to be enabled until it's available on a Free system. |
| 7521 | Currently it only happens by accident and is buggy anyway. */ | 7518 | Currently it only happens by accident and is buggy anyway. */ |
| 7522 | #if defined (NS_IMPL_COCOA) \ | 7519 | #if defined (NS_IMPL_COCOA) \ |
| 7523 | && MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 | 7520 | && MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 |
| 7524 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 | 7521 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 |
| @@ -7560,7 +7557,7 @@ not_in_argv (NSString *arg) | |||
| 7560 | 7557 | ||
| 7561 | /* Called AFTER method below, but before our windowWillResize call there leads | 7558 | /* Called AFTER method below, but before our windowWillResize call there leads |
| 7562 | to windowDidResize -> x_set_window_size. Update emacs' notion of frame | 7559 | to windowDidResize -> x_set_window_size. Update emacs' notion of frame |
| 7563 | location so set_window_size moves the frame. */ | 7560 | location so set_window_size moves the frame. */ |
| 7564 | - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame | 7561 | - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame |
| 7565 | { | 7562 | { |
| 7566 | NSTRACE (("[EmacsView windowShouldZoom:toFrame:" NSTRACE_FMT_RECT "]" | 7563 | NSTRACE (("[EmacsView windowShouldZoom:toFrame:" NSTRACE_FMT_RECT "]" |
| @@ -7574,7 +7571,7 @@ not_in_argv (NSString *arg) | |||
| 7574 | 7571 | ||
| 7575 | /* Override to do something slightly nonstandard, but nice. First click on | 7572 | /* Override to do something slightly nonstandard, but nice. First click on |
| 7576 | zoom button will zoom vertically. Second will zoom completely. Third | 7573 | zoom button will zoom vertically. Second will zoom completely. Third |
| 7577 | returns to original. */ | 7574 | returns to original. */ |
| 7578 | - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender | 7575 | - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender |
| 7579 | defaultFrame:(NSRect)defaultFrame | 7576 | defaultFrame:(NSRect)defaultFrame |
| 7580 | { | 7577 | { |
| @@ -7655,7 +7652,7 @@ not_in_argv (NSString *arg) | |||
| 7655 | { | 7652 | { |
| 7656 | NSTRACE_MSG ("FULLSCREEN_MAXIMIZED"); | 7653 | NSTRACE_MSG ("FULLSCREEN_MAXIMIZED"); |
| 7657 | 7654 | ||
| 7658 | result = defaultFrame; /* second click */ | 7655 | result = defaultFrame; /* second click */ |
| 7659 | maximized_width = result.size.width; | 7656 | maximized_width = result.size.width; |
| 7660 | maximized_height = result.size.height; | 7657 | maximized_height = result.size.height; |
| 7661 | [self setFSValue: FULLSCREEN_MAXIMIZED]; | 7658 | [self setFSValue: FULLSCREEN_MAXIMIZED]; |
| @@ -7936,7 +7933,7 @@ not_in_argv (NSString *arg) | |||
| 7936 | NSScreen *screen = [w screen]; | 7933 | NSScreen *screen = [w screen]; |
| 7937 | 7934 | ||
| 7938 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 | 7935 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 |
| 7939 | /* Hide ghost menu bar on secondary monitor? */ | 7936 | /* Hide ghost menu bar on secondary monitor? */ |
| 7940 | if (! onFirstScreen | 7937 | if (! onFirstScreen |
| 7941 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 | 7938 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 |
| 7942 | && [NSScreen respondsToSelector: @selector(screensHaveSeparateSpaces)] | 7939 | && [NSScreen respondsToSelector: @selector(screensHaveSeparateSpaces)] |
| @@ -8015,7 +8012,8 @@ not_in_argv (NSString *arg) | |||
| 8015 | 8012 | ||
| 8016 | f->border_width = bwidth; | 8013 | f->border_width = bwidth; |
| 8017 | 8014 | ||
| 8018 | // to do: consider using [NSNotificationCenter postNotificationName:] to send notifications. | 8015 | // To do: consider using [NSNotificationCenter postNotificationName:] to |
| 8016 | // send notifications. | ||
| 8019 | 8017 | ||
| 8020 | [self windowWillExitFullScreen]; | 8018 | [self windowWillExitFullScreen]; |
| 8021 | [fw setFrame: [w frame] display:YES animate:ns_use_fullscreen_animation]; | 8019 | [fw setFrame: [w frame] display:YES animate:ns_use_fullscreen_animation]; |
| @@ -8155,7 +8153,7 @@ not_in_argv (NSString *arg) | |||
| 8155 | } | 8153 | } |
| 8156 | 8154 | ||
| 8157 | 8155 | ||
| 8158 | /* this gets called on toolbar button click */ | 8156 | /* This gets called on toolbar button click. */ |
| 8159 | - (instancetype)toolbarClicked: (id)item | 8157 | - (instancetype)toolbarClicked: (id)item |
| 8160 | { | 8158 | { |
| 8161 | NSEvent *theEvent; | 8159 | NSEvent *theEvent; |
| @@ -8166,14 +8164,14 @@ not_in_argv (NSString *arg) | |||
| 8166 | if (!emacs_event) | 8164 | if (!emacs_event) |
| 8167 | return self; | 8165 | return self; |
| 8168 | 8166 | ||
| 8169 | /* send first event (for some reason two needed) */ | 8167 | /* Send first event (for some reason two needed). */ |
| 8170 | theEvent = [[self window] currentEvent]; | 8168 | theEvent = [[self window] currentEvent]; |
| 8171 | emacs_event->kind = TOOL_BAR_EVENT; | 8169 | emacs_event->kind = TOOL_BAR_EVENT; |
| 8172 | XSETFRAME (emacs_event->arg, emacsframe); | 8170 | XSETFRAME (emacs_event->arg, emacsframe); |
| 8173 | EV_TRAILER (theEvent); | 8171 | EV_TRAILER (theEvent); |
| 8174 | 8172 | ||
| 8175 | emacs_event->kind = TOOL_BAR_EVENT; | 8173 | emacs_event->kind = TOOL_BAR_EVENT; |
| 8176 | /* XSETINT (emacs_event->code, 0); */ | 8174 | /* XSETINT (emacs_event->code, 0); */ |
| 8177 | emacs_event->arg = AREF (emacsframe->tool_bar_items, | 8175 | emacs_event->arg = AREF (emacsframe->tool_bar_items, |
| 8178 | idx + TOOL_BAR_ITEM_KEY); | 8176 | idx + TOOL_BAR_ITEM_KEY); |
| 8179 | emacs_event->modifiers = EV_MODIFIERS (theEvent); | 8177 | emacs_event->modifiers = EV_MODIFIERS (theEvent); |
| @@ -8365,13 +8363,13 @@ not_in_argv (NSString *arg) | |||
| 8365 | But this should not happen because we override the services menu with our | 8363 | But this should not happen because we override the services menu with our |
| 8366 | own entries which call ns-perform-service. | 8364 | own entries which call ns-perform-service. |
| 8367 | Nonetheless, it appeared to happen (under strange circumstances): bug#1435. | 8365 | Nonetheless, it appeared to happen (under strange circumstances): bug#1435. |
| 8368 | So let's at least stub them out until further investigation can be done. */ | 8366 | So let's at least stub them out until further investigation can be done. */ |
| 8369 | 8367 | ||
| 8370 | - (BOOL) readSelectionFromPasteboard: (NSPasteboard *)pb | 8368 | - (BOOL) readSelectionFromPasteboard: (NSPasteboard *)pb |
| 8371 | { | 8369 | { |
| 8372 | /* we could call ns_string_from_pasteboard(pboard) here but then it should | 8370 | /* We could call ns_string_from_pasteboard(pboard) here but then it should |
| 8373 | be written into the buffer in place of the existing selection.. | 8371 | be written into the buffer in place of the existing selection. |
| 8374 | ordinary service calls go through functions defined in ns-win.el */ | 8372 | Ordinary service calls go through functions defined in ns-win.el. */ |
| 8375 | return NO; | 8373 | return NO; |
| 8376 | } | 8374 | } |
| 8377 | 8375 | ||
| @@ -8382,7 +8380,7 @@ not_in_argv (NSString *arg) | |||
| 8382 | 8380 | ||
| 8383 | NSTRACE ("[EmacsView writeSelectionToPasteboard:types:]"); | 8381 | NSTRACE ("[EmacsView writeSelectionToPasteboard:types:]"); |
| 8384 | 8382 | ||
| 8385 | /* We only support NSStringPboardType */ | 8383 | /* We only support NSStringPboardType. */ |
| 8386 | if ([types containsObject:NSStringPboardType] == NO) { | 8384 | if ([types containsObject:NSStringPboardType] == NO) { |
| 8387 | return NO; | 8385 | return NO; |
| 8388 | } | 8386 | } |
| @@ -8404,10 +8402,10 @@ not_in_argv (NSString *arg) | |||
| 8404 | } | 8402 | } |
| 8405 | 8403 | ||
| 8406 | 8404 | ||
| 8407 | /* setMini =YES means set from internal (gives a finder icon), NO means set nil | 8405 | /* setMini = YES means set from internal (gives a finder icon), NO means set nil |
| 8408 | (gives a miniaturized version of the window); currently we use the latter for | 8406 | (gives a miniaturized version of the window); currently we use the latter for |
| 8409 | frames whose active buffer doesn't correspond to any file | 8407 | frames whose active buffer doesn't correspond to any file |
| 8410 | (e.g., '*scratch*') */ | 8408 | (e.g., '*scratch*'). */ |
| 8411 | - (instancetype)setMiniwindowImage: (BOOL) setMini | 8409 | - (instancetype)setMiniwindowImage: (BOOL) setMini |
| 8412 | { | 8410 | { |
| 8413 | id image = [[self window] miniwindowImage]; | 8411 | id image = [[self window] miniwindowImage]; |
| @@ -8415,7 +8413,7 @@ not_in_argv (NSString *arg) | |||
| 8415 | 8413 | ||
| 8416 | /* NOTE: under Cocoa miniwindowImage always returns nil, documentation | 8414 | /* NOTE: under Cocoa miniwindowImage always returns nil, documentation |
| 8417 | about "AppleDockIconEnabled" notwithstanding, however the set message | 8415 | about "AppleDockIconEnabled" notwithstanding, however the set message |
| 8418 | below has its effect nonetheless. */ | 8416 | below has its effect nonetheless. */ |
| 8419 | if (image != emacsframe->output_data.ns->miniimage) | 8417 | if (image != emacsframe->output_data.ns->miniimage) |
| 8420 | { | 8418 | { |
| 8421 | if (image && [image isKindOfClass: [EmacsImage class]]) | 8419 | if (image && [image isKindOfClass: [EmacsImage class]]) |
| @@ -8526,7 +8524,7 @@ not_in_argv (NSString *arg) | |||
| 8526 | Note that this should work in situations where multiple monitors | 8524 | Note that this should work in situations where multiple monitors |
| 8527 | are present. Common configurations are side-by-side monitors and a | 8525 | are present. Common configurations are side-by-side monitors and a |
| 8528 | monitor on top of another (e.g. when a laptop is placed under a | 8526 | monitor on top of another (e.g. when a laptop is placed under a |
| 8529 | large screen). */ | 8527 | large screen). */ |
| 8530 | - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen | 8528 | - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen |
| 8531 | { | 8529 | { |
| 8532 | NSTRACE ("[EmacsWindow constrainFrameRect:" NSTRACE_FMT_RECT " toScreen:]", | 8530 | NSTRACE ("[EmacsWindow constrainFrameRect:" NSTRACE_FMT_RECT " toScreen:]", |
| @@ -8753,7 +8751,7 @@ not_in_argv (NSString *arg) | |||
| 8753 | + (CGFloat) scrollerWidth | 8751 | + (CGFloat) scrollerWidth |
| 8754 | { | 8752 | { |
| 8755 | /* TODO: if we want to allow variable widths, this is the place to do it, | 8753 | /* TODO: if we want to allow variable widths, this is the place to do it, |
| 8756 | however neither GNUstep nor Cocoa support it very well */ | 8754 | however neither GNUstep nor Cocoa support it very well. */ |
| 8757 | CGFloat r; | 8755 | CGFloat r; |
| 8758 | #if defined (NS_IMPL_COCOA) \ | 8756 | #if defined (NS_IMPL_COCOA) \ |
| 8759 | && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 | 8757 | && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 |
| @@ -8789,7 +8787,7 @@ not_in_argv (NSString *arg) | |||
| 8789 | 8787 | ||
| 8790 | /* Ensure auto resizing of scrollbars occurs within the emacs frame's view | 8788 | /* Ensure auto resizing of scrollbars occurs within the emacs frame's view |
| 8791 | locked against the top and bottom edges, and right edge on macOS, where | 8789 | locked against the top and bottom edges, and right edge on macOS, where |
| 8792 | scrollers are on right. */ | 8790 | scrollers are on right. */ |
| 8793 | #ifdef NS_IMPL_GNUSTEP | 8791 | #ifdef NS_IMPL_GNUSTEP |
| 8794 | [self setAutoresizingMask: NSViewMaxXMargin | NSViewHeightSizable]; | 8792 | [self setAutoresizingMask: NSViewMaxXMargin | NSViewHeightSizable]; |
| 8795 | #else | 8793 | #else |
| @@ -8813,7 +8811,7 @@ not_in_argv (NSString *arg) | |||
| 8813 | NSView *sview = [[view window] contentView]; | 8811 | NSView *sview = [[view window] contentView]; |
| 8814 | NSArray *subs = [sview subviews]; | 8812 | NSArray *subs = [sview subviews]; |
| 8815 | 8813 | ||
| 8816 | /* disable optimization stopping redraw of other scrollbars */ | 8814 | /* Disable optimization stopping redraw of other scrollbars. */ |
| 8817 | view->scrollbarsNeedingUpdate = 0; | 8815 | view->scrollbarsNeedingUpdate = 0; |
| 8818 | for (i =[subs count]-1; i >= 0; i--) | 8816 | for (i =[subs count]-1; i >= 0; i--) |
| 8819 | if ([[subs objectAtIndex: i] isKindOfClass: [EmacsScroller class]]) | 8817 | if ([[subs objectAtIndex: i] isKindOfClass: [EmacsScroller class]]) |
| @@ -8821,7 +8819,7 @@ not_in_argv (NSString *arg) | |||
| 8821 | [sview addSubview: self]; | 8819 | [sview addSubview: self]; |
| 8822 | } | 8820 | } |
| 8823 | 8821 | ||
| 8824 | /* [self setFrame: r]; */ | 8822 | /* [self setFrame: r]; */ |
| 8825 | 8823 | ||
| 8826 | return self; | 8824 | return self; |
| 8827 | } | 8825 | } |
| @@ -8831,7 +8829,7 @@ not_in_argv (NSString *arg) | |||
| 8831 | { | 8829 | { |
| 8832 | NSTRACE ("[EmacsScroller setFrame:]"); | 8830 | NSTRACE ("[EmacsScroller setFrame:]"); |
| 8833 | 8831 | ||
| 8834 | /* block_input (); */ | 8832 | /* block_input (); */ |
| 8835 | if (horizontal) | 8833 | if (horizontal) |
| 8836 | pixel_length = NSWidth (newRect); | 8834 | pixel_length = NSWidth (newRect); |
| 8837 | else | 8835 | else |
| @@ -8839,7 +8837,7 @@ not_in_argv (NSString *arg) | |||
| 8839 | if (pixel_length == 0) pixel_length = 1; | 8837 | if (pixel_length == 0) pixel_length = 1; |
| 8840 | min_portion = 20 / pixel_length; | 8838 | min_portion = 20 / pixel_length; |
| 8841 | [super setFrame: newRect]; | 8839 | [super setFrame: newRect]; |
| 8842 | /* unblock_input (); */ | 8840 | /* unblock_input (); */ |
| 8843 | } | 8841 | } |
| 8844 | 8842 | ||
| 8845 | 8843 | ||
| @@ -8882,7 +8880,7 @@ not_in_argv (NSString *arg) | |||
| 8882 | { | 8880 | { |
| 8883 | EmacsView *view; | 8881 | EmacsView *view; |
| 8884 | block_input (); | 8882 | block_input (); |
| 8885 | /* ensure other scrollbar updates after deletion */ | 8883 | /* Ensure other scrollbar updates after deletion. */ |
| 8886 | view = (EmacsView *)FRAME_NS_VIEW (frame); | 8884 | view = (EmacsView *)FRAME_NS_VIEW (frame); |
| 8887 | if (view != nil) | 8885 | if (view != nil) |
| 8888 | view->scrollbarsNeedingUpdate++; | 8886 | view->scrollbarsNeedingUpdate++; |
| @@ -8924,7 +8922,7 @@ not_in_argv (NSString *arg) | |||
| 8924 | whole: (int) whole | 8922 | whole: (int) whole |
| 8925 | { | 8923 | { |
| 8926 | return em_position ==position && em_portion ==portion && em_whole ==whole | 8924 | return em_position ==position && em_portion ==portion && em_whole ==whole |
| 8927 | && portion != whole; /* needed for resize empty buf */ | 8925 | && portion != whole; /* Needed for resizing empty buffer. */ |
| 8928 | } | 8926 | } |
| 8929 | 8927 | ||
| 8930 | 8928 | ||
| @@ -8963,7 +8961,7 @@ not_in_argv (NSString *arg) | |||
| 8963 | return self; | 8961 | return self; |
| 8964 | } | 8962 | } |
| 8965 | 8963 | ||
| 8966 | /* set up emacs_event */ | 8964 | /* Set up emacs_event. */ |
| 8967 | - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e | 8965 | - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e |
| 8968 | { | 8966 | { |
| 8969 | Lisp_Object win; | 8967 | Lisp_Object win; |
| @@ -9006,7 +9004,8 @@ not_in_argv (NSString *arg) | |||
| 9006 | } | 9004 | } |
| 9007 | 9005 | ||
| 9008 | 9006 | ||
| 9009 | /* called manually thru timer to implement repeated button action w/hold-down */ | 9007 | /* Called manually through timer to implement repeated button action |
| 9008 | with hold-down. */ | ||
| 9010 | - (instancetype)repeatScroll: (NSTimer *)scrollEntry | 9009 | - (instancetype)repeatScroll: (NSTimer *)scrollEntry |
| 9011 | { | 9010 | { |
| 9012 | NSEvent *e = [[self window] currentEvent]; | 9011 | NSEvent *e = [[self window] currentEvent]; |
| @@ -9015,7 +9014,7 @@ not_in_argv (NSString *arg) | |||
| 9015 | 9014 | ||
| 9016 | NSTRACE ("[EmacsScroller repeatScroll:]"); | 9015 | NSTRACE ("[EmacsScroller repeatScroll:]"); |
| 9017 | 9016 | ||
| 9018 | /* clear timer if need be */ | 9017 | /* Clear timer if need be. */ |
| 9019 | if (inKnob || [scroll_repeat_entry timeInterval] == SCROLL_BAR_FIRST_DELAY) | 9018 | if (inKnob || [scroll_repeat_entry timeInterval] == SCROLL_BAR_FIRST_DELAY) |
| 9020 | { | 9019 | { |
| 9021 | [scroll_repeat_entry invalidate]; | 9020 | [scroll_repeat_entry invalidate]; |
| @@ -9041,11 +9040,11 @@ not_in_argv (NSString *arg) | |||
| 9041 | 9040 | ||
| 9042 | 9041 | ||
| 9043 | /* Asynchronous mouse tracking for scroller. This allows us to dispatch | 9042 | /* Asynchronous mouse tracking for scroller. This allows us to dispatch |
| 9044 | mouseDragged events without going into a modal loop. */ | 9043 | mouseDragged events without going into a modal loop. */ |
| 9045 | - (void)mouseDown: (NSEvent *)e | 9044 | - (void)mouseDown: (NSEvent *)e |
| 9046 | { | 9045 | { |
| 9047 | NSRect sr, kr; | 9046 | NSRect sr, kr; |
| 9048 | /* hitPart is only updated AFTER event is passed on */ | 9047 | /* hitPart is only updated AFTER event is passed on. */ |
| 9049 | NSScrollerPart part = [self testPart: [e locationInWindow]]; | 9048 | NSScrollerPart part = [self testPart: [e locationInWindow]]; |
| 9050 | CGFloat loc, kloc, pos UNINIT; | 9049 | CGFloat loc, kloc, pos UNINIT; |
| 9051 | int edge = 0; | 9050 | int edge = 0; |
| @@ -9144,9 +9143,9 @@ not_in_argv (NSString *arg) | |||
| 9144 | } | 9143 | } |
| 9145 | else | 9144 | else |
| 9146 | { | 9145 | { |
| 9147 | pos = 0; /* ignored */ | 9146 | pos = 0; /* ignored */ |
| 9148 | 9147 | ||
| 9149 | /* set a timer to repeat, as we can't let superclass do this modally */ | 9148 | /* Set a timer to repeat, as we can't let superclass do this modally. */ |
| 9150 | scroll_repeat_entry | 9149 | scroll_repeat_entry |
| 9151 | = [[NSTimer scheduledTimerWithTimeInterval: SCROLL_BAR_FIRST_DELAY | 9150 | = [[NSTimer scheduledTimerWithTimeInterval: SCROLL_BAR_FIRST_DELAY |
| 9152 | target: self | 9151 | target: self |
| @@ -9161,7 +9160,7 @@ not_in_argv (NSString *arg) | |||
| 9161 | } | 9160 | } |
| 9162 | 9161 | ||
| 9163 | 9162 | ||
| 9164 | /* Called as we manually track scroller drags, rather than superclass. */ | 9163 | /* Called as we manually track scroller drags, rather than superclass. */ |
| 9165 | - (void)mouseDragged: (NSEvent *)e | 9164 | - (void)mouseDragged: (NSEvent *)e |
| 9166 | { | 9165 | { |
| 9167 | NSRect sr; | 9166 | NSRect sr; |
| @@ -9219,7 +9218,7 @@ not_in_argv (NSString *arg) | |||
| 9219 | } | 9218 | } |
| 9220 | 9219 | ||
| 9221 | 9220 | ||
| 9222 | /* treat scrollwheel events in the bar as though they were in the main window */ | 9221 | /* Treat scrollwheel events in the bar as though they were in the main window. */ |
| 9223 | - (void) scrollWheel: (NSEvent *)theEvent | 9222 | - (void) scrollWheel: (NSEvent *)theEvent |
| 9224 | { | 9223 | { |
| 9225 | NSTRACE ("[EmacsScroller scrollWheel:]"); | 9224 | NSTRACE ("[EmacsScroller scrollWheel:]"); |
| @@ -9307,7 +9306,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 9307 | 9306 | ||
| 9308 | /* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */ | 9307 | /* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */ |
| 9309 | /* Note: ns_font_to_xlfd and ns_fontname_to_xlfd no longer needed, removed | 9308 | /* Note: ns_font_to_xlfd and ns_fontname_to_xlfd no longer needed, removed |
| 9310 | in 1.43. */ | 9309 | in 1.43. */ |
| 9311 | 9310 | ||
| 9312 | const char * | 9311 | const char * |
| 9313 | ns_xlfd_to_fontname (const char *xlfd) | 9312 | ns_xlfd_to_fontname (const char *xlfd) |
| @@ -9348,7 +9347,7 @@ ns_xlfd_to_fontname (const char *xlfd) | |||
| 9348 | name[i+1] = c_toupper (name[i+1]); | 9347 | name[i+1] = c_toupper (name[i+1]); |
| 9349 | } | 9348 | } |
| 9350 | } | 9349 | } |
| 9351 | /*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */ | 9350 | /* fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */ |
| 9352 | ret = [[NSString stringWithUTF8String: name] UTF8String]; | 9351 | ret = [[NSString stringWithUTF8String: name] UTF8String]; |
| 9353 | xfree (name); | 9352 | xfree (name); |
| 9354 | return ret; | 9353 | return ret; |
| @@ -9362,7 +9361,7 @@ syms_of_nsterm (void) | |||
| 9362 | 9361 | ||
| 9363 | ns_antialias_threshold = 10.0; | 9362 | ns_antialias_threshold = 10.0; |
| 9364 | 9363 | ||
| 9365 | /* from 23+ we need to tell emacs what modifiers there are.. */ | 9364 | /* From 23+ we need to tell emacs what modifiers there are. */ |
| 9366 | DEFSYM (Qmodifier_value, "modifier-value"); | 9365 | DEFSYM (Qmodifier_value, "modifier-value"); |
| 9367 | DEFSYM (Qalt, "alt"); | 9366 | DEFSYM (Qalt, "alt"); |
| 9368 | DEFSYM (Qhyper, "hyper"); | 9367 | DEFSYM (Qhyper, "hyper"); |
| @@ -9477,11 +9476,11 @@ allowing it to be used at a lower level for accented character entry."); | |||
| 9477 | 9476 | ||
| 9478 | DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, | 9477 | DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, |
| 9479 | doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near. | 9478 | doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near. |
| 9480 | Only works on Mac OS X 10.6 or later. */); | 9479 | Only works on Mac OS X. */); |
| 9481 | ns_auto_hide_menu_bar = Qnil; | 9480 | ns_auto_hide_menu_bar = Qnil; |
| 9482 | 9481 | ||
| 9483 | DEFVAR_BOOL ("ns-use-native-fullscreen", ns_use_native_fullscreen, | 9482 | DEFVAR_BOOL ("ns-use-native-fullscreen", ns_use_native_fullscreen, |
| 9484 | doc: /*Non-nil means to use native fullscreen on Mac OS X 10.7 and later. | 9483 | doc: /* Non-nil means to use native fullscreen on Mac OS X 10.7 and later. |
| 9485 | Nil means use fullscreen the old (< 10.7) way. The old way works better with | 9484 | Nil means use fullscreen the old (< 10.7) way. The old way works better with |
| 9486 | multiple monitors, but lacks tool bar. This variable is ignored on | 9485 | multiple monitors, but lacks tool bar. This variable is ignored on |
| 9487 | Mac OS X < 10.7. Default is t. */); | 9486 | Mac OS X < 10.7. Default is t. */); |
| @@ -9489,35 +9488,35 @@ Mac OS X < 10.7. Default is t. */); | |||
| 9489 | ns_last_use_native_fullscreen = ns_use_native_fullscreen; | 9488 | ns_last_use_native_fullscreen = ns_use_native_fullscreen; |
| 9490 | 9489 | ||
| 9491 | DEFVAR_BOOL ("ns-use-fullscreen-animation", ns_use_fullscreen_animation, | 9490 | DEFVAR_BOOL ("ns-use-fullscreen-animation", ns_use_fullscreen_animation, |
| 9492 | doc: /*Non-nil means use animation on non-native fullscreen. | 9491 | doc: /* Non-nil means use animation on non-native fullscreen. |
| 9493 | For native fullscreen, this does nothing. | 9492 | For native fullscreen, this does nothing. |
| 9494 | Default is nil. */); | 9493 | Default is nil. */); |
| 9495 | ns_use_fullscreen_animation = NO; | 9494 | ns_use_fullscreen_animation = NO; |
| 9496 | 9495 | ||
| 9497 | DEFVAR_BOOL ("ns-use-srgb-colorspace", ns_use_srgb_colorspace, | 9496 | DEFVAR_BOOL ("ns-use-srgb-colorspace", ns_use_srgb_colorspace, |
| 9498 | doc: /*Non-nil means to use sRGB colorspace on Mac OS X 10.7 and later. | 9497 | doc: /* Non-nil means to use sRGB colorspace on Mac OS X 10.7 and later. |
| 9499 | Note that this does not apply to images. | 9498 | Note that this does not apply to images. |
| 9500 | This variable is ignored on Mac OS X < 10.7 and GNUstep. */); | 9499 | This variable is ignored on Mac OS X < 10.7 and GNUstep. */); |
| 9501 | ns_use_srgb_colorspace = YES; | 9500 | ns_use_srgb_colorspace = YES; |
| 9502 | 9501 | ||
| 9503 | DEFVAR_BOOL ("ns-use-mwheel-acceleration", | 9502 | DEFVAR_BOOL ("ns-use-mwheel-acceleration", |
| 9504 | ns_use_mwheel_acceleration, | 9503 | ns_use_mwheel_acceleration, |
| 9505 | doc: /*Non-nil means use macOS's standard mouse wheel acceleration. | 9504 | doc: /* Non-nil means use macOS's standard mouse wheel acceleration. |
| 9506 | This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); | 9505 | This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); |
| 9507 | ns_use_mwheel_acceleration = YES; | 9506 | ns_use_mwheel_acceleration = YES; |
| 9508 | 9507 | ||
| 9509 | DEFVAR_LISP ("ns-mwheel-line-height", ns_mwheel_line_height, | 9508 | DEFVAR_LISP ("ns-mwheel-line-height", ns_mwheel_line_height, |
| 9510 | doc: /*The number of pixels touchpad scrolling considers one line. | 9509 | doc: /* The number of pixels touchpad scrolling considers one line. |
| 9511 | Nil or a non-number means use the default frame line height. | 9510 | Nil or a non-number means use the default frame line height. |
| 9512 | This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. */); | 9511 | This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. */); |
| 9513 | ns_mwheel_line_height = Qnil; | 9512 | ns_mwheel_line_height = Qnil; |
| 9514 | 9513 | ||
| 9515 | DEFVAR_BOOL ("ns-use-mwheel-momentum", ns_use_mwheel_momentum, | 9514 | DEFVAR_BOOL ("ns-use-mwheel-momentum", ns_use_mwheel_momentum, |
| 9516 | doc: /*Non-nil means mouse wheel scrolling uses momentum. | 9515 | doc: /* Non-nil means mouse wheel scrolling uses momentum. |
| 9517 | This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); | 9516 | This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); |
| 9518 | ns_use_mwheel_momentum = YES; | 9517 | ns_use_mwheel_momentum = YES; |
| 9519 | 9518 | ||
| 9520 | /* TODO: move to common code */ | 9519 | /* TODO: Move to common code. */ |
| 9521 | DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, | 9520 | DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, |
| 9522 | doc: /* SKIP: real doc in xterm.c. */); | 9521 | doc: /* SKIP: real doc in xterm.c. */); |
| 9523 | Vx_toolkit_scroll_bars = Qt; | 9522 | Vx_toolkit_scroll_bars = Qt; |