static ptrdiff_t image_cache_refcount;
#endif
-static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
/* ==========================================================================
x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
NSColor *col;
- CGFloat r, g, b, alpha;
+ EmacsCGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
struct face *face;
NSColor *col;
NSView *view = FRAME_NS_VIEW (f);
- CGFloat r, g, b, alpha;
+ EmacsCGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
{
[[view window] setBackgroundColor: col];
- if (alpha != 1.0)
+ if (alpha != (EmacsCGFloat) 1.0)
[[view window] setOpaque: NO];
else
[[view window] setOpaque: YES];
}
-void
+static void
ns_implicitly_set_icon_type (struct frame *f)
{
Lisp_Object tem;
}
/* This is the same as the xfns.c definition. */
-void
+static void
x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
set_frame_cursor_types (f, arg);
struct ns_display_info *dpyinfo = NULL;
Lisp_Object parent;
struct kboard *kb;
- Lisp_Object tfont, tfontsize;
static int desc_ctr = 1;
/* x_get_arg modifies parms. */
{
/* use for default font name */
id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */
- tfontsize = x_default_parameter (f, parms, Qfontsize,
+ x_default_parameter (f, parms, Qfontsize,
make_number (0 /*(int)[font pointSize]*/),
"fontSize", "FontSize", RES_TYPE_NUMBER);
- tfont = x_default_parameter (f, parms, Qfont,
+ x_default_parameter (f, parms, Qfont,
build_string ([[font fontName] UTF8String]),
"font", "Font", RES_TYPE_STRING);
}
{
static id fileDelegate = nil;
BOOL ret;
+ BOOL isSave = NILP (mustmatch) && NILP (dir_only_p);
id panel;
Lisp_Object fname;
if ([dirS characterAtIndex: 0] == '~')
dirS = [dirS stringByExpandingTildeInPath];
- panel = NILP (mustmatch) && NILP (dir_only_p) ?
+ panel = isSave ?
(id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel];
[panel setTitle: promptS];
[panel setCanChooseDirectories: YES];
[panel setCanChooseFiles: NO];
}
- else
+ else if (! isSave)
{
/* This is not quite what the documentation says, but it is compatible
with the Gtk+ code. Also, the menu entry says "Open File...". */
if (ret)
{
- NSString *str = [panel getFilename];
- if (! str) str = [panel getDirectory];
+ NSString *str = ns_filename_from_panel (panel);
+ if (! str) str = ns_directory_from_panel (panel);
if (! str) ret = NO;
else fname = build_string ([str UTF8String]);
}
#else
Lisp_Object ret = Qnil;
NSMenu *svcs;
+#ifdef NS_IMPL_COCOA
id delegate;
+#endif
check_window_system (NULL);
svcs = [[NSMenu alloc] initWithTitle: @"Services"];
CHECK_STRING (str);
utfStr = [NSString stringWithUTF8String: SSDATA (str)];
- if (![utfStr respondsToSelector:
- @selector (precomposedStringWithCanonicalMapping)])
- {
- message1
- ("Warning: ns-convert-utf8-nfd-to-nfc unsupported under GNUstep.\n");
- return Qnil;
- }
- else
+#ifdef NS_IMPL_COCOA
utfStr = [utfStr precomposedStringWithCanonicalMapping];
+#endif
return build_string ([utfStr UTF8String]);
}
}
+extern const char *x_get_string_resource (XrmDatabase, char *, char *);
+
+
/* terms impl this instead of x-get-resource directly */
const char *
x_get_string_resource (XrmDatabase rdb, char *name, char *class)
}
-int
-x_screen_planes (struct frame *f)
-{
- return FRAME_NS_DISPLAY_INFO (f)->n_planes;
-}
-
-
void
x_sync (struct frame *f)
{
(Lisp_Object color, Lisp_Object frame)
{
NSColor * col;
- CGFloat red, green, blue, alpha;
+ EmacsCGFloat red, green, blue, alpha;
check_window_system (NULL);
CHECK_STRING (color);
return make_number (x_display_pixel_height (dpyinfo));
}
-struct MonitorInfo {
- XRectangle geom, work;
- int mm_width, mm_height;
- char *name;
-};
-
-static void
-free_monitors (struct MonitorInfo *monitors, int n_monitors)
-{
- int i;
- for (i = 0; i < n_monitors; ++i)
- xfree (monitors[i].name);
- xfree (monitors);
-}
-
#ifdef NS_IMPL_COCOA
/* Returns the name for the screen that DICT came from, or NULL.
Caller must free return value.
*/
-char *
+static char *
ns_screen_name (CGDirectDisplayID did)
{
char *name = NULL;
const char *source)
{
Lisp_Object monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
- Lisp_Object frame, rest, attributes_list = Qnil;
- Lisp_Object primary_monitor_attributes = Qnil;
+ Lisp_Object frame, rest;
NSArray *screens = [NSScreen screens];
int i;
}
}
- for (i = 0; i < n_monitors; ++i)
- {
- Lisp_Object geometry, workarea, attributes = Qnil;
- struct MonitorInfo *mi = &monitors[i];
-
- if (mi->geom.width == 0) continue;
-
- workarea = list4i (mi->work.x, mi->work.y,
- mi->work.width, mi->work.height);
- geometry = list4i (mi->geom.x, mi->geom.y,
- mi->geom.width, mi->geom.height);
- attributes = Fcons (Fcons (Qsource,
- make_string (source, strlen (source))),
- attributes);
- attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
- attributes);
- attributes = Fcons (Fcons (Qmm_size,
- list2i (mi->mm_width, mi->mm_height)),
- attributes);
- attributes = Fcons (Fcons (Qworkarea, workarea), attributes);
- attributes = Fcons (Fcons (Qgeometry, geometry), attributes);
- if (mi->name)
- attributes = Fcons (Fcons (Qname, make_string (mi->name,
- strlen (mi->name))),
- attributes);
-
- if (i == primary_monitor)
- primary_monitor_attributes = attributes;
- else
- attributes_list = Fcons (attributes, attributes_list);
- }
-
- if (!NILP (primary_monitor_attributes))
- attributes_list = Fcons (primary_monitor_attributes, attributes_list);
- return attributes_list;
+ return make_monitor_attribute_list (monitors, n_monitors, primary_monitor,
+ monitor_frames, source);
}
DEFUN ("ns-display-monitor-attributes-list",
struct MonitorInfo *m = &monitors[i];
NSRect fr = [s frame];
NSRect vfr = [s visibleFrame];
- NSDictionary *dict = [s deviceDescription];
- NSValue *resval = [dict valueForKey:NSDeviceResolution];
short y, vy;
#ifdef NS_IMPL_COCOA
+ NSDictionary *dict = [s deviceDescription];
NSNumber *nid = [dict objectForKey:@"NSScreenNumber"];
CGDirectDisplayID did = [nid unsignedIntValue];
#endif
case NSPageUpFunctionKey:
case NSPageDownFunctionKey:
case NSEndFunctionKey:
- [panel sendEvent: theEvent];
- ret = YES;
+ /* Don't send command modified keys, as those are handled in the
+ performKeyEquivalent method of the super class.
+ */
+ if (! ([theEvent modifierFlags] & NSCommandKeyMask))
+ {
+ [panel sendEvent: theEvent];
+ ret = YES;
+ }
break;
/* As we don't have the standard key commands for
copy/paste/cut/select-all in our edit menu, we must handle
[NSApp stop: self];
}
#endif
-- (NSString *) getFilename
-{
- return ns_filename_from_panel (self);
-}
-- (NSString *) getDirectory
-{
- return ns_directory_from_panel (self);
-}
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
{
[super ok: sender];
// If not choosing directories, and Open is pressed on a directory, return.
- if (! [self canChooseDirectories] && [self getDirectory] &&
- ! [self getFilename])
+ if (! [self canChooseDirectories] && ns_directory_from_panel (self) &&
+ ! ns_filename_from_panel (self))
return;
panelOK = 1;
}
#endif
-- (NSString *) getFilename
-{
- return ns_filename_from_panel (self);
-}
-- (NSString *) getDirectory
-{
- return ns_directory_from_panel (self);
-}
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
{
// NSOpenPanel inherits NSSavePanel, so passing self is OK.
void
syms_of_nsfns (void)
{
- DEFSYM (Qgeometry, "geometry");
- DEFSYM (Qworkarea, "workarea");
- DEFSYM (Qmm_size, "mm-size");
- DEFSYM (Qframes, "frames");
- DEFSYM (Qsource, "source");
Qfontsize = intern_c_string ("fontsize");
staticpro (&Qfontsize);