========================================================================== */
-
-void
-check_window_system (void)
-{
- if (NSApp == nil)
- error ("OpenStep is not in use or not initialized");
-}
-
-
-/* Nonzero if we can use mouse menus. */
-int
-have_menus_p (void)
-{
- return NSApp != nil;
-}
-
-
-/* Extract a frame as a FRAME_PTR, defaulting to the selected frame
- and checking validity for NS. */
-static FRAME_PTR
-check_ns_frame (Lisp_Object frame)
-{
- FRAME_PTR f;
-
- if (NILP (frame))
- f = SELECTED_FRAME ();
- else
- {
- CHECK_LIVE_FRAME (frame);
- f = XFRAME (frame);
- }
- if (! FRAME_NS_P (f))
- error ("non-Nextstep frame used");
- return f;
-}
-
-
/* Let the user specify an Nextstep display with a frame.
nil stands for the selected frame--or, if that is not an Nextstep frame,
the first Nextstep display on the list. */
Lisp_Object tfont, tfontsize;
static int desc_ctr = 1;
- check_window_system ();
-
/* x_get_arg modifies parms. */
parms = Fcopy_alist (parms);
FRAME nil means use the selected frame. */)
(Lisp_Object frame)
{
- struct frame *f = check_ns_frame (frame);
+ struct frame *f = decode_window_system_frame (frame);
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
if (dpyinfo->x_focus_frame != f)
doc: /* Pop up the font panel. */)
(Lisp_Object frame)
{
- id fm;
- struct frame *f;
-
- check_window_system ();
- fm = [NSFontManager sharedFontManager];
- if (NILP (frame))
- f = SELECTED_FRAME ();
- else
- {
- CHECK_FRAME (frame);
- f = XFRAME (frame);
- }
+ struct frame *f = decode_window_system_frame (frame);
+ id fm = [NSFontManager sharedFontManager];
[fm setSelectedFont: ((struct nsfont_info *)f->output_data.ns->font)->nsfont
isMultiple: NO];
doc: /* Pop up the color panel. */)
(Lisp_Object frame)
{
- struct frame *f;
-
- check_window_system ();
- if (NILP (frame))
- f = SELECTED_FRAME ();
- else
- {
- CHECK_FRAME (frame);
- f = XFRAME (frame);
- }
-
+ check_window_system (NULL);
[NSApp orderFrontColorPanel: NSApp];
return Qnil;
}
NSString *initS = NILP (init) || !STRINGP (init) ? nil :
[NSString stringWithUTF8String: SSDATA (init)];
- check_window_system ();
+ check_window_system (NULL);
if (fileDelegate == nil)
fileDelegate = [EmacsFileDelegate new];
{
const char *value;
- check_window_system ();
+ check_window_system (NULL);
if (NILP (owner))
owner = build_string([ns_app_name UTF8String]);
CHECK_STRING (name);
-/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SSDATA (name)); */
value = ns_get_defaults_value (SSDATA (name));
If VALUE is nil, the default is removed. */)
(Lisp_Object owner, Lisp_Object name, Lisp_Object value)
{
- check_window_system ();
+ check_window_system (NULL);
if (NILP (owner))
owner = build_string ([ns_app_name UTF8String]);
CHECK_STRING (name);
doc: /* This function is a no-op. It is only present for completeness. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
/* This function has no real equivalent under NeXTstep. Return nil to
indicate this. */
return Qnil;
{
int num;
- check_window_system ();
+ check_ns_display_info (display);
num = [[NSScreen screens] count];
return (num != 0) ? make_number (num) : Qnil;
If omitted or nil, the selected frame's display is used. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
return make_number ((int)
([ns_get_screen (display) frame].size.height/(92.0/25.4)));
}
If omitted or nil, the selected frame's display is used. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
return make_number ((int)
([ns_get_screen (display) frame].size.width/(92.0/25.4)));
}
If omitted or nil, the selected frame's display is used. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
switch ([ns_get_window (display) backingType])
{
case NSBackingStoreBuffered:
(Lisp_Object display)
{
NSWindowDepth depth;
- check_window_system ();
+
+ check_ns_display_info (display);
depth = [ns_get_screen (display) depth];
if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL))
If omitted or nil, the selected frame's display is used. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
switch ([ns_get_window (display) backingType])
{
case NSBackingStoreBuffered:
DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection,
1, 1, 0,
doc: /* Close the connection to the current Nextstep display server.
-The argument DISPLAY is currently ignored. */)
+DISPLAY should be a frame, the display name as a string, or a terminal ID. */)
(Lisp_Object display)
{
- check_window_system ();
- /*ns_delete_terminal (dpyinfo->terminal); */
+ check_ns_display_info (display);
[NSApp terminate: NSApp];
return Qnil;
}
doc: /* Hides all applications other than Emacs. */)
(void)
{
- check_window_system ();
+ check_window_system (NULL);
[NSApp hideOtherApplications: NSApp];
return Qnil;
}
the active application. */)
(Lisp_Object on)
{
- check_window_system ();
+ check_window_system (NULL);
if (EQ (on, intern ("activate")))
{
[NSApp unhide: NSApp];
doc: /* Shows the 'Info' or 'About' panel for Emacs. */)
(void)
{
- check_window_system ();
+ check_window_system (NULL);
[NSApp orderFrontStandardAboutPanel: nil];
return Qnil;
}
NSMenu *svcs;
id delegate;
- check_window_system ();
+ check_window_system (NULL);
svcs = [[NSMenu alloc] initWithTitle: @"Services"];
[NSApp setServicesMenu: svcs];
[NSApp registerServicesMenuSendTypes: ns_send_types
char *utfStr;
CHECK_STRING (service);
- check_window_system ();
+ check_window_system (NULL);
utfStr = SSDATA (service);
svcName = [NSString stringWithUTF8String: utfStr];
NSEvent *nxev;
CHECK_STRING (script);
- check_window_system ();
+ check_window_system (NULL);
block_input ();
========================================================================== */
-
-/* called from image.c */
-FRAME_PTR
-check_x_frame (Lisp_Object frame)
-{
- return check_ns_frame (frame);
-}
-
-
/* called from frame.c */
struct ns_display_info *
check_x_display_info (Lisp_Object frame)
/* remove appname prefix; TODO: allow for !="Emacs" */
char *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0);
const char *res;
- check_window_system ();
+ check_window_system (NULL);
if (inhibit_x_resources)
/* --quick was passed, so this is a no-op. */
(Lisp_Object color, Lisp_Object frame)
{
NSColor * col;
- check_window_system ();
+ check_window_system (NULL);
return ns_lisp_to_color (color, &col) ? Qnil : Qt;
}
NSColor * col;
CGFloat red, green, blue, alpha;
- check_window_system ();
+ check_window_system (NULL);
CHECK_STRING (color);
if (ns_lisp_to_color (color, &col))
{
NSWindowDepth depth;
NSString *colorSpace;
- check_window_system ();
+
+ check_ns_display_info (display);
depth = [ns_get_screen (display) depth];
colorSpace = NSColorSpaceFromDepth (depth);
(Lisp_Object display)
{
NSWindowDepth depth;
- check_window_system ();
+
+ check_ns_display_info (display);
depth = [ns_get_screen (display) depth];
return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil;
If omitted or nil, that stands for the selected frame's display. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
return make_number ((int) [ns_get_screen (display) frame].size.width);
}
If omitted or nil, that stands for the selected frame's display. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
return make_number ((int) [ns_get_screen (display) frame].size.height);
}
NSScreen *screen;
NSRect vScreen;
- check_window_system ();
+ check_ns_display_info (display);
screen = ns_get_screen (display);
if (!screen)
return Qnil;
If omitted or nil, that stands for the selected frame's display. */)
(Lisp_Object display)
{
- check_window_system ();
+ check_ns_display_info (display);
return make_number
(NSBitsPerPixelFromDepth ([ns_get_screen (display) depth]));
}
If omitted or nil, that stands for the selected frame's display. */)
(Lisp_Object display)
{
- struct ns_display_info *dpyinfo;
- check_window_system ();
-
- dpyinfo = check_ns_display_info (display);
+ struct ns_display_info *dpyinfo = check_ns_display_info (display);
/* We force 24+ bit depths to 24-bit to prevent an overflow. */
return make_number (1 << min (dpyinfo->n_planes, 24));
}
CHECK_STRING (string);
str = SSDATA (string);
- f = check_x_frame (frame);
+ f = decode_window_system_frame (frame);
if (NILP (timeout))
timeout = make_number (5);
else