From: Charles A. Roelli Date: Mon, 19 Mar 2018 19:16:19 +0000 (+0100) Subject: Normalize and fix some mistakes in NS-related commentary X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fe4af1c543f1f048ad53d6f494038d66b45fe663;p=emacs.git 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. --- diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index 1c7dd8a63fe..fa988ad5f24 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -307,8 +307,8 @@ is currently being used." "Insert contents of `ns-working-text' as UTF-8 string and mark with `ns-working-overlay'. Any previously existing working text is cleared first. The overlay is assigned the face `ns-working-text-face'." - ;; FIXME: if buffer is read-only, don't try to insert anything - ;; and if text is bound to a command, execute that instead (Bug#1453) + ;; FIXME: if buffer is read-only, don't try to insert anything, and + ;; if text is bound to a command, execute that instead (Bug#1453). (interactive) (ns-delete-working-text) (let ((start (point))) @@ -437,7 +437,7 @@ Lines are highlighted according to `ns-input-line'." ;;;; File handling. (defun x-file-dialog (prompt dir default_filename mustmatch only_dir_p) -"SKIP: real doc in xfns.c." + "SKIP: real doc in xfns.c." (ns-read-file-name prompt dir mustmatch default_filename only_dir_p)) (defun ns-open-file-using-panel () 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) */ /* This should be the first include, as it may set up #defines affecting - interpretation of even the system includes. */ + interpretation of even the system includes. */ #include #include @@ -54,7 +54,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) static EmacsTooltip *ns_tooltip = nil; -/* Static variables to handle applescript execution. */ +/* Static variables to handle AppleScript execution. */ static Lisp_Object as_script, *as_result; static int as_status; @@ -116,7 +116,7 @@ ns_get_window (Lisp_Object maybeFrame) id view =nil, window =nil; if (!FRAMEP (maybeFrame) || !FRAME_NS_P (XFRAME (maybeFrame))) - maybeFrame = selected_frame;/*wrong_type_argument (Qframep, maybeFrame); */ + maybeFrame = selected_frame; /* wrong_type_argument (Qframep, maybeFrame); */ if (!NILP (maybeFrame)) view = FRAME_NS_VIEW (XFRAME (maybeFrame)); @@ -178,7 +178,7 @@ ns_directory_from_panel (NSSavePanel *panel) static Lisp_Object interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) /* -------------------------------------------------------------------------- - Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side + Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. -------------------------------------------------------------------------- */ { int i, count; @@ -261,7 +261,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (FRAME_NS_VIEW (f)) { update_face_from_frame_parameter (f, Qforeground_color, arg); - /*recompute_basic_faces (f); */ + /* recompute_basic_faces (f); */ if (FRAME_VISIBLE_P (f)) SET_FRAME_GARBAGED (f); } @@ -285,8 +285,9 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) error ("Unknown color"); } - /* clear the frame; in some instances the NS-internal GC appears not to - update, or it does update and cannot clear old text properly */ + /* Clear the frame; in some instances the NS-internal GC appears not + to update, or it does update and cannot clear old text + properly. */ if (FRAME_VISIBLE_P (f)) ns_clear_frame (f); @@ -356,7 +357,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) NSView *view = FRAME_NS_VIEW (f); NSTRACE ("x_set_icon_name"); - /* see if it's changed */ + /* See if it's changed. */ if (STRINGP (arg)) { 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) if (nlines) { FRAME_EXTERNAL_MENU_BAR (f) = 1; - /* does for all frames, whereas we just want for one frame + /* Does for all frames, whereas we just want for one frame [NSMenu setMenuBarVisible: YES]; */ } else { if (FRAME_EXTERNAL_MENU_BAR (f) == 1) free_frame_menubar (f); - /* [NSMenu setMenuBarVisible: NO]; */ + /* [NSMenu setMenuBarVisible: NO]; */ FRAME_EXTERNAL_MENU_BAR (f) = 0; } } @@ -573,11 +574,11 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) static void x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { - /* Currently, when the tool bar change state, the frame is resized. + /* Currently, when the tool bar changes state, the frame is resized. TODO: It would be better if this didn't occur when 1) the frame is full height or maximized or 2) when specified by - `frame-inhibit-implied-resize'. */ + `frame-inhibit-implied-resize'. */ int nlines; NSTRACE ("x_set_tool_bar_lines"); @@ -694,7 +695,7 @@ ns_implicitly_set_icon_type (struct frame *f) chain = XCDR (chain)) { elt = XCAR (chain); - /* special case: t means go by file type */ + /* Special case: t means go by file type. */ if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (f->name)[0] == '/') { NSString *str @@ -744,7 +745,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) store_frame_param (f, Qicon_type, arg); } - /* do it the implicit way */ + /* Do it the implicit way. */ if (NILP (arg)) { ns_implicitly_set_icon_type (f); @@ -780,7 +781,7 @@ x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) static void x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - /* don't think we can do this on Nextstep */ + /* Don't think we can do this on Nextstep. */ } @@ -809,7 +810,7 @@ ns_appkit_version_str (void) /* This is for use by x-server-version and collapses all version info we have into a single int. For a better picture of the implementation - running, use ns_appkit_version_str.*/ + running, use ns_appkit_version_str. */ static int ns_appkit_version_int (void) { @@ -852,7 +853,8 @@ x_icon (struct frame *f, Lisp_Object parms) } -/* Note: see frame.c for template, also where generic functions are impl */ +/* Note: see frame.c for template, also where generic functions are + implemented. */ frame_parm_handler ns_frame_parm_handlers[] = { x_set_autoraise, /* generic OK */ @@ -896,7 +898,7 @@ frame_parm_handler ns_frame_parm_handlers[] = #ifdef NS_IMPL_COCOA x_set_undecorated, #else - 0, /*x_set_undecorated */ + 0, /* x_set_undecorated */ #endif x_set_parent_frame, 0, /* x_set_skip_taskbar */ @@ -1127,7 +1129,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, /* use for default font name */ id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ x_default_parameter (f, parms, Qfontsize, - make_number (0 /*(int)[font pointSize]*/), + make_number (0 /* (int)[font pointSize] */), "fontSize", "FontSize", RES_TYPE_NUMBER); // Remove ' Regular', not handled by backends. char *fontname = xstrdup ([[font displayName] UTF8String]); @@ -1170,7 +1172,6 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, "foreground", "Foreground", RES_TYPE_STRING); x_default_parameter (f, parms, Qbackground_color, build_string ("White"), "background", "Background", RES_TYPE_STRING); - /* FIXME: not supported yet in Nextstep */ x_default_parameter (f, parms, Qline_spacing, Qnil, "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); x_default_parameter (f, parms, Qleft_fringe, Qnil, @@ -1252,7 +1253,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !EQ (tem, Qnil)); /* NOTE: on other terms, this is done in set_mouse_color, however this - was not getting called under Nextstep */ + was not getting called under Nextstep. */ f->output_data.ns->text_cursor = [NSCursor IBeamCursor]; f->output_data.ns->nontext_cursor = [NSCursor arrowCursor]; f->output_data.ns->modeline_cursor = [NSCursor pointingHandCursor]; @@ -1284,8 +1285,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, /* ns_display_info does not have a reference_count. */ f->terminal->reference_count++; - /* It is now ok to make the frame official even if we get an error below. - The frame needs to be on Vframe_list or making it visible won't work. */ + /* It is now ok to make the frame official even if we get an error + below. The frame needs to be on Vframe_list or making it visible + won't work. */ Vframe_list = Fcons (frame, Vframe_list); x_default_parameter (f, parms, Qicon_type, Qnil, @@ -1379,7 +1381,7 @@ x_focus_frame (struct frame *f, bool noactivate) static BOOL ns_window_is_ancestor (NSWindow *win, NSWindow *candidate) -/* Test whether CANDIDATE is an ancestor window of WIN. */ +/* Test whether CANDIDATE is an ancestor window of WIN. */ { if (candidate == NULL) return NO; @@ -1408,7 +1410,8 @@ Frames are listed from topmost (first) to bottommost (last). */) { Lisp_Object frame; - /* Check against [win parentWindow] so that it doesn't match itself. */ + /* Check against [win parentWindow] so that it doesn't match + itself. */ if (parent == nil || ns_window_is_ancestor (parent, [win parentWindow])) { XSETFRAME (frame, ((EmacsView *)[win delegate])->emacsframe); @@ -1453,7 +1456,7 @@ Some window managers may refuse to restack windows. */) DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel, 0, 1, "", - doc: /* Pop up the font panel. */) + doc: /* Pop up the font panel. */) (Lisp_Object frame) { struct frame *f = decode_window_system_frame (frame); @@ -1698,8 +1701,8 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size, (Lisp_Object terminal) { check_ns_display_info (terminal); - /* This function has no real equivalent under NeXTstep. Return nil to - indicate this. */ + /* This function has no real equivalent under Nextstep. Return nil to + indicate this. */ return Qnil; } @@ -1722,12 +1725,12 @@ DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, (Lisp_Object terminal) { check_ns_display_info (terminal); - /*NOTE: it is unclear what would best correspond with "protocol"; - we return 10.3, meaning Panther, since this is roughly the - level that GNUstep's APIs correspond to. - The last number is where we distinguish between the Apple - and GNUstep implementations ("distributor-specific release - number") and give int'ized versions of major.minor. */ + /* NOTE: it is unclear what would best correspond with "protocol"; + we return 10.3, meaning Panther, since this is roughly the + level that GNUstep's APIs correspond to. The last number + is where we distinguish between the Apple and GNUstep + implementations ("distributor-specific release number") and + give int'ized versions of major.minor. */ return list3i (10, 3, ns_appkit_version_int ()); } @@ -1806,7 +1809,8 @@ DEFUN ("x-display-visual-class", Fx_display_visual_class, else if ( depth == NSBestDepth (NSCalibratedRGBColorSpace, 8, 24, NO, NULL)) return intern ("direct-color"); else - /* color mgmt as far as we do it is really handled by Nextstep itself anyway */ + /* Color management as far as we do it is really handled by + Nextstep itself anyway. */ return intern ("direct-color"); } @@ -1932,7 +1936,7 @@ DEFUN ("ns-font-name", Fns_font_name, Sns_font_name, 1, 1, 0, doc: /* Determine font PostScript or family name for font NAME. NAME should be a string containing either the font name or an XLFD font descriptor. If string contains `fontset' and not -`fontset-startup', it is left alone. */) +`fontset-startup', it is left alone. */) (Lisp_Object name) { char *nm; @@ -2049,7 +2053,7 @@ there was no result. */) status as function value. A zero is returned if compilation and execution is successful, in which case *RESULT is set to a Lisp string or a number containing the resulting script value. Otherwise, - 1 is returned. */ + 1 is returned. */ static int ns_do_applescript (Lisp_Object script, Lisp_Object *result) { @@ -2102,7 +2106,7 @@ ns_do_applescript (Lisp_Object script, Lisp_Object *result) return 0; } -/* Helper function called from sendEvent to run applescript +/* Helper function called from sendEvent to run AppleScript from within the main event loop. */ void @@ -2117,7 +2121,7 @@ DEFUN ("ns-do-applescript", Fns_do_applescript, Sns_do_applescript, 1, 1, 0, doc: /* Execute AppleScript SCRIPT and return the result. If compilation and execution are successful, the resulting script value is returned as a string, a number or, in the case of other constructs, t. -In case the execution fails, an error is signaled. */) +In case the execution fails, an error is signaled. */) (Lisp_Object script) { Lisp_Object result; @@ -2133,10 +2137,10 @@ In case the execution fails, an error is signaled. */) as_script = script; as_result = &result; - /* executing apple script requires the event loop to run, otherwise + /* Executing AppleScript requires the event loop to run, otherwise errors aren't returned and executeAndReturnError hangs forever. - Post an event that runs applescript and then start the event loop. - The event loop is exited when the script is done. */ + Post an event that runs AppleScript and then start the event + loop. The event loop is exited when the script is done. */ nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined location: NSMakePoint (0, 0) modifierFlags: 0 @@ -2149,8 +2153,8 @@ In case the execution fails, an error is signaled. */) [NSApp postEvent: nxev atStart: NO]; - // If there are other events, the event loop may exit. Keep running - // until the script has been handled. */ + /* If there are other events, the event loop may exit. Keep running + until the script has been handled. */ ns_init_events (&ev); while (! NILP (as_script)) [NSApp run]; @@ -2203,7 +2207,7 @@ x_set_scroll_bar_default_height (struct frame *f) height - 1) / height; } -/* terms impl this instead of x-get-resource directly */ +/* Terms implement this instead of x-get-resource directly. */ char * x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) { @@ -2381,7 +2385,7 @@ ns_screen_name (CGDirectDisplayID did) /* CGDisplayIOServicePort is deprecated. Do it another (harder) way. Is this code OK for macOS < 10.9, and GNUstep? I suspect it is, - in which case is it worth keeping the other method in here? */ + in which case is it worth keeping the other method in here? */ if (IOMasterPort (MACH_PORT_NULL, &masterPort) != kIOReturnSuccess || IOServiceGetMatchingServices (masterPort, @@ -2620,7 +2624,7 @@ compute_tip_xy (struct frame *f, - height); } - /* Find the screen that pt is on. */ + /* Find the screen that pt is on. */ for (screen in [NSScreen screens]) if (pt.x >= screen.frame.origin.x && pt.x < screen.frame.origin.x + screen.frame.size.width @@ -2633,13 +2637,13 @@ compute_tip_xy (struct frame *f, if (CGRectContainsPoint ([screen frame], pt)) which would be neater, but it causes problems building on old - versions of macOS and in GNUstep. */ + versions of macOS and in GNUstep. */ /* Ensure in bounds. (Note, screen origin = lower left.) */ if (INTEGERP (left) || INTEGERP (right)) *root_x = pt.x; else if (pt.x + XINT (dx) <= screen.frame.origin.x) - *root_x = screen.frame.origin.x; /* Can happen for negative dx */ + *root_x = screen.frame.origin.x; else if (pt.x + XINT (dx) + width <= screen.frame.origin.x + screen.frame.size.width) /* It fits to the right of the pointer. */ @@ -2658,7 +2662,7 @@ compute_tip_xy (struct frame *f, *root_y = pt.y - height - XINT (dy); else if (pt.y + XINT (dy) + height <= screen.frame.origin.y + screen.frame.size.height) - /* It fits above the pointer */ + /* It fits above the pointer. */ *root_y = pt.y + XINT (dy); else /* Put it on the top. */ @@ -2885,7 +2889,7 @@ The coordinates X and Y are interpreted in pixels relative to a position { #ifdef NS_IMPL_COCOA /* GNUstep doesn't support CGWarpMouseCursorPosition, so none of - this will work. */ + this will work. */ struct frame *f = SELECTED_FRAME (); EmacsView *view = FRAME_NS_VIEW (f); NSScreen *screen = [[view window] screen]; @@ -2923,7 +2927,7 @@ DEFUN ("ns-mouse-absolute-pixel-position", doc: /* Return absolute position of mouse cursor in pixels. The position is returned as a cons cell (X . Y) of the coordinates of the mouse cursor position in pixels relative to a -position (0, 0) of the selected frame's terminal. */) +position (0, 0) of the selected frame's terminal. */) (void) { struct frame *f = SELECTED_FRAME (); @@ -2983,8 +2987,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) case NSPageDownFunctionKey: case NSEndFunctionKey: /* Don't send command modified keys, as those are handled in the - performKeyEquivalent method of the super class. - */ + performKeyEquivalent method of the super class. */ if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand)) { [panel sendEvent: theEvent]; @@ -2996,8 +2999,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) them here. TODO: handle Emacs key bindings for copy/cut/select-all here, paste works, because we have that in our Edit menu. I.e. refactor out code in nsterm.m, keyDown: to figure out the - correct modifier. - */ + correct modifier. */ case 'x': // Cut case 'c': // Copy 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) */ /* This should be the first include, as it may set up #defines affecting - interpretation of even the system includes. */ + interpretation of even the system includes. */ #include #include "lisp.h" @@ -37,7 +37,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu) #include "font.h" #include "termchar.h" -/* TODO: Drop once we can assume gnustep-gui 0.17.1. */ +/* TODO: Drop once we can assume gnustep-gui 0.17.1. */ #ifdef NS_IMPL_GNUSTEP #import #endif @@ -45,7 +45,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu) #define NSFONT_TRACE 0 #define LCD_SMOOTHING_MARGIN 2 -/* font glyph and metrics caching functions, implemented at end */ +/* Font glyph and metrics caching functions, implemented at end. */ static void ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block); static void ns_glyph_metrics (struct nsfont_info *font_info, @@ -61,7 +61,7 @@ static void ns_glyph_metrics (struct nsfont_info *font_info, /* Replace spaces w/another character so emacs core font parsing routines - aren't thrown off. */ + aren't thrown off. */ static void ns_escape_name (char *name) { @@ -71,7 +71,7 @@ ns_escape_name (char *name) } -/* Reconstruct spaces in a font family name passed through emacs. */ +/* Reconstruct spaces in a font family name passed through emacs. */ static void ns_unescape_name (char *name) { @@ -81,7 +81,7 @@ ns_unescape_name (char *name) } -/* Extract family name from a font spec. */ +/* Extract family name from a font spec. */ static NSString * ns_get_family (Lisp_Object font_spec) { @@ -103,7 +103,7 @@ ns_get_family (Lisp_Object font_spec) /* Return 0 if attr not set, else value (which might also be 0). On Leopard 0 gets returned even on descriptors where the attribute was never set, so there's no way to distinguish between unspecified - and set to not have. Callers should assume 0 means unspecified. */ + and set to not have. Callers should assume 0 means unspecified. */ static float ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) { @@ -114,7 +114,7 @@ ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) /* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang - to NSFont descriptor. Information under extra only needed for matching. */ + to NSFont descriptor. Information under extra only needed for matching. */ #define STYLE_REF 100 static NSFontDescriptor * ns_spec_to_descriptor (Lisp_Object font_spec) @@ -125,7 +125,7 @@ ns_spec_to_descriptor (Lisp_Object font_spec) NSString *family = ns_get_family (font_spec); float n; - /* add each attr in font_spec to fdAttrs.. */ + /* Add each attr in font_spec to fdAttrs. */ n = min (FONT_WEIGHT_NUMERIC (font_spec), 200); if (n != -1 && n != STYLE_REF) [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] @@ -156,7 +156,7 @@ ns_spec_to_descriptor (Lisp_Object font_spec) } -/* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc.. */ +/* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc. */ static Lisp_Object ns_descriptor_to_entity (NSFontDescriptor *desc, Lisp_Object extra, @@ -168,7 +168,7 @@ ns_descriptor_to_entity (NSFontDescriptor *desc, unsigned int traits = [desc symbolicTraits]; char *escapedFamily; - /* Shouldn't happen, but on Tiger fallback desc gets name but no family. */ + /* Shouldn't happen, but on Tiger fallback desc gets name but no family. */ if (family == nil) family = [desc objectForKey: NSFontNameAttribute]; if (family == nil) @@ -220,7 +220,7 @@ ns_descriptor_to_entity (NSFontDescriptor *desc, } -/* Default font entity. */ +/* Default font entity. */ static Lisp_Object ns_fallback_entity (void) { @@ -229,7 +229,7 @@ ns_fallback_entity (void) } -/* Utility: get width of a char c in screen font SFONT */ +/* Utility: get width of a char c in screen font SFONT. */ static CGFloat ns_char_width (NSFont *sfont, int c) { @@ -292,7 +292,7 @@ ns_ascii_average_width (NSFont *sfont) /* Return whether set1 covers set2 to a reasonable extent given by pct. We check, out of each 16 Unicode char range containing chars in set2, whether at least one character is present in set1. - This must be true for pct of the pairs to consider it covering. */ + This must be true for pct of the pairs to consider it covering. */ static BOOL ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct) { @@ -312,20 +312,20 @@ ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct) if (*bytes1 == 0) // *bytes1 & *bytes2 != *bytes2 off++; } -//fprintf(stderr, "off = %d\ttot = %d\n", off,tot); + // fprintf(stderr, "off = %d\ttot = %d\n", off,tot); return (float)off / tot < 1.0F - pct; } /* Convert :lang property to a script. Use of :lang property by font backend - seems to be limited for now (2009/05) to ja, zh, and ko. */ + seems to be limited for now (2009/05) to ja, zh, and ko. */ static NSString *ns_lang_to_script (Lisp_Object lang) { if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ja")) return @"han"; /* NOTE: ja given for any hanzi that's also a kanji, but Chinese fonts - have more characters. */ + have more characters. */ else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "zh")) return @"han"; else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ko")) @@ -336,7 +336,7 @@ static NSString /* Convert OTF 4-letter script code to emacs script name. (Why can't - everyone just use some standard Unicode names for these?) */ + everyone just use some standard Unicode names for these?) */ static NSString *ns_otf_to_script (Lisp_Object otf) { @@ -347,7 +347,7 @@ static NSString } -/* Convert a font registry, such as */ +/* Convert a font registry. */ static NSString *ns_registry_to_script (char *reg) { @@ -368,14 +368,14 @@ static NSString /* Searches the :script, :lang, and :otf extra-bundle properties of the spec, plus registry regular property, for something that can be mapped to a - Unicode script. Empty string returned if no script spec found. */ + Unicode script. Empty string returned if no script spec found. */ static NSString *ns_get_req_script (Lisp_Object font_spec) { Lisp_Object reg = AREF (font_spec, FONT_REGISTRY_INDEX); Lisp_Object extra = AREF (font_spec, FONT_EXTRA_INDEX); - /* The extra-bundle properties have priority. */ + /* The extra-bundle properties have priority. */ for ( ; CONSP (extra); extra = XCDR (extra)) { Lisp_Object tmp = XCAR (extra); @@ -392,12 +392,12 @@ static NSString } } - /* If we get here, check the charset portion of the registry. */ + /* If we get here, check the charset portion of the registry. */ if (! NILP (reg)) { /* XXX: iso10646 is passed in for non-ascii latin-1 characters (which causes box rendering if we don't treat it like iso8858-1) - but also for ascii (which causes unnecessary font substitution). */ + but also for ascii (which causes unnecessary font substitution). */ #if 0 if (EQ (reg, Qiso10646_1)) reg = Qiso8859_1; @@ -410,7 +410,7 @@ static NSString /* This small function is static in fontset.c. If it can be made public for - all ports, remove this, but otherwise it doesn't seem worth the ifdefs. */ + all ports, remove this, but otherwise it doesn't seem worth the ifdefs. */ static void accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val) { @@ -425,7 +425,7 @@ accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val) /* Use the Unicode range information in Vchar_script_table to convert a script - name into an NSCharacterSet. */ + name into an NSCharacterSet. */ static NSCharacterSet *ns_script_to_charset (NSString *scriptName) { @@ -465,7 +465,7 @@ static NSCharacterSet If none are found, we reduce the percentage and try again, until 5%. This provides a font with at least some characters if such can be found. We don't use isSupersetOfSet: because (a) it doesn't work on Tiger, and - (b) need approximate match as fonts covering full Unicode ranges are rare. */ + (b) need approximate match as fonts covering full Unicode ranges are rare. */ static NSSet *ns_get_covering_families (NSString *script, float pct) { @@ -497,7 +497,7 @@ static NSSet { NSCharacterSet *fset = [[fontMgr fontWithFamily: family traits: 0 weight: 5 size: 12.0] coveredCharacterSet]; - /* Some fonts on macOS, maybe many on GNUstep, return nil. */ + /* Some fonts on macOS, maybe many on GNUstep, return nil. */ if (fset == nil) fset = [NSCharacterSet characterSetWithRange: NSMakeRange (0, 127)]; @@ -525,7 +525,7 @@ static NSSet /* Implementation for list() and match(). List() can return nil, match() must return something. Strategy is to drop family name from attribute -matching set for match. */ +matching set for match. */ static Lisp_Object ns_findfonts (Lisp_Object font_spec, BOOL isMatch) { @@ -574,7 +574,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch) foundItal = YES; } - /* Add synthItal member if needed. */ + /* Add synthItal member if needed. */ family = [fdesc objectForKey: NSFontFamilyAttribute]; if (family != nil && !foundItal && XINT (Flength (list)) > 0) { @@ -590,7 +590,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch) unblock_input (); - /* Return something if was a match and nothing found. */ + /* Return something if was a match and nothing found. */ if (isMatch) return ns_fallback_entity (); @@ -642,7 +642,7 @@ nsfont_list (struct frame *f, Lisp_Object font_spec) /* Return a font entity most closely matching with FONT_SPEC on FRAME. The closeness is determined by the font backend, thus `face-font-selection-order' is ignored here. - Properties to be considered are same as for list(). */ + Properties to be considered are same as for list(). */ static Lisp_Object nsfont_match (struct frame *f, Lisp_Object font_spec) { @@ -651,7 +651,7 @@ nsfont_match (struct frame *f, Lisp_Object font_spec) /* List available families. The value is a list of family names - (symbols). */ + (symbols). */ static Lisp_Object nsfont_list_family (struct frame *f) { @@ -664,7 +664,7 @@ nsfont_list_family (struct frame *f) objectEnumerator]; while ((family = [families nextObject])) list = Fcons (intern ([family UTF8String]), list); - /* FIXME: escape the name? */ + /* FIXME: escape the name? */ if (NSFONT_TRACE) 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) if (family == nil) family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that - when setting family in ns_spec_to_descriptor(). */ + when setting family in ns_spec_to_descriptor(). */ if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50F) traits |= NSBoldFontMask; 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) if (!font) { unblock_input (); - return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */ + return Qnil; /* FIXME: other terms do, but returning Qnil causes segfault. */ } 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) * -2.00000405... (represented by 0xc000000220000000). Without * adjustment, the code below would round the descender to -3, * resulting in a font that would be one pixel higher than - * intended. */ + * intended. */ CGFloat adjusted_descender = [sfont descender] + 0.0001; #ifdef NS_IMPL_GNUSTEP @@ -810,7 +810,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask); /* Metrics etc.; some fonts return an unusually large max advance, so we - only use it for fonts that have wide characters. */ + only use it for fonts that have wide characters. */ font_info->width = ([sfont numberOfGlyphs] > 2000) ? [sfont maximumAdvancement].width : ns_char_width (sfont, '0'); @@ -823,7 +823,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) /* max bounds */ font->ascent = font_info->max_bounds.ascent = lrint ([sfont ascender]); /* Descender is usually negative. Use floor to avoid - clipping descenders. */ + clipping descenders. */ font->descent = font_info->max_bounds.descent = -lrint (floor(adjusted_descender)); font_info->height = @@ -880,7 +880,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) } -/* Close FONT. */ +/* Close FONT. */ static void nsfont_close (struct font *font) { @@ -911,7 +911,7 @@ nsfont_close (struct font *font) /* If FONT_ENTITY has a glyph for character C (Unicode code point), return 1. If not, return 0. If a font must be opened to check - it, return -1. */ + it, return -1. */ static int nsfont_has_char (Lisp_Object entity, int c) { @@ -920,7 +920,7 @@ nsfont_has_char (Lisp_Object entity, int c) /* Return a glyph code of FONT for character C (Unicode code point). - If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ + If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ static unsigned int nsfont_encode_char (struct font *font, int c) { @@ -931,7 +931,7 @@ nsfont_encode_char (struct font *font, int c) if (c > 0xFFFF) return FONT_INVALID_CODE; - /* did we already cache this block? */ + /* Did we already cache this block? */ if (!font_info->glyphs[high]) ns_uni_to_glyphs (font_info, high); @@ -942,7 +942,7 @@ nsfont_encode_char (struct font *font, int c) /* Perform the size computation of glyphs of FONT and fill in members of METRICS. The glyphs are specified by their glyph codes in - CODE (length NGLYPHS). */ + CODE (length NGLYPHS). */ static void nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics) @@ -985,11 +985,11 @@ nsfont_text_extents (struct font *font, unsigned int *code, /* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, fill the background in advance. It is assured that WITH_BACKGROUND - is false when (FROM > 0 || TO < S->nchars). */ + is false when (FROM > 0 || TO < S->nchars). */ static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, bool with_background) -/* NOTE: focus and clip must be set */ +/* NOTE: focus and clip must be set. */ { static unsigned char cbuf[1024]; unsigned char *c = cbuf; @@ -1019,7 +1019,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, if (font == NULL) font = (struct nsfont_info *)FRAME_FONT (s->f); - /* Select face based on input flags */ + /* Select face based on input flags. */ flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR : (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE : (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND : @@ -1049,11 +1049,11 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, /* Convert UTF-16 (?) to UTF-8 and determine advances. Note if we just ask NS to render the string, it will come out differently from the individual - character widths added up because of layout processing. */ + character widths added up because of layout processing. */ { int cwidth, twidth = 0; int hi, lo; - /* FIXME: composition: no vertical displacement is considered. */ + /* FIXME: composition: no vertical displacement is considered. */ t += from; /* advance into composition */ for (i = from; i < to; i++, t++) { @@ -1082,14 +1082,14 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, } else { - if (!font->metrics[hi]) /* FIXME: why/how can we need this now? */ + if (!font->metrics[hi]) /* FIXME: why/how can we need this now? */ ns_glyph_metrics (font, hi); cwidth = font->metrics[hi][lo].width; } twidth += cwidth; #ifdef NS_IMPL_GNUSTEP *adv++ = cwidth; - CHAR_STRING_ADVANCE (*t, c); /* this converts the char to UTF-8 */ + CHAR_STRING_ADVANCE (*t, c); /* This converts the char to UTF-8. */ #else (*adv++).width = cwidth; #endif @@ -1099,7 +1099,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, *c = 0; } - /* fill background if requested */ + /* Fill background if requested. */ if (with_background && !isComposite) { NSRect br = r; @@ -1119,7 +1119,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, } if (s->face->box == FACE_NO_BOX) { - /* expand unboxed top row over internal border */ + /* Expand unboxed top row over internal border. */ if (br.origin.y <= fibw + 1 + mbox_line_width) { br.size.height += br.origin.y; @@ -1258,7 +1258,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, ========================================================================== */ /* Find and cache corresponding glyph codes for unicode values in given - hi-byte block of 256. */ + hi-byte block of 256. */ static void ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) { @@ -1288,7 +1288,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) if (!unichars || !(font_info->glyphs[block])) emacs_abort (); - /* create a string containing all Unicode characters in this block */ + /* Create a string containing all Unicode characters in this block. */ for (idx = block<<8, i = 0; i < 0x100; idx++, i++) if (idx < 0xD800 || idx > 0xDFFF) unichars[i] = idx; @@ -1303,7 +1303,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) length: 0x100 freeWhenDone: NO]; NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator]; - /*NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */ + /* NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */ unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs]; NSUInteger gInd = 0, cInd = 0; @@ -1319,9 +1319,9 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) g = unichars[i]; #else g = glyphStorage->cglyphs[i]; - /* TODO: is this a good check? maybe need to use coveredChars.. */ + /* TODO: is this a good check? Maybe need to use coveredChars. */ if (g > numGlyphs || g == NSNullGlyph) - g = INVALID_GLYPH; /* hopefully unused... */ + g = INVALID_GLYPH; /* Hopefully unused... */ #endif *glyphs = g; } @@ -1337,7 +1337,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) /* Determine and cache metrics for corresponding glyph codes in given - hi-byte block of 256. */ + hi-byte block of 256. */ static void ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) { @@ -1387,16 +1387,16 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; - /*lrint (hshrink * [sfont ascender] + expand * hd/2); */ + /* lrint (hshrink * [sfont ascender] + expand * hd/2); */ metrics->ascent = r.size.height - metrics->descent; -/*-lrint (hshrink* [sfont descender] - expand * hd/2); */ + /* -lrint (hshrink* [sfont descender] - expand * hd/2); */ } unblock_input (); } #ifdef NS_IMPL_COCOA -/* helper for font glyph setup */ +/* Helper for font glyph setup. */ @implementation EmacsGlyphStorage - init @@ -1508,7 +1508,7 @@ syms_of_nsfont (void) DEFSYM (Qapple, "apple"); DEFSYM (Qmedium, "medium"); DEFVAR_LISP ("ns-reg-to-script", Vns_reg_to_script, - doc: /* Internal use: maps font registry to Unicode script. */); + doc: /* Internal use: maps font registry to Unicode script. */); ascii_printable = NULL; } 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 . */ #ifndef __NSGUI_H__ #define __NSGUI_H__ -/* this gets included from a couple of the plain (non-NS) .c files */ +/* This gets included from a couple of the plain (non-NS) .c files. */ #ifdef __OBJC__ #ifdef NS_IMPL_COCOA @@ -75,7 +75,7 @@ typedef unichar XChar2b; /* XXX: xfaces requires these structures, but the question is are we - forced to use them? */ + forced to use them? */ typedef struct _XGCValues { unsigned long foreground; @@ -119,8 +119,8 @@ typedef int Display; typedef Lisp_Object XrmDatabase; -/* some sort of attempt to normalize rectangle handling.. seems a bit much - for what is accomplished */ +/* Some sort of attempt to normalize rectangle handling. Seems a bit + much for what is accomplished. */ typedef struct { int x, y; unsigned width, height; @@ -160,7 +160,7 @@ typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect; -/* This stuff needed by frame.c. */ +/* This stuff needed by frame.c. */ #define ForgetGravity 0 #define NorthWestGravity 1 #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) */ /* This should be the first include, as it may set up #defines affecting - interpretation of even the system includes. */ + interpretation of even the system includes. */ #include #include "lisp.h" @@ -41,7 +41,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) C interface. This allows easy calling from C files. We could just compile everything as Objective-C, but that might mean slower - compilation and possible difficulties on some platforms.. + compilation and possible difficulties on some platforms. ========================================================================== */ @@ -226,7 +226,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) /* Create image from monochrome bitmap. If both FG and BG are 0 - (black), set the background to white and make it transparent. */ + (black), set the background to white and make it transparent. */ - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h fg: (unsigned long)fg bg: (unsigned long)bg { @@ -251,7 +251,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) } { - /* pull bits out to set the (bytewise) alpha mask */ + /* Pull bits out to set the (bytewise) alpha mask. */ int i, j, k; unsigned char *s = bits; unsigned char *rr = planes[0]; @@ -362,7 +362,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) } -/* attempt to pull out pixmap data from a BitmapImageRep; returns NO if fails */ +/* Attempt to pull out pixmap data from a BitmapImageRep; returns NO if fails. */ - (void) setPixmapData { NSEnumerator *reps; @@ -386,15 +386,15 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) } -/* note; this and next work only for image created with initForXPMWithDepth, - initFromSkipXBM, or where setPixmapData was called successfully */ +/* Note: this and next work only for image created with initForXPMWithDepth, + initFromSkipXBM, or where setPixmapData was called successfully. */ /* return ARGB */ - (unsigned long) getPixelAtX: (int)x Y: (int)y { if (bmRep == nil) return 0; - /* this method is faster but won't work for bitmaps */ + /* This method is faster but won't work for bitmaps. */ if (pixmapData[0] != NULL) { int loc = x + y * [self size].width; @@ -457,7 +457,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) } } -/* returns a pattern color, which is cached here */ +/* Returns a pattern color, which is cached here. */ - (NSColor *)stippleMask { if (stippleMask == nil) @@ -465,7 +465,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) return stippleMask; } -/* Find the first NSBitmapImageRep which has multiple frames. */ +/* Find the first NSBitmapImageRep which has multiple frames. */ - (NSBitmapImageRep *)getAnimatedBitmapImageRep { for (NSImageRep * r in [self representations]) @@ -481,7 +481,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) } /* If the image has multiple frames, get a count of them and the - animation delay, if available. */ + animation delay, if available. */ - (Lisp_Object)getMetadata { Lisp_Object metadata = Qnil; @@ -502,7 +502,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) return metadata; } -/* Attempt to set the animation frame to be displayed. */ +/* Attempt to set the animation frame to be displayed. */ - (BOOL)setFrame: (unsigned int) index { NSBitmapImageRep * bm = [self getAnimatedBitmapImageRep]; @@ -511,7 +511,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) { int frames = [[bm valueForProperty:NSImageFrameCount] intValue]; - /* If index is invalid, give up. */ + /* If index is invalid, give up. */ if (index < 0 || index > frames) return NO; @@ -520,7 +520,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) } /* Setting the frame has succeeded, or the image doesn't have - multiple frames. */ + multiple frames. */ return YES; } 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 Carbon version by Yamamoto Mitsuharu. */ /* This should be the first include, as it may set up #defines affecting - interpretation of even the system includes. */ + interpretation of even the system includes. */ #include #include "lisp.h" @@ -47,7 +47,7 @@ Carbon version by Yamamoto Mitsuharu. */ #if 0 -/* Include lisp -> C common menu parsing code */ +/* Include lisp -> C common menu parsing code. */ #define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) #include "nsmenu_common.c" #endif @@ -62,7 +62,7 @@ static int trackingMenu; /* NOTE: toolbar implementation is at end, - following complete menu implementation. */ + following complete menu implementation. */ /* ========================================================================== @@ -74,7 +74,7 @@ static int trackingMenu; /* Supposed to discard menubar and free storage. Since we share the menubar among frames and update its context for the focused window, - there is nothing to do here. */ + there is nothing to do here. */ void free_frame_menubar (struct frame *f) { @@ -123,7 +123,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) block_input (); pool = [[NSAutoreleasePool alloc] init]; - /* Menu may have been created automatically; if so, discard it. */ + /* Menu may have been created automatically; if so, discard it. */ if ([menu isKindOfClass: [EmacsMenu class]] == NO) { [menu release]; @@ -147,7 +147,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) if (deep_p) { - /* Fully parse one or more of the submenus. */ + /* Fully parse one or more of the submenus. */ int n = 0; int *submenu_start, *submenu_end; bool *submenu_top_level_items; @@ -172,8 +172,8 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) set_buffer_internal_1 (XBUFFER (buffer)); /* TODO: for some reason this is not needed in other terms, - but some menu updates call Info-extract-pointer which causes - abort-on-error if waiting-for-input. Needs further investigation. */ + but some menu updates call Info-extract-pointer which causes + abort-on-error if waiting-for-input. Needs further investigation. */ owfi = waiting_for_input; waiting_for_input = 0; @@ -214,10 +214,10 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) break; /* FIXME: we'd like to only parse the needed submenu, but this - was causing crashes in the _common parsing code.. need to make - sure proper initialization done.. */ -/* if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string))) - continue; */ + was causing crashes in the _common parsing code: need to make + sure proper initialization done. */ + /* if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string))) + continue; */ submenu_start[i] = menu_items_used; @@ -267,17 +267,17 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) set_buffer_internal_1 (prev); - /* Compare the new menu items with previous, and leave off if no change */ + /* Compare the new menu items with previous, and leave off if no change. */ /* FIXME: following other terms here, but seems like this should be - done before parse stage 2 above, since its results aren't used */ + done before parse stage 2 above, since its results aren't used. */ if (previous_menu_items_used && (!submenu || (submenu && submenu == last_submenu)) && menu_items_used == previous_menu_items_used) { for (i = 0; i < previous_menu_items_used; i++) /* FIXME: this ALWAYS fails on Buffers menu items.. something - about their strings causes them to change every time, so we - double-check failures */ + about their strings causes them to change every time, so we + double-check failures. */ if (!EQ (previous_items[i], AREF (menu_items, i))) if (!(STRINGP (previous_items[i]) && STRINGP (AREF (menu_items, i)) @@ -286,7 +286,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) break; if (i == previous_menu_items_used) { - /* No change.. */ + /* No change. */ #if NSMENUPROFILE ftime (&tb); @@ -302,16 +302,16 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) return; } } - /* The menu items are different, so store them in the frame */ - /* FIXME: this is not correct for single-submenu case */ + /* The menu items are different, so store them in the frame. */ + /* FIXME: this is not correct for single-submenu case. */ fset_menu_bar_vector (f, menu_items); f->menu_bar_items_used = menu_items_used; - /* Calls restore_menu_items, etc., as they were outside */ + /* Calls restore_menu_items, etc., as they were outside. */ unbind_to (specpdl_count, Qnil); /* Parse stage 2a: now GC cannot happen during the lifetime of the - widget_value, so it's safe to store data from a Lisp_String */ + widget_value, so it's safe to store data from a Lisp_String. */ wv = first_wv->contents; for (i = 0; i < ASIZE (items); i += 4) { @@ -326,7 +326,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) } /* Now, update the NS menu; if we have a submenu, use that, otherwise - create a new menu for each sub and fill it. */ + create a new menu for each sub and fill it. */ if (submenu) { const char *submenuTitle = [[submenu title] UTF8String]; @@ -358,7 +358,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) wv->button_type = BUTTON_TYPE_NONE; first_wv = wv; - /* Make widget-value tree w/ just the top level menu bar strings */ + /* Make widget-value tree with just the top level menu bar strings. */ items = FRAME_MENU_BAR_ITEMS (f); if (NILP (items)) { @@ -369,7 +369,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) } - /* check if no change.. this mechanism is a bit rough, but ready */ + /* Check if no change: this mechanism is a bit rough, but ready. */ n = ASIZE (items) / 4; if (f == last_f && n_previous_strings == n) { @@ -416,10 +416,10 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) wv->call_data = (void *) (intptr_t) (-1); #ifdef NS_IMPL_COCOA - /* we'll update the real copy under app menu when time comes */ + /* We'll update the real copy under app menu when time comes. */ if (!strcmp ("Services", wv->name)) { - /* but we need to make sure it will update on demand */ + /* But we need to make sure it will update on demand. */ [svcsMenu setFrame: f]; } else @@ -461,7 +461,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) /* Main emacs core entry point for menubar menus: called to indicate that the frame's menus have changed, and the *step representation should be updated - from Lisp. */ + from Lisp. */ void set_frame_menubar (struct frame *f, bool first_time, bool deep_p) { @@ -489,7 +489,7 @@ x_activate_menubar (struct frame *f) /* Menu that can define itself from Emacs "widget_value"s and will lazily update itself when user clicked. Based on Carbon/AppKit implementation - by Yamamoto Mitsuharu. */ + by Yamamoto Mitsuharu. */ @implementation EmacsMenu /* override designated initializer */ @@ -556,8 +556,8 @@ x_activate_menubar (struct frame *f) #endif /* NS_IMPL_COCOA */ -/* delegate method called when a submenu is being opened: run a 'deep' call - to set_frame_menubar */ +/* Delegate method called when a submenu is being opened: run a 'deep' call + to set_frame_menubar. */ - (void)menuNeedsUpdate: (NSMenu *)menu { if (!FRAME_LIVE_P (frame)) @@ -664,7 +664,7 @@ x_activate_menubar (struct frame *f) [item setEnabled: wv->enabled]; - /* Draw radio buttons and tickboxes */ + /* Draw radio buttons and tickboxes. */ if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || wv->button_type == BUTTON_TYPE_RADIO)) [item setState: NSOnState]; @@ -735,7 +735,7 @@ x_activate_menubar (struct frame *f) } -/* adds an empty submenu and returns it */ +/* Adds an empty submenu and returns it. */ - (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f { NSString *titleStr = [NSString stringWithUTF8String: title]; @@ -748,7 +748,7 @@ x_activate_menubar (struct frame *f) return submenu; } -/* run a menu in popup mode */ +/* Run a menu in popup mode. */ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f keymaps: (bool)keymaps { @@ -756,7 +756,7 @@ x_activate_menubar (struct frame *f) NSEvent *e, *event; long retVal; -/* p = [view convertPoint:p fromView: nil]; */ + /* p = [view convertPoint:p fromView: nil]; */ p.y = NSHeight ([view frame]) - p.y; e = [[view window] currentEvent]; event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown @@ -765,7 +765,7 @@ x_activate_menubar (struct frame *f) timestamp: [e timestamp] windowNumber: [[view window] windowNumber] context: nil - eventNumber: 0/*[e eventNumber] */ + eventNumber: 0 /* [e eventNumber] */ clickCount: 1 pressure: 0]; @@ -811,14 +811,14 @@ ns_menu_show (struct frame *f, int x, int y, int menuflags, first_wv = wv; #if 0 - /* FIXME: a couple of one-line differences prevent reuse */ + /* FIXME: a couple of one-line differences prevent reuse. */ wv = digest_single_submenu (0, menu_items_used, 0); #else { widget_value *save_wv = 0, *prev_wv = 0; widget_value **submenu_stack = alloca (menu_items_used * sizeof *submenu_stack); -/* Lisp_Object *subprefix_stack + /* Lisp_Object *subprefix_stack = alloca (menu_items_used * sizeof *subprefix_stack); */ int submenu_depth = 0; int first_pane = 1; @@ -1009,8 +1009,8 @@ free_frame_tool_bar (struct frame *f) block_input (); view->wait_for_tool_bar = NO; - /* Note: This trigger an animation, which calls windowDidResize - repeatedly. */ + /* Note: This triggers an animation, which calls windowDidResize + repeatedly. */ f->output_data.ns->in_animation = 1; [[view toolbar] setVisible: NO]; f->output_data.ns->in_animation = 0; @@ -1021,7 +1021,7 @@ free_frame_tool_bar (struct frame *f) void update_frame_tool_bar (struct frame *f) /* -------------------------------------------------------------------------- - Update toolbar contents + Update toolbar contents. -------------------------------------------------------------------------- */ { int i, k = 0; @@ -1042,7 +1042,7 @@ update_frame_tool_bar (struct frame *f) [toolbar clearAll]; #endif - /* update EmacsToolbar as in GtkUtils, build items list */ + /* Update EmacsToolbar as in GtkUtils, build items list. */ for (i = 0; i < f->n_tool_bar_items; ++i) { #define TOOLPROP(IDX) AREF (f->tool_bar_items, \ @@ -1070,7 +1070,7 @@ update_frame_tool_bar (struct frame *f) image = TOOLPROP (TOOL_BAR_ITEM_IMAGES); if (VECTORP (image)) { - /* NS toolbar auto-computes disabled and selected images */ + /* NS toolbar auto-computes disabled and selected images. */ idx = TOOL_BAR_IMAGE_ENABLED_SELECTED; eassert (ASIZE (image) >= idx); image = AREF (image, idx); @@ -1119,7 +1119,7 @@ update_frame_tool_bar (struct frame *f) #ifdef NS_IMPL_COCOA if ([toolbar changed]) { - /* inform app that toolbar has changed */ + /* Inform app that toolbar has changed. */ NSDictionary *dict = [toolbar configurationDictionary]; NSMutableDictionary *newDict = [dict mutableCopy]; NSEnumerator *keys = [[dict allKeys] objectEnumerator]; @@ -1252,7 +1252,7 @@ update_frame_tool_bar (struct frame *f) } /* This overrides super's implementation, which automatically sets - all items to enabled state (for some reason). */ + all items to enabled state (for some reason). */ - (void)validateVisibleItems { NSTRACE ("[EmacsToolbar validateVisibleItems]"); @@ -1267,7 +1267,7 @@ update_frame_tool_bar (struct frame *f) { NSTRACE ("[EmacsToolbar toolbar: ...]"); - /* look up NSToolbarItem by identifier and return... */ + /* Look up NSToolbarItem by identifier and return... */ return [identifierToItem objectForKey: itemIdentifier]; } @@ -1275,7 +1275,7 @@ update_frame_tool_bar (struct frame *f) { NSTRACE ("[EmacsToolbar toolbarDefaultItemIdentifiers:]"); - /* return entire set.. */ + /* Return entire set. */ return activeIdentifiers; } @@ -1284,7 +1284,7 @@ update_frame_tool_bar (struct frame *f) { NSTRACE ("[EmacsToolbar toolbarAllowedItemIdentifiers:]"); - /* return entire set... */ + /* return entire set... */ return activeIdentifiers; //return [identifierToItem allKeys]; } @@ -1313,7 +1313,7 @@ update_frame_tool_bar (struct frame *f) ========================================================================== */ /* Needed because NeXTstep does not provide enough control over tooltip - display. */ + display. */ @implementation EmacsTooltip - (instancetype)init @@ -1323,7 +1323,7 @@ update_frame_tool_bar (struct frame *f) NSFont *font = [NSFont toolTipsFontOfSize: 0]; NSFont *sfont = [font screenFont]; int height = [sfont ascender] - [sfont descender]; -/*[font boundingRectForFont].size.height; */ + /* [font boundingRectForFont].size.height; */ NSRect r = NSMakeRect (0, 0, 100, height+6); textField = [[NSTextField alloc] initWithFrame: r]; @@ -1345,7 +1345,7 @@ update_frame_tool_bar (struct frame *f) [win setReleasedWhenClosed: NO]; [win setDelegate: self]; [[win contentView] addSubview: textField]; -/* [win setBackgroundColor: col]; */ + /* [win setBackgroundColor: col]; */ [win setOpaque: NO]; return self; @@ -1558,7 +1558,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) [self setTitle: @""]; area.origin.x += ICONSIZE+2*SPACER; -/* area.origin.y = TEXTHEIGHT; ICONSIZE/2-10+SPACER; */ + /* area.origin.y = TEXTHEIGHT; ICONSIZE/2-10+SPACER; */ area.size.width = 400; area.size.height= TEXTHEIGHT; command = [[[NSTextField alloc] initWithFrame: area] autorelease]; @@ -1569,16 +1569,16 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) [command setSelectable: NO]; [command setFont: [NSFont boldSystemFontOfSize: 13.0]]; -/* area.origin.x = ICONSIZE+2*SPACER; + /* area.origin.x = ICONSIZE+2*SPACER; area.origin.y = TEXTHEIGHT + 2*SPACER; area.size.width = 400; area.size.height= 2; tem = [[[NSBox alloc] initWithFrame: area] autorelease]; [[self contentView] addSubview: tem]; [tem setTitlePosition: NSNoTitle]; - [tem setAutoresizingMask: NSViewWidthSizable];*/ + [tem setAutoresizingMask: NSViewWidthSizable]; */ -/* area.origin.x = ICONSIZE+2*SPACER; */ + /* area.origin.x = ICONSIZE+2*SPACER; */ area.origin.y += TEXTHEIGHT+SPACER; area.size.width = 400; area.size.height= TEXTHEIGHT; @@ -1746,7 +1746,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) int i; NSRect r, s, t; - if (cols == 1 && rows > 1) /* Never told where to split */ + if (cols == 1 && rows > 1) /* Never told where to split. */ { [matrix addColumn]; for (i = 0; i < rows/2; i++) @@ -1810,9 +1810,9 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) data2: 0]; timer_fired = YES; - /* We use sto because stopModal/abortModal out of the main loop does not - seem to work in 10.6. But as we use stop we must send a real event so - the stop is seen and acted upon. */ + /* We use stop because stopModal/abortModal out of the main loop + does not seem to work in 10.6. But as we use stop we must send a + real event so the stop is seen and acted upon. */ [NSApp stop:self]; [NSApp postEvent: nxev atStart: NO]; } @@ -1843,7 +1843,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) ret = dialog_return; if (! timer_fired) { - if (tmo != nil) [tmo invalidate]; /* Cancels timer */ + if (tmo != nil) [tmo invalidate]; /* Cancels timer. */ break; } } @@ -1874,7 +1874,7 @@ DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 0, 0, 0, DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, - doc: /* SKIP: real doc in xmenu.c. */) + doc: /* SKIP: real doc in xmenu.c. */) (void) { 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) static Lisp_Object Vselection_alist; -/* NSPasteboardNameGeneral is pretty much analogous to X11 CLIPBOARD */ +/* NSPasteboardNameGeneral is pretty much analogous to X11 CLIPBOARD. */ static NSString *NXPrimaryPboard; static NSString *NXSecondaryPboard; 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 . */ /* CGFloat on GNUstep may be 4 or 8 byte, but functions expect float* for some versions. - On Cocoa >= 10.5, functions expect CGFloat *. Make compatible type. */ + On Cocoa >= 10.5, functions expect CGFloat *. Make compatible type. */ #ifdef NS_IMPL_COCOA typedef CGFloat EmacsCGFloat; #elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22 @@ -85,7 +85,7 @@ typedef float EmacsCGFloat; can become misaligned, as all threads (currently) share one state. This is post prominent when the EVENTS part is enabled. - Note that the trace system, when enabled, use the GCC/Clang + Note that the trace system, when enabled, uses the GCC/Clang "cleanup" extension. */ /* For example, the following is the output of `M-x @@ -170,7 +170,7 @@ void nstrace_leave(int *); void nstrace_restore_global_trace_state(int *); char const * nstrace_fullscreen_type_name (int); -/* printf-style trace output. Output is aligned with contained heading. */ +/* printf-style trace output. Output is aligned with contained heading. */ #define NSTRACE_MSG_NO_DASHES(...) \ do \ { \ @@ -192,7 +192,7 @@ char const * nstrace_fullscreen_type_name (int); /* Macros for printing complex types. NSTRACE_FMT_what -- Printf format string for "what". - NSTRACE_ARG_what(x) -- Printf argument for "what". */ + NSTRACE_ARG_what(x) -- Printf argument for "what". */ #define NSTRACE_FMT_SIZE "(W:%.0f H:%.0f)" #define NSTRACE_ARG_SIZE(elt) (elt).width, (elt).height @@ -208,7 +208,7 @@ char const * nstrace_fullscreen_type_name (int); #define NSTRACE_ARG_FSTYPE(elt) nstrace_fullscreen_type_name(elt) -/* Macros for printing complex types as extra information. */ +/* Macros for printing complex types as extra information. */ #define NSTRACE_SIZE(str,size) \ NSTRACE_MSG (str ": " NSTRACE_FMT_SIZE, \ @@ -236,7 +236,7 @@ char const * nstrace_fullscreen_type_name (int); NSTRACE_FMT_RETURN - A string literal representing a returned value. Useful when creating a format string - to printf-like constructs like NSTRACE(). */ + to printf-like constructs like NSTRACE(). */ #define NSTRACE_FMT_RETURN "->>" @@ -262,7 +262,7 @@ char const * nstrace_fullscreen_type_name (int); NSTRACE_WHEN (cond, fmt, ...) -- Enable trace output when COND is true. NSTRACE_UNLESS (cond, fmt, ...) -- Enable trace output unless COND is - true. */ + true. */ @@ -278,7 +278,7 @@ char const * nstrace_fullscreen_type_name (int); /* Unsilence called functions. Concretely, this us used to allow "event" functions to be silenced - while trace output can be printed for functions they call. */ + while trace output can be printed for functions they call. */ #define NSTRACE_UNSILENCE() do { nstrace_enabled_global = 1; } while(0) #endif /* NSTRACE_ENABLED */ @@ -286,7 +286,7 @@ char const * nstrace_fullscreen_type_name (int); #define NSTRACE(...) NSTRACE_WHEN(1, __VA_ARGS__) #define NSTRACE_UNLESS(cond, ...) NSTRACE_WHEN(!(cond), __VA_ARGS__) -/* Non-trace replacement versions. */ +/* Non-trace replacement versions. */ #ifndef NSTRACE_WHEN #define NSTRACE_WHEN(...) #endif @@ -332,7 +332,7 @@ char const * nstrace_fullscreen_type_name (int); #endif -/* If the compiler doesn't support instancetype, map it to id. */ +/* If the compiler doesn't support instancetype, map it to id. */ #ifndef NATIVE_OBJC_INSTANCETYPE typedef id instancetype; #endif @@ -356,7 +356,7 @@ typedef id instancetype; ========================================================================== */ -/* We override sendEvent: as a means to stop/start the event loop */ +/* We override sendEvent: as a means to stop/start the event loop. */ @interface EmacsApp : NSApplication { #ifdef NS_IMPL_COCOA @@ -456,7 +456,7 @@ typedef id instancetype; #endif - (int)fullscreenState; -/* Non-notification versions of NSView methods. Used for direct calls. */ +/* Non-notification versions of NSView methods. Used for direct calls. */ - (void)windowWillEnterFullScreen; - (void)windowDidEnterFullScreen; - (void)windowWillExitFullScreen; @@ -465,7 +465,7 @@ typedef id instancetype; @end -/* Small utility used for processing resize events under Cocoa. */ +/* Small utility used for processing resize events under Cocoa. */ @interface EmacsWindow : NSWindow { NSPoint grabOffset; @@ -722,7 +722,7 @@ extern NSArray *ns_send_types, *ns_return_types; extern NSString *ns_app_name; extern EmacsMenu *svcsMenu; -/* Apple removed the declaration, but kept the implementation */ +/* Apple removed the declaration, but kept the implementation. */ #if defined (NS_IMPL_COCOA) @interface NSApplication (EmacsApp) - (void)setAppleMenu: (NSMenu *)menu; @@ -752,8 +752,8 @@ extern EmacsMenu *svcsMenu; #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13) #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14) -/* could use list to store these, but rest of emacs has a big infrastructure - for managing a table of bitmap "records" */ +/* Could use list to store these, but rest of emacs has a big infrastructure + for managing a table of bitmap "records". */ struct ns_bitmap_record { #ifdef __OBJC__ @@ -766,7 +766,7 @@ struct ns_bitmap_record int height, width, depth; }; -/* this to map between emacs color indices and NSColor objects */ +/* This maps between emacs color indices and NSColor objects. */ struct ns_color_table { ptrdiff_t size; @@ -790,7 +790,7 @@ struct ns_color_table #define BLUE_FROM_ULONG(color) ((color) & 0xff) /* Do not change `* 0x101' in the following lines to `<< 8'. If - changed, image masks in 1-bit depth will not work. */ + changed, image masks in 1-bit depth will not work. */ #define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101) #define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101) #define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101) @@ -802,7 +802,7 @@ struct nsfont_info char *name; /* PostScript name, uniquely identifies on NS systems */ - /* The following metrics are stored as float rather than int. */ + /* The following metrics are stored as float rather than int. */ float width; /* Maximum advance for the font. */ float height; @@ -823,26 +823,26 @@ struct nsfont_info char bold, ital; /* convenience flags */ char synthItal; XCharStruct max_bounds; - /* we compute glyph codes and metrics on-demand in blocks of 256 indexed - by hibyte, lobyte */ + /* We compute glyph codes and metrics on-demand in blocks of 256 indexed + by hibyte, lobyte. */ unsigned short **glyphs; /* map Unicode index to glyph */ struct font_metrics **metrics; }; -/* init'd in ns_initialize_display_info () */ +/* Initialized in ns_initialize_display_info (). */ struct ns_display_info { /* Chain of all ns_display_info structures. */ struct ns_display_info *next; - /* The generic display parameters corresponding to this NS display. */ + /* The generic display parameters corresponding to this NS display. */ struct terminal *terminal; /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */ Lisp_Object name_list_element; - /* The number of fonts loaded. */ + /* The number of fonts loaded. */ int n_fonts; /* Minimum width over all characters in all fonts in font_table. */ @@ -872,10 +872,10 @@ struct ns_display_info /* Xism */ XrmDatabase xrdb; - /* The cursor to use for vertical scroll bars. */ + /* The cursor to use for vertical scroll bars. */ Cursor vertical_scroll_bar_cursor; - /* The cursor to use for horizontal scroll bars. */ + /* The cursor to use for horizontal scroll bars. */ Cursor horizontal_scroll_bar_cursor; /* Information about the range of text currently shown in @@ -931,7 +931,7 @@ struct ns_output void *toolbar; #endif - /* NSCursors init'ed in initFrameFromEmacs */ + /* NSCursors are initialized in initFrameFromEmacs. */ Cursor text_cursor; Cursor nontext_cursor; Cursor modeline_cursor; @@ -969,10 +969,10 @@ struct ns_output scroll bars, in pixels. */ int vertical_scroll_bar_extra; - /* The height of the titlebar decoration (included in NSWindow's frame). */ + /* The height of the titlebar decoration (included in NSWindow's frame). */ int titlebar_height; - /* The height of the toolbar if displayed, else 0. */ + /* The height of the toolbar if displayed, else 0. */ int toolbar_height; /* This is the Emacs structure for the NS display this frame is on. */ @@ -981,11 +981,11 @@ struct ns_output /* Non-zero if we are zooming (maximizing) the frame. */ int zooming; - /* Non-zero if we are doing an animation, e.g. toggling the tool bar. */ + /* Non-zero if we are doing an animation, e.g. toggling the tool bar. */ int in_animation; }; -/* this dummy decl needed to support TTYs */ +/* This dummy declaration needed to support TTYs. */ struct x_output { int unused; @@ -1024,7 +1024,7 @@ struct x_output #define XNS_SCROLL_BAR(vec) XSAVE_POINTER (vec, 0) #endif -/* Compute pixel height of the frame's titlebar. */ +/* Compute pixel height of the frame's titlebar. */ #define FRAME_NS_TITLEBAR_HEIGHT(f) \ (NSHeight([FRAME_NS_VIEW (f) frame]) == 0 ? \ 0 \ @@ -1033,7 +1033,7 @@ struct x_output [[FRAME_NS_VIEW (f) window] frame] \ styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]))) -/* Compute pixel height of the toolbar. */ +/* Compute pixel height of the toolbar. */ #define FRAME_TOOLBAR_HEIGHT(f) \ (([[FRAME_NS_VIEW (f) window] toolbar] == nil \ || ! [[FRAME_NS_VIEW (f) window] toolbar].isVisible) ? \ @@ -1043,7 +1043,7 @@ struct x_output styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]) \ - NSHeight([[[FRAME_NS_VIEW (f) window] contentView] frame]))) -/* Compute pixel size for vertical scroll bars */ +/* Compute pixel size for vertical scroll bars. */ #define NS_SCROLL_BAR_WIDTH(f) \ (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \ @@ -1051,7 +1051,7 @@ struct x_output : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \ : 0) -/* Compute pixel size for horizontal scroll bars */ +/* Compute pixel size for horizontal scroll bars. */ #define NS_SCROLL_BAR_HEIGHT(f) \ (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \ ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 \ @@ -1059,22 +1059,22 @@ struct x_output : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))) \ : 0) -/* Difference btwn char-column-calculated and actual SB widths. - This is only a concern for rendering when SB on left. */ +/* Difference between char-column-calculated and actual SB widths. + This is only a concern for rendering when SB on left. */ #define NS_SCROLL_BAR_ADJUST(w, f) \ (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) ? \ (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) \ - NS_SCROLL_BAR_WIDTH (f)) : 0) -/* Difference btwn char-line-calculated and actual SB heights. - This is only a concern for rendering when SB on top. */ +/* Difference between char-line-calculated and actual SB heights. + This is only a concern for rendering when SB on top. */ #define NS_SCROLL_BAR_ADJUST_HORIZONTALLY(w, f) \ (WINDOW_HAS_HORIZONTAL_SCROLL_BARS (w) ? \ (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f) \ - NS_SCROLL_BAR_HEIGHT (f)) : 0) /* Calculate system coordinates of the left and top of the parent - window or, if there is no parent window, the screen. */ + window or, if there is no parent window, the screen. */ #define NS_PARENT_WINDOW_LEFT_POS(f) \ (FRAME_PARENT_FRAME (f) != NULL \ ? [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window].frame.origin.x : 0) @@ -1094,7 +1094,7 @@ struct x_output #define WHITE_PIX_DEFAULT(f) 0xFFFFFF /* First position where characters can be shown (instead of scrollbar, if - it is on left. */ + it is on left. */ #define FIRST_CHAR_POSITION(f) \ (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \ : FRAME_SCROLL_BAR_COLS (f)) @@ -1118,7 +1118,7 @@ extern void nsfont_make_fontset_for_font (Lisp_Object name, struct glyph_string; void ns_dump_glyphstring (struct glyph_string *s) EXTERNALLY_VISIBLE; -/* Implemented in nsterm, published in or needed from nsfns. */ +/* Implemented in nsterm, published in or needed from nsfns. */ extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern, int size, int maxnames); extern void ns_clear_frame (struct frame *f); @@ -1251,13 +1251,13 @@ extern char gnustep_base_version[]; /* version tracking */ #define MINWIDTH 10 #define MINHEIGHT 10 -/* Screen max coordinate - Using larger coordinates causes movewindow/placewindow to abort */ +/* Screen max coordinate -- using larger coordinates causes + movewindow/placewindow to abort. */ #define SCREENMAX 16000 #define NS_SCROLL_BAR_WIDTH_DEFAULT [EmacsScroller scrollerWidth] #define NS_SCROLL_BAR_HEIGHT_DEFAULT [EmacsScroller scrollerHeight] -/* This is to match emacs on other platforms, ugly though it is. */ +/* This is to match emacs on other platforms, ugly though it is. */ #define NS_SELECTION_BG_COLOR_DEFAULT @"LightGoldenrod2"; #define NS_SELECTION_FG_COLOR_DEFAULT @"Black"; #define RESIZE_HANDLE_SIZE 12 @@ -1267,7 +1267,7 @@ extern char gnustep_base_version[]; /* version tracking */ ? (min) : (((x)>(max)) ? (max) : (x))) #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX)) -/* macOS 10.7 introduces some new constants. */ +/* macOS 10.7 introduces some new constants. */ #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_7) #define NSFullScreenWindowMask (1 << 14) #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) @@ -1276,7 +1276,7 @@ extern char gnustep_base_version[]; /* version tracking */ #define NSAppKitVersionNumber10_7 1138 #endif /* !defined (MAC_OS_X_VERSION_10_7) */ -/* macOS 10.12 deprecates a bunch of constants. */ +/* macOS 10.12 deprecates a bunch of constants. */ #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12) #define NSEventModifierFlagCommand NSCommandKeyMask #define NSEventModifierFlagControl NSControlKeyMask @@ -1315,12 +1315,12 @@ extern char gnustep_base_version[]; /* version tracking */ #define NSControlSizeRegular NSRegularControlSize #define NSCompositingOperationCopy NSCompositeCopy -/* And adds NSWindowStyleMask. */ +/* And adds NSWindowStyleMask. */ #ifdef __OBJC__ typedef NSUInteger NSWindowStyleMask; #endif -/* Window tabbing mode enums are new too. */ +/* Window tabbing mode enums are new too. */ enum NSWindowTabbingMode { 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) */ /* This should be the first include, as it may set up #defines affecting - interpretation of even the system includes. */ + interpretation of even the system includes. */ #include #include @@ -84,7 +84,7 @@ static EmacsMenu *mainMenu; #if NSTRACE_ENABLED /* The following use "volatile" since they can be accessed from - parallel threads. */ + parallel threads. */ volatile int nstrace_num = 0; volatile int nstrace_depth = 0; @@ -93,10 +93,10 @@ volatile int nstrace_depth = 0; TODO: This should really be a thread-local variable, to avoid that a function with disabled trace thread silence trace output in - another. However, in practice this seldom is a problem. */ + another. However, in practice this seldom is a problem. */ volatile int nstrace_enabled_global = 1; -/* Called when nstrace_enabled goes out of scope. */ +/* Called when nstrace_enabled goes out of scope. */ void nstrace_leave(int * pointer_to_nstrace_enabled) { if (*pointer_to_nstrace_enabled) @@ -106,7 +106,7 @@ void nstrace_leave(int * pointer_to_nstrace_enabled) } -/* Called when nstrace_saved_enabled_global goes out of scope. */ +/* Called when nstrace_saved_enabled_global goes out of scope. */ void nstrace_restore_global_trace_state(int * pointer_to_saved_enabled_global) { nstrace_enabled_global = *pointer_to_saved_enabled_global; @@ -161,7 +161,7 @@ char const * nstrace_fullscreen_type_name (int fs_type) { /* FIXMES: We're checking for colorWithSRGBRed here so this will only work in the same place as in the method above. It should - really be a check whether we're on macOS 10.7 or above. */ + really be a check whether we're on macOS 10.7 or above. */ #if defined (NS_IMPL_COCOA) \ && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (ns_use_srgb_colorspace @@ -185,7 +185,7 @@ char const * nstrace_fullscreen_type_name (int fs_type) /* Convert a symbol indexed with an NSxxx value to a value as defined in keyboard.c (lispy_function_key). I hope this is a correct way - of doing things... */ + of doing things... */ static unsigned convert_ns_to_X_keysym[] = { NSHomeFunctionKey, 0x50, @@ -234,9 +234,9 @@ static unsigned convert_ns_to_X_keysym[] = NSF23FunctionKey, 0xD4, NSF24FunctionKey, 0xD5, - NSBackspaceCharacter, 0x08, /* 8: Not on some KBs. */ - NSDeleteCharacter, 0xFF, /* 127: Big 'delete' key upper right. */ - NSDeleteFunctionKey, 0x9F, /* 63272: Del forw key off main array. */ + NSBackspaceCharacter, 0x08, /* 8: Not on some KBs. */ + NSDeleteCharacter, 0xFF, /* 127: Big 'delete' key upper right. */ + NSDeleteFunctionKey, 0x9F, /* 63272: Del forw key off main array. */ NSTabCharacter, 0x09, 0x19, 0x09, /* left tab->regular since pass shift */ @@ -266,7 +266,7 @@ static unsigned convert_ns_to_X_keysym[] = /* On macOS picks up the default NSGlobalDomain AppleAntiAliasingThreshold, the maximum font size to NOT antialias. On GNUstep there is currently - no way to control this behavior. */ + no way to control this behavior. */ float ns_antialias_threshold; NSArray *ns_send_types = 0, *ns_return_types = 0; @@ -292,7 +292,7 @@ static BOOL ns_menu_bar_is_hidden = NO; /* The number of times NSDisableScreenUpdates has been called. */ static int disable_screen_updates_count = 0; #endif -/*static int debug_lock = 0; */ +/* static int debug_lock = 0; */ /* event loop */ static BOOL send_appdefined = YES; @@ -424,7 +424,7 @@ ev_modifiers_helper (unsigned int flags, unsigned int left_mask, (([e type] == NSEventTypeRightMouseDown) || ([e type] == NSEventTypeRightMouseUp)) ? 2 : \ [e buttonNumber] - 1) -/* Convert the time field to a timestamp in milliseconds. */ +/* Convert the time field to a timestamp in milliseconds. */ #define EV_TIMESTAMP(e) ([e timestamp] * 1000) /* 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, /* These flags will be OR'd or XOR'd with the NSWindow's styleMask - property depending on what we're doing. */ + property depending on what we're doing. */ #define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \ | NSWindowStyleMaskResizable \ | NSWindowStyleMaskMiniaturizable \ | NSWindowStyleMaskClosable) #define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless -/* TODO: get rid of need for these forward declarations */ +/* TODO: Get rid of need for these forward declarations. */ static void ns_condemn_scroll_bars (struct frame *f); static void ns_judge_scroll_bars (struct frame *f); @@ -665,7 +665,7 @@ ns_load_path (void) void ns_init_locale (void) /* macOS doesn't set any environment variables for the locale when run - from the GUI. Get the locale from the OS and set LANG. */ + from the GUI. Get the locale from the OS and set LANG. */ { NSLocale *locale = [NSLocale currentLocale]; @@ -676,11 +676,11 @@ ns_init_locale (void) /* It seems macOS should probably use UTF-8 everywhere. 'localeIdentifier' does not specify the encoding, and I can't find any way to get the OS to tell us which encoding to use, - so hard-code '.UTF-8'. */ + so hard-code '.UTF-8'. */ NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8", [locale localeIdentifier]]; - /* Set LANG to locale, but not if LANG is already set. */ + /* Set LANG to locale, but not if LANG is already set. */ setenv("LANG", [localeID UTF8String], 0); } @catch (NSException *e) @@ -703,7 +703,7 @@ ns_release_object (void *obj) void ns_retain_object (void *obj) /* -------------------------------------------------------------------------- - Retain an object (callable from C) + Retain an object (callable from C) -------------------------------------------------------------------------- */ { [(id)obj retain]; @@ -836,7 +836,7 @@ ns_screen_margins (NSScreen *screen) static struct EmacsMargins ns_screen_margins_ignoring_hidden_dock (NSScreen *screen) /* The parts of SCREEN used by the operating system, excluding the parts -reserved for an hidden dock. */ + reserved for a hidden dock. */ { NSTRACE ("ns_screen_margins_ignoring_hidden_dock"); @@ -1297,13 +1297,13 @@ ns_focus (struct frame *f, NSRect *r, int n) { [focus_view unlockFocus]; [[focus_view window] flushWindow]; -/*debug_lock--; */ +/* debug_lock--; */ } if (view) [view lockFocus]; focus_view = view; -/*if (view) debug_lock++; */ +/* if (view) debug_lock++; */ } } @@ -1341,7 +1341,7 @@ ns_unfocus (struct frame *f) [focus_view unlockFocus]; [[focus_view window] flushWindow]; focus_view = NULL; -/*debug_lock--; */ +/* debug_lock--; */ } } } @@ -1399,7 +1399,7 @@ ns_clip_to_row (struct window *w, struct glyph_row *row, @interface EmacsBell : NSImageView { - // Number of currently active bell:s. + // Number of currently active bells. unsigned int nestCount; NSView * mView; bool isAttached; @@ -1660,7 +1660,7 @@ x_make_frame_visible (struct frame *f) NSTRACE ("x_make_frame_visible"); /* XXX: at some points in past this was not needed, as the only place that called this (frame.c:Fraise_frame ()) also called raise_lower; - if this ends up the case again, comment this out again. */ + if this ends up the case again, comment this out again. */ if (!FRAME_VISIBLE_P (f)) { EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); @@ -1683,7 +1683,7 @@ x_make_frame_visible (struct frame *f) } /* Making a frame invisible seems to break the parent->child - relationship, so reinstate it. */ + relationship, so reinstate it. */ if ([window parentWindow] == nil && FRAME_PARENT_FRAME (f) != NULL) { NSWindow *parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window]; @@ -1695,7 +1695,7 @@ x_make_frame_visible (struct frame *f) /* If the parent frame moved while the child frame was invisible, the child frame's position won't have been - updated. Make sure it's in the right place now. */ + updated. Make sure it's in the right place now. */ x_set_offset(f, f->left_pos, f->top_pos, 0); } } @@ -1737,8 +1737,8 @@ x_iconify_frame (struct frame *f) if ([[view window] windowNumber] <= 0) { - /* the window is still deferred. Make it very small, bring it - on screen and order it out. */ + /* The window is still deferred. Make it very small, bring it + on screen and order it out. */ NSRect s = { { 100, 100}, {0, 0} }; NSRect t; t = [[view window] frame]; @@ -1749,7 +1749,7 @@ x_iconify_frame (struct frame *f) } /* Processing input while Emacs is being minimized can cause a - crash, so block it for the duration. */ + crash, so block it for the duration. */ block_input(); [[view window] miniaturize: NSApp]; unblock_input(); @@ -1804,7 +1804,7 @@ x_destroy_window (struct frame *f) NSTRACE ("x_destroy_window"); /* If this frame has a parent window, detach it as not doing so can - cause a crash in GNUStep. */ + cause a crash in GNUStep. */ if (FRAME_PARENT_FRAME (f) != NULL) { 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 else { [window setToolbar: nil]; - /* Do I need to release the toolbar here? */ + /* Do I need to release the toolbar here? */ FRAME_UNDECORATED (f) = true; [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 } /* At this point it seems we don't have an active NSResponder, - so some key presses (TAB) are swallowed by the system. */ + so some key presses (TAB) are swallowed by the system. */ [window makeFirstResponder: view]; [view updateFrameSize: NO]; @@ -2073,7 +2073,7 @@ x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_v * displayed for the first time and when the frame changes its state * from `iconified' or `invisible' to `visible'.) * - * Some window managers may not honor this parameter. */ + * Some window managers may not honor this parameter. */ { NSTRACE ("x_set_no_focus_on_map"); @@ -2092,7 +2092,7 @@ x_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_v * If non-nil, this may have the unwanted side-effect that a user cannot * scroll a non-selected frame with the mouse. * - * Some window managers may not honor this parameter. */ + * Some window managers may not honor this parameter. */ { NSTRACE ("x_set_no_accept_focus"); @@ -2109,7 +2109,7 @@ x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) `below' property set. If `below', F's window is displayed below all windows that do. - Some window managers may not honor this parameter. */ + Some window managers may not honor this parameter. */ { EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); NSWindow *window = [view window]; @@ -2128,7 +2128,7 @@ x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) } else if (EQ (new_value, Qabove_suspended)) { - /* Not sure what level this should be. */ + /* Not sure what level this should be. */ window.level = NSNormalWindowLevel + 1; FRAME_Z_GROUP (f) = z_group_above_suspended; } @@ -2206,8 +2206,7 @@ ns_fullscreen_hook (struct frame *f) if (! [view fsIsNative] && f->want_fullscreen == FULLSCREEN_BOTH) { /* Old style fs don't initiate correctly if created from - init/default-frame alist, so use a timer (not nice...). - */ + init/default-frame alist, so use a timer (not nice...). */ [NSTimer scheduledTimerWithTimeInterval: 0.5 target: view selector: @selector (handleFS) userInfo: nil repeats: NO]; @@ -2274,7 +2273,7 @@ ns_index_color (NSColor *color, struct frame *f) color_table->colors[idx] = color; [color retain]; -/*fprintf(stderr, "color_table: allocated %d\n",idx);*/ + /* fprintf(stderr, "color_table: allocated %d\n",idx); */ return idx; } @@ -2286,7 +2285,7 @@ ns_get_color (const char *name, NSColor **col) -------------------------------------------------------------------------- */ /* On *Step, we attempt to mimic the X11 platform here, down to installing an X11 rgb.txt-compatible color list in Emacs.clr (see ns_term_init()). - See: http://thread.gmane.org/gmane.emacs.devel/113050/focus=113272). */ + See https://lists.gnu.org/r/emacs-devel/2009-07/msg01203.html. */ { NSColor *new = nil; static char hex[20]; @@ -2321,8 +2320,7 @@ ns_get_color (const char *name, NSColor **col) else if ([nsname isEqualToString: @"ns_selection_fg_color"]) { /* NOTE: macOS applications normally don't set foreground - selection, but text may be unreadable if we don't. - */ + selection, but text may be unreadable if we don't. */ if ((new = [NSColor selectedTextColor]) != nil) { *col = [new colorUsingDefaultColorSpace]; @@ -2334,7 +2332,7 @@ ns_get_color (const char *name, NSColor **col) name = [nsname UTF8String]; } - /* First, check for some sort of numeric specification. */ + /* First, check for some sort of numeric specification. */ hex[0] = '\0'; if (name[0] == '0' || name[0] == '1' || name[0] == '.') /* RGB decimal */ @@ -2384,7 +2382,7 @@ ns_get_color (const char *name, NSColor **col) NSColorList *clist; #ifdef NS_IMPL_GNUSTEP - /* XXX: who is wrong, the requestor or the implementation? */ + /* XXX: who is wrong, the requestor or the implementation? */ if ([nsname compare: @"Highlight" options: NSCaseInsensitiveSearch] == NSOrderedSame) nsname = @"highlightColor"; @@ -2413,7 +2411,7 @@ ns_get_color (const char *name, NSColor **col) int ns_lisp_to_color (Lisp_Object color, NSColor **col) /* -------------------------------------------------------------------------- - Convert a Lisp string object to a NS color + Convert a Lisp string object to a NS color. -------------------------------------------------------------------------- */ { NSTRACE ("ns_lisp_to_color"); @@ -2458,7 +2456,7 @@ ns_defined_color (struct frame *f, If makeIndex and alloc are nonzero put the color in the color_table, and set color_def pixel to the resulting index. If makeIndex is zero, set color_def pixel to ARGB. - Return false if not found + Return false if not found. -------------------------------------------------------------------------- */ { NSColor *col; @@ -2531,7 +2529,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) { NSTRACE ("frame_set_mouse_pixel_position"); - /* FIXME: what about GNUstep? */ + /* FIXME: what about GNUstep? */ #ifdef NS_IMPL_COCOA CGPoint mouse_pos = CGPointMake(f->left_pos + pix_x, @@ -2552,15 +2550,15 @@ note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); NSRect *r; -// NSTRACE ("note_mouse_movement"); + // NSTRACE ("note_mouse_movement"); dpyinfo->last_mouse_motion_frame = frame; r = &dpyinfo->last_mouse_glyph; /* Note, this doesn't get called for enter/leave, since we don't have a - position. Those are taken care of in the corresponding NSView methods. */ + position. Those are taken care of in the corresponding NSView methods. */ - /* has movement gone beyond last rect we were tracking? */ + /* Has movement gone beyond last rect we were tracking? */ if (x < r->origin.x || x >= r->origin.x + r->size.width || y < r->origin.y || y >= r->origin.y + r->size.height) { @@ -2584,7 +2582,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, External (hook): inform emacs about mouse position and hit parts. If a scrollbar is being dragged, set bar_window, part, x, y, time. x & y should be position in the scrollbar (the whole bar, not the handle) - and length of scrollbar respectively + and length of scrollbar respectively. -------------------------------------------------------------------------- */ { id view; @@ -2703,7 +2701,7 @@ ns_convert_key (unsigned code) { const unsigned last_keysym = ARRAYELTS (convert_ns_to_X_keysym); unsigned keysym; - /* An array would be faster, but less easy to read. */ + /* An array would be faster, but less easy to read. */ for (keysym = 0; keysym < last_keysym; keysym += 2) if (code == convert_ns_to_X_keysym[keysym]) return 0xFF00 | convert_ns_to_X_keysym[keysym+1]; @@ -2900,7 +2898,7 @@ ns_copy_bits (struct frame *f, NSRect src, NSRect dest) static void ns_scroll_run (struct window *w, struct run *run) /* -------------------------------------------------------------------------- - External (RIF): Insert or delete n lines at line vpos + External (RIF): Insert or delete n lines at line vpos. -------------------------------------------------------------------------- */ { struct frame *f = XFRAME (w->frame); @@ -3146,7 +3144,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, NSRectClip (r); /* Since we composite the bitmap instead of just blitting it, we need - to erase the whole background. */ + to erase the whole background. */ [ns_lookup_indexed_color(face->background, f) set]; NSRectFill (r); @@ -3239,17 +3237,17 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); /* The above get_phys_cursor_geometry call set w->phys_cursor_width - to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ + to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ if (cursor_type == BAR_CURSOR) { if (cursor_width < 1) cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); - /* The bar cursor should never be wider than the glyph. */ + /* The bar cursor should never be wider than the glyph. */ if (cursor_width < w->phys_cursor_width) w->phys_cursor_width = cursor_width; } - /* If we have an HBAR, "cursor_width" MAY specify height. */ + /* If we have an HBAR, "cursor_width" MAY specify height. */ else if (cursor_type == HBAR_CURSOR) { 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, r.size.height = h; r.size.width = w->phys_cursor_width; - /* Prevent the cursor from being drawn outside the text area. */ + /* Prevent the cursor from being drawn outside the text area. */ ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1); if remove */ @@ -3282,8 +3280,8 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph atomic. Cleaner ways of doing this should be investigated. One way would be to set a global variable DRAWING_CURSOR - when making the call to draw_phys..(), don't focus in that - case, then move the ns_unfocus() here after that call. */ + when making the call to draw_phys..(), don't focus in that + case, then move the ns_unfocus() here after that call. */ NSDisableScreenUpdates (); #endif @@ -3503,7 +3501,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, if (s->for_overlaps) return; - /* Do underline. */ + /* Do underline. */ if (face->underline_p) { if (s->face->underline_type == FACE_UNDER_WAVE) @@ -3521,7 +3519,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, NSRect r; unsigned long thickness, position; - /* If the prev was underlined, match its appearance. */ + /* If the prev was underlined, match its appearance. */ if (s->prev && s->prev->face->underline_p && s->prev->face->underline_type == FACE_UNDER_LINE && s->prev->underline_thickness > 0) @@ -3549,11 +3547,11 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, use_underline_position_properties = !(NILP (val) || EQ (val, Qunbound)); - /* Use underline thickness of font, defaulting to 1. */ + /* Use underline thickness of font, defaulting to 1. */ thickness = (font && font->underline_thickness > 0) ? font->underline_thickness : 1; - /* Determine the offset of underlining from the baseline. */ + /* Determine the offset of underlining from the baseline. */ if (underline_at_descent_line) position = descent - thickness; else if (use_underline_position_properties @@ -3566,7 +3564,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, position = max (position, minimum_offset); - /* Ensure underlining is not cropped. */ + /* Ensure underlining is not cropped. */ if (descent <= position) { position = descent - 1; @@ -3589,7 +3587,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, } } /* Do overline. We follow other terms in using a thickness of 1 - and ignoring overline_margin. */ + and ignoring overline_margin. */ if (face->overline_p) { NSRect r; @@ -3603,7 +3601,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, } /* Do strike-through. We follow other terms for thickness and - vertical position.*/ + vertical position. */ if (face->strike_through_p) { NSRect r; @@ -3710,7 +3708,7 @@ ns_draw_relief (NSRect r, int thickness, char raised_p, [(raised_p ? lightCol : darkCol) set]; - /* TODO: mitering. Using NSBezierPath doesn't work because of color switch. */ + /* TODO: mitering. Using NSBezierPath doesn't work because of color switch. */ /* top */ sr.size.height = thickness; @@ -3784,7 +3782,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s) r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height); - /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ + /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) { ns_draw_box (r, abs (thickness), @@ -3887,7 +3885,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) /* Draw BG: if we need larger area than image itself cleared, do that, otherwise, since we composite the image under NS (instead of mucking - with its background color), we must clear just the image area. */ + with its background color), we must clear just the image area. */ if (s->hl == DRAW_MOUSE_FACE) { face = FACE_FROM_ID_OR_NULL (s->f, @@ -3913,7 +3911,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) NSRectFill (br); - /* Draw the image.. do we need to draw placeholder if img ==nil? */ + /* Draw the image... do we need to draw placeholder if img == nil? */ if (img != nil) { #ifdef NS_IMPL_COCOA @@ -3939,11 +3937,11 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) if (s->w->phys_cursor_type == FILLED_BOX_CURSOR) tdCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); else - /* Currently on NS img->mask is always 0. Since + /* Currently on NS img->mask is always 0. Since get_window_cursor_type specifies a hollow box cursor when on - a non-masked image we never reach this clause. But we put it + a non-masked image we never reach this clause. But we put it in, in anticipation of better support for image masks on - NS. */ + NS. */ tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); } else @@ -3951,7 +3949,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); } - /* Draw underline, overline, strike-through. */ + /* Draw underline, overline, strike-through. */ ns_draw_text_decoration (s, face, tdCol, br.size.width, br.origin.x); /* Draw relief, if requested */ @@ -4046,14 +4044,14 @@ ns_dumpglyphs_stretch (struct glyph_string *s) a partially-visible bottom row will clear part of the modeline, and another where list-buffers headers and similar rows erroneously have visible_height set to 0. Not sure - where this is coming from as other terms seem not to show. */ + where this is coming from as other terms seem not to show. */ r[i].size.height = min (s->height, s->row->visible_height); } [bgCol set]; /* NOTE: under NS this is NOT used to draw cursors, but we must avoid - overwriting cursor (usually when cursor on a tab) */ + overwriting cursor (usually when cursor on a tab). */ if (s->hl == DRAW_CURSOR) { CGFloat x, width; @@ -4065,7 +4063,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) NSRectFill (r[i]); - /* Draw overlining, etc. on the cursor. */ + /* Draw overlining, etc. on the cursor. */ if (s->w->phys_cursor_type == FILLED_BOX_CURSOR) ns_draw_text_decoration (s, face, bgCol, width, x); else @@ -4077,7 +4075,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) } /* Draw overlining, etc. on the stretch glyph (or the part - of the stretch glyph after the cursor). */ + of the stretch glyph after the cursor). */ ns_draw_text_decoration (s, face, fgCol, r[i].size.width, r[i].origin.x); } @@ -4304,7 +4302,7 @@ ns_draw_glyph_string (struct glyph_string *s) : FRAME_FOREGROUND_COLOR (s->f)); [col set]; - /* Draw underline, overline, strike-through. */ + /* Draw underline, overline, strike-through. */ ns_draw_text_decoration (s, s->face, col, s->width, s->x); } @@ -4338,7 +4336,7 @@ ns_draw_glyph_string (struct glyph_string *s) emacs_abort (); } - /* Draw box if not done already. */ + /* Draw box if not done already. */ if (!s->for_overlaps && !box_drawn_p && s->face->box != FACE_NO_BOX) { n = ns_get_glyph_string_clip_rect (s, r); @@ -4381,8 +4379,8 @@ ns_send_appdefined (int value) } /* Only post this event if we haven't already posted one. This will end - the [NXApp run] main loop after having processed all events queued at - this moment. */ + the [NXApp run] main loop after having processed all events queued at + this moment. */ #ifdef NS_IMPL_COCOA if (! send_appdefined) @@ -4405,7 +4403,7 @@ ns_send_appdefined (int value) /* We only need one NX_APPDEFINED event to stop NXApp from running. */ send_appdefined = NO; - /* Don't need wakeup timer any more */ + /* Don't need wakeup timer any more. */ if (timed_entry) { [timed_entry invalidate]; @@ -4459,7 +4457,7 @@ check_native_fs () void ns_check_menu_open (NSMenu *menu) { - /* Click in menu bar? */ + /* Click in menu bar? */ NSArray *a = [[NSApp mainMenu] itemArray]; int i; BOOL found = NO; @@ -4555,19 +4553,19 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) ns_init_events (&ev); q_event_ptr = hold_quit; - /* we manage autorelease pools by allocate/reallocate each time around + /* We manage autorelease pools by allocate/reallocate each time around the loop; strict nesting is occasionally violated but seems not to - matter.. earlier methods using full nesting caused major memory leaks */ + matter... earlier methods using full nesting caused major memory leaks. */ [outerpool release]; outerpool = [[NSAutoreleasePool alloc] init]; - /* If have pending open-file requests, attend to the next one of those. */ + /* If have pending open-file requests, attend to the next one of those. */ if (ns_pending_files && [ns_pending_files count] != 0 && [(EmacsApp *)NSApp openFile: [ns_pending_files objectAtIndex: 0]]) { [ns_pending_files removeObjectAtIndex: 0]; } - /* Deal with pending service requests. */ + /* Deal with pending service requests. */ else if (ns_pending_service_names && [ns_pending_service_names count] != 0 && [(EmacsApp *) NSApp fulfillService: [ns_pending_service_names objectAtIndex: 0] @@ -4620,7 +4618,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, if (hold_event_q.nr > 0) { - /* We already have events pending. */ + /* We already have events pending. */ raise (SIGIO); errno = EINTR; return -1; @@ -4672,13 +4670,13 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, pthread_mutex_unlock (&select_mutex); - /* Inform fd_handler that select should be called */ + /* Inform fd_handler that select should be called. */ c = 'g'; emacs_write_sig (selfds[1], &c, 1); } else if (nr == 0 && timeout) { - /* No file descriptor, just a timeout, no need to wake fd_handler */ + /* No file descriptor, just a timeout, no need to wake fd_handler. */ double time = timespectod (*timeout); timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time target: NSApp @@ -4690,7 +4688,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, } else /* No timeout and no file descriptors, can this happen? */ { - /* Send appdefined so we exit from the loop */ + /* Send appdefined so we exit from the loop. */ ns_send_appdefined (-1); } @@ -4715,7 +4713,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, if (t == -2) { - /* The NX_APPDEFINED event we received was a timeout. */ + /* The NX_APPDEFINED event we received was a timeout. */ result = 0; } else if (t == -1) @@ -4727,7 +4725,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, } else { - /* Received back from select () in fd_handler; copy the results */ + /* Received back from select () in fd_handler; copy the results. */ pthread_mutex_lock (&select_mutex); if (readfds) *readfds = select_readfds; if (writefds) *writefds = select_writefds; @@ -4747,11 +4745,11 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, #ifdef HAVE_PTHREAD void ns_run_loop_break () -/* Break out of the NS run loop in ns_select or ns_read_socket. */ +/* Break out of the NS run loop in ns_select or ns_read_socket. */ { NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_run_loop_break"); - /* If we don't have a GUI, don't send the event. */ + /* If we don't have a GUI, don't send the event. */ if (NSApp != NULL) ns_send_appdefined(-1); } @@ -4781,7 +4779,7 @@ ns_set_vertical_scroll_bar (struct window *window, int top, left, height, width; BOOL update_p = YES; - /* optimization; display engine sends WAY too many of these.. */ + /* Optimization; display engine sends WAY too many of these. */ if (!NILP (window->vertical_scroll_bar)) { bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); @@ -4808,14 +4806,14 @@ ns_set_vertical_scroll_bar (struct window *window, left = WINDOW_SCROLL_BAR_AREA_X (window); r = NSMakeRect (left, top, width, height); - /* the parent view is flipped, so we need to flip y value */ + /* The parent view is flipped, so we need to flip y value. */ v = [view frame]; r.origin.y = (v.size.height - r.size.height - r.origin.y); XSETWINDOW (win, window); block_input (); - /* we want at least 5 lines to display a scrollbar */ + /* We want at least 5 lines to display a scrollbar. */ if (WINDOW_TOTAL_LINES (window) < 5) { if (!NILP (window->vertical_scroll_bar)) @@ -4863,7 +4861,7 @@ static void ns_set_horizontal_scroll_bar (struct window *window, int portion, int whole, int position) /* -------------------------------------------------------------------------- - External (hook): Update or add scrollbar + External (hook): Update or add scrollbar. -------------------------------------------------------------------------- */ { Lisp_Object win; @@ -4875,7 +4873,7 @@ ns_set_horizontal_scroll_bar (struct window *window, int window_x, window_width; BOOL update_p = YES; - /* optimization; display engine sends WAY too many of these.. */ + /* Optimization; display engine sends WAY too many of these. */ if (!NILP (window->horizontal_scroll_bar)) { bar = XNS_SCROLL_BAR (window->horizontal_scroll_bar); @@ -4902,7 +4900,7 @@ ns_set_horizontal_scroll_bar (struct window *window, top = WINDOW_SCROLL_BAR_AREA_Y (window); r = NSMakeRect (left, top, width, height); - /* the parent view is flipped, so we need to flip y value */ + /* The parent view is flipped, so we need to flip y value. */ v = [view frame]; r.origin.y = (v.size.height - r.size.height - r.origin.y); @@ -4934,7 +4932,7 @@ ns_set_horizontal_scroll_bar (struct window *window, /* If there are both horizontal and vertical scroll-bars they leave a square that belongs to neither. We need to clear it otherwise - it fills with junk. */ + it fills with junk. */ if (!NILP (window->vertical_scroll_bar)) ns_clear_frame_area (f, WINDOW_SCROLL_BAR_AREA_X (window), top, NS_SCROLL_BAR_HEIGHT (f), height); @@ -5057,7 +5055,7 @@ x_display_pixel_width (struct ns_display_info *dpyinfo) static Lisp_Object ns_string_to_lispmod (const char *s) /* -------------------------------------------------------------------------- - Convert modifier name to lisp symbol + Convert modifier name to lisp symbol. -------------------------------------------------------------------------- */ { if (!strncmp (SSDATA (SYMBOL_NAME (Qmeta)), s, 10)) @@ -5082,7 +5080,7 @@ ns_default (const char *parameter, Lisp_Object *result, Lisp_Object yesval, Lisp_Object noval, BOOL is_float, BOOL is_modstring) /* -------------------------------------------------------------------------- - Check a parameter value in user's preferences + Check a parameter value in user's preferences. -------------------------------------------------------------------------- */ { const char *value = ns_get_defaults_value (parameter); @@ -5123,7 +5121,7 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); dpyinfo->color_table->colors = NULL; - dpyinfo->root_window = 42; /* a placeholder.. */ + dpyinfo->root_window = 42; /* A placeholder. */ dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; dpyinfo->n_fonts = 0; dpyinfo->smallest_font_height = 1; @@ -5133,11 +5131,11 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) } -/* This and next define (many of the) public functions in this file. */ +/* This and next define (many of the) public functions in this file. */ /* x_... are generic versions in xdisp.c that we, and other terms, get away with using despite presence in the "system dependent" redisplay interface. In addition, many of the ns_ methods have code that is - shared with all terms, indicating need for further refactoring. */ + shared with all terms, indicating need for further refactoring. */ extern frame_parm_handler ns_frame_parm_handlers[]; static struct redisplay_interface ns_redisplay_interface = { @@ -5173,11 +5171,11 @@ static struct redisplay_interface ns_redisplay_interface = static void ns_delete_display (struct ns_display_info *dpyinfo) { - /* TODO... */ + /* TODO... */ } -/* This function is called when the last frame on a display is deleted. */ +/* This function is called when the last frame on a display is deleted. */ static void ns_delete_terminal (struct terminal *terminal) { @@ -5285,9 +5283,9 @@ ns_term_init (Lisp_Object display_name) ns_pending_service_names = [[NSMutableArray alloc] init]; ns_pending_service_args = [[NSMutableArray alloc] init]; -/* Start app and create the main menu, window, view. + /* Start app and create the main menu, window, view. Needs to be here because ns_initialize_display_info () uses AppKit classes. - The view will then ask the NSApp to stop and return to Emacs. */ + The view will then ask the NSApp to stop and return to Emacs. */ [EmacsApp sharedApplication]; if (NSApp == nil) return NULL; @@ -5377,7 +5375,7 @@ ns_term_init (Lisp_Object display_name) #ifdef NS_IMPL_GNUSTEP Vwindow_system_version = build_string (gnustep_base_version); #else - /*PSnextrelease (128, c); */ + /* PSnextrelease (128, c); */ char c[DBL_BUFSIZE_BOUND]; int len = dtoastr (c, sizeof c, 0, 0, NSAppKitVersionNumber); Vwindow_system_version = make_unibyte_string (c, len); @@ -5463,7 +5461,7 @@ ns_term_init (Lisp_Object display_name) #endif /* macOS menu setup */ /* Register our external input/output types, used for determining - applicable services and also drag/drop eligibility. */ + applicable services and also drag/drop eligibility. */ NSTRACE_MSG ("Input/output types"); @@ -5633,9 +5631,9 @@ ns_term_shutdown (int sig) NSString *fstr = represented_filename; NSView *view = FRAME_NS_VIEW (represented_frame); #ifdef NS_IMPL_COCOA - /* work around a bug observed on 10.3 and later where + /* Work around a bug observed on 10.3 and later where setTitleWithRepresentedFilename does not clear out previous state - if given filename does not exist */ + if given filename does not exist. */ if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr]) [[view window] setRepresentedFilename: @""]; #endif @@ -5673,7 +5671,7 @@ ns_term_shutdown (int sig) /* Events posted by ns_send_appdefined interrupt the run loop here. But, if a modal window is up, an appdefined can still come through, (e.g., from a makeKeyWindow event) but stopping self also stops the - modal loop. Just defer it until later. */ + modal loop. Just defer it until later. */ if ([NSApp modalWindow] == nil) { last_appdefined_event_data = [theEvent data1]; @@ -5738,7 +5736,7 @@ ns_term_shutdown (int sig) } -/* Open a file (used by below, after going into queue read by ns_read_socket) */ +/* Open a file (used by below, after going into queue read by ns_read_socket). */ - (BOOL) openFile: (NSString *)fileName { NSTRACE ("[EmacsApp openFile:]"); @@ -5768,7 +5766,7 @@ ns_term_shutdown (int sig) - (void)applicationDidFinishLaunching: (NSNotification *)notification /* -------------------------------------------------------------------------- - When application is loaded, terminate event loop in ns_term_init + When application is loaded, terminate event loop in ns_term_init. -------------------------------------------------------------------------- */ { NSTRACE ("[EmacsApp applicationDidFinishLaunching:]"); @@ -5791,7 +5789,7 @@ ns_term_shutdown (int sig) if ([NSApp activationPolicy] == NSApplicationActivationPolicyProhibited) { /* Set the app's activation policy to regular when we run outside of a bundle. This is already done for us by Info.plist when we - run inside a bundle. */ + run inside a bundle. */ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; [NSApp setApplicationIconImage: [EmacsImage @@ -5895,7 +5893,7 @@ not_in_argv (NSString *arg) return 1; } -/* Notification from the Workspace to open a file */ +/* Notification from the Workspace to open a file. */ - (BOOL)application: sender openFile: (NSString *)file { if (ns_do_open_file || not_in_argv (file)) @@ -5904,7 +5902,7 @@ not_in_argv (NSString *arg) } -/* Open a file as a temporary file */ +/* Open a file as a temporary file. */ - (BOOL)application: sender openTempFile: (NSString *)file { if (ns_do_open_file || not_in_argv (file)) @@ -5913,7 +5911,7 @@ not_in_argv (NSString *arg) } -/* Notification from the Workspace to open a file noninteractively (?) */ +/* Notification from the Workspace to open a file noninteractively (?). */ - (BOOL)application: sender openFileWithoutUI: (NSString *)file { if (ns_do_open_file || not_in_argv (file)) @@ -5921,7 +5919,7 @@ not_in_argv (NSString *arg) return YES; } -/* Notification from the Workspace to open multiple files */ +/* Notification from the Workspace to open multiple files. */ - (void)application: sender openFiles: (NSArray *)fileList { NSEnumerator *files = [fileList objectEnumerator]; @@ -5945,11 +5943,11 @@ not_in_argv (NSString *arg) } -/* TODO: these may help w/IO switching btwn terminal and NSApp */ +/* TODO: these may help w/IO switching between terminal and NSApp. */ - (void)applicationWillBecomeActive: (NSNotification *)notification { NSTRACE ("[EmacsApp applicationWillBecomeActive:]"); - //ns_app_active=YES; + // ns_app_active=YES; } - (void)applicationDidBecomeActive: (NSNotification *)notification @@ -5960,7 +5958,7 @@ not_in_argv (NSString *arg) if (! applicationDidFinishLaunchingCalled) [self applicationDidFinishLaunching:notification]; #endif - //ns_app_active=YES; + // ns_app_active=YES; ns_update_auto_hide_menu_bar (); // No constraining takes place when the application is not active. @@ -5970,7 +5968,7 @@ not_in_argv (NSString *arg) { NSTRACE ("[EmacsApp applicationDidResignActive:]"); - //ns_app_active=NO; + // ns_app_active=NO; ns_send_appdefined (-1); } @@ -5988,7 +5986,7 @@ not_in_argv (NSString *arg) The timeout specified to ns_select has passed. -------------------------------------------------------------------------- */ { - /*NSTRACE ("timeout_handler"); */ + /* NSTRACE ("timeout_handler"); */ ns_send_appdefined (-2); } @@ -5999,7 +5997,7 @@ not_in_argv (NSString *arg) - (void)fd_handler:(id)unused /* -------------------------------------------------------------------------- - Check data waiting on file descriptors and terminate if so + Check data waiting on file descriptors and terminate if so. -------------------------------------------------------------------------- */ { int result; @@ -6094,7 +6092,7 @@ not_in_argv (NSString *arg) ========================================================================== */ -/* called from system: queue for next pass through event loop */ +/* Called from system: queue for next pass through event loop. */ - (void)requestService: (NSPasteboard *)pboard userData: (NSString *)userData error: (NSString **)error @@ -6105,7 +6103,7 @@ not_in_argv (NSString *arg) } -/* called from ns_read_socket to clear queue */ +/* Called from ns_read_socket to clear queue. */ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg { struct frame *emacsframe = SELECTED_FRAME (); @@ -6139,7 +6137,7 @@ not_in_argv (NSString *arg) @implementation EmacsView -/* needed to inform when window closed from LISP */ +/* Needed to inform when window closed from lisp. */ - (void) setWindowClosing: (BOOL)closing { NSTRACE ("[EmacsView setWindowClosing:%d]", closing); @@ -6158,7 +6156,7 @@ not_in_argv (NSString *arg) } -/* called on font panel selection */ +/* Called on font panel selection. */ - (void)changeFont: (id)sender { NSEvent *e = [[self window] currentEvent]; @@ -6226,7 +6224,7 @@ not_in_argv (NSString *arg) /*****************************************************************************/ -/* Keyboard handling. */ +/* Keyboard handling. */ #define NS_KEYLOG 0 - (void)keyDown: (NSEvent *)theEvent @@ -6239,7 +6237,7 @@ not_in_argv (NSString *arg) NSTRACE ("[EmacsView keyDown:]"); - /* Rhapsody and macOS give up and down events for the arrow keys */ + /* Rhapsody and macOS give up and down events for the arrow keys. */ if (ns_fake_keydown == YES) ns_fake_keydown = NO; else if ([theEvent type] != NSEventTypeKeyDown) @@ -6250,7 +6248,7 @@ not_in_argv (NSString *arg) if (![[self window] isKeyWindow] && [[theEvent window] isKindOfClass: [EmacsWindow class]] - /* we must avoid an infinite loop here. */ + /* We must avoid an infinite loop here. */ && (EmacsView *)[[theEvent window] delegate] != self) { /* XXX: There is an occasional condition in which, when Emacs display @@ -6258,7 +6256,7 @@ not_in_argv (NSString *arg) selects it, then processes some interrupt-driven input (dispnew.c:3878), OS will send the event to the correct NSWindow, but for some reason that window has its first responder set to the NSView - most recently updated (I guess), which is not the correct one. */ + most recently updated (I guess), which is not the correct one. */ [(EmacsView *)[[theEvent window] delegate] keyDown: theEvent]; return; } @@ -6281,10 +6279,9 @@ not_in_argv (NSString *arg) code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; - /* is it a "function key"? */ + /* Is it a "function key"? */ /* Note: Sometimes a plain key will have the NSEventModifierFlagNumericPad - flag set (this is probably a bug in the OS). - */ + flag set (this is probably a bug in the OS). */ if (code < 0x00ff && (flags&NSEventModifierFlagNumericPad)) { fnKeysym = ns_convert_key ([theEvent keyCode] | NSEventModifierFlagNumericPad); @@ -6297,14 +6294,13 @@ not_in_argv (NSString *arg) if (fnKeysym) { /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', - because Emacs treats Delete and KP-Delete same (in simple.el). */ + because Emacs treats Delete and KP-Delete same (in simple.el). */ if ((fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) #ifdef NS_IMPL_GNUSTEP /* GNUstep uses incompatible keycodes, even for those that are supposed to be hardware independent. Just check for delete. Keypad delete does not have keysym 0xFFFF. - See https://savannah.gnu.org/bugs/?25395 - */ + See https://savannah.gnu.org/bugs/?25395 */ || (fnKeysym == 0xFFFF && code == 127) #endif ) @@ -6336,7 +6332,7 @@ not_in_argv (NSString *arg) hasn't. Also some combinations of fn and a function key return a different key than was pressed (e.g. fn- gives ). We need to unset the fn modifier in these cases. - FIXME: Can we avoid setting it in the first place. */ + FIXME: Can we avoid setting it in the first place? */ if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK)) emacs_event->modifiers ^= parse_solitary_modifier (ns_function_modifier); @@ -6412,12 +6408,12 @@ not_in_argv (NSString *arg) } -/* implementation (called through super interpretKeyEvents:]). */ +/* implementation (called through [super interpretKeyEvents:]). */ /* : called when done composing; - NOTE: also called when we delete over working text, followed immed. - by doCommandBySelector: deleteBackward: */ + NOTE: also called when we delete over working text, followed + immediately by doCommandBySelector: deleteBackward: */ - (void)insertText: (id)aString { NSString *s; @@ -6439,7 +6435,7 @@ not_in_argv (NSString *arg) if (!emacs_event) return; - /* first, clear any working text */ + /* First, clear any working text. */ if (workingText != nil) [self deleteWorkingText]; @@ -6448,7 +6444,7 @@ not_in_argv (NSString *arg) However, we probably can't use SAFE_NALLOCA here because it might exit nonlocally. */ - /* now insert the string as keystrokes */ + /* Now insert the string as keystrokes. */ for (NSUInteger i = 0; i < len; i++) { NSUInteger code = [s characterAtIndex:i]; @@ -6461,7 +6457,7 @@ not_in_argv (NSString *arg) ++i; } } - /* TODO: still need this? */ + /* TODO: still need this? */ if (code == 0x2DC) code = '~'; /* 0x7E */ if (code != 32) /* Space */ @@ -6474,7 +6470,7 @@ not_in_argv (NSString *arg) } -/* : inserts display of composing characters */ +/* : inserts display of composing characters. */ - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange { NSString *str = [aString respondsToSelector: @selector (string)] ? @@ -6506,7 +6502,7 @@ not_in_argv (NSString *arg) } -/* delete display of composing characters [not in ] */ +/* Delete display of composing characters [not in ]. */ - (void)deleteWorkingText { NSTRACE ("[EmacsView deleteWorkingText]"); @@ -6559,7 +6555,7 @@ not_in_argv (NSString *arg) } -/* used to position char selection windows, etc. */ +/* Used to position char selection windows, etc. */ - (NSRect)firstRectForCharacterRange: (NSRange)theRange { NSRect rect; @@ -6619,8 +6615,8 @@ not_in_argv (NSString *arg) processingCompose = NO; if (aSelector == @selector (deleteBackward:)) { - /* happens when user backspaces over an ongoing composition: - throw a 'delete' into the event queue */ + /* Happens when user backspaces over an ongoing composition: + throw a 'delete' into the event queue. */ if (!emacs_event) return; emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT; @@ -6665,7 +6661,7 @@ not_in_argv (NSString *arg) return str; } -/* End impl. */ +/* End implementation. */ /*****************************************************************************/ @@ -6683,8 +6679,8 @@ not_in_argv (NSString *arg) return; dpyinfo->last_mouse_frame = emacsframe; - /* appears to be needed to prevent spurious movement events generated on - button clicks */ + /* Appears to be needed to prevent spurious movement events generated on + button clicks. */ emacsframe->mouse_moved = 0; if ([theEvent type] == NSEventTypeScrollWheel) @@ -6803,7 +6799,8 @@ not_in_argv (NSString *arg) #if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070 { CGFloat delta = [theEvent deltaY]; - /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ + /* Mac notebooks send wheel events with delta equal to 0 + when trackpad scrolling. */ if (delta == 0) { delta = [theEvent deltaX]; @@ -6880,7 +6877,7 @@ not_in_argv (NSString *arg) } -/* Tell emacs the mouse has moved. */ +/* Tell emacs the mouse has moved. */ - (void)mouseMoved: (NSEvent *)e { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); @@ -6895,14 +6892,14 @@ not_in_argv (NSString *arg) dpyinfo->last_mouse_motion_x = pt.x; dpyinfo->last_mouse_motion_y = pt.y; - /* update any mouse face */ + /* Update any mouse face. */ if (hlinfo->mouse_face_hidden) { hlinfo->mouse_face_hidden = 0; clear_mouse_face (hlinfo); } - /* tooltip handling */ + /* Tooltip handling. */ previous_help_echo_string = help_echo_string; help_echo_string = Qnil; @@ -6937,7 +6934,7 @@ not_in_argv (NSString *arg) { /* NOTE: help_echo_{window,pos,object} are set in xdisp.c (note_mouse_highlight), which is called through the - note_mouse_movement () call above */ + note_mouse_movement () call above. */ any_help_event_p = YES; gen_help_event (help_echo_string, frame, help_echo_window, help_echo_object, help_echo_pos); @@ -7021,7 +7018,7 @@ not_in_argv (NSString *arg) if (wait_for_tool_bar) { /* The toolbar height is always 0 in fullscreen and undecorated - frames, so don't wait for it to become available. */ + frames, so don't wait for it to become available. */ if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0 && FRAME_UNDECORATED (emacsframe) == false && ! [self isFullscreen]) @@ -7069,7 +7066,7 @@ not_in_argv (NSString *arg) wr = NSMakeRect (0, 0, neww, newh); [view setFrame: wr]; - // to do: consider using [NSNotificationCenter postNotificationName:]. + // To do: consider using [NSNotificationCenter postNotificationName:]. [self windowDidMove: // Update top/left. [NSNotification notificationWithName:NSWindowDidMoveNotification object:[view window]]]; @@ -7081,7 +7078,7 @@ not_in_argv (NSString *arg) } - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize -/* normalize frame to gridded text size */ +/* Normalize frame to gridded text size. */ { int extra = 0; @@ -7123,7 +7120,7 @@ not_in_argv (NSString *arg) rows = MINHEIGHT; #ifdef NS_IMPL_COCOA { - /* this sets window title to have size in it; the wm does this under GS */ + /* This sets window title to have size in it; the wm does this under GS. */ NSRect r = [[self window] frame]; if (r.size.height == frameSize.height && r.size.width == frameSize.width) { @@ -7157,12 +7154,12 @@ not_in_argv (NSString *arg) NSTRACE_MSG ("cols: %d rows: %d", cols, rows); - /* Restrict the new size to the text gird. + /* Restrict the new size to the text grid. Don't restrict the width if the user only adjusted the height, and vice versa. (Without this, the frame would shrink, and move slightly, if the window was resized by dragging one of its - borders.) */ + borders.) */ if (!frame_resize_pixelwise) { NSRect r = [[self window] frame]; @@ -7214,8 +7211,8 @@ not_in_argv (NSString *arg) NSWindow *theWindow = [notification object]; /* In GNUstep, at least currently, it's possible to get a didResize - without getting a willResize.. therefore we need to act as if we got - the willResize now */ + without getting a willResize, therefore we need to act as if we got + the willResize now. */ NSSize sz = [theWindow frame].size; sz = [self windowWillResize: theWindow toSize: sz]; #endif /* NS_IMPL_GNUSTEP */ @@ -7286,7 +7283,7 @@ not_in_argv (NSString *arg) ns_frame_rehighlight (emacsframe); /* FIXME: for some reason needed on second and subsequent clicks away - from sole-frame Emacs to get hollow box to show */ + from sole-frame Emacs to get hollow box to show. */ if (!windowClosing && [[self window] isVisible] == YES) { x_update_cursor (emacsframe, 1); @@ -7518,7 +7515,7 @@ not_in_argv (NSString *arg) /* macOS Sierra automatically enables tabbed windows. We can't allow this to be enabled until it's available on a Free system. - Currently it only happens by accident and is buggy anyway. */ + Currently it only happens by accident and is buggy anyway. */ #if defined (NS_IMPL_COCOA) \ && MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 @@ -7560,7 +7557,7 @@ not_in_argv (NSString *arg) /* Called AFTER method below, but before our windowWillResize call there leads to windowDidResize -> x_set_window_size. Update emacs' notion of frame - location so set_window_size moves the frame. */ + location so set_window_size moves the frame. */ - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame { NSTRACE (("[EmacsView windowShouldZoom:toFrame:" NSTRACE_FMT_RECT "]" @@ -7574,7 +7571,7 @@ not_in_argv (NSString *arg) /* Override to do something slightly nonstandard, but nice. First click on zoom button will zoom vertically. Second will zoom completely. Third - returns to original. */ + returns to original. */ - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender defaultFrame:(NSRect)defaultFrame { @@ -7655,7 +7652,7 @@ not_in_argv (NSString *arg) { NSTRACE_MSG ("FULLSCREEN_MAXIMIZED"); - result = defaultFrame; /* second click */ + result = defaultFrame; /* second click */ maximized_width = result.size.width; maximized_height = result.size.height; [self setFSValue: FULLSCREEN_MAXIMIZED]; @@ -7936,7 +7933,7 @@ not_in_argv (NSString *arg) NSScreen *screen = [w screen]; #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 - /* Hide ghost menu bar on secondary monitor? */ + /* Hide ghost menu bar on secondary monitor? */ if (! onFirstScreen #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 && [NSScreen respondsToSelector: @selector(screensHaveSeparateSpaces)] @@ -8015,7 +8012,8 @@ not_in_argv (NSString *arg) f->border_width = bwidth; - // to do: consider using [NSNotificationCenter postNotificationName:] to send notifications. + // To do: consider using [NSNotificationCenter postNotificationName:] to + // send notifications. [self windowWillExitFullScreen]; [fw setFrame: [w frame] display:YES animate:ns_use_fullscreen_animation]; @@ -8155,7 +8153,7 @@ not_in_argv (NSString *arg) } -/* this gets called on toolbar button click */ +/* This gets called on toolbar button click. */ - (instancetype)toolbarClicked: (id)item { NSEvent *theEvent; @@ -8166,14 +8164,14 @@ not_in_argv (NSString *arg) if (!emacs_event) return self; - /* send first event (for some reason two needed) */ + /* Send first event (for some reason two needed). */ theEvent = [[self window] currentEvent]; emacs_event->kind = TOOL_BAR_EVENT; XSETFRAME (emacs_event->arg, emacsframe); EV_TRAILER (theEvent); emacs_event->kind = TOOL_BAR_EVENT; -/* XSETINT (emacs_event->code, 0); */ + /* XSETINT (emacs_event->code, 0); */ emacs_event->arg = AREF (emacsframe->tool_bar_items, idx + TOOL_BAR_ITEM_KEY); emacs_event->modifiers = EV_MODIFIERS (theEvent); @@ -8365,13 +8363,13 @@ not_in_argv (NSString *arg) But this should not happen because we override the services menu with our own entries which call ns-perform-service. Nonetheless, it appeared to happen (under strange circumstances): bug#1435. - So let's at least stub them out until further investigation can be done. */ + So let's at least stub them out until further investigation can be done. */ - (BOOL) readSelectionFromPasteboard: (NSPasteboard *)pb { - /* we could call ns_string_from_pasteboard(pboard) here but then it should - be written into the buffer in place of the existing selection.. - ordinary service calls go through functions defined in ns-win.el */ + /* We could call ns_string_from_pasteboard(pboard) here but then it should + be written into the buffer in place of the existing selection. + Ordinary service calls go through functions defined in ns-win.el. */ return NO; } @@ -8382,7 +8380,7 @@ not_in_argv (NSString *arg) NSTRACE ("[EmacsView writeSelectionToPasteboard:types:]"); - /* We only support NSStringPboardType */ + /* We only support NSStringPboardType. */ if ([types containsObject:NSStringPboardType] == NO) { return NO; } @@ -8404,10 +8402,10 @@ not_in_argv (NSString *arg) } -/* setMini =YES means set from internal (gives a finder icon), NO means set nil +/* setMini = YES means set from internal (gives a finder icon), NO means set nil (gives a miniaturized version of the window); currently we use the latter for frames whose active buffer doesn't correspond to any file - (e.g., '*scratch*') */ + (e.g., '*scratch*'). */ - (instancetype)setMiniwindowImage: (BOOL) setMini { id image = [[self window] miniwindowImage]; @@ -8415,7 +8413,7 @@ not_in_argv (NSString *arg) /* NOTE: under Cocoa miniwindowImage always returns nil, documentation about "AppleDockIconEnabled" notwithstanding, however the set message - below has its effect nonetheless. */ + below has its effect nonetheless. */ if (image != emacsframe->output_data.ns->miniimage) { if (image && [image isKindOfClass: [EmacsImage class]]) @@ -8526,7 +8524,7 @@ not_in_argv (NSString *arg) Note that this should work in situations where multiple monitors are present. Common configurations are side-by-side monitors and a monitor on top of another (e.g. when a laptop is placed under a - large screen). */ + large screen). */ - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen { NSTRACE ("[EmacsWindow constrainFrameRect:" NSTRACE_FMT_RECT " toScreen:]", @@ -8753,7 +8751,7 @@ not_in_argv (NSString *arg) + (CGFloat) scrollerWidth { /* TODO: if we want to allow variable widths, this is the place to do it, - however neither GNUstep nor Cocoa support it very well */ + however neither GNUstep nor Cocoa support it very well. */ CGFloat r; #if defined (NS_IMPL_COCOA) \ && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 @@ -8789,7 +8787,7 @@ not_in_argv (NSString *arg) /* Ensure auto resizing of scrollbars occurs within the emacs frame's view locked against the top and bottom edges, and right edge on macOS, where - scrollers are on right. */ + scrollers are on right. */ #ifdef NS_IMPL_GNUSTEP [self setAutoresizingMask: NSViewMaxXMargin | NSViewHeightSizable]; #else @@ -8813,7 +8811,7 @@ not_in_argv (NSString *arg) NSView *sview = [[view window] contentView]; NSArray *subs = [sview subviews]; - /* disable optimization stopping redraw of other scrollbars */ + /* Disable optimization stopping redraw of other scrollbars. */ view->scrollbarsNeedingUpdate = 0; for (i =[subs count]-1; i >= 0; i--) if ([[subs objectAtIndex: i] isKindOfClass: [EmacsScroller class]]) @@ -8821,7 +8819,7 @@ not_in_argv (NSString *arg) [sview addSubview: self]; } -/* [self setFrame: r]; */ + /* [self setFrame: r]; */ return self; } @@ -8831,7 +8829,7 @@ not_in_argv (NSString *arg) { NSTRACE ("[EmacsScroller setFrame:]"); -/* block_input (); */ + /* block_input (); */ if (horizontal) pixel_length = NSWidth (newRect); else @@ -8839,7 +8837,7 @@ not_in_argv (NSString *arg) if (pixel_length == 0) pixel_length = 1; min_portion = 20 / pixel_length; [super setFrame: newRect]; -/* unblock_input (); */ + /* unblock_input (); */ } @@ -8882,7 +8880,7 @@ not_in_argv (NSString *arg) { EmacsView *view; block_input (); - /* ensure other scrollbar updates after deletion */ + /* Ensure other scrollbar updates after deletion. */ view = (EmacsView *)FRAME_NS_VIEW (frame); if (view != nil) view->scrollbarsNeedingUpdate++; @@ -8924,7 +8922,7 @@ not_in_argv (NSString *arg) whole: (int) whole { return em_position ==position && em_portion ==portion && em_whole ==whole - && portion != whole; /* needed for resize empty buf */ + && portion != whole; /* Needed for resizing empty buffer. */ } @@ -8963,7 +8961,7 @@ not_in_argv (NSString *arg) return self; } -/* set up emacs_event */ +/* Set up emacs_event. */ - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e { Lisp_Object win; @@ -9006,7 +9004,8 @@ not_in_argv (NSString *arg) } -/* called manually thru timer to implement repeated button action w/hold-down */ +/* Called manually through timer to implement repeated button action + with hold-down. */ - (instancetype)repeatScroll: (NSTimer *)scrollEntry { NSEvent *e = [[self window] currentEvent]; @@ -9015,7 +9014,7 @@ not_in_argv (NSString *arg) NSTRACE ("[EmacsScroller repeatScroll:]"); - /* clear timer if need be */ + /* Clear timer if need be. */ if (inKnob || [scroll_repeat_entry timeInterval] == SCROLL_BAR_FIRST_DELAY) { [scroll_repeat_entry invalidate]; @@ -9041,11 +9040,11 @@ not_in_argv (NSString *arg) /* Asynchronous mouse tracking for scroller. This allows us to dispatch - mouseDragged events without going into a modal loop. */ + mouseDragged events without going into a modal loop. */ - (void)mouseDown: (NSEvent *)e { NSRect sr, kr; - /* hitPart is only updated AFTER event is passed on */ + /* hitPart is only updated AFTER event is passed on. */ NSScrollerPart part = [self testPart: [e locationInWindow]]; CGFloat loc, kloc, pos UNINIT; int edge = 0; @@ -9144,9 +9143,9 @@ not_in_argv (NSString *arg) } else { - pos = 0; /* ignored */ + pos = 0; /* ignored */ - /* set a timer to repeat, as we can't let superclass do this modally */ + /* Set a timer to repeat, as we can't let superclass do this modally. */ scroll_repeat_entry = [[NSTimer scheduledTimerWithTimeInterval: SCROLL_BAR_FIRST_DELAY target: self @@ -9161,7 +9160,7 @@ not_in_argv (NSString *arg) } -/* Called as we manually track scroller drags, rather than superclass. */ +/* Called as we manually track scroller drags, rather than superclass. */ - (void)mouseDragged: (NSEvent *)e { NSRect sr; @@ -9219,7 +9218,7 @@ not_in_argv (NSString *arg) } -/* treat scrollwheel events in the bar as though they were in the main window */ +/* Treat scrollwheel events in the bar as though they were in the main window. */ - (void) scrollWheel: (NSEvent *)theEvent { NSTRACE ("[EmacsScroller scrollWheel:]"); @@ -9307,7 +9306,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) /* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */ /* Note: ns_font_to_xlfd and ns_fontname_to_xlfd no longer needed, removed - in 1.43. */ + in 1.43. */ const char * ns_xlfd_to_fontname (const char *xlfd) @@ -9348,7 +9347,7 @@ ns_xlfd_to_fontname (const char *xlfd) name[i+1] = c_toupper (name[i+1]); } } -/*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */ + /* fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */ ret = [[NSString stringWithUTF8String: name] UTF8String]; xfree (name); return ret; @@ -9362,7 +9361,7 @@ syms_of_nsterm (void) ns_antialias_threshold = 10.0; - /* from 23+ we need to tell emacs what modifiers there are.. */ + /* From 23+ we need to tell emacs what modifiers there are. */ DEFSYM (Qmodifier_value, "modifier-value"); DEFSYM (Qalt, "alt"); DEFSYM (Qhyper, "hyper"); @@ -9477,11 +9476,11 @@ allowing it to be used at a lower level for accented character entry."); DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near. -Only works on Mac OS X 10.6 or later. */); +Only works on Mac OS X. */); ns_auto_hide_menu_bar = Qnil; DEFVAR_BOOL ("ns-use-native-fullscreen", ns_use_native_fullscreen, - doc: /*Non-nil means to use native fullscreen on Mac OS X 10.7 and later. + doc: /* Non-nil means to use native fullscreen on Mac OS X 10.7 and later. Nil means use fullscreen the old (< 10.7) way. The old way works better with multiple monitors, but lacks tool bar. This variable is ignored on Mac OS X < 10.7. Default is t. */); @@ -9489,35 +9488,35 @@ Mac OS X < 10.7. Default is t. */); ns_last_use_native_fullscreen = ns_use_native_fullscreen; DEFVAR_BOOL ("ns-use-fullscreen-animation", ns_use_fullscreen_animation, - doc: /*Non-nil means use animation on non-native fullscreen. + doc: /* Non-nil means use animation on non-native fullscreen. For native fullscreen, this does nothing. Default is nil. */); ns_use_fullscreen_animation = NO; DEFVAR_BOOL ("ns-use-srgb-colorspace", ns_use_srgb_colorspace, - doc: /*Non-nil means to use sRGB colorspace on Mac OS X 10.7 and later. + doc: /* Non-nil means to use sRGB colorspace on Mac OS X 10.7 and later. Note that this does not apply to images. This variable is ignored on Mac OS X < 10.7 and GNUstep. */); ns_use_srgb_colorspace = YES; DEFVAR_BOOL ("ns-use-mwheel-acceleration", ns_use_mwheel_acceleration, - doc: /*Non-nil means use macOS's standard mouse wheel acceleration. + doc: /* Non-nil means use macOS's standard mouse wheel acceleration. This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); ns_use_mwheel_acceleration = YES; DEFVAR_LISP ("ns-mwheel-line-height", ns_mwheel_line_height, - doc: /*The number of pixels touchpad scrolling considers one line. + doc: /* The number of pixels touchpad scrolling considers one line. Nil or a non-number means use the default frame line height. This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. */); ns_mwheel_line_height = Qnil; DEFVAR_BOOL ("ns-use-mwheel-momentum", ns_use_mwheel_momentum, - doc: /*Non-nil means mouse wheel scrolling uses momentum. + doc: /* Non-nil means mouse wheel scrolling uses momentum. This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); ns_use_mwheel_momentum = YES; - /* TODO: move to common code */ + /* TODO: Move to common code. */ DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, doc: /* SKIP: real doc in xterm.c. */); Vx_toolkit_scroll_bars = Qt;