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🪟, 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.
This commit is contained in:
Charles A. Roelli 2018-03-19 20:16:19 +01:00
parent 6d2e8fdd10
commit 7ff62ed221
9 changed files with 472 additions and 471 deletions

View file

@ -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 ()

View file

@ -27,7 +27,7 @@ Updated by Christian Limpach (chris@nice.ch)
*/
/* 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 <config.h>
#include <math.h>
@ -54,7 +54,7 @@ Updated by Christian Limpach (chris@nice.ch)
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 @@ Updated by Christian Limpach (chris@nice.ch)
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 @@ Updated by Christian Limpach (chris@nice.ch)
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
/* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
}
/* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
#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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
/* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
"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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
/* 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 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
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 @@ Frames are listed from topmost (first) to bottommost (last). */)
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 @@ Frames are listed from topmost (first) to bottommost (last). */)
(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 @@ Frames are listed from topmost (first) to bottommost (last). */)
(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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
[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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
/* 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 @@ and GNUstep implementations ("distributor-specific release
- 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 @@ and GNUstep implementations ("distributor-specific release
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 @@ and GNUstep implementations ("distributor-specific release
*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 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are
{
#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 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are
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 @@ The position is returned as a cons cell (X . Y) of the
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 @@ The position is returned as a cons cell (X . Y) of the
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

View file

@ -21,7 +21,7 @@
*/
/* 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 <config.h>
#include "lisp.h"
@ -37,7 +37,7 @@
#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 <AppKit/NSFontDescriptor.h>
#endif
@ -45,7 +45,7 @@
#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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
}
/* 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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
}
/* 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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
/* 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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
/* 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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
}
/* 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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
}
/* Default font entity. */
/* Default font entity. */
static Lisp_Object
ns_fallback_entity (void)
{
@ -229,7 +229,7 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
}
/* 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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
/* 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 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
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 @@ seems to be limited for now (2009/05) to ja, zh, and ko. */
/* 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 @@ seems to be limited for now (2009/05) to ja, zh, and ko. */
}
/* Convert a font registry, such as */
/* Convert a font registry. */
static NSString
*ns_registry_to_script (char *reg)
{
@ -368,14 +368,14 @@ seems to be limited for now (2009/05) to ja, zh, and ko. */
/* 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 @@ seems to be limited for now (2009/05) to ja, zh, and ko. */
}
}
/* 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 @@ but also for ascii (which causes unnecessary font substitution). */
/* 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 @@ but also for ascii (which causes unnecessary font substitution). */
/* 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 @@ but also for ascii (which causes unnecessary font substitution). */
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 @@ but also for ascii (which causes unnecessary font substitution). */
{
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 @@ but also for ascii (which causes unnecessary font substitution). */
/* 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 @@ but also for ascii (which causes unnecessary font substitution). */
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 @@ but also for ascii (which causes unnecessary font substitution). */
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 @@ The returned entities should have type set (to 'ns), plus the following:
/* 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 @@ Properties to be considered are same as for list(). */
/* 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 @@ Properties to be considered are same as for list(). */
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 @@ Properties to be considered are same as for list(). */
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 @@ when setting family in ns_spec_to_descriptor(). */
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 @@ when setting family in ns_spec_to_descriptor(). */
* -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 @@ when setting family in ns_spec_to_descriptor(). */
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 @@ when setting family in ns_spec_to_descriptor(). */
/* 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 @@ when setting family in ns_spec_to_descriptor(). */
}
/* Close FONT. */
/* Close FONT. */
static void
nsfont_close (struct font *font)
{
@ -911,7 +911,7 @@ when setting family in ns_spec_to_descriptor(). */
/* 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 @@ when setting family in ns_spec_to_descriptor(). */
/* 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 @@ when setting family in ns_spec_to_descriptor(). */
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 @@ when setting family in ns_spec_to_descriptor(). */
/* 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 @@ when setting family in ns_spec_to_descriptor(). */
/* 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 @@ is false when (FROM > 0 || TO < S->nchars). */
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 @@ is false when (FROM > 0 || TO < S->nchars). */
/* 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 @@ is false when (FROM > 0 || TO < S->nchars). */
}
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 @@ is false when (FROM > 0 || TO < S->nchars). */
*c = 0;
}
/* fill background if requested */
/* Fill background if requested. */
if (with_background && !isComposite)
{
NSRect br = r;
@ -1119,7 +1119,7 @@ is false when (FROM > 0 || TO < S->nchars). */
}
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 @@ is false when (FROM > 0 || TO < S->nchars). */
========================================================================== */
/* 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 @@ is false when (FROM > 0 || TO < S->nchars). */
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 @@ is false when (FROM > 0 || TO < S->nchars). */
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 @@ is false when (FROM > 0 || TO < S->nchars). */
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 @@ is false when (FROM > 0 || TO < S->nchars). */
/* 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 @@ is false when (FROM > 0 || TO < S->nchars). */
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 @@ - (void)setIntAttribute: (NSInteger)attributeTag value: (NSInteger)val
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;
}

View file

@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#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

View file

@ -26,7 +26,7 @@ Updated by Christian Limpach (chris@nice.ch)
*/
/* 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 <config.h>
#include "lisp.h"
@ -41,7 +41,7 @@ Updated by Christian Limpach (chris@nice.ch)
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 @@ - (void)dealloc
/* 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 @@ - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
}
{
/* 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 @@ - (instancetype)initForXPMWithDepth: (int)depth width: (int)width height: (int)h
}
/* 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 @@ - (void) setPixmapData
}
/* 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 @@ - (void) setAlphaAtX: (int) x Y: (int) y to: (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 @@ - (NSColor *)stippleMask
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 @@ - (NSBitmapImageRep *)getAnimatedBitmapImageRep
}
/* 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 @@ - (Lisp_Object)getMetadata
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 @@ - (BOOL)setFrame: (unsigned int) index
{
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 @@ - (BOOL)setFrame: (unsigned int) index
}
/* Setting the frame has succeeded, or the image doesn't have
multiple frames. */
multiple frames. */
return YES;
}

View file

@ -22,7 +22,7 @@
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 <config.h>
#include "lisp.h"
@ -47,7 +47,7 @@
#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 @@
/* NOTE: toolbar implementation is at end,
following complete menu implementation. */
following complete menu implementation. */
/* ==========================================================================
@ -74,7 +74,7 @@
/* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
break;
if (i == previous_menu_items_used)
{
/* No change.. */
/* No change. */
#if NSMENUPROFILE
ftime (&tb);
@ -302,16 +302,16 @@
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 @@
}
/* 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 @@
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 @@
}
/* 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 @@
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 @@
/* 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 @@
/* 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 @@ - (void)menuDidClose:(NSMenu *)menu
#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 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
[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 @@ - (void)fillWithWidgetValue: (void *)wvptr frame: (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 @@ - (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame
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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (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 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (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 @@ - (void) addDisplayItemWithImage: (EmacsImage *)img
}
/* 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 @@ - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar
{
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 @@ - (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
{
NSTRACE ("[EmacsToolbar toolbarDefaultItemIdentifiers:]");
/* return entire set.. */
/* Return entire set. */
return activeIdentifiers;
}
@ -1284,7 +1284,7 @@ - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
{
NSTRACE ("[EmacsToolbar toolbarAllowedItemIdentifiers:]");
/* return entire set... */
/* return entire set... */
return activeIdentifiers;
//return [identifierToItem allKeys];
}
@ -1313,7 +1313,7 @@ - (void)setVisible:(BOOL)shown
========================================================================== */
/* Needed because NeXTstep does not provide enough control over tooltip
display. */
display. */
@implementation EmacsTooltip
- (instancetype)init
@ -1323,7 +1323,7 @@ - (instancetype)init
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 @@ - (instancetype)init
[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 @@ - (instancetype)initWithContentRect: (NSRect)contentRect styleMask: (NSWindowSty
[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 @@ - (instancetype)initWithContentRect: (NSRect)contentRect styleMask: (NSWindowSty
[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 @@ - (instancetype)initFromContents: (Lisp_Object)contents isQuestion: (BOOL)isQ
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 @@ - (void)timeout_handler: (NSTimer *)timedEntry
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 @@ - (Lisp_Object)runDialogAt: (NSPoint)p
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 @@ - (Lisp_Object)runDialogAt: (NSPoint)p
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;

View file

@ -36,7 +36,7 @@ Updated by Christian Limpach (chris@nice.ch)
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;

View file

@ -29,7 +29,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
/* 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,

File diff suppressed because it is too large Load diff