1 /* Definitions and headers for communication with NeXT/Open/GNUstep API.
2 Copyright (C) 1989, 1993, 2005, 2008 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 #include "dispextern.h"
23 #include "character.h"
30 /* ==========================================================================
34 ========================================================================== */
36 /* We override sendEvent: as a means to stop/start the event loop */
37 @interface EmacsApp
: NSApplication
40 - (void)sendEvent
: (NSEvent
*)theEvent
;
41 - (void)showPreferencesWindow
: (id
)sender
;
45 /* ==========================================================================
49 ========================================================================== */
53 @interface EmacsView
: NSView
<NSTextInput
>
57 NSString
*workingText
;
58 BOOL processingCompose
;
60 struct frame
*emacsframe
;
62 int scrollbarsNeedingUpdate
;
63 EmacsToolbar
*toolbar
;
66 /* AppKit-side interface */
68 - toolbarClicked
: (id
)item
;
69 - toggleToolbar
: (id
)sender
;
70 - (void)keyDown
: (NSEvent
*)theEvent
;
71 - (void)mouseDown
: (NSEvent
*)theEvent
;
72 - (void)mouseUp
: (NSEvent
*)theEvent
;
73 - setMiniwindowImage
: (BOOL
)setMini
;
75 /* Emacs-side interface */
76 - initFrameFromEmacs
: (struct frame
*) f
;
77 - (void) setRows
: (int) r andColumns
: (int) c
;
78 - (void) setWindowClosing
: (BOOL
)closing
;
79 - (EmacsToolbar
*) toolbar
;
80 - (void) deleteWorkingText
;
84 /* Small utility used for processing resize events under Cocoa. */
85 @interface EmacsWindow
: NSWindow
92 /* ==========================================================================
94 The main menu implementation
96 ========================================================================== */
98 @interface EmacsMenu
: NSMenu
101 unsigned long keyEquivModMask
;
104 - initWithTitle
: (NSString
*)title frame
: (struct frame
*)f
;
105 - (void)setFrame
: (struct frame
*)f
;
106 - (void)menuNeedsUpdate
: (NSMenu
*)menu
; /* (delegate method) */
107 - (NSString
*)parseKeyEquiv
: (char *)key
;
108 - (id
<NSMenuItem
>)addItemWithWidgetValue
: (void *)wvptr
;
109 - (void)fillWithWidgetValue
: (void *)wvptr
;
110 - (EmacsMenu
*)addSubmenuWithTitle
: (char *)title forFrame
: (struct frame
*)f
;
112 - (Lisp_Object
)runMenuAt
: (NSPoint
)p forFrame
: (struct frame
*)f
113 keymaps
: (int)keymaps
;
117 /* ==========================================================================
121 ========================================================================== */
125 @interface EmacsToolbar
: NSToolbar
127 EmacsView
*emacsView
;
128 NSMutableDictionary
*identifierToItem
;
129 NSMutableArray
*activeIdentifiers
;
130 NSArray
*prevIdentifiers
;
131 unsigned long enablement
, prevEnablement
;
133 - initForView
: (EmacsView
*)view withIdentifier
: (NSString
*)identifier
;
134 - (void) clearActive
;
136 - (void) addDisplayItemWithImage
: (EmacsImage
*)img idx
: (int)idx
137 helpText
: (char *)help
138 enabled
: (BOOL
)enabled
;
139 /* delegate methods */
140 - (NSToolbarItem
*)toolbar
: (NSToolbar
*)toolbar
141 itemForItemIdentifier
: (NSString
*)itemIdentifier
142 willBeInsertedIntoToolbar
: (BOOL
)flag
;
143 - (NSArray
*)toolbarDefaultItemIdentifiers
: (NSToolbar
*)toolbar
;
144 - (NSArray
*)toolbarAllowedItemIdentifiers
: (NSToolbar
*)toolbar
;
148 /* ==========================================================================
150 Message / question windows
152 ========================================================================== */
154 @interface EmacsDialogPanel
: NSPanel
156 NSTextField
*command
;
161 - initFromContents
: (Lisp_Object
)menu isQuestion
: (BOOL
)isQ
;
162 - addButton
: (char *)str value
: (Lisp_Object
)val row
: (int)row
;
163 - addString
: (char *)str row
: (int)row
;
165 - (Lisp_Object
)runDialogAt
: (NSPoint
)p
;
168 @interface EmacsTooltip
: NSObject
171 NSTextField
*textField
;
175 - (void) setText
: (char *)text
;
176 - (void) showAtX
: (int)x Y
: (int)y
for: (int)seconds
;
183 /* ==========================================================================
185 File open/save panels
186 This and next override methods to work around OS X behavior of
187 restarting application loop when user dismisses panel.
189 ========================================================================== */
191 @interface EmacsSavePanel
: NSSavePanel
195 @interface EmacsOpenPanel
: NSOpenPanel
200 @interface EmacsFileDelegate
: NSObject
203 - (BOOL
)panel
: (id
)sender isValidFilename
: (NSString
*)filename
;
204 - (BOOL
)panel
: (id
)sender shouldShowFilename
: (NSString
*)filename
;
205 - (NSString
*)panel
: (id
)sender userEnteredFilename
: (NSString
*)filename
206 confirmed
: (BOOL
)okFlag
;
210 /* ==========================================================================
214 ========================================================================== */
216 @interface EmacsImage
: NSImage
220 NSBitmapImageRep
*bmRep
; /* used for accessing pixel data */
221 unsigned char *pixmapData
[5]; /* shortcut to access pixel data */
223 NSColor
*stippleMask
;
225 + allocInitFromFile
: (Lisp_Object
)file
;
227 - imageListSetNext
: (id
)arg
;
230 - initFromXBM
: (unsigned char *)bits width
: (int)w height
: (int)h
232 - initFromSkipXBM
: (unsigned char *)bits width
: (int)w height
: (int)h
233 flip
: (BOOL
)flip length
: (int)length
;
234 - setXBMColor
: (NSColor
*)color
;
235 - initForXPMWithDepth
: (int)depth width
: (int)width height
: (int)height
;
236 - (void)setPixmapData
;
237 - (unsigned long)getPixelAtX
: (int)x Y
: (int)y
;
238 - (void)setPixelAtX
: (int)x Y
: (int)y toRed
: (unsigned char)r
239 green
: (unsigned char)g blue
: (unsigned char)b
240 alpha
:(unsigned char)a
;
241 - (void)setAlphaAtX
: (int)x Y
: (int)y to
: (unsigned char)a
;
242 - (NSColor
*)stippleMask
;
246 /* ==========================================================================
250 ========================================================================== */
252 @interface EmacsScroller
: NSScroller
256 NSResponder
*prevResponder
;
258 /* offset to the bottom of knob of last mouse down */
259 float last_mouse_offset
;
266 /* optimize against excessive positioning calls generated by emacs */
272 - initFrame
: (NSRect
)r window
: (Lisp_Object
)win
;
273 - (void)setFrame
: (NSRect
)r
;
276 - setPosition
: (int) position portion
: (int) portion whole
: (int) whole
;
277 - (int) checkSamePosition
: (int)position portion
: (int)portion
279 - (void) getMouseMotionPart
: (int *)part window
: (Lisp_Object
*)window
280 x
: (Lisp_Object
*)x y
: ( Lisp_Object
*)y
;
281 - (void) sendScrollEventAtLoc
: (float)loc fromEvent
: (NSEvent
*)e
;
282 - repeatScroll
: (NSTimer
*)sender
;
289 /* ==========================================================================
291 Rendering on Panther and above
293 ========================================================================== */
297 @interface EmacsGlyphStorage
: NSObject
<NSGlyphStorage
>
300 NSAttributedString
*attrStr
;
301 NSMutableDictionary
*dict
;
303 unsigned long maxChar
, maxGlyph
;
306 - initWithCapacity
: (unsigned long) c
;
307 - (void) setString
: (NSString
*)str font
: (NSFont
*)font
;
309 #endif /* NS_IMPL_COCOA */
312 /* ==========================================================================
314 Running the preferences window
316 ========================================================================== */
318 @interface EmacsPrefsController
: NSObject
321 IBOutlet NSWindow
*prefsWindow
;
322 IBOutlet NSPopUpButton
*alternateModMenu
;
323 IBOutlet NSPopUpButton
*commandModMenu
;
325 IBOutlet NSPopUpButton
*controlModMenu
;
326 IBOutlet NSPopUpButton
*functionModMenu
;
328 IBOutlet NSMatrix
*cursorTypeMatrix
;
329 IBOutlet NSSlider
*cursorBlinkSlider
;
330 IBOutlet NSSlider
*expandSpaceSlider
;
332 IBOutlet NSButton
*smoothFontsCheck
;
333 IBOutlet NSButton
*useQuickdrawCheck
;
334 IBOutlet NSButton
*useSysHiliteCheck
;
335 BOOL prevUseHighlightColor
;
337 float prevExpandSpace
;
340 - (IBAction
)cancel
: (id
)sender
;
341 - (IBAction
)ok
: (id
)sender
;
342 - (IBAction
)resetToDefaults
: (id
)sender
;
343 - (IBAction
)runHelp
: (id
)sender
;
344 - (IBAction
)setColors
: (id
)sender
;
345 - (IBAction
)setDefaultFont
: (id
)sender
;
347 - (void) showForFrame
: (struct frame
*)f
;
348 - (void) setPanelFromValues
;
349 - (void) setValuesFromPanel
;
352 extern NSArray
*ns_send_types
, *ns_return_types
;
353 extern EmacsMenu
*mainMenu
, *svcsMenu
;
355 /* Apple removed the declaration, but kept the implementation */
356 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
357 @interface
NSApplication (EmacsApp
)
358 - (void)setAppleMenu
: (NSMenu
*)menu
;
362 #endif /* __OBJC__ */
366 /* ==========================================================================
370 ========================================================================== */
382 /* could use list to store these, but rest of emacs has a big infrastructure
383 for managing a table of bitmap "records" */
384 struct ns_bitmap_record
393 int height
, width
, depth
;
396 /* this to map between emacs color indices and NSColor objects */
397 struct ns_color_table
403 NSMutableSet
*empty_indices
;
409 #define NS_COLOR_CAPACITY 256
411 #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
412 #define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
414 #define ALPHA_FROM_ULONG(color) ((color) >> 24)
415 #define RED_FROM_ULONG(color) (((color) >> 16) & 0xff)
416 #define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
417 #define BLUE_FROM_ULONG(color) ((color) & 0xff)
419 /* Do not change `* 0x101' in the following lines to `<< 8'. If
420 changed, image masks in 1-bit depth will not work. */
421 #define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101)
422 #define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101)
423 #define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101)
425 /* this extends font backend font */
430 char *name
; /* postscript name, uniquely identifies on NS systems */
431 float width
; /* this and following metrics stored as float rather than int */
438 /* cgfont and synthItal are used only on OS X 10.3+ */
439 #if defined (NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
441 #else /* GNUstep or OS X < 10.3 */
448 char bold
, ital
; /* convenience flags */
450 float voffset
; /* mean of ascender/descender offsets */
451 XCharStruct max_bounds
; /* 23 */
452 /* we compute glyph codes and metrics on-demand in blocks of 256 indexed
454 unsigned short **glyphs
; /* map unicode index to glyph */
455 struct font_metrics
**metrics
;
459 /* init'd in ns_initialize_display_info () */
460 struct ns_display_info
462 /* Chain of all ns_display_info structures. */
463 struct ns_display_info
*next
;
465 /* The generic display parameters corresponding to this NS display. */
466 struct terminal
*terminal
;
468 /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
469 The same cons cell also appears in ns_display_name_list. */
470 Lisp_Object name_list_element
;
472 /* The number of fonts loaded. */
475 /* Minimum width over all characters in all fonts in font_table. */
476 int smallest_char_width
;
478 /* Minimum font height over all fonts in font_table. */
479 int smallest_font_height
;
481 struct kboard
*kboard
;
484 struct ns_bitmap_record
*bitmaps
;
489 struct image_cache
*image_cache
;
491 struct ns_color_table
*color_table
;
493 /* 23: Dimensions and DPI resolution of this screen */
497 /* 23: Mask of things that cause the mouse to be grabbed */
512 /* 23: The cursor to use for vertical scroll bars. */
513 Cursor vertical_scroll_bar_cursor
;
515 /* 23: most mouse face stuff moved in here (and reasonably so) */
516 int mouse_face_beg_row
, mouse_face_beg_col
;
517 int mouse_face_end_row
, mouse_face_end_col
;
518 int mouse_face_beg_x
, mouse_face_beg_y
;
519 int mouse_face_end_x
, mouse_face_end_y
;
520 int mouse_face_past_end
;
521 Lisp_Object mouse_face_window
;
522 int mouse_face_face_id
;
523 int mouse_face_deferred_gc
;
524 Lisp_Object mouse_face_overlay
;
525 FRAME_PTR mouse_face_mouse_frame
;
526 int mouse_face_mouse_x
, mouse_face_mouse_y
;
527 int mouse_face_defer
;
528 int mouse_face_hidden
;
529 int mouse_face_image_state
;
531 /* these are general, but we redefine due to Xism */
532 struct frame
*ns_highlight_frame
;
533 struct frame
*ns_focus_frame
;
534 #define x_highlight_frame ns_highlight_frame
535 #define x_focus_frame ns_focus_frame
538 /* This is a chain of structures for all the NS displays currently in use. */
539 extern struct ns_display_info
*ns_display_list
;
541 #define x_display_list ns_display_list
543 extern Lisp_Object ns_display_name_list
;
544 extern struct ns_display_info
*ns_display_info_for_name ();
546 /* 23: PENDING: these functions (we defined in nsfns) are used in various
547 places, but no prototypes are provided */
548 struct ns_display_info
*check_x_display_info (Lisp_Object frame
);
549 FRAME_PTR
check_x_frame (Lisp_Object frame
);
557 NSColor
*current_cursor_color
;
558 NSColor
*desired_cursor_color
;
559 NSColor
*foreground_color
;
560 NSColor
*background_color
;
561 EmacsToolbar
*toolbar
;
565 void *current_cursor_color
;
566 void *desired_cursor_color
;
567 void *foreground_color
;
568 void *background_color
;
572 /* 23: NSCursors init'ed in initFrameFromEmacs */
574 Cursor nontext_cursor
;
575 Cursor modeline_cursor
;
577 Cursor hourglass_cursor
;
578 Cursor horizontal_drag_cursor
;
580 /* 23: NS-specific */
581 Cursor current_pointer
;
583 /* 23: lord knows why Emacs needs to know about our Window ids.. */
584 Window window_desc
, parent_desc
;
585 char explicit_parent
;
590 /* If a fontset is specified for this frame instead of font, this
591 value contains an ID of the fontset, else -1. */
592 int fontset
; /* only used with font_backend */
594 Lisp_Object icon_top
;
595 Lisp_Object icon_left
;
596 enum ns_cursor_types current_cursor
, desired_cursor
;
597 unsigned char last_inactive
;
599 /* The size of the extra width currently allotted for vertical
600 scroll bars, in pixels. */
601 int vertical_scroll_bar_extra
;
603 /* The height of the titlebar decoration (included in NSWindow's frame). */
606 /* The height of the toolbar if displayed, else 0. */
609 /* This is the Emacs structure for the NS display this frame is on. */
610 struct ns_display_info
*display_info
;
613 /* 23: this dummy decl now needed to support TTYs */
616 unsigned long background_pixel
;
617 unsigned long foreground_pixel
;
621 /* This gives the ns_display_info structure for the display F is on. */
622 #define FRAME_NS_DISPLAY_INFO(f) ((f)->output_data.ns->display_info)
623 /* the primacy of X must be constantly worked with... */
624 #define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.ns->display_info)
625 #define FRAME_X_OUTPUT(f) ((f)->output_data.ns)
626 #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc)
627 #define FRAME_X_WINDOW(f) ((f)->output_data.ns->window_desc)
629 /* This is the `Display *' which frame F is on. */
630 #define FRAME_NS_DISPLAY(f) (0)
631 #define FRAME_X_DISPLAY(f) (0)
633 #define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color)
634 #define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color)
636 #define FRAME_X_IMAGE_CACHE(F) FRAME_NS_DISPLAY_INFO ((F))->image_cache
638 #define NS_FACE_FOREGROUND(f) ((f)->foreground)
639 #define NS_FACE_BACKGROUND(f) ((f)->background)
640 #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height)
641 #define FRAME_NS_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height)
643 #define FONT_WIDTH(f) ((f)->max_width)
644 #define FONT_HEIGHT(f) ((f)->height)
645 /*#define FONT_BASE(f) ((f)->ascent) */
646 #define FONT_BASE(f) (((struct nsfont_info *)f)->max_bounds.ascent)
647 /*#define FONT_DESCENT(f) ((f)->descent) */
648 #define FONT_DESCENT(f) (((struct nsfont_info *)f)->max_bounds.descent)
650 #define FRAME_DEFAULT_FACE(f) FACE_FROM_ID (f, DEFAULT_FACE_ID)
652 #define FRAME_NS_VIEW(f) ((f)->output_data.ns->view)
653 #define FRAME_CURSOR(f) ((f)->output_data.ns->current_cursor)
654 #define FRAME_CURSOR_COLOR(f) ((f)->output_data.ns->current_cursor_color)
655 #define FRAME_NEW_CURSOR_COLOR(f) ((f)->output_data.ns->desired_cursor_color)
656 #define FRAME_NEW_CURSOR(f) ((f)->output_data.ns->desired_cursor)
657 #define FRAME_POINTER_TYPE(f) ((f)->output_data.ns->current_pointer)
658 #define FRAME_LAST_INACTIVE(f) ((f)->output_data.ns->last_inactive)
660 #define FRAME_FONT(f) ((f)->output_data.ns->font)
663 #define XNS_SCROLL_BAR(vec) ((id) XSAVE_VALUE (vec)->pointer)
665 #define XNS_SCROLL_BAR(vec) XSAVE_VALUE (vec)->pointer
668 /* Compute pixel size for vertical scroll bars */
669 #define NS_SCROLL_BAR_WIDTH(f) \
670 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
671 ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \
672 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
673 : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \
676 /* Difference btwn char-column-calculated and actual SB widths.
677 This is only a concern for rendering when SB on left. */
678 #define NS_SCROLL_BAR_ADJUST(w, f) \
679 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) ? \
680 (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) \
681 - NS_SCROLL_BAR_WIDTH (f)) : 0)
683 /*PENDING: fix for GNUstep inconsistent accounting for titlebar */
684 #ifdef NS_IMPL_GNUSTEP
685 #define NS_TOP_POS(f) ((f)->top_pos + 18)
687 #define NS_TOP_POS(f) ((f)->top_pos)
690 #define FRAME_NS_FONT_TABLE(f) (FRAME_NS_DISPLAY_INFO (f)->font_table)
692 #define FRAME_FONTSET(f) ((f)->output_data.ns->fontset)
695 #define FRAME_SMALLEST_CHAR_WIDTH(f) \
696 (FRAME_NS_DISPLAY_INFO (f)->smallest_char_width)
697 #define FRAME_SMALLEST_FONT_HEIGHT(f) \
698 (FRAME_NS_DISPLAY_INFO (f)->smallest_font_height)
699 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
700 #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0
701 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.ns->baseline_offset)
702 #define BLACK_PIX_DEFAULT(f) 0x000000
703 #define WHITE_PIX_DEFAULT(f) 0xFFFFFF
705 /* First position where characters can be shown (instead of scrollbar, if
707 #define FIRST_CHAR_POSITION(f) \
708 (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \
709 : FRAME_SCROLL_BAR_COLS (f))
711 extern struct ns_display_info
*ns_term_init ();
712 extern void ns_term_shutdown (int sig
);
714 /* constants for text rendering */
715 #define NS_DUMPGLYPH_NORMAL 0
716 #define NS_DUMPGLYPH_CURSOR 1
717 #define NS_DUMPGLYPH_FOREGROUND 2
718 #define NS_DUMPGLYPH_MOUSEFACE 3
721 /* In nsfont, called from fontset.c */
722 extern void nsfont_make_fontset_for_font (Lisp_Object name
,
723 Lisp_Object font_object
);
725 /* In nsfont, for debugging */
727 void dump_glyphstring (struct glyph_string
*s
);
729 /* Implemented in nsterm, published in or needed from nsfns. */
730 extern Lisp_Object Qfontsize
;
731 extern Lisp_Object
ns_list_fonts (FRAME_PTR f
, Lisp_Object pattern
,
732 int size
, int maxnames
);
733 extern void ns_clear_frame (struct frame
*f
);
736 extern const char *ns_font_to_xlfd (NSFont
*font
);
738 extern const char *ns_fontname_to_xlfd (const char *name
);
739 extern const char *ns_xlfd_to_fontname (const char *xlfd
);
741 extern void check_ns (void);
742 extern Lisp_Object
ns_map_event_to_object ();
743 extern Lisp_Object
ns_string_from_pasteboard ();
744 extern void ns_string_to_pasteboard ();
745 extern void nxatoms_of_nsselect ();
746 extern int ns_lisp_to_cursor_type ();
747 extern Lisp_Object
ns_cursor_type_to_lisp (int arg
);
748 extern Lisp_Object Qnone
;
750 /* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but
751 this causes an #include snafu, so we can't declare it.
752 extern int ns_defined_color (struct frame *f, char *name, XColor *color_def,
756 extern int ns_lisp_to_color (Lisp_Object color
, NSColor
**col
);
757 extern NSColor
*ns_lookup_indexed_color (unsigned long idx
, struct frame
*f
);
758 extern unsigned long ns_index_color (NSColor
*color
, struct frame
*f
);
759 extern void ns_free_indexed_color (unsigned long idx
, struct frame
*f
);
762 /* C access to ObjC functionality */
763 extern void ns_release_object (void *obj
);
764 extern void ns_retain_object (void *obj
);
765 extern void *ns_alloc_autorelease_pool ();
766 extern void ns_release_autorelease_pool ();
769 extern void update_frame_tool_bar (FRAME_PTR f
);
770 extern void free_frame_tool_bar (FRAME_PTR f
);
771 extern void find_and_call_menu_selection (FRAME_PTR f
,
772 EMACS_INT menu_bar_items_used
, Lisp_Object vector
, void *client_data
);
773 extern Lisp_Object
find_and_return_menu_selection (FRAME_PTR f
,
776 extern Lisp_Object
ns_popup_dialog (Lisp_Object position
, Lisp_Object contents
,
779 /* two more prototypes that should be moved to a more general include file */
780 extern void set_frame_menubar (struct frame
*f
, int first_time
, int deep_p
);
781 extern void x_set_window_size (struct frame
*f
, int change_grav
,
784 /* From nsimage.m, needed in image.c */
786 extern void *ns_image_from_XBM (unsigned char *bits
, int width
, int height
);
787 extern void *ns_image_for_XPM (int width
, int height
, int depth
);
788 extern void *ns_image_from_file (Lisp_Object file
);
789 extern int ns_load_image (struct frame
*f
, struct image
*img
,
790 Lisp_Object spec_file
, Lisp_Object spec_data
);
791 extern int ns_image_width (void *img
);
792 extern int ns_image_height (void *img
);
793 extern unsigned long ns_get_pixel (void *img
, int x
, int y
);
794 extern void ns_put_pixel (void *img
, int x
, int y
, unsigned long argb
);
795 extern void ns_set_alpha (void *img
, int x
, int y
, unsigned char a
);
797 /* This in nsterm.m */
798 extern unsigned long ns_get_rgb_color (struct frame
*f
,
799 float r
, float g
, float b
, float a
);
800 extern NSPoint last_mouse_motion_position
;
802 #ifdef NS_IMPL_GNUSTEP
803 extern char gnustep_base_version
[]; /* version tracking */
809 /* Screen max coordinate
810 Using larger coordinates causes movewindow/placewindow to abort */
811 #define SCREENMAX 16000
813 #define NS_SCROLL_BAR_WIDTH_DEFAULT [EmacsScroller scrollerWidth]
814 /* This is to match emacs on other platforms, ugly though it is. */
815 #define NS_SELECTION_COLOR_DEFAULT @"LightGoldenrod2";
816 #define RESIZE_HANDLE_SIZE 12
818 /* Little utility macros */
819 #define IN_BOUND(min, x, max) (((x) < (min)) \
820 ? (min) : (((x)>(max)) ? (max) : (x)))
821 #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX))
823 /* 23: needed somewhere... */
824 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
829 /* arch-tag: 0a28b142-4ac1-4a81-a243-abcd82d9c4e5
830 (do not change this comment) */