summaryrefslogtreecommitdiff
path: root/src/nsterm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nsterm.h')
-rw-r--r--src/nsterm.h121
1 files changed, 64 insertions, 57 deletions
diff --git a/src/nsterm.h b/src/nsterm.h
index 35dd9b3c3b6..089cbccbf0c 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -29,7 +29,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
/* 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;
@@ -585,6 +585,8 @@ typedef id instancetype;
}
- (instancetype) init;
- (void) setText: (char *)text;
+- (void) setBackgroundColor: (NSColor *)col;
+- (void) setForegroundColor: (NSColor *)col;
- (void) showAtX: (int)x Y: (int)y for: (int)seconds;
- (void) hide;
- (BOOL) isActive;
@@ -646,6 +648,8 @@ typedef id instancetype;
- (NSColor *)stippleMask;
- (Lisp_Object)getMetadata;
- (BOOL)setFrame: (unsigned int) index;
+- (void)setSizeFromSpec: (Lisp_Object) spec;
+- (instancetype)rotate: (double)rotation;
@end
@@ -718,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;
@@ -748,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__
@@ -762,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;
@@ -786,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)
@@ -798,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;
@@ -819,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. */
@@ -868,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
@@ -927,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;
@@ -965,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. */
@@ -977,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;
@@ -1015,12 +1019,12 @@ struct x_output
#define FRAME_FONT(f) ((f)->output_data.ns->font)
#ifdef __OBJC__
-#define XNS_SCROLL_BAR(vec) ((id) XSAVE_POINTER (vec, 0))
+#define XNS_SCROLL_BAR(vec) ((id) xmint_pointer (vec))
#else
-#define XNS_SCROLL_BAR(vec) XSAVE_POINTER (vec, 0)
+#define XNS_SCROLL_BAR(vec) xmint_pointer (vec)
#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 \
@@ -1029,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) ? \
@@ -1039,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 \
@@ -1047,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 \
@@ -1055,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)
@@ -1090,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))
@@ -1114,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);
@@ -1156,6 +1160,9 @@ extern void ns_release_autorelease_pool (void *);
extern const char *ns_get_defaults_value (const char *key);
extern void ns_init_locale (void);
+#ifdef NS_IMPL_COCOA
+extern void ns_enable_screen_updates (void);
+#endif
/* in nsmenu */
extern void update_frame_tool_bar (struct frame *f);
@@ -1230,12 +1237,6 @@ struct input_event;
extern void ns_init_events (struct input_event *);
extern void ns_finish_events (void);
-#ifdef __OBJC__
-/* Needed in nsfns.m. */
-extern void
-ns_set_represented_filename (NSString *fstr, struct frame *f);
-
-#endif
#ifdef NS_IMPL_GNUSTEP
extern char gnustep_base_version[]; /* version tracking */
@@ -1244,13 +1245,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
@@ -1260,7 +1261,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)
@@ -1269,7 +1270,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
@@ -1306,18 +1307,24 @@ extern char gnustep_base_version[]; /* version tracking */
#define NSWindowStyleMaskUtilityWindow NSUtilityWindowMask
#define NSAlertStyleCritical NSCriticalAlertStyle
#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,
NSWindowTabbingModePreferred,
NSWindowTabbingModeDisallowed
};
+#endif /* !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12) */
+
+#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_13)
+/* Deprecated in macOS 10.13. */
+#define NSPasteboardNameGeneral NSGeneralPboard
#endif
#endif /* HAVE_NS */