diff options
Diffstat (limited to 'src/nsterm.h')
| -rw-r--r-- | src/nsterm.h | 449 |
1 files changed, 351 insertions, 98 deletions
diff --git a/src/nsterm.h b/src/nsterm.h index c34067991f6..3fb8cfc9cd8 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1,5 +1,5 @@ /* Definitions and headers for communication with NeXT/Open/GNUstep API. - Copyright (C) 1989, 1993, 2005, 2008-2013 Free Software Foundation, + Copyright (C) 1989, 1993, 2005, 2008-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -27,12 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_NS #ifdef NS_IMPL_COCOA -#ifndef MAC_OS_X_VERSION_10_4 -#define MAC_OS_X_VERSION_10_4 1040 -#endif -#ifndef MAC_OS_X_VERSION_10_5 -#define MAC_OS_X_VERSION_10_5 1050 -#endif #ifndef MAC_OS_X_VERSION_10_6 #define MAC_OS_X_VERSION_10_6 1060 #endif @@ -42,6 +36,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MAC_OS_X_VERSION_10_8 #define MAC_OS_X_VERSION_10_8 1080 #endif +#ifndef MAC_OS_X_VERSION_10_9 +#define MAC_OS_X_VERSION_10_9 1090 +#endif #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 #define HAVE_NATIVE_FS @@ -51,25 +48,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef __OBJC__ -/* CGFloat on GNUStep may be 4 or 8 byte, but functions expect float* for some +/* 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. */ #ifdef NS_IMPL_COCOA - -#ifndef NS_HAVE_NSINTEGER -#if defined (__LP64__) && __LP64__ -typedef double CGFloat; -typedef long NSInteger; -typedef unsigned long NSUInteger; -#else -typedef float CGFloat; -typedef int NSInteger; -typedef unsigned int NSUInteger; -#endif /* not LP64 */ -#endif /* not NS_HAVE_NSINTEGER */ - typedef CGFloat EmacsCGFloat; - #elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22 typedef CGFloat EmacsCGFloat; #else @@ -78,6 +61,255 @@ typedef float EmacsCGFloat; /* ========================================================================== + Trace support + + ========================================================================== */ + +/* Uncomment the following line to enable trace. + + Hint: keep the trailing whitespace -- the version control system + will reject accidental commits. */ + +/* #define NSTRACE_ENABLED 1 */ + + +/* Print a call tree containing all annotated functions. + + The call structure of the functions is represented using + indentation and vertical lines. Extra information is printed using + horizontal lines that connect to the vertical line. + + The return value is represented using the arrow "->>". For simple + functions, the arrow can be printed on the same line as the + function name. If more output is printed, it is connected to the + vertical line of the function. + + The first column contains the file name, the second the line + number, and the third a number increasing for each trace line. + + Note that the trace system, when enabled, use the GCC/Clang + "cleanup" extension. + + For example (long lines manually split to reduce width): + +nsterm.m : 1600: [ 4428] ns_fullscreen_hook +nsterm.m : 7006: [ 4429] | handleFS +nsterm.m : 7035: [ 4430] | +--- FULLSCREEN_MAXIMIZED +nsterm.m : 7627: [ 4431] | | performZoom +nsterm.m : 7636: [ 4432] | | | zoom +nsterm.m : 874: [ 4433] | | | | ns_update_auto_hide_menu_bar +nsterm.m : 6615: [ 4434] | | | | [windowWillUseStandardFrame: + defaultFrame:(X:0 Y:0)/(W:1600 H:1177)] +nsterm.m : 99: [ 4435] | | | | +--- fs_state: FULLSCREEN_NONE +nsterm.m : 119: [ 4436] | | | | +--- fs_before_fs: -1 +nsterm.m : 115: [ 4437] | | | | +--- next_maximized: FULLSCREEN_MAXIMIZED +nsterm.m : 6619: [ 4438] | | | | +--- ns_userRect: (X:0 Y:0)/(W:0 H:0) +nsterm.m : 6620: [ 4439] | | | | +--- [sender frame]: + (X:0 Y:626)/(W:595 H:551) +nsterm.m : 6644: [ 4440] | | | | +--- ns_userRect (2): + (X:0 Y:626)/(W:595 H:551) +nsterm.m : 6684: [ 4441] | | | | +--- FULLSCREEN_MAXIMIZED +nsterm.m : 7057: [ 4442] | | | | | setFSValue +nsterm.m : 115: [ 4443] | | | | | +--- value: FULLSCREEN_MAXIMIZED +nsterm.m : 6711: [ 4444] | | | | +--- Final ns_userRect: + (X:0 Y:626)/(W:595 H:551) +nsterm.m : 6712: [ 4445] | | | | +--- Final maximized_width: 1600 +nsterm.m : 6713: [ 4446] | | | | +--- Final maximized_height: 1177 +nsterm.m : 119: [ 4447] | | | | +--- Final next_maximized: -1 +nsterm.m : 6209: [ 4448] | | | | | windowWillResize: toSize: (W:1600 H:1177) +nsterm.m : 6210: [ 4449] | | | | | +--- [sender frame]: + (X:0 Y:626)/(W:595 H:551) +nsterm.m : 115: [ 4450] | | | | | +--- fs_state: FULLSCREEN_MAXIMIZED +nsterm.m : 6274: [ 4451] | | | | | +--- cols: 223 rows: 79 +nsterm.m : 6299: [ 4452] | | | | | +->> (W:1596 H:1167) +nsterm.m : 6718: [ 4453] | | | | +->> (X:0 Y:0)/(W:1600 H:1177) + + Here, "ns_fullscreen_hook" calls "handleFS", which is turn calls + "performZoom". This function calls "[super performZoom]", which + isn't annoted (so it doesn't show up in the trace). However, it + calls "zoom" which is annotated so it is part of the call trace. + Later, the method "windowWillUseStandardFrame" and the function + "setFSValue" are called. The lines with "+---" contain extra + information and lines containing "->>" represent return values. */ + +#ifndef NSTRACE_ENABLED +#define NSTRACE_ENABLED 0 +#endif + +#if NSTRACE_ENABLED +extern int nstrace_num; +extern int nstrace_depth; + +void nstrace_leave(int *); + +/* printf-style trace output. Output is aligned with contained heading. */ +#define NSTRACE_MSG_NO_DASHES(...) \ + do \ + { \ + if (nstrace_enabled) \ + { \ + fprintf (stderr, "%-10s:%5d: [%5d]%.*s", \ + __FILE__, __LINE__, ++nstrace_num, \ + 2*nstrace_depth, " | | | | | | | | | | | | | | | .."); \ + fprintf (stderr, __VA_ARGS__); \ + fprintf (stderr, "\n"); \ + } \ + } \ + while(0) + +#define NSTRACE_MSG(...) NSTRACE_MSG_NO_DASHES("+--- " __VA_ARGS__) + + + +/* Macros for printing complex types. + + NSTRACE_FMT_what -- Printf format string 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 + +#define NSTRACE_FMT_POINT "(X:%.0f Y:%.0f)" +#define NSTRACE_ARG_POINT(elt) (elt).x, (elt).y + +#define NSTRACE_FMT_RECT NSTRACE_FMT_POINT "/" NSTRACE_FMT_SIZE +#define NSTRACE_ARG_RECT(elt) \ + NSTRACE_ARG_POINT((elt).origin), NSTRACE_ARG_SIZE((elt).size) + + +/* Macros for printing complex types as extra information. */ + +#define NSTRACE_SIZE(str,size) \ + NSTRACE_MSG (str ": " NSTRACE_FMT_SIZE, \ + NSTRACE_ARG_SIZE (size)); + +#define NSTRACE_POINT(str,point) \ + NSTRACE_MSG (str ": " NSTRACE_FMT_POINT, \ + NSTRACE_ARG_POINT (point)); + +#define NSTRACE_RECT(str,rect) \ + NSTRACE_MSG (str ": " NSTRACE_FMT_RECT, \ + NSTRACE_ARG_RECT (rect)); + +#define NSTRACE_FSTYPE(str,fs_type) \ + do \ + { \ + if (nstrace_enabled) \ + { \ + ns_print_fullscreen_type_name(str, fs_type); \ + } \ + } \ + while(0) + + +/* Return value macros. + + NSTRACE_RETURN(fmt, ...) - Print a return value, support printf-style + format string and arguments. + + NSTRACE_RETURN_what(obj) - Print a return value of kind WHAT. + + NSTRACE_FMT_RETURN - A string literal representing a returned + value. Useful when creating a format string + to printf-like constructs like NSTRACE(). */ + +#define NSTRACE_FMT_RETURN "->>" + +#define NSTRACE_RETURN(...) \ + NSTRACE_MSG_NO_DASHES ("+" NSTRACE_FMT_RETURN " " __VA_ARGS__) + +#define NSTRACE_RETURN_SIZE(size) \ + NSTRACE_RETURN(NSTRACE_FMT_SIZE, NSTRACE_ARG_SIZE(size)) + +#define NSTRACE_RETURN_POINT(point) \ + NSTRACE_RETURN(NSTRACE_FMT_POINT, NSTRACE_ARG_POINT(point)) + +#define NSTRACE_RETURN_RECT(rect) \ + NSTRACE_RETURN(NSTRACE_FMT_RECT, NSTRACE_ARG_RECT(rect)) + + +/* Function enter macros. + + NSTRACE (fmt, ...) -- Enable trace output in curent block + (typically a function). Accepts printf-style + arguments. + + NSTRACE_WHEN (cond, fmt, ...) -- Enable trace output when COND is true. + + NSTRACE_UNLESS (cond, fmt, ...) -- Enable trace output unless COND is + true. */ + + + +#define NSTRACE_WHEN(cond, ...) \ + __attribute__((cleanup(nstrace_leave))) \ + int nstrace_enabled = (cond); \ + if (nstrace_enabled) { ++nstrace_depth; } \ + NSTRACE_MSG_NO_DASHES(__VA_ARGS__); + +#endif /* NSTRACE_ENABLED */ + +#define NSTRACE(...) NSTRACE_WHEN(1, __VA_ARGS__) +#define NSTRACE_UNLESS(cond, ...) NSTRACE_WHEN(!(cond), __VA_ARGS__) + + +/* Non-trace replacement versions. */ +#ifndef NSTRACE_WHEN +#define NSTRACE_WHEN(...) +#endif + +#ifndef NSTRACE_MSG +#define NSTRACE_MSG(...) +#endif + +#ifndef NSTRACE_SIZE +#define NSTRACE_SIZE(str,size) +#endif + +#ifndef NSTRACE_POINT +#define NSTRACE_POINT(str,point) +#endif + +#ifndef NSTRACE_RECT +#define NSTRACE_RECT(str,rect) +#endif + +#ifndef NSTRACE_FSTYPE +#define NSTRACE_FSTYPE(str,fs_type) +#endif + +#ifndef NSTRACE_RETURN_SIZE +#define NSTRACE_RETURN_SIZE(size) +#endif + +#ifndef NSTRACE_RETURN_POINT +#define NSTRACE_RETURN_POINT(point) +#endif + +#ifndef NSTRACE_RETURN_RECT +#define NSTRACE_RETURN_RECT(rect) +#endif + +#ifndef NSTRACE_RETURN_FSTYPE +#define NSTRACE_RETURN_FSTYPE(fs_type) +#endif + + + +/* ========================================================================== + + NSColor, EmacsColor category. + + ========================================================================== */ +@interface NSColor (EmacsColor) ++ (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green + blue:(CGFloat)blue alpha:(CGFloat)alpha; +- (NSColor *)colorUsingDefaultColorSpace; + +@end + +/* ========================================================================== + The Emacs application ========================================================================== */ @@ -85,12 +317,18 @@ typedef float EmacsCGFloat; /* We override sendEvent: as a means to stop/start the event loop */ @interface EmacsApp : NSApplication { +#ifdef NS_IMPL_COCOA + BOOL shouldKeepRunning; + BOOL isFirst; +#endif #ifdef NS_IMPL_GNUSTEP + BOOL applicationDidFinishLaunchingCalled; @public int nextappdefined; #endif } - (void)logNotification: (NSNotification *)notification; +- (void)antialiasThresholdDidChange:(NSNotification *)notification; - (void)sendEvent: (NSEvent *)theEvent; - (void)showPreferencesWindow: (id)sender; - (BOOL) openFile: (NSString *)fileName; @@ -118,7 +356,7 @@ typedef float EmacsCGFloat; @class EmacsToolbar; -#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NS_IMPL_COCOA @interface EmacsView : NSView <NSTextInput, NSWindowDelegate> #else @interface EmacsView : NSView <NSTextInput> @@ -142,6 +380,7 @@ typedef float EmacsCGFloat; int scrollbarsNeedingUpdate; EmacsToolbar *toolbar; NSRect ns_userRect; + BOOL wait_for_tool_bar; } /* AppKit-side interface */ @@ -166,12 +405,13 @@ typedef float EmacsCGFloat; - (BOOL) fsIsNative; - (BOOL) isFullscreen; #ifdef HAVE_NATIVE_FS -- (void) updateCollectionBehaviour; +- (void) updateCollectionBehavior; #endif #ifdef NS_IMPL_GNUSTEP - (void)windowDidMove: (id)sender; #endif +- (int)fullscreenState; @end @@ -195,7 +435,7 @@ typedef float EmacsCGFloat; ========================================================================== */ -#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NS_IMPL_COCOA @interface EmacsMenu : NSMenu <NSMenuDelegate> #else @interface EmacsMenu : NSMenu @@ -227,7 +467,7 @@ typedef float EmacsCGFloat; @class EmacsImage; -#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NS_IMPL_COCOA @interface EmacsToolbar : NSToolbar <NSToolbarDelegate> #else @interface EmacsToolbar : NSToolbar @@ -283,7 +523,7 @@ typedef float EmacsCGFloat; - (void)timeout_handler: (NSTimer *)timedEntry; @end -#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NS_IMPL_COCOA @interface EmacsTooltip : NSObject <NSWindowDelegate> #else @interface EmacsTooltip : NSObject @@ -336,21 +576,15 @@ typedef float EmacsCGFloat; @interface EmacsImage : NSImage { - id imageListNext; - int refCount; NSBitmapImageRep *bmRep; /* used for accessing pixel data */ unsigned char *pixmapData[5]; /* shortcut to access pixel data */ NSColor *stippleMask; + unsigned long xbm_fg; } + allocInitFromFile: (Lisp_Object)file; -- reference; -- imageListSetNext: (id)arg; -- imageListNext; - (void)dealloc; - initFromXBM: (unsigned char *)bits width: (int)w height: (int)h - flip: (BOOL)flip; -- initFromSkipXBM: (unsigned char *)bits width: (int)w height: (int)h - flip: (BOOL)flip length: (int)length; + fg: (unsigned long)fg bg: (unsigned long)bg; - setXBMColor: (NSColor *)color; - initForXPMWithDepth: (int)depth width: (int)width height: (int)height; - (void)setPixmapData; @@ -371,7 +605,7 @@ typedef float EmacsCGFloat; @interface EmacsScroller : NSScroller { - Lisp_Object win; + struct window *window; struct frame *frame; NSResponder *prevResponder; @@ -379,7 +613,7 @@ typedef float EmacsCGFloat; CGFloat last_mouse_offset; float min_portion; int pixel_height; - int last_hit_part; + enum scroll_bar_part last_hit_part; BOOL condemned; @@ -391,18 +625,16 @@ typedef float EmacsCGFloat; - initFrame: (NSRect )r window: (Lisp_Object)win; - (void)setFrame: (NSRect)r; -- (void)dealloc; - setPosition: (int) position portion: (int) portion whole: (int) whole; - (int) checkSamePosition: (int)position portion: (int)portion whole: (int)whole; -- (void) getMouseMotionPart: (int *)part window: (Lisp_Object *)window - x: (Lisp_Object *)x y: ( Lisp_Object *)y; - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e; - repeatScroll: (NSTimer *)sender; - condemn; - reprieve; -- judge; +- (bool)judge; ++ (CGFloat)scrollerWidth; @end @@ -453,9 +685,6 @@ extern EmacsMenu *mainMenu, *svcsMenu, *dockMenu; #define KEY_NS_POWER_OFF ((1<<28)|(0<<16)|1) #define KEY_NS_OPEN_FILE ((1<<28)|(0<<16)|2) #define KEY_NS_OPEN_TEMP_FILE ((1<<28)|(0<<16)|3) -#define KEY_NS_DRAG_FILE ((1<<28)|(0<<16)|4) -#define KEY_NS_DRAG_COLOR ((1<<28)|(0<<16)|5) -#define KEY_NS_DRAG_TEXT ((1<<28)|(0<<16)|6) #define KEY_NS_CHANGE_FONT ((1<<28)|(0<<16)|7) #define KEY_NS_OPEN_FILE_LINE ((1<<28)|(0<<16)|8) #define KEY_NS_PUT_WORKING_TEXT ((1<<28)|(0<<16)|9) @@ -552,8 +781,7 @@ struct ns_display_info /* The generic display parameters corresponding to this NS display. */ struct terminal *terminal; - /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). - The same cons cell also appears in ns_display_name_list. */ + /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */ Lisp_Object name_list_element; /* The number of fonts loaded. */ @@ -569,8 +797,6 @@ struct ns_display_info ptrdiff_t bitmaps_size; ptrdiff_t bitmaps_last; - struct image_cache *image_cache; - struct ns_color_table *color_table; /* DPI resolution of this screen */ @@ -591,22 +817,46 @@ struct ns_display_info /* The cursor to use for vertical scroll bars. */ Cursor vertical_scroll_bar_cursor; + /* The cursor to use for horizontal scroll bars. */ + Cursor horizontal_scroll_bar_cursor; + /* Information about the range of text currently shown in mouse-face. */ Mouse_HLInfo mouse_highlight; struct frame *x_highlight_frame; struct frame *x_focus_frame; + + /* The frame where the mouse was last time we reported a mouse event. */ + struct frame *last_mouse_frame; + + /* The frame where the mouse was last time we reported a mouse motion. */ + struct frame *last_mouse_motion_frame; + + /* Position where the mouse was last time we reported a motion. + This is a position on last_mouse_motion_frame. */ + int last_mouse_motion_x; + int last_mouse_motion_y; + + /* Where the mouse was last time we reported a mouse position. */ + NSRect last_mouse_glyph; + + /* Time of last mouse movement. */ + Time last_mouse_movement_time; + + /* The scroll bar in which the last motion event occurred. */ +#ifdef __OBJC__ + EmacsScroller *last_mouse_scroll_bar; +#else + void *last_mouse_scroll_bar; +#endif }; /* This is a chain of structures for all the NS displays currently in use. */ extern struct ns_display_info *x_display_list; -extern Lisp_Object ns_display_name_list; extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name); -struct ns_display_info *check_x_display_info (Lisp_Object frame); - struct ns_output { #ifdef __OBJC__ @@ -632,6 +882,7 @@ struct ns_output Cursor hand_cursor; Cursor hourglass_cursor; Cursor horizontal_drag_cursor; + Cursor vertical_drag_cursor; /* NS-specific */ Cursor current_pointer; @@ -647,8 +898,8 @@ struct ns_output value contains an ID of the fontset, else -1. */ int fontset; /* only used with font_backend */ - Lisp_Object icon_top; - Lisp_Object icon_left; + int icon_top; + int icon_left; /* The size of the extra width currently allotted for vertical scroll bars, in pixels. */ @@ -663,11 +914,11 @@ struct ns_output /* This is the Emacs structure for the NS display this frame is on. */ struct ns_display_info *display_info; - /* Non-zero if we want to constrain the frame to the screen. */ - int dont_constrain; - /* 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. */ + int in_animation; }; /* this dummy decl needed to support TTYs */ @@ -678,9 +929,7 @@ struct x_output /* This gives the ns_display_info structure for the display F is on. */ -#define FRAME_NS_DISPLAY_INFO(f) ((f)->output_data.ns->display_info) -/* the primacy of X must be constantly worked with... */ -#define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.ns->display_info) +#define FRAME_DISPLAY_INFO(f) ((f)->output_data.ns->display_info) #define FRAME_X_OUTPUT(f) ((f)->output_data.ns) #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc) #define FRAME_X_WINDOW(f) ((f)->output_data.ns->window_desc) @@ -689,25 +938,16 @@ struct x_output #define FRAME_NS_DISPLAY(f) (0) #define FRAME_X_DISPLAY(f) (0) #define FRAME_X_SCREEN(f) (0) -#define FRAME_X_VISUAL(f) FRAME_NS_DISPLAY_INFO(f)->visual +#define FRAME_X_VISUAL(f) FRAME_DISPLAY_INFO(f)->visual #define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color) #define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color) -#define FRAME_X_IMAGE_CACHE(F) FRAME_NS_DISPLAY_INFO ((F))->image_cache - #define NS_FACE_FOREGROUND(f) ((f)->foreground) #define NS_FACE_BACKGROUND(f) ((f)->background) #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height) #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) -#define FONT_WIDTH(f) ((f)->max_width) -#define FONT_HEIGHT(f) ((f)->height) -/*#define FONT_BASE(f) ((f)->ascent) */ -#define FONT_BASE(f) (((struct nsfont_info *)f)->max_bounds.ascent) -/*#define FONT_DESCENT(f) ((f)->descent) */ -#define FONT_DESCENT(f) (((struct nsfont_info *)f)->max_bounds.descent) - #define FRAME_DEFAULT_FACE(f) FACE_FROM_ID (f, DEFAULT_FACE_ID) #define FRAME_NS_VIEW(f) ((f)->output_data.ns->view) @@ -723,12 +963,20 @@ struct x_output #endif /* 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 \ - ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \ - : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \ - : 0) +#define NS_SCROLL_BAR_WIDTH(f) \ + (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ + ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \ + ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \ + : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \ + : 0) + +/* 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 \ + ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) \ + : (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. */ @@ -737,6 +985,13 @@ struct x_output (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. */ +#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) + /* XXX: fix for GNUstep inconsistent accounting for titlebar */ #ifdef NS_IMPL_GNUSTEP #define NS_TOP_POS(f) ((f)->top_pos + 18) @@ -744,24 +999,18 @@ struct x_output #define NS_TOP_POS(f) ((f)->top_pos) #endif -#define FRAME_NS_FONT_TABLE(f) (FRAME_NS_DISPLAY_INFO (f)->font_table) +#define FRAME_NS_FONT_TABLE(f) (FRAME_DISPLAY_INFO (f)->font_table) #define FRAME_FONTSET(f) ((f)->output_data.ns->fontset) -#define FRAME_SMALLEST_CHAR_WIDTH(f) \ - (FRAME_NS_DISPLAY_INFO (f)->smallest_char_width) -#define FRAME_SMALLEST_FONT_HEIGHT(f) \ - (FRAME_NS_DISPLAY_INFO (f)->smallest_font_height) -#define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 -#define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.ns->baseline_offset) #define BLACK_PIX_DEFAULT(f) 0x000000 #define WHITE_PIX_DEFAULT(f) 0xFFFFFF /* First position where characters can be shown (instead of scrollbar, if it is on left. */ -#define FIRST_CHAR_POSITION(f) \ - (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \ +#define FIRST_CHAR_POSITION(f) \ + (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \ : FRAME_SCROLL_BAR_COLS (f)) extern struct ns_display_info *ns_term_init (Lisp_Object display_name); @@ -784,7 +1033,6 @@ struct glyph_string; void ns_dump_glyphstring (struct glyph_string *s); /* Implemented in nsterm, published in or needed from nsfns. */ -extern Lisp_Object Qfontsize; extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern, int size, int maxnames); extern void ns_clear_frame (struct frame *f); @@ -802,7 +1050,7 @@ extern void nxatoms_of_nsselect (void); extern int ns_lisp_to_cursor_type (Lisp_Object arg); extern Lisp_Object ns_cursor_type_to_lisp (int arg); extern void ns_set_name_as_filename (struct frame *f); -extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg); +extern void ns_set_doc_edited (void); extern bool ns_defined_color (struct frame *f, @@ -838,8 +1086,8 @@ extern void find_and_call_menu_selection (struct frame *f, extern Lisp_Object find_and_return_menu_selection (struct frame *f, bool keymaps, void *client_data); -extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents, - Lisp_Object header); +extern Lisp_Object ns_popup_dialog (struct frame *, Lisp_Object header, + Lisp_Object contents); #define NSAPP_DATA2_RUNASSCRIPT 10 extern void ns_run_ascript (void); @@ -857,7 +1105,8 @@ extern void syms_of_nsselect (void); /* From nsimage.m, needed in image.c */ struct image; -extern void *ns_image_from_XBM (unsigned char *bits, int width, int height); +extern void *ns_image_from_XBM (unsigned char *bits, int width, int height, + unsigned long fg, unsigned long bg); extern void *ns_image_for_XPM (int width, int height, int depth); extern void *ns_image_from_file (Lisp_Object file); extern bool ns_load_image (struct frame *f, struct image *img, @@ -874,17 +1123,23 @@ extern int x_display_pixel_width (struct ns_display_info *); /* This in nsterm.m */ extern void x_destroy_window (struct frame *f); extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, EMACS_TIME *timeout, - sigset_t *sigmask); + fd_set *exceptfds, struct timespec const *timeout, + sigset_t const *sigmask); extern unsigned long ns_get_rgb_color (struct frame *f, float r, float g, float b, float a); -extern NSPoint last_mouse_motion_position; -/* From nsterm.m, needed in nsfont.m. */ +extern void ns_init_events (); +extern void ns_finish_events (); + #ifdef __OBJC__ +/* From nsterm.m, needed in nsfont.m. */ extern void ns_draw_text_decoration (struct glyph_string *s, struct face *face, NSColor *defaultCol, CGFloat width, CGFloat x); +/* Needed in nsfns.m. */ +extern void +ns_set_represented_filename (NSString* fstr, struct frame *f); + #endif #ifdef NS_IMPL_GNUSTEP @@ -899,8 +1154,10 @@ extern char gnustep_base_version[]; /* version tracking */ #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. */ -#define NS_SELECTION_COLOR_DEFAULT @"LightGoldenrod2"; +#define NS_SELECTION_BG_COLOR_DEFAULT @"LightGoldenrod2"; +#define NS_SELECTION_FG_COLOR_DEFAULT @"Black"; #define RESIZE_HANDLE_SIZE 12 /* Little utility macros */ @@ -908,8 +1165,4 @@ extern char gnustep_base_version[]; /* version tracking */ ? (min) : (((x)>(max)) ? (max) : (x))) #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX)) -/* needed somewhere... */ -#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0) - - #endif /* HAVE_NS */ |
