X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/8121e4813da7e5898eb216a5de3c17f4875cac61..a5c9bbb3413d8eea89cb832040a0ef6cd704dcfe:/src/nsterm.h diff --git a/src/nsterm.h b/src/nsterm.h index 7843f369d2..0215f13dff 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -53,9 +53,24 @@ along with GNU Emacs. If not, see . */ /* CGFloat on GNUStep may be 4 or 8 byte, but functions expect float* for some versions. - On Cocoa, functions expect CGFloat*. Make compatible type. */ -#if defined (NS_IMPL_COCOA) || GNUSTEP_GUI_MAJOR_VERSION > 0 || \ - GNUSTEP_GUI_MINOR_VERSION >= 22 + 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 typedef float EmacsCGFloat; @@ -70,7 +85,12 @@ typedef float EmacsCGFloat; /* We override sendEvent: as a means to stop/start the event loop */ @interface EmacsApp : NSApplication { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 + BOOL shouldKeepRunning; + BOOL isFirst; +#endif #ifdef NS_IMPL_GNUSTEP + BOOL applicationDidFinishLaunchingCalled; @public int nextappdefined; #endif @@ -424,18 +444,6 @@ extern EmacsMenu *mainMenu, *svcsMenu, *dockMenu; @end #endif -#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 */ - #endif /* __OBJC__ */ @@ -549,8 +557,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. */ @@ -566,8 +573,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 */ @@ -594,16 +599,37 @@ struct ns_display_info 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__ @@ -629,6 +655,7 @@ struct ns_output Cursor hand_cursor; Cursor hourglass_cursor; Cursor horizontal_drag_cursor; + Cursor vertical_drag_cursor; /* NS-specific */ Cursor current_pointer; @@ -675,9 +702,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) @@ -686,25 +711,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) @@ -741,16 +757,10 @@ 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 @@ -835,8 +845,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 (Lisp_Object position, Lisp_Object header, + Lisp_Object contents); #define NSAPP_DATA2_RUNASSCRIPT 10 extern void ns_run_ascript (void); @@ -871,11 +881,10 @@ 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. */ #ifdef __OBJC__ @@ -897,7 +906,8 @@ extern char gnustep_base_version[]; /* version tracking */ #define NS_SCROLL_BAR_WIDTH_DEFAULT [EmacsScroller scrollerWidth] /* 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 */ @@ -905,8 +915,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 */