#ifdef NS_IMPL_COCOA
#include <IOKit/graphics/IOGraphicsLib.h>
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#include "macfont.h"
#endif
-#endif
#if 0
int fns_trace_num = 1;
extern Lisp_Object Qicon_name;
extern Lisp_Object Qicon_left;
extern Lisp_Object Qicon_top;
-extern Lisp_Object Qleft;
-extern Lisp_Object Qright;
extern Lisp_Object Qtop;
extern Lisp_Object Qdisplay;
extern Lisp_Object Qvertical_scroll_bars;
+extern Lisp_Object Qhorizontal_scroll_bars;
extern Lisp_Object Qauto_raise;
extern Lisp_Object Qauto_lower;
extern Lisp_Object Qbox;
extern Lisp_Object Qscroll_bar_width;
+extern Lisp_Object Qscroll_bar_height;
extern Lisp_Object Qx_resource_name;
extern Lisp_Object Qface_set_after_frame_default;
extern Lisp_Object Qunderline, Qundefined;
}
else if (TERMINALP (object))
{
- struct terminal *t = get_terminal (object, 1);
+ struct terminal *t = decode_live_terminal (object);
if (t->type != output_ns)
error ("Terminal %d is not a Nextstep display", t->id);
static NSString *
ns_filename_from_panel (NSSavePanel *panel)
{
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
NSURL *url = [panel URL];
NSString *str = [url path];
return str;
static NSString *
ns_directory_from_panel (NSSavePanel *panel)
{
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
NSURL *url = [panel directoryURL];
NSString *str = [url path];
return str;
}
+void
+x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+ int old_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+
+ CHECK_TYPE_RANGED_INTEGER (int, arg);
+ FRAME_INTERNAL_BORDER_WIDTH (f) = XINT (arg);
+ if (FRAME_INTERNAL_BORDER_WIDTH (f) < 0)
+ FRAME_INTERNAL_BORDER_WIDTH (f) = 0;
+
+ if (FRAME_INTERNAL_BORDER_WIDTH (f) == old_width)
+ return;
+
+ if (FRAME_X_WINDOW (f) != 0)
+ adjust_frame_size (f, -1, -1, 3, 0, Qinternal_border_width);
+
+ SET_FRAME_GARBAGED (f);
+}
+
+
static void
ns_implicitly_set_icon_type (struct frame *f)
{
static Lisp_Object
ns_appkit_version_str (void)
{
- char tmp[80];
+ char tmp[256];
#ifdef NS_IMPL_GNUSTEP
sprintf(tmp, "gnustep-gui-%s", Xstr(GNUSTEP_GUI_VERSION));
#elif defined (NS_IMPL_COCOA)
- sprintf(tmp, "apple-appkit-%.2f", NSAppKitVersionNumber);
+ NSString *osversion
+ = [[NSProcessInfo processInfo] operatingSystemVersionString];
+ sprintf(tmp, "appkit-%.2f %s",
+ NSAppKitVersionNumber,
+ [osversion UTF8String]);
#else
tmp = "ns-unknown";
#endif
x_set_mouse_color,
x_explicitly_set_name,
x_set_scroll_bar_width, /* generic OK */
+ x_set_scroll_bar_height, /* generic OK */
x_set_title,
x_set_unsplittable, /* generic OK */
x_set_vertical_scroll_bars, /* generic OK */
+ x_set_horizontal_scroll_bars, /* generic OK */
x_set_visibility, /* generic OK */
x_set_tool_bar_lines,
0, /* x_set_scroll_bar_foreground, will ignore (not possible on NS) */
0, /* x_set_scroll_bar_background, will ignore (not possible on NS) */
x_set_screen_gamma, /* generic OK */
x_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */
- x_set_fringe_width, /* generic OK */
- x_set_fringe_width, /* generic OK */
+ x_set_left_fringe, /* generic OK */
+ x_set_right_fringe, /* generic OK */
0, /* x_set_wait_for_wm, will ignore */
x_set_fullscreen, /* generic OK */
x_set_font_backend, /* generic OK */
};
int i;
- for (i = 0; i < sizeof (r)/sizeof (r[0]); ++i)
+ for (i = 0; i < ARRAYELTS (r); ++i)
{
if (NILP (Fassq (r[i].tem, parms)))
{
block_input ();
#ifdef NS_IMPL_COCOA
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if (CTGetCoreTextVersion != NULL
- && CTGetCoreTextVersion () >= kCTVersionNumber10_5)
mac_register_font_driver (f);
+#else
+ register_font_driver (&nsfont_driver, f);
#endif
-#endif
- register_font_driver (&nsfont_driver, f);
x_default_parameter (f, parms, Qfont_backend, Qnil,
"fontBackend", "FontBackend", RES_TYPE_STRING);
"internalBorderWidth", "InternalBorderWidth",
RES_TYPE_NUMBER);
- /* default scrollbars on right on Mac */
+ /* default vertical scrollbars on right on Mac */
{
Lisp_Object spos
#ifdef NS_IMPL_GNUSTEP
"verticalScrollBars", "VerticalScrollBars",
RES_TYPE_SYMBOL);
}
+ x_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil,
+ "horizontalScrollBars", "HorizontalScrollBars",
+ RES_TYPE_SYMBOL);
x_default_parameter (f, parms, Qforeground_color, build_string ("Black"),
"foreground", "Foreground", RES_TYPE_STRING);
x_default_parameter (f, parms, Qbackground_color, build_string ("White"),
init_frame_faces (f);
/* Read comment about this code in corresponding place in xfns.c. */
- width = FRAME_TEXT_WIDTH (f);
- height = FRAME_TEXT_HEIGHT (f);
- FRAME_TEXT_HEIGHT (f) = 0;
- SET_FRAME_WIDTH (f, 0);
- change_frame_size (f, width, height, 1, 0, 0, 1);
+ adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
+ FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, Qnil);
/* The resources controlling the menu-bar and tool-bar are
processed specially at startup, and reflected in the mode
f->output_data.ns->vertical_drag_cursor = [NSCursor resizeUpDownCursor];
FRAME_DISPLAY_INFO (f)->vertical_scroll_bar_cursor
= [NSCursor arrowCursor];
+ FRAME_DISPLAY_INFO (f)->horizontal_scroll_bar_cursor
+ = [NSCursor arrowCursor];
f->output_data.ns->current_pointer = f->output_data.ns->text_cursor;
[[EmacsView alloc] initFrameFromEmacs: f];
x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
"scrollBarWidth", "ScrollBarWidth",
RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qscroll_bar_height, Qnil,
+ "scrollBarHeight", "ScrollBarHeight",
+ RES_TYPE_NUMBER);
x_default_parameter (f, parms, Qalpha, Qnil,
"alpha", "Alpha", RES_TYPE_NUMBER);
x_default_parameter (f, parms, Qfullscreen, Qnil,
"fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
- width = FRAME_TEXT_WIDTH (f);
- height = FRAME_TEXT_HEIGHT (f);
- FRAME_TEXT_HEIGHT (f) = 0;
- SET_FRAME_WIDTH (f, 0);
- change_frame_size (f, width, height, 1, 0, 0, 1);
+ /* Allow x_set_window_size, now. */
+ f->can_x_set_window_size = true;
+
+ adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil);
if (! f->output_data.ns->explicit_parent)
{
id fm = [NSFontManager sharedFontManager];
struct font *font = f->output_data.ns->font;
NSFont *nsfont;
- if (EQ (font->driver->type, Qns))
- nsfont = ((struct nsfont_info *)font)->nsfont;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- else
- nsfont = (NSFont *) macfont_get_nsctfont (font);
+#ifdef NS_IMPL_GNUSTEP
+ nsfont = ((struct nsfont_info *)font)->nsfont;
+#endif
+#ifdef NS_IMPL_COCOA
+ nsfont = (NSFont *) macfont_get_nsctfont (font);
#endif
[fm setSelectedFont: nsfont isMultiple: NO];
[fm orderFrontFontPanel: NSApp];
{
id panel;
BOOL ret;
-#if ! defined (NS_IMPL_COCOA) || \
- MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_GNUSTEP
NSString *dirS, *initS;
BOOL no_types;
#endif
ns_run_file_dialog (void)
{
if (ns_fd_data.panel == nil) return;
-#if defined (NS_IMPL_COCOA) && \
- MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
ns_fd_data.ret = [ns_fd_data.panel runModal];
#else
if (ns_fd_data.no_types)
block_input ();
ns_fd_data.panel = panel;
ns_fd_data.ret = NO;
-#if defined (NS_IMPL_COCOA) && \
- MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
if (! NILP (mustmatch) || ! NILP (dir_only_p))
[panel setAllowedFileTypes: nil];
if (dirS) [panel setDirectoryURL: [NSURL fileURLWithPath: dirS]];
doc: /* List available Nextstep services by querying NSApp. */)
(void)
{
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
/* You can't get services like this in 10.6+. */
return Qnil;
#else
returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
[scriptObject release];
-
*result = Qnil;
if (returnDescriptor != NULL)
Lisp_Object result;
int status;
NSEvent *nxev;
+ struct input_event ev;
CHECK_STRING (script);
check_window_system (NULL);
// If there are other events, the event loop may exit. Keep running
// until the script has been handled. */
+ ns_init_events (&ev);
while (! NILP (as_script))
[NSApp run];
+ ns_finish_events ();
status = as_status;
as_status = 0;
wid - 1) / wid;
}
+void
+x_set_scroll_bar_default_height (struct frame *f)
+{
+ int height = FRAME_LINE_HEIGHT (f);
+ FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = NS_SCROLL_BAR_WIDTH_DEFAULT;
+ FRAME_CONFIG_SCROLL_BAR_LINES (f) = (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) +
+ height - 1) / height;
+}
+
/* terms impl this instead of x-get-resource directly */
char *
x_get_string_resource (XrmDatabase rdb, const char *name, const char *class)
Internal use only, use `display-monitor-attributes-list' instead. */)
(Lisp_Object terminal)
{
- struct terminal *term = get_terminal (terminal, 1);
+ struct terminal *term = decode_live_terminal (terminal);
NSArray *screens;
NSUInteger i, n_monitors;
struct MonitorInfo *monitors;