emacs/src/nsterm.h

883 lines
26 KiB
C
Raw Normal View History

2008-07-15 18:15:18 +00:00
/* Definitions and headers for communication with NeXT/Open/GNUstep API.
2013-01-01 09:11:05 +00:00
Copyright (C) 1989, 1993, 2005, 2008-2013 Free Software Foundation,
Inc.
2008-07-15 18:15:18 +00:00
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
2008-07-15 18:15:18 +00:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
2008-07-15 18:15:18 +00:00
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
2008-07-15 18:15:18 +00:00
#include "dispextern.h"
#include "frame.h"
#include "character.h"
#include "font.h"
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
#include "sysselect.h"
2008-07-15 18:15:18 +00:00
#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
#ifndef MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_10_7 1070
#endif
#ifndef MAC_OS_X_VERSION_10_8
#define MAC_OS_X_VERSION_10_8 1080
#endif
* lisp/cus-start.el (all): Add ns-use-native-fullscreen. * src/nsmenu.m (update_frame_tool_bar): Check for negative tool bar height. * src/nsterm.h (HAVE_NATIVE_FS): Define if OSX => 10.7. (EmacsView): Add fs_is_native, fsIsNative, isFullscreen and updateCollectionBehaviour. * src/nsterm.m (NEW_STYLE_FS): Remove. (ns_last_use_native_fullscreen): New variable. (x_make_frame_visible): Replace NEW_STYLE_FS with isFullscreen. (x_set_window_size): Do not take title bar and tool bar into account if isFullscreen returns YES. (ns_fullscreen_hook): Replace NEW_STYLE_FS with isFullscreen. (check_native_fs): New function. (ns_select, ns_read_socket): Call check_native_fs if HAVE_NATIVE_FS. (ns_term_init): Remove NEW_STYLE_FS. (updateFrameSize:, windowWillResize:toSize:): Only adjust for title bar and tool bar if isFullscreen returns NO. (windowDidResize:): Replace NEW_STYLE_FS with fsIsNative. (initFrameFromEmacs:): Initialize fs_is_native. Replace NEW_STYLE_FS with HAVE_NATIVE_FS. (window:willUseFullScreenPresentationOptions:): New method. (windowDidEnterFullScreen:): Replace NEW_STYLE_FS with fsIsNative. Hide toolbar if not enabled. (windowDidExitFullScreen:): Call updateCollectionBehaviour. Restore tool bar if enabled, hide it otherwise (Bug#13444). (fsIsNative, isFullscreen, updateCollectionBehaviour): New methods. (toggleFullScreen:): If fs_is_native, call toggleFullScreen on window. Do no set FRAME_EXTERNAL_TOOL_BAR (f) to 0. Check FRAME_EXTERNAL_TOOL_BAR (f) before restoring FRAME_TOOLBAR_HEIGHT (f). Call updateFrameSize when going non-fs. (syms_of_nsterm): Add ns-use-native-fullscreen.
2013-02-05 13:16:35 +01:00
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
#define HAVE_NATIVE_FS
#endif
#endif /* NS_IMPL_COCOA */
2008-07-15 18:15:18 +00:00
#ifdef __OBJC__
/* ==========================================================================
The Emacs application
========================================================================== */
/* We override sendEvent: as a means to stop/start the event loop */
@interface EmacsApp : NSApplication
{
}
2008-08-01 14:01:08 +00:00
- (void)logNotification: (NSNotification *)notification;
2008-07-15 18:15:18 +00:00
- (void)sendEvent: (NSEvent *)theEvent;
- (void)showPreferencesWindow: (id)sender;
2008-08-01 14:01:08 +00:00
- (BOOL) openFile: (NSString *)fileName;
Improve event loop on NS so that no polling is used. * nsmenu.m (popupSession): Remove. (pop_down_menu): Remove endModalSession. (timeout_handler:): New method. (runDialogAt:): Get next timeout. Start a NSTimer with that timeout. Call runModalForWindow. Check timer_fired when it returns. If not set, cancel timer and break out of loop. Otherwise loop again, with a new timeout. * nsterm.h (EmacsApp): fd_handler takes id argument. (EmacsDialogPanel): Add timer_fired and timeout_handler. * nsterm.m: Include fcntl.h if present. (fd_entry, t_readfds, inNsSelect): Remove. (select_writefds, select_valid, select_timeout, selfds) (select_mutex, apploopnr): Add. (EV_TRAILER): Call kbd_buffer_store_event_hold only if q_event_ptr. Otherwise call kbd_buffer_store_event. (ns_send_appdefined): Remove release of fd_entry. (ns_read_socket): Always send appdefined. Remove inNsSelect check. Increment and decrement apploopnr. (ns_select): If no file descriptors, just do a NSTimer. Otherwise copy read/write masks and start select thread (fd_handler). Start main loop and wait for application defined event. Inform select thread to stop selecting after main loop is exited. (ns_term_init): Create selfds pipe and set non-blocking. Initialize select_mutex. Start the select thread (fd_handler). (fd_handler:): Loop forever, wait for info from the main thread to either start or stop selecting. When select returns, send and appdefined event. (sendScrollEventAtLoc:fromEvent:): Check if q_event_ptr is set. If not call kbd_buffer_store_event.
2012-08-15 20:58:19 +02:00
- (void)fd_handler: (id)unused;
2008-08-01 14:01:08 +00:00
- (void)timeout_handler: (NSTimer *)timedEntry;
- (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg;
2008-07-15 18:15:18 +00:00
@end
/* ==========================================================================
The main Emacs view
========================================================================== */
@class EmacsToolbar;
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
#else
@interface EmacsView : NSView <NSTextInput>
#endif
2008-07-15 18:15:18 +00:00
{
char *old_title;
BOOL windowClosing;
NSString *workingText;
BOOL processingCompose;
int fs_state, fs_before_fs, next_maximized;
int tibar_height, tobar_height, bwidth;
int maximized_width, maximized_height;
NSWindow *nonfs_window;
* lisp/cus-start.el (all): Add ns-use-native-fullscreen. * src/nsmenu.m (update_frame_tool_bar): Check for negative tool bar height. * src/nsterm.h (HAVE_NATIVE_FS): Define if OSX => 10.7. (EmacsView): Add fs_is_native, fsIsNative, isFullscreen and updateCollectionBehaviour. * src/nsterm.m (NEW_STYLE_FS): Remove. (ns_last_use_native_fullscreen): New variable. (x_make_frame_visible): Replace NEW_STYLE_FS with isFullscreen. (x_set_window_size): Do not take title bar and tool bar into account if isFullscreen returns YES. (ns_fullscreen_hook): Replace NEW_STYLE_FS with isFullscreen. (check_native_fs): New function. (ns_select, ns_read_socket): Call check_native_fs if HAVE_NATIVE_FS. (ns_term_init): Remove NEW_STYLE_FS. (updateFrameSize:, windowWillResize:toSize:): Only adjust for title bar and tool bar if isFullscreen returns NO. (windowDidResize:): Replace NEW_STYLE_FS with fsIsNative. (initFrameFromEmacs:): Initialize fs_is_native. Replace NEW_STYLE_FS with HAVE_NATIVE_FS. (window:willUseFullScreenPresentationOptions:): New method. (windowDidEnterFullScreen:): Replace NEW_STYLE_FS with fsIsNative. Hide toolbar if not enabled. (windowDidExitFullScreen:): Call updateCollectionBehaviour. Restore tool bar if enabled, hide it otherwise (Bug#13444). (fsIsNative, isFullscreen, updateCollectionBehaviour): New methods. (toggleFullScreen:): If fs_is_native, call toggleFullScreen on window. Do no set FRAME_EXTERNAL_TOOL_BAR (f) to 0. Check FRAME_EXTERNAL_TOOL_BAR (f) before restoring FRAME_TOOLBAR_HEIGHT (f). Call updateFrameSize when going non-fs. (syms_of_nsterm): Add ns-use-native-fullscreen.
2013-02-05 13:16:35 +01:00
BOOL fs_is_native;
2008-07-15 18:15:18 +00:00
@public
struct frame *emacsframe;
int rows, cols;
int scrollbarsNeedingUpdate;
EmacsToolbar *toolbar;
NSRect ns_userRect;
2008-07-15 18:15:18 +00:00
}
/* AppKit-side interface */
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
- menuDown: (id)sender;
2008-07-15 18:15:18 +00:00
- toolbarClicked: (id)item;
- toggleToolbar: (id)sender;
- (void)keyDown: (NSEvent *)theEvent;
- (void)mouseDown: (NSEvent *)theEvent;
- (void)mouseUp: (NSEvent *)theEvent;
- setMiniwindowImage: (BOOL)setMini;
/* Emacs-side interface */
- initFrameFromEmacs: (struct frame *) f;
- (void) setRows: (int) r andColumns: (int) c;
- (void) setWindowClosing: (BOOL)closing;
- (EmacsToolbar *) toolbar;
- (void) deleteWorkingText;
- (void) updateFrameSize: (BOOL) delay;
- (void) handleFS;
- (void) setFSValue: (int)value;
- (void) toggleFullScreen: (id) sender;
* lisp/cus-start.el (all): Add ns-use-native-fullscreen. * src/nsmenu.m (update_frame_tool_bar): Check for negative tool bar height. * src/nsterm.h (HAVE_NATIVE_FS): Define if OSX => 10.7. (EmacsView): Add fs_is_native, fsIsNative, isFullscreen and updateCollectionBehaviour. * src/nsterm.m (NEW_STYLE_FS): Remove. (ns_last_use_native_fullscreen): New variable. (x_make_frame_visible): Replace NEW_STYLE_FS with isFullscreen. (x_set_window_size): Do not take title bar and tool bar into account if isFullscreen returns YES. (ns_fullscreen_hook): Replace NEW_STYLE_FS with isFullscreen. (check_native_fs): New function. (ns_select, ns_read_socket): Call check_native_fs if HAVE_NATIVE_FS. (ns_term_init): Remove NEW_STYLE_FS. (updateFrameSize:, windowWillResize:toSize:): Only adjust for title bar and tool bar if isFullscreen returns NO. (windowDidResize:): Replace NEW_STYLE_FS with fsIsNative. (initFrameFromEmacs:): Initialize fs_is_native. Replace NEW_STYLE_FS with HAVE_NATIVE_FS. (window:willUseFullScreenPresentationOptions:): New method. (windowDidEnterFullScreen:): Replace NEW_STYLE_FS with fsIsNative. Hide toolbar if not enabled. (windowDidExitFullScreen:): Call updateCollectionBehaviour. Restore tool bar if enabled, hide it otherwise (Bug#13444). (fsIsNative, isFullscreen, updateCollectionBehaviour): New methods. (toggleFullScreen:): If fs_is_native, call toggleFullScreen on window. Do no set FRAME_EXTERNAL_TOOL_BAR (f) to 0. Check FRAME_EXTERNAL_TOOL_BAR (f) before restoring FRAME_TOOLBAR_HEIGHT (f). Call updateFrameSize when going non-fs. (syms_of_nsterm): Add ns-use-native-fullscreen.
2013-02-05 13:16:35 +01:00
- (BOOL) fsIsNative;
- (BOOL) isFullscreen;
#ifdef HAVE_NATIVE_FS
- (void) updateCollectionBehaviour;
#endif
#ifdef NS_IMPL_GNUSTEP
/* Not declared, but useful. */
- (void) unlockFocusNeedsFlush: (BOOL)needs;
#endif
2008-07-15 18:15:18 +00:00
@end
/* Small utility used for processing resize events under Cocoa. */
@interface EmacsWindow : NSWindow
{
NSPoint grabOffset;
}
@end
/* Fullscreen version of the above. */
@interface EmacsFSWindow : EmacsWindow
{
}
@end
2008-07-15 18:15:18 +00:00
/* ==========================================================================
The main menu implementation
========================================================================== */
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@interface EmacsMenu : NSMenu <NSMenuDelegate>
#else
@interface EmacsMenu : NSMenu
#endif
2008-07-15 18:15:18 +00:00
{
struct frame *frame;
unsigned long keyEquivModMask;
}
- initWithTitle: (NSString *)title frame: (struct frame *)f;
- (void)setFrame: (struct frame *)f;
- (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
- (NSString *)parseKeyEquiv: (const char *)key;
2008-08-01 14:01:08 +00:00
- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr;
2008-07-15 18:15:18 +00:00
- (void)fillWithWidgetValue: (void *)wvptr;
- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
2008-07-15 18:15:18 +00:00
- (void) clear;
- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
keymaps: (bool)keymaps;
2008-07-15 18:15:18 +00:00
@end
/* ==========================================================================
Toolbar
========================================================================== */
@class EmacsImage;
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@interface EmacsToolbar : NSToolbar <NSToolbarDelegate>
#else
@interface EmacsToolbar : NSToolbar
#endif
2008-07-15 18:15:18 +00:00
{
EmacsView *emacsView;
NSMutableDictionary *identifierToItem;
NSMutableArray *activeIdentifiers;
NSArray *prevIdentifiers;
unsigned long enablement, prevEnablement;
}
- initForView: (EmacsView *)view withIdentifier: (NSString *)identifier;
- (void) clearActive;
- (BOOL) changed;
- (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx
helpText: (const char *)help
2008-07-15 18:15:18 +00:00
enabled: (BOOL)enabled;
/* delegate methods */
- (NSToolbarItem *)toolbar: (NSToolbar *)toolbar
itemForItemIdentifier: (NSString *)itemIdentifier
willBeInsertedIntoToolbar: (BOOL)flag;
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar;
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar;
@end
/* ==========================================================================
Message / question windows
========================================================================== */
@interface EmacsDialogPanel : NSPanel
{
NSTextField *command;
NSTextField *title;
NSMatrix *matrix;
int rows, cols;
BOOL timer_fired, window_closed;
Lisp_Object dialog_return;
Lisp_Object *button_values;
2008-07-15 18:15:18 +00:00
}
- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
- (void)process_dialog: (Lisp_Object)list;
- (void)addButton: (char *)str value: (int)tag row: (int)row;
- (void)addString: (char *)str row: (int)row;
- (void)addSplit;
2008-07-15 18:15:18 +00:00
- (Lisp_Object)runDialogAt: (NSPoint)p;
Improve event loop on NS so that no polling is used. * nsmenu.m (popupSession): Remove. (pop_down_menu): Remove endModalSession. (timeout_handler:): New method. (runDialogAt:): Get next timeout. Start a NSTimer with that timeout. Call runModalForWindow. Check timer_fired when it returns. If not set, cancel timer and break out of loop. Otherwise loop again, with a new timeout. * nsterm.h (EmacsApp): fd_handler takes id argument. (EmacsDialogPanel): Add timer_fired and timeout_handler. * nsterm.m: Include fcntl.h if present. (fd_entry, t_readfds, inNsSelect): Remove. (select_writefds, select_valid, select_timeout, selfds) (select_mutex, apploopnr): Add. (EV_TRAILER): Call kbd_buffer_store_event_hold only if q_event_ptr. Otherwise call kbd_buffer_store_event. (ns_send_appdefined): Remove release of fd_entry. (ns_read_socket): Always send appdefined. Remove inNsSelect check. Increment and decrement apploopnr. (ns_select): If no file descriptors, just do a NSTimer. Otherwise copy read/write masks and start select thread (fd_handler). Start main loop and wait for application defined event. Inform select thread to stop selecting after main loop is exited. (ns_term_init): Create selfds pipe and set non-blocking. Initialize select_mutex. Start the select thread (fd_handler). (fd_handler:): Loop forever, wait for info from the main thread to either start or stop selecting. When select returns, send and appdefined event. (sendScrollEventAtLoc:fromEvent:): Check if q_event_ptr is set. If not call kbd_buffer_store_event.
2012-08-15 20:58:19 +02:00
- (void)timeout_handler: (NSTimer *)timedEntry;
2008-07-15 18:15:18 +00:00
@end
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@interface EmacsTooltip : NSObject <NSWindowDelegate>
#else
@interface EmacsTooltip : NSObject
#endif
2008-07-15 18:15:18 +00:00
{
NSWindow *win;
NSTextField *textField;
NSTimer *timer;
}
- init;
- (void) setText: (char *)text;
- (void) showAtX: (int)x Y: (int)y for: (int)seconds;
- (void) hide;
- (BOOL) isActive;
- (NSRect) frame;
@end
/* ==========================================================================
File open/save panels
This and next override methods to work around OS X behavior of
restarting application loop when user dismisses panel.
========================================================================== */
@interface EmacsSavePanel : NSSavePanel
{
}
- (NSString *) getFilename;
- (NSString *) getDirectory;
2008-07-15 18:15:18 +00:00
@end
@interface EmacsOpenPanel : NSOpenPanel
{
}
- (NSString *) getFilename;
- (NSString *) getDirectory;
2008-07-15 18:15:18 +00:00
@end
@interface EmacsFileDelegate : NSObject
{
}
- (BOOL)panel: (id)sender isValidFilename: (NSString *)filename;
- (BOOL)panel: (id)sender shouldShowFilename: (NSString *)filename;
- (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename
confirmed: (BOOL)okFlag;
@end
/* ==========================================================================
Images and stippling
========================================================================== */
@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;
}
+ 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;
- setXBMColor: (NSColor *)color;
- initForXPMWithDepth: (int)depth width: (int)width height: (int)height;
- (void)setPixmapData;
- (unsigned long)getPixelAtX: (int)x Y: (int)y;
- (void)setPixelAtX: (int)x Y: (int)y toRed: (unsigned char)r
green: (unsigned char)g blue: (unsigned char)b
alpha:(unsigned char)a;
- (void)setAlphaAtX: (int)x Y: (int)y to: (unsigned char)a;
- (NSColor *)stippleMask;
@end
/* ==========================================================================
Scrollbars
========================================================================== */
@interface EmacsScroller : NSScroller
{
Lisp_Object win;
struct frame *frame;
NSResponder *prevResponder;
/* offset to the bottom of knob of last mouse down */
float last_mouse_offset;
float min_portion;
int pixel_height;
int last_hit_part;
BOOL condemned;
/* optimize against excessive positioning calls generated by emacs */
int em_position;
int em_portion;
int em_whole;
}
- 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;
@end
/* ==========================================================================
Rendering
2008-07-15 18:15:18 +00:00
========================================================================== */
#ifdef NS_IMPL_COCOA
/* rendering util */
@interface EmacsGlyphStorage : NSObject <NSGlyphStorage>
{
@public
NSAttributedString *attrStr;
NSMutableDictionary *dict;
CGGlyph *cglyphs;
unsigned long maxChar, maxGlyph;
long i, len;
}
- initWithCapacity: (unsigned long) c;
- (void) setString: (NSString *)str font: (NSFont *)font;
@end
#endif /* NS_IMPL_COCOA */
extern NSArray *ns_send_types, *ns_return_types;
2009-09-27 15:48:30 +00:00
extern NSString *ns_app_name;
extern EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
2008-07-15 18:15:18 +00:00
/* Apple removed the declaration, but kept the implementation */
#if defined (NS_IMPL_COCOA)
2008-07-15 18:15:18 +00:00
@interface NSApplication (EmacsApp)
- (void)setAppleMenu: (NSMenu *)menu;
@end
#endif
#ifndef NS_HAVE_NSINTEGER
2011-09-09 03:06:52 +02:00
#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 */
2008-07-15 18:15:18 +00:00
#endif /* __OBJC__ */
/* ==========================================================================
Non-OO stuff
========================================================================== */
/* Special keycodes that we pass down the event chain */
#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)
#define KEY_NS_UNPUT_WORKING_TEXT ((1<<28)|(0<<16)|10)
#define KEY_NS_SPI_SERVICE_CALL ((1<<28)|(0<<16)|11)
#define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
#define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13)
#define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14)
2008-07-15 18:15:18 +00:00
/* 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__
EmacsImage *img;
#else
void *img;
#endif
char *file;
int refcount;
int height, width, depth;
};
/* this to map between emacs color indices and NSColor objects */
struct ns_color_table
{
ptrdiff_t size;
ptrdiff_t avail;
2008-07-15 18:15:18 +00:00
#ifdef __OBJC__
NSColor **colors;
NSMutableSet *empty_indices;
#else
void **items;
void *availIndices;
#endif
};
#define NS_COLOR_CAPACITY 256
#define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
#define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
#define ALPHA_FROM_ULONG(color) ((color) >> 24)
#define RED_FROM_ULONG(color) (((color) >> 16) & 0xff)
#define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
#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. */
#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)
/* this extends font backend font */
struct nsfont_info
{
struct font font;
2011-11-16 18:47:25 +01:00
char *name; /* PostScript name, uniquely identifies on NS systems */
/* The following metrics are stored as float rather than int. */
float width; /* Maximum advance for the font. */
2008-07-15 18:15:18 +00:00
float height;
float underpos;
float underwidth;
float size;
#ifdef __OBJC__
NSFont *nsfont;
#if defined (NS_IMPL_COCOA)
2008-07-15 18:15:18 +00:00
CGFontRef cgfont;
#else /* GNUstep */
2008-07-15 18:15:18 +00:00
void *cgfont;
#endif
#else /* ! OBJC */
void *nsfont;
void *cgfont;
#endif
char bold, ital; /* convenience flags */
char synthItal;
XCharStruct max_bounds;
2008-07-15 18:15:18 +00:00
/* we compute glyph codes and metrics on-demand in blocks of 256 indexed
by hibyte, lobyte */
2011-11-20 20:35:27 +01:00
unsigned short **glyphs; /* map Unicode index to glyph */
2008-07-15 18:15:18 +00:00
struct font_metrics **metrics;
};
/* init'd 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. */
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. */
Lisp_Object name_list_element;
/* The number of fonts loaded. */
int n_fonts;
/* Minimum width over all characters in all fonts in font_table. */
int smallest_char_width;
/* Minimum font height over all fonts in font_table. */
int smallest_font_height;
struct ns_bitmap_record *bitmaps;
ptrdiff_t bitmaps_size;
ptrdiff_t bitmaps_last;
2008-07-15 18:15:18 +00:00
struct image_cache *image_cache;
struct ns_color_table *color_table;
/* DPI resolution of this screen */
2008-07-15 18:15:18 +00:00
double resx, resy;
/* Mask of things that cause the mouse to be grabbed */
2008-07-15 18:15:18 +00:00
int grabbed;
int n_planes;
int color_p;
Window root_window;
/* Xism */
2008-07-15 18:15:18 +00:00
XrmDatabase xrdb;
/* The cursor to use for vertical scroll bars. */
2008-07-15 18:15:18 +00:00
Cursor vertical_scroll_bar_cursor;
/* Information about the range of text currently shown in
mouse-face. */
Mouse_HLInfo mouse_highlight;
2008-07-15 18:15:18 +00:00
struct frame *x_highlight_frame;
struct frame *x_focus_frame;
2008-07-15 18:15:18 +00:00
};
/* This is a chain of structures for all the NS displays currently in use. */
extern struct ns_display_info *x_display_list;
2008-07-15 18:15:18 +00:00
extern Lisp_Object ns_display_name_list;
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name);
2008-07-15 18:15:18 +00:00
struct ns_display_info *check_x_display_info (Lisp_Object frame);
struct ns_output
{
#ifdef __OBJC__
EmacsView *view;
id miniimage;
NSColor *cursor_color;
2008-07-15 18:15:18 +00:00
NSColor *foreground_color;
NSColor *background_color;
EmacsToolbar *toolbar;
#else
void *view;
void *miniimage;
void *cursor_color;
2008-07-15 18:15:18 +00:00
void *foreground_color;
void *background_color;
void *toolbar;
#endif
/* NSCursors init'ed in initFrameFromEmacs */
2008-07-15 18:15:18 +00:00
Cursor text_cursor;
Cursor nontext_cursor;
Cursor modeline_cursor;
Cursor hand_cursor;
Cursor hourglass_cursor;
Cursor horizontal_drag_cursor;
/* NS-specific */
2008-07-15 18:15:18 +00:00
Cursor current_pointer;
/* lord knows why Emacs needs to know about our Window ids.. */
2008-07-15 18:15:18 +00:00
Window window_desc, parent_desc;
char explicit_parent;
struct font *font;
int baseline_offset;
/* If a fontset is specified for this frame instead of font, this
value contains an ID of the fontset, else -1. */
int fontset; /* only used with font_backend */
Lisp_Object icon_top;
Lisp_Object icon_left;
/* The size of the extra width currently allotted for vertical
scroll bars, in pixels. */
int vertical_scroll_bar_extra;
/* The height of the titlebar decoration (included in NSWindow's frame). */
int titlebar_height;
/* 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. */
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;
2008-07-15 18:15:18 +00:00
};
/* this dummy decl needed to support TTYs */
2008-07-15 18:15:18 +00:00
struct x_output
{
int unused;
2008-07-15 18:15:18 +00:00
};
/* 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_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)
/* This is the `Display *' which frame F is on. */
#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
2008-07-15 18:15:18 +00:00
#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)
2008-07-15 18:15:18 +00:00
#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)
#define FRAME_CURSOR_COLOR(f) ((f)->output_data.ns->cursor_color)
2008-07-15 18:15:18 +00:00
#define FRAME_POINTER_TYPE(f) ((f)->output_data.ns->current_pointer)
#define FRAME_FONT(f) ((f)->output_data.ns->font)
#ifdef __OBJC__
#define XNS_SCROLL_BAR(vec) ((id) XSAVE_POINTER (vec, 0))
2008-07-15 18:15:18 +00:00
#else
#define XNS_SCROLL_BAR(vec) XSAVE_POINTER (vec, 0)
2008-07-15 18:15:18 +00:00
#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)
/* Difference btwn 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)
/* XXX: fix for GNUstep inconsistent accounting for titlebar */
2008-07-15 18:15:18 +00:00
#ifdef NS_IMPL_GNUSTEP
#define NS_TOP_POS(f) ((f)->top_pos + 18)
#else
#define NS_TOP_POS(f) ((f)->top_pos)
#endif
#define FRAME_NS_FONT_TABLE(f) (FRAME_NS_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 \
: FRAME_SCROLL_BAR_COLS (f))
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern struct ns_display_info *ns_term_init (Lisp_Object display_name);
2008-07-15 18:15:18 +00:00
extern void ns_term_shutdown (int sig);
/* constants for text rendering */
#define NS_DUMPGLYPH_NORMAL 0
#define NS_DUMPGLYPH_CURSOR 1
#define NS_DUMPGLYPH_FOREGROUND 2
#define NS_DUMPGLYPH_MOUSEFACE 3
2008-07-15 18:15:18 +00:00
/* In nsfont, called from fontset.c */
extern void nsfont_make_fontset_for_font (Lisp_Object name,
Lisp_Object font_object);
/* In nsfont, for debugging */
struct glyph_string;
void ns_dump_glyphstring (struct glyph_string *s);
2008-07-15 18:15:18 +00:00
/* Implemented in nsterm, published in or needed from nsfns. */
extern Lisp_Object Qfontsize;
extern Lisp_Object ns_list_fonts (FRAME_PTR f, Lisp_Object pattern,
int size, int maxnames);
extern void ns_clear_frame (struct frame *f);
extern const char *ns_xlfd_to_fontname (const char *xlfd);
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern Lisp_Object ns_map_event_to_object (void);
#ifdef __OBJC__
extern Lisp_Object ns_string_from_pasteboard (id pb);
extern void ns_string_to_pasteboard (id pb, Lisp_Object str);
#endif
extern Lisp_Object ns_get_local_selection (Lisp_Object selection_name,
Lisp_Object target_type);
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern void nxatoms_of_nsselect (void);
extern int ns_lisp_to_cursor_type (Lisp_Object arg);
2008-07-15 18:15:18 +00:00
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);
2008-07-15 18:15:18 +00:00
image.c, indent.c: Use bool for booleans. * dispextern.h (struct image_type): Members valid_p, load, init now return bool, not int. All uses changed. * image.c: Omit unnecessary static decls. (x_create_bitmap_mask, x_build_heuristic_mask): Return void, not int, since callers don't care about the return value. (x_create_bitmap_mask, define_image_type, valid_image_p) (struct image_keyword, parse_image_spec, image_spec_value) (check_image_size, image_background) (image_background_transparent, x_clear_image_1) (postprocess_image, lookup_image, x_check_image_size) (x_create_x_image_and_pixmap, xbm_image_p) (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, init_png_functions, png_load_body, png_load) (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) (init_gif_functions, gif_load, imagemagick_image_p) (imagemagick_load_image, imagemagick_load, svg_image_p) (init_svg_functions, svg_load, svg_load_image, gs_image_p) (gs_load): * nsimage.m (ns_load_image): * nsterm.m (ns_defined_color): * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): * xfns.c (x_defined_color): * xterm.c (x_alloc_lighter_color_for_widget) (x_alloc_nearest_color_1, x_alloc_nearest_color) (x_alloc_lighter_color): * indent.c (disptab_matches_widthtab, current_column) (scan_for_column, string_display_width, indented_beyond_p) (compute_motion, vmotion, Fvertical_motion): Use bool for booleans.
2012-09-24 14:38:23 -07:00
extern bool
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
ns_defined_color (struct frame *f,
const char *name,
image.c, indent.c: Use bool for booleans. * dispextern.h (struct image_type): Members valid_p, load, init now return bool, not int. All uses changed. * image.c: Omit unnecessary static decls. (x_create_bitmap_mask, x_build_heuristic_mask): Return void, not int, since callers don't care about the return value. (x_create_bitmap_mask, define_image_type, valid_image_p) (struct image_keyword, parse_image_spec, image_spec_value) (check_image_size, image_background) (image_background_transparent, x_clear_image_1) (postprocess_image, lookup_image, x_check_image_size) (x_create_x_image_and_pixmap, xbm_image_p) (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, init_png_functions, png_load_body, png_load) (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) (init_gif_functions, gif_load, imagemagick_image_p) (imagemagick_load_image, imagemagick_load, svg_image_p) (init_svg_functions, svg_load, svg_load_image, gs_image_p) (gs_load): * nsimage.m (ns_load_image): * nsterm.m (ns_defined_color): * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): * xfns.c (x_defined_color): * xterm.c (x_alloc_lighter_color_for_widget) (x_alloc_nearest_color_1, x_alloc_nearest_color) (x_alloc_lighter_color): * indent.c (disptab_matches_widthtab, current_column) (scan_for_column, string_display_width, indented_beyond_p) (compute_motion, vmotion, Fvertical_motion): Use bool for booleans.
2012-09-24 14:38:23 -07:00
XColor *color_def, bool alloc,
bool makeIndex);
extern void
ns_query_color (void *col, XColor *color_def, int setPixel);
2008-07-15 18:15:18 +00:00
#ifdef __OBJC__
extern Lisp_Object ns_color_to_lisp (NSColor *col);
2008-07-15 18:15:18 +00:00
extern int ns_lisp_to_color (Lisp_Object color, NSColor **col);
extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f);
extern unsigned long ns_index_color (NSColor *color, struct frame *f);
extern void ns_free_indexed_color (unsigned long idx, struct frame *f);
extern const char *ns_get_pending_menu_title ();
extern void ns_check_menu_open (NSMenu *menu);
extern void ns_check_pending_open_menu ();
2008-07-15 18:15:18 +00:00
#endif
/* C access to ObjC functionality */
extern void ns_release_object (void *obj);
extern void ns_retain_object (void *obj);
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern void *ns_alloc_autorelease_pool (void);
extern void ns_release_autorelease_pool (void *);
extern const char *ns_get_defaults_value (const char *key);
2008-07-15 18:15:18 +00:00
/* in nsmenu */
extern void update_frame_tool_bar (FRAME_PTR f);
extern void free_frame_tool_bar (FRAME_PTR f);
extern void find_and_call_menu_selection (FRAME_PTR f,
int menu_bar_items_used, Lisp_Object vector, void *client_data);
2008-07-15 18:15:18 +00:00
extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f,
bool keymaps,
2008-07-15 18:15:18 +00:00
void *client_data);
extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
Lisp_Object header);
#define NSAPP_DATA2_RUNASSCRIPT 10
extern void ns_run_ascript (void);
extern const char *ns_etc_directory (void);
extern const char *ns_exec_path (void);
extern const char *ns_load_path (void);
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
extern void syms_of_nsterm (void);
extern void syms_of_nsfns (void);
extern void syms_of_nsmenu (void);
extern void syms_of_nsselect (void);
2008-07-15 18:15:18 +00:00
/* 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_for_XPM (int width, int height, int depth);
extern void *ns_image_from_file (Lisp_Object file);
image.c, indent.c: Use bool for booleans. * dispextern.h (struct image_type): Members valid_p, load, init now return bool, not int. All uses changed. * image.c: Omit unnecessary static decls. (x_create_bitmap_mask, x_build_heuristic_mask): Return void, not int, since callers don't care about the return value. (x_create_bitmap_mask, define_image_type, valid_image_p) (struct image_keyword, parse_image_spec, image_spec_value) (check_image_size, image_background) (image_background_transparent, x_clear_image_1) (postprocess_image, lookup_image, x_check_image_size) (x_create_x_image_and_pixmap, xbm_image_p) (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, init_png_functions, png_load_body, png_load) (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) (init_gif_functions, gif_load, imagemagick_image_p) (imagemagick_load_image, imagemagick_load, svg_image_p) (init_svg_functions, svg_load, svg_load_image, gs_image_p) (gs_load): * nsimage.m (ns_load_image): * nsterm.m (ns_defined_color): * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): * xfns.c (x_defined_color): * xterm.c (x_alloc_lighter_color_for_widget) (x_alloc_nearest_color_1, x_alloc_nearest_color) (x_alloc_lighter_color): * indent.c (disptab_matches_widthtab, current_column) (scan_for_column, string_display_width, indented_beyond_p) (compute_motion, vmotion, Fvertical_motion): Use bool for booleans.
2012-09-24 14:38:23 -07:00
extern bool ns_load_image (struct frame *f, struct image *img,
Lisp_Object spec_file, Lisp_Object spec_data);
2008-07-15 18:15:18 +00:00
extern int ns_image_width (void *img);
extern int ns_image_height (void *img);
extern unsigned long ns_get_pixel (void *img, int x, int y);
extern void ns_put_pixel (void *img, int x, int y, unsigned long argb);
extern void ns_set_alpha (void *img, int x, int y, unsigned char a);
extern int x_display_pixel_height (struct ns_display_info *);
extern int x_display_pixel_width (struct ns_display_info *);
2008-07-15 18:15:18 +00:00
/* This in nsterm.m */
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, EMACS_TIME *timeout,
sigset_t *sigmask);
2008-07-15 18:15:18 +00:00
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__
extern void
ns_draw_text_decoration (struct glyph_string *s, struct face *face,
NSColor *defaultCol, CGFloat width, CGFloat x);
#endif
2008-07-15 18:15:18 +00:00
#ifdef NS_IMPL_GNUSTEP
extern char gnustep_base_version[]; /* version tracking */
#endif
#define MINWIDTH 10
#define MINHEIGHT 10
/* Screen max coordinate
Using larger coordinates causes movewindow/placewindow to abort */
#define SCREENMAX 16000
#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 RESIZE_HANDLE_SIZE 12
/* Little utility macros */
#define IN_BOUND(min, x, max) (((x) < (min)) \
? (min) : (((x)>(max)) ? (max) : (x)))
#define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX))
/* needed somewhere... */
2008-07-15 18:15:18 +00:00
#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
#endif /* HAVE_NS */