annotate src/nsfns.m @ 110709:f07cd17d0a5a

* keyboard.c (command_loop_1): Make sure the mark is really alive before using it (Bug#7044).
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 02 Oct 2010 20:59:02 -0400
parents 7e83565f8d0e
children b9e560ce3ab6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1 /* Functions for the NeXT/Open/GNUstep and MacOSX window system.
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106753
diff changeset
2 Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010
96692
6fad3f85eab7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96689
diff changeset
3 Free Software Foundation, Inc.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
4
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
5 This file is part of GNU Emacs.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
6
96692
6fad3f85eab7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96689
diff changeset
7 GNU Emacs is free software: you can redistribute it and/or modify
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
96692
6fad3f85eab7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96689
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
6fad3f85eab7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96689
diff changeset
10 (at your option) any later version.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
11
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
15 GNU General Public License for more details.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
16
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
96692
6fad3f85eab7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96689
diff changeset
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
6fad3f85eab7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96689
diff changeset
19
6fad3f85eab7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96689
diff changeset
20 /*
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
21 Originally by Carl Edman
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
22 Updated by Christian Limpach (chris@nice.ch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
23 OpenStep/Rhapsody port by Scott Bender (sbender@harmony-ds.com)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
24 MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
25 GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
26 */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
27
99904
ba4876d944bc Fix bug #1362. * image.c (x_clear_image_1): Do not free background under HAVE_NS, it is not an indexed color. * nsterm.m (free_indexed_color): Add argument checking. * nsfns.m: Move config.h to before system includes (advised by Dan N.).
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 99028
diff changeset
28 /* This should be the first include, as it may set up #defines affecting
ba4876d944bc Fix bug #1362. * image.c (x_clear_image_1): Do not free background under HAVE_NS, it is not an indexed color. * nsterm.m (free_indexed_color): Add argument checking. * nsfns.m: Move config.h to before system includes (advised by Dan N.).
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 99028
diff changeset
29 interpretation of even the system includes. */
108861
ad09f2bfce51 Fix config.h includes.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 107724
diff changeset
30 #include <config.h>
99904
ba4876d944bc Fix bug #1362. * image.c (x_clear_image_1): Do not free background under HAVE_NS, it is not an indexed color. * nsterm.m (free_indexed_color): Add argument checking. * nsfns.m: Move config.h to before system includes (advised by Dan N.).
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 99028
diff changeset
31
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
32 #include <signal.h>
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
33 #include <math.h>
105676
bb413968898a * nsterm.m:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105557
diff changeset
34 #include <setjmp.h>
99904
ba4876d944bc Fix bug #1362. * image.c (x_clear_image_1): Do not free background under HAVE_NS, it is not an indexed color. * nsterm.m (free_indexed_color): Add argument checking. * nsfns.m: Move config.h to before system includes (advised by Dan N.).
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 99028
diff changeset
35
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
36 #include "lisp.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
37 #include "blockinput.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
38 #include "nsterm.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
39 #include "window.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
40 #include "buffer.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
41 #include "keyboard.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
42 #include "termhooks.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
43 #include "fontset.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
44 #include "character.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
45 #include "font.h"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
46
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
47 #if 0
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
48 int fns_trace_num = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
49 #define NSTRACE(x) fprintf (stderr, "%s:%d: [%d] " #x "\n", \
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
50 __FILE__, __LINE__, ++fns_trace_num)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
51 #else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
52 #define NSTRACE(x)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
53 #endif
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
54
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
55 #ifdef HAVE_NS
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
56
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
57 extern NSArray *ns_send_types, *ns_return_types, *ns_drag_types;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
58
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
59 extern Lisp_Object Qforeground_color;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
60 extern Lisp_Object Qbackground_color;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
61 extern Lisp_Object Qcursor_color;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
62 extern Lisp_Object Qinternal_border_width;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
63 extern Lisp_Object Qvisibility;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
64 extern Lisp_Object Qcursor_type;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
65 extern Lisp_Object Qicon_type;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
66 extern Lisp_Object Qicon_name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
67 extern Lisp_Object Qicon_left;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
68 extern Lisp_Object Qicon_top;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
69 extern Lisp_Object Qleft;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
70 extern Lisp_Object Qright;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
71 extern Lisp_Object Qtop;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
72 extern Lisp_Object Qdisplay;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
73 extern Lisp_Object Qvertical_scroll_bars;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
74 extern Lisp_Object Qauto_raise;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
75 extern Lisp_Object Qauto_lower;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
76 extern Lisp_Object Qbox;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
77 extern Lisp_Object Qscroll_bar_width;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
78 extern Lisp_Object Qx_resource_name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
79 extern Lisp_Object Qface_set_after_frame_default;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
80 extern Lisp_Object Qunderline, Qundefined;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
81 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
82 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
106843
36dd02b00382 Fix Qnone definition in NS files.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
83 extern Lisp_Object Qnone;
107700
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
84 extern Lisp_Object Vframe_title_format;
106843
36dd02b00382 Fix Qnone definition in NS files.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
85
109071
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
86 /* The below are defined in frame.c. */
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
87
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
88 extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
89
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
90 Lisp_Object Qbuffered;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
91 Lisp_Object Qfontsize;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
92
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
93 /* hack for OS X file panels */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
94 char panelOK = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
95
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
96 /* Alist of elements (REGEXP . IMAGE) for images of icons associated
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
97 to frames.*/
99028
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
98 static Lisp_Object Vns_icon_type_alist;
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
99
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
100 /* Toolkit version support. */
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
101 static Lisp_Object Vns_version_string;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
102
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
103 EmacsTooltip *ns_tooltip;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
104
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
105 /* Need forward declaration here to preserve organizational integrity of file */
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
106 Lisp_Object Fx_open_connection (Lisp_Object, Lisp_Object, Lisp_Object);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
107
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
108 extern BOOL ns_in_resize;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
109
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
110
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
111 /* ==========================================================================
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
112
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
113 Internal utility functions
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
114
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
115 ========================================================================== */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
116
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
117
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
118 void
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
119 check_ns (void)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
120 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
121 if (NSApp == nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
122 error ("OpenStep is not in use or not initialized");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
123 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
124
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
125
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
126 /* Nonzero if we can use mouse menus. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
127 int
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
128 have_menus_p (void)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
129 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
130 return NSApp != nil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
131 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
132
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
133
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
134 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
135 and checking validity for NS. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
136 static FRAME_PTR
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
137 check_ns_frame (Lisp_Object frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
138 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
139 FRAME_PTR f;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
140
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
141 if (NILP (frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
142 f = SELECTED_FRAME ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
143 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
144 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
145 CHECK_LIVE_FRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
146 f = XFRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
147 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
148 if (! FRAME_NS_P (f))
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
149 error ("non-Nextstep frame used");
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
150 return f;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
151 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
152
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
153
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
154 /* Let the user specify an Nextstep display with a frame.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
155 nil stands for the selected frame--or, if that is not an Nextstep frame,
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
156 the first Nextstep display on the list. */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
157 static struct ns_display_info *
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
158 check_ns_display_info (Lisp_Object frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
159 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
160 if (NILP (frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
161 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
162 struct frame *f = SELECTED_FRAME ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
163 if (FRAME_NS_P (f) && FRAME_LIVE_P (f) )
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
164 return FRAME_NS_DISPLAY_INFO (f);
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
165 else if (x_display_list != 0)
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
166 return x_display_list;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
167 else
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
168 error ("Nextstep windows are not in use or not initialized");
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
169 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
170 else if (INTEGERP (frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
171 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
172 struct terminal *t = get_terminal (frame, 1);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
173
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
174 if (t->type != output_ns)
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
175 error ("Terminal %d is not a Nextstep display", XINT (frame));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
176
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
177 return t->display_info.ns;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
178 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
179 else if (STRINGP (frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
180 return ns_display_info_for_name (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
181 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
182 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
183 FRAME_PTR f;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
184
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
185 CHECK_LIVE_FRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
186 f = XFRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
187 if (! FRAME_NS_P (f))
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
188 error ("non-Nextstep frame used");
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
189 return FRAME_NS_DISPLAY_INFO (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
190 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
191 return NULL; /* shut compiler up */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
192 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
193
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
194
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
195 static id
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
196 ns_get_window (Lisp_Object maybeFrame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
197 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
198 id view =nil, window =nil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
199
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
200 if (!FRAMEP (maybeFrame) || !FRAME_NS_P (XFRAME (maybeFrame)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
201 maybeFrame = selected_frame;/*wrong_type_argument (Qframep, maybeFrame); */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
202
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
203 if (!NILP (maybeFrame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
204 view = FRAME_NS_VIEW (XFRAME (maybeFrame));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
205 if (view) window =[view window];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
206
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
207 return window;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
208 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
209
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
210
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
211 static NSScreen *
103163
8dbdd97b2aae (ns_get_screen): Rewrite.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 102560
diff changeset
212 ns_get_screen (Lisp_Object screen)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
213 {
106753
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
214 struct frame *f;
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
215 struct terminal *terminal;
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
216
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
217 if (EQ (Qt, screen)) /* not documented */
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
218 return [NSScreen mainScreen];
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
219
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
220 terminal = get_terminal (screen, 1);
103163
8dbdd97b2aae (ns_get_screen): Rewrite.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 102560
diff changeset
221 if (terminal->type != output_ns)
106753
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
222 return NULL;
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
223
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
224 if (NILP (screen))
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
225 f = SELECTED_FRAME ();
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
226 else if (FRAMEP (screen))
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
227 f = XFRAME (screen);
103163
8dbdd97b2aae (ns_get_screen): Rewrite.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 102560
diff changeset
228 else
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
229 {
103163
8dbdd97b2aae (ns_get_screen): Rewrite.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 102560
diff changeset
230 struct ns_display_info *dpyinfo = terminal->display_info.ns;
109071
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
231 f = dpyinfo->x_focus_frame
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
232 ? dpyinfo->x_focus_frame : dpyinfo->x_highlight_frame;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
233 }
106753
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
234
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
235 return ((f && FRAME_NS_P (f)) ? [[FRAME_NS_VIEW (f) window] screen]
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
236 : NULL);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
237 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
238
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
239
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
240 /* Return the X display structure for the display named NAME.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
241 Open a new connection if necessary. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
242 struct ns_display_info *
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
243 ns_display_info_for_name (Lisp_Object name)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
244 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
245 Lisp_Object names;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
246 struct ns_display_info *dpyinfo;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
247
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
248 CHECK_STRING (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
249
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
250 for (dpyinfo = x_display_list, names = ns_display_name_list;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
251 dpyinfo;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
252 dpyinfo = dpyinfo->next, names = XCDR (names))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
253 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
254 Lisp_Object tem;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
255 tem = Fstring_equal (XCAR (XCAR (names)), name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
256 if (!NILP (tem))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
257 return dpyinfo;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
258 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
259
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
260 error ("Emacs for OpenStep does not yet support multi-display.");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
261
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
262 Fx_open_connection (name, Qnil, Qnil);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
263 dpyinfo = x_display_list;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
264
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
265 if (dpyinfo == 0)
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
266 error ("OpenStep on %s not responding.\n", SDATA (name));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
267
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
268 return dpyinfo;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
269 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
270
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
271
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
272 static Lisp_Object
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
273 interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
274 /* --------------------------------------------------------------------------
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
275 Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
276 -------------------------------------------------------------------------- */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
277 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
278 int i, count;
97198
cf43f4e3ecc8 clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97047
diff changeset
279 NSMenuItem *item;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
280 const char *name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
281 Lisp_Object nameStr;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
282 unsigned short key;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
283 NSString *keys;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
284 Lisp_Object res;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
285
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
286 count = [menu numberOfItems];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
287 for (i = 0; i<count; i++)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
288 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
289 item = [menu itemAtIndex: i];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
290 name = [[item title] UTF8String];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
291 if (!name) continue;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
292
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
293 nameStr = build_string (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
294
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
295 if ([item hasSubmenu])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
296 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
297 old = interpret_services_menu ([item submenu],
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
298 Fcons (nameStr, prefix), old);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
299 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
300 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
301 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
302 keys = [item keyEquivalent];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
303 if (keys && [keys length] )
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
304 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
305 key = [keys characterAtIndex: 0];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
306 res = make_number (key|super_modifier);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
307 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
308 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
309 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
310 res = Qundefined;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
311 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
312 old = Fcons (Fcons (res,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
313 Freverse (Fcons (nameStr,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
314 prefix))),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
315 old);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
316 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
317 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
318 return old;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
319 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
320
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
321
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
322
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
323 /* ==========================================================================
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
324
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
325 Frame parameter setters
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
326
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
327 ========================================================================== */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
328
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
329
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
330 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
331 x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
332 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
333 NSColor *col;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
334
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
335 if (ns_lisp_to_color (arg, &col))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
336 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
337 store_frame_param (f, Qforeground_color, oldval);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
338 error ("Unknown color");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
339 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
340
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
341 [col retain];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
342 [f->output_data.ns->foreground_color release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
343 f->output_data.ns->foreground_color = col;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
344
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
345 if (FRAME_NS_VIEW (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
346 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
347 update_face_from_frame_parameter (f, Qforeground_color, arg);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
348 /*recompute_basic_faces (f); */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
349 if (FRAME_VISIBLE_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
350 redraw_frame (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
351 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
352 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
353
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
354
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
355 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
356 x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
357 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
358 struct face *face;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
359 NSColor *col;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
360 NSView *view = FRAME_NS_VIEW (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
361 float alpha;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
362
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
363 if (ns_lisp_to_color (arg, &col))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
364 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
365 store_frame_param (f, Qbackground_color, oldval);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
366 error ("Unknown color");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
367 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
368
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
369 /* clear the frame; in some instances the NS-internal GC appears not to
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
370 update, or it does update and cannot clear old text properly */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
371 if (FRAME_VISIBLE_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
372 ns_clear_frame (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
373
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
374 [col retain];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
375 [f->output_data.ns->background_color release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
376 f->output_data.ns->background_color = col;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
377 if (view != nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
378 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
379 [[view window] setBackgroundColor: col];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
380 alpha = [col alphaComponent];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
381
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
382 if (alpha != 1.0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
383 [[view window] setOpaque: NO];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
384 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
385 [[view window] setOpaque: YES];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
386
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
387 face = FRAME_DEFAULT_FACE (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
388 if (face)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
389 {
96812
eb46d3216494 apply fix from Chong Yidong to NS port ns_set_background_color(), and clean up comparison use of result from NS_FACE_BACKGROUND
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96763
diff changeset
390 col = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f);
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
391 face->background
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
392 = (EMACS_UINT) [[col colorWithAlphaComponent: alpha] retain];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
393 [col release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
394
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
395 update_face_from_frame_parameter (f, Qbackground_color, arg);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
396 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
397
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
398 if (FRAME_VISIBLE_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
399 redraw_frame (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
400 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
401 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
402
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
403
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
404 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
405 x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
406 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
407 NSColor *col;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
408
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
409 if (ns_lisp_to_color (arg, &col))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
410 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
411 store_frame_param (f, Qcursor_color, oldval);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
412 error ("Unknown color");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
413 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
414
98458
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
415 [FRAME_CURSOR_COLOR (f) release];
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
416 FRAME_CURSOR_COLOR (f) = [col retain];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
417
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
418 if (FRAME_VISIBLE_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
419 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
420 x_update_cursor (f, 0);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
421 x_update_cursor (f, 1);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
422 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
423 update_face_from_frame_parameter (f, Qcursor_color, arg);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
424 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
425
98458
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
426
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
427 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
428 x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
429 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
430 NSView *view = FRAME_NS_VIEW (f);
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
431 NSTRACE (x_set_icon_name);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
432
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
433 if (ns_in_resize)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
434 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
435
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
436 /* see if it's changed */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
437 if (STRINGP (arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
438 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
439 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
440 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
441 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
442 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
443 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
444
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
445 f->icon_name = arg;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
446
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
447 if (NILP (arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
448 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
449 if (!NILP (f->title))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
450 arg = f->title;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
451 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
452 /* explicit name and no icon-name -> explicit_name */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
453 if (f->explicit_name)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
454 arg = f->name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
455 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
456 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
457 /* no explicit name and no icon-name ->
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
458 name has to be rebuild from icon_title_format */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
459 windows_or_buffers_changed++;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
460 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
461 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
462 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
463
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
464 /* Don't change the name if it's already NAME. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
465 if ([[view window] miniwindowTitle] &&
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
466 ([[[view window] miniwindowTitle]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
467 isEqualToString: [NSString stringWithUTF8String:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
468 SDATA (arg)]]))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
469 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
470
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
471 [[view window] setMiniwindowTitle:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
472 [NSString stringWithUTF8String: SDATA (arg)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
473 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
474
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
475
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
476 static void
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
477 ns_set_name_iconic (struct frame *f, Lisp_Object name, int explicit)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
478 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
479 NSView *view = FRAME_NS_VIEW (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
480 NSTRACE (ns_set_name_iconic);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
481
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
482 if (ns_in_resize)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
483 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
484
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
485 /* Make sure that requests from lisp code override requests from
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
486 Emacs redisplay code. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
487 if (explicit)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
488 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
489 /* If we're switching from explicit to implicit, we had better
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
490 update the mode lines and thereby update the title. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
491 if (f->explicit_name && NILP (name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
492 update_mode_lines = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
493
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
494 f->explicit_name = ! NILP (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
495 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
496 else if (f->explicit_name)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
497 name = f->name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
498
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
499 /* title overrides explicit name */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
500 if (! NILP (f->title))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
501 name = f->title;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
502
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
503 /* icon_name overrides title and explicit name */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
504 if (! NILP (f->icon_name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
505 name = f->icon_name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
506
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
507 if (NILP (name))
105227
4d1103e3ad15 (ns_set_name_iconic, ns_set_name, ns_set_name_as_filename, x-create-frame, ns-get-resource, ns-set-resource): Use ns_app_name instead of NSProcessInfo call.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105099
diff changeset
508 name = build_string([ns_app_name UTF8String]);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
509 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
510 CHECK_STRING (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
511
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
512 /* Don't change the name if it's already NAME. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
513 if ([[view window] miniwindowTitle] &&
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
514 ([[[view window] miniwindowTitle]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
515 isEqualToString: [NSString stringWithUTF8String:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
516 SDATA (name)]]))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
517 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
518
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
519 [[view window] setMiniwindowTitle:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
520 [NSString stringWithUTF8String: SDATA (name)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
521 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
522
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
523
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
524 static void
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
525 ns_set_name (struct frame *f, Lisp_Object name, int explicit)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
526 {
105751
70c3773ee524 * nsfns.m (ns_set_name, ns_set_name_as_filename): Don't call
Chong Yidong <cyd@stupidchicken.com>
parents: 105676
diff changeset
527 NSView *view;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
528 NSTRACE (ns_set_name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
529
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
530 if (ns_in_resize)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
531 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
532
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
533 /* Make sure that requests from lisp code override requests from
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
534 Emacs redisplay code. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
535 if (explicit)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
536 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
537 /* If we're switching from explicit to implicit, we had better
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
538 update the mode lines and thereby update the title. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
539 if (f->explicit_name && NILP (name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
540 update_mode_lines = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
541
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
542 f->explicit_name = ! NILP (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
543 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
544 else if (f->explicit_name)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
545 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
546
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
547 if (NILP (name))
105227
4d1103e3ad15 (ns_set_name_iconic, ns_set_name, ns_set_name_as_filename, x-create-frame, ns-get-resource, ns-set-resource): Use ns_app_name instead of NSProcessInfo call.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105099
diff changeset
548 name = build_string([ns_app_name UTF8String]);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
549
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
550 f->name = name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
551
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
552 /* title overrides explicit name */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
553 if (! NILP (f->title))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
554 name = f->title;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
555
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
556 CHECK_STRING (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
557
105751
70c3773ee524 * nsfns.m (ns_set_name, ns_set_name_as_filename): Don't call
Chong Yidong <cyd@stupidchicken.com>
parents: 105676
diff changeset
558 view = FRAME_NS_VIEW (f);
70c3773ee524 * nsfns.m (ns_set_name, ns_set_name_as_filename): Don't call
Chong Yidong <cyd@stupidchicken.com>
parents: 105676
diff changeset
559
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
560 /* Don't change the name if it's already NAME. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
561 if ([[[view window] title]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
562 isEqualToString: [NSString stringWithUTF8String:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
563 SDATA (name)]])
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
564 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
565 [[view window] setTitle: [NSString stringWithUTF8String:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
566 SDATA (name)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
567 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
568
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
569
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
570 /* This function should be called when the user's lisp code has
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
571 specified a name for the frame; the name will override any set by the
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
572 redisplay code. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
573 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
574 x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
575 {
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
576 NSTRACE (x_explicitly_set_name);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
577 ns_set_name_iconic (f, arg, 1);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
578 ns_set_name (f, arg, 1);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
579 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
580
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
581
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
582 /* This function should be called by Emacs redisplay code to set the
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
583 name; names set this way will never override names set by the user's
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
584 lisp code. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
585 void
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
586 x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
587 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
588 NSTRACE (x_implicitly_set_name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
589 if (FRAME_ICONIFIED_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
590 ns_set_name_iconic (f, arg, 0);
107700
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
591 else if (FRAME_NS_P (f) && EQ (Vframe_title_format, Qt))
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
592 ns_set_name_as_filename (f);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
593 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
594 ns_set_name (f, arg, 0);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
595 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
596
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
597
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
598 /* Change the title of frame F to NAME.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
599 If NAME is nil, use the frame name as the title.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
600
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
601 If EXPLICIT is non-zero, that indicates that lisp code is setting the
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
602 name; if NAME is a string, set F's name to NAME and set
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
603 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
604
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
605 If EXPLICIT is zero, that indicates that Emacs redisplay code is
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
606 suggesting a new name, which lisp code should override; if
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
607 F->explicit_name is set, ignore the new name; otherwise, set it. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
608 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
609 x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
610 {
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
611 NSTRACE (x_set_title);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
612 /* Don't change the title if it's already NAME. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
613 if (EQ (name, f->title))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
614 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
615
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
616 update_mode_lines = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
617
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
618 f->title = name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
619 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
620
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
621
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
622 void
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
623 ns_set_name_as_filename (struct frame *f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
624 {
105751
70c3773ee524 * nsfns.m (ns_set_name, ns_set_name_as_filename): Don't call
Chong Yidong <cyd@stupidchicken.com>
parents: 105676
diff changeset
625 NSView *view;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
626 Lisp_Object name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
627 Lisp_Object buf = XWINDOW (f->selected_window)->buffer;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
628 const char *title;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
629 NSAutoreleasePool *pool;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
630 NSTRACE (ns_set_name_as_filename);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
631
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
632 if (f->explicit_name || ! NILP (f->title) || ns_in_resize)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
633 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
634
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
635 BLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
636 pool = [[NSAutoreleasePool alloc] init];
107700
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
637 name = XBUFFER (buf)->filename;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
638 if (NILP (name) || FRAME_ICONIFIED_P (f)) name =XBUFFER (buf)->name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
639
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
640 if (FRAME_ICONIFIED_P (f) && !NILP (f->icon_name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
641 name = f->icon_name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
642
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
643 if (NILP (name))
107700
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
644 name = build_string ([ns_app_name UTF8String]);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
645 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
646 CHECK_STRING (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
647
105751
70c3773ee524 * nsfns.m (ns_set_name, ns_set_name_as_filename): Don't call
Chong Yidong <cyd@stupidchicken.com>
parents: 105676
diff changeset
648 view = FRAME_NS_VIEW (f);
70c3773ee524 * nsfns.m (ns_set_name, ns_set_name_as_filename): Don't call
Chong Yidong <cyd@stupidchicken.com>
parents: 105676
diff changeset
649
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
650 title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
651 : [[[view window] title] UTF8String];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
652
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
653 if (title && (! strcmp (title, SDATA (name))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
654 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
655 [pool release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
656 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
657 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
658 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
659
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
660 if (! FRAME_ICONIFIED_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
661 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
662 #ifdef NS_IMPL_COCOA
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
663 /* work around a bug observed on 10.3 where
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
664 setTitleWithRepresentedFilename does not clear out previous state
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
665 if given filename does not exist */
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
666 NSString *str = [NSString stringWithUTF8String: SDATA (name)];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
667 if (![[NSFileManager defaultManager] fileExistsAtPath: str])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
668 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
669 [[view window] setTitleWithRepresentedFilename: @""];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
670 [[view window] setTitle: str];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
671 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
672 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
673 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
674 [[view window] setTitleWithRepresentedFilename: str];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
675 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
676 #else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
677 [[view window] setTitleWithRepresentedFilename:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
678 [NSString stringWithUTF8String: SDATA (name)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
679 #endif
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
680 f->name = name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
681 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
682 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
683 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
684 [[view window] setMiniwindowTitle:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
685 [NSString stringWithUTF8String: SDATA (name)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
686 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
687 [pool release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
688 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
689 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
690
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
691
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
692 void
107724
0e2821d60d4c [merge] Fix last set of Nextstep changes.
Chong Yidong <cyd@stupidchicken.com>
parents: 107700
diff changeset
693 ns_set_doc_edited (struct frame *f, Lisp_Object arg)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
694 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
695 NSView *view = FRAME_NS_VIEW (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
696 NSAutoreleasePool *pool;
107700
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
697 if (!MINI_WINDOW_P (XWINDOW (f->selected_window)))
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
698 {
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
699 BLOCK_INPUT;
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
700 pool = [[NSAutoreleasePool alloc] init];
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
701 [[view window] setDocumentEdited: !NILP (arg)];
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
702 [pool release];
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
703 UNBLOCK_INPUT;
5860ffa0c5d9 Clean up unneeded ns_set_icon_type calls.
Chong Yidong <cyd@stupidchicken.com>
parents: 106843
diff changeset
704 }
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
705 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
706
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
707
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
708 void
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
709 x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
710 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
711 int nlines;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
712 int olines = FRAME_MENU_BAR_LINES (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
713 if (FRAME_MINIBUF_ONLY_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
714 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
715
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
716 if (INTEGERP (value))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
717 nlines = XINT (value);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
718 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
719 nlines = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
720
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
721 FRAME_MENU_BAR_LINES (f) = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
722 if (nlines)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
723 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
724 FRAME_EXTERNAL_MENU_BAR (f) = 1;
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
725 /* does for all frames, whereas we just want for one frame
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
726 [NSMenu setMenuBarVisible: YES]; */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
727 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
728 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
729 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
730 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
731 free_frame_menubar (f);
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
732 /* [NSMenu setMenuBarVisible: NO]; */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
733 FRAME_EXTERNAL_MENU_BAR (f) = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
734 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
735 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
736
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
737
101357
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
738 /* toolbar support */
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
739 void
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
740 x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
741 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
742 int nlines;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
743 Lisp_Object root_window;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
744
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
745 if (FRAME_MINIBUF_ONLY_P (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
746 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
747
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
748 if (INTEGERP (value) && XINT (value) >= 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
749 nlines = XFASTINT (value);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
750 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
751 nlines = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
752
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
753 if (nlines)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
754 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
755 FRAME_EXTERNAL_TOOL_BAR (f) = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
756 update_frame_tool_bar (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
757 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
758 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
759 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
760 if (FRAME_EXTERNAL_TOOL_BAR (f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
761 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
762 free_frame_tool_bar (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
763 FRAME_EXTERNAL_TOOL_BAR (f) = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
764 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
765 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
766
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
767 x_set_window_size (f, 0, f->text_cols, f->text_lines);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
768 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
769
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
770
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
771 void
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
772 ns_implicitly_set_icon_type (struct frame *f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
773 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
774 Lisp_Object tem;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
775 EmacsView *view = FRAME_NS_VIEW (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
776 id image =nil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
777 Lisp_Object chain, elt;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
778 NSAutoreleasePool *pool;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
779 BOOL setMini = YES;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
780
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
781 NSTRACE (ns_implicitly_set_icon_type);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
782
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
783 BLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
784 pool = [[NSAutoreleasePool alloc] init];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
785 if (f->output_data.ns->miniimage
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
786 && [[NSString stringWithUTF8String: SDATA (f->name)]
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
787 isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
788 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
789 [pool release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
790 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
791 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
792 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
793
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
794 tem = assq_no_quit (Qicon_type, f->param_alist);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
795 if (CONSP (tem) && ! NILP (XCDR (tem)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
796 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
797 [pool release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
798 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
799 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
800 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
801
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
802 for (chain = Vns_icon_type_alist;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
803 (image = nil) && CONSP (chain);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
804 chain = XCDR (chain))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
805 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
806 elt = XCAR (chain);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
807 /* special case: 't' means go by file type */
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
808 if (SYMBOLP (elt) && EQ (elt, Qt) && SDATA (f->name)[0] == '/')
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
809 {
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
810 NSString *str
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
811 = [NSString stringWithUTF8String: SDATA (f->name)];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
812 if ([[NSFileManager defaultManager] fileExistsAtPath: str])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
813 image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
814 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
815 else if (CONSP (elt) &&
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
816 STRINGP (XCAR (elt)) &&
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
817 STRINGP (XCDR (elt)) &&
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
818 fast_string_match (XCAR (elt), f->name) >= 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
819 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
820 image = [EmacsImage allocInitFromFile: XCDR (elt)];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
821 if (image == nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
822 image = [[NSImage imageNamed:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
823 [NSString stringWithUTF8String:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
824 SDATA (XCDR (elt))]] retain];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
825 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
826 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
827
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
828 if (image == nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
829 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
830 image = [[[NSWorkspace sharedWorkspace] iconForFileType: @"text"] retain];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
831 setMini = NO;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
832 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
833
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
834 [f->output_data.ns->miniimage release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
835 f->output_data.ns->miniimage = image;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
836 [view setMiniwindowImage: setMini];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
837 [pool release];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
838 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
839 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
840
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
841
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
842 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
843 x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
844 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
845 EmacsView *view = FRAME_NS_VIEW (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
846 id image = nil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
847 BOOL setMini = YES;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
848
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
849 NSTRACE (x_set_icon_type);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
850
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
851 if (!NILP (arg) && SYMBOLP (arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
852 {
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
853 arg =build_string (SDATA (SYMBOL_NAME (arg)));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
854 store_frame_param (f, Qicon_type, arg);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
855 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
856
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
857 /* do it the implicit way */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
858 if (NILP (arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
859 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
860 ns_implicitly_set_icon_type (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
861 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
862 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
863
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
864 CHECK_STRING (arg);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
865
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
866 image = [EmacsImage allocInitFromFile: arg];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
867 if (image == nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
868 image =[NSImage imageNamed: [NSString stringWithUTF8String:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
869 SDATA (arg)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
870
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
871 if (image == nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
872 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
873 image = [NSImage imageNamed: @"text"];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
874 setMini = NO;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
875 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
876
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
877 f->output_data.ns->miniimage = image;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
878 [view setMiniwindowImage: setMini];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
879 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
880
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
881
101357
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
882 /* Xism; we stub out (we do implement this in ns-win.el) */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
883 int
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
884 XParseGeometry (char *string, int *x, int *y,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
885 unsigned int *width, unsigned int *height)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
886 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
887 message1 ("Warning: XParseGeometry not supported under NS.\n");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
888 return 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
889 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
890
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
891
96763
a27390a84360 change most cases of PENDING to TODO, some to FIXME or XXX
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96759
diff changeset
892 /* TODO: move to nsterm? */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
893 int
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
894 ns_lisp_to_cursor_type (Lisp_Object arg)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
895 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
896 char *str;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
897 if (XTYPE (arg) == Lisp_String)
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
898 str = SDATA (arg);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
899 else if (XTYPE (arg) == Lisp_Symbol)
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
900 str = SDATA (SYMBOL_NAME (arg));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
901 else return -1;
98458
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
902 if (!strcmp (str, "box")) return FILLED_BOX_CURSOR;
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
903 if (!strcmp (str, "hollow")) return HOLLOW_BOX_CURSOR;
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
904 if (!strcmp (str, "hbar")) return HBAR_CURSOR;
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
905 if (!strcmp (str, "bar")) return BAR_CURSOR;
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
906 if (!strcmp (str, "no")) return NO_CURSOR;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
907 return -1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
908 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
909
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
910
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
911 Lisp_Object
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
912 ns_cursor_type_to_lisp (int arg)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
913 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
914 switch (arg)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
915 {
98458
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
916 case FILLED_BOX_CURSOR: return Qbox;
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
917 case HOLLOW_BOX_CURSOR: return intern ("hollow");
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
918 case HBAR_CURSOR: return intern ("hbar");
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
919 case BAR_CURSOR: return intern ("bar");
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
920 case NO_CURSOR:
5db459c2e438 * nsterm.h (ns_cursor_types, ns_output.desired_cursor_color)(ns_output.current_cursor, ns_output.desired_cursor) (ns_output.last_inactive, FRAME_CURSOR, FRAME_NEW_CURSOR) (FRAME_NEW_CURSOR_COLOR,): Remove. * nsfns.m (ns_set_cursor_color): Use FRAME_CURSOR_COLOR. (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): Use core emacs enumeration (HOLLOW_BOX_CURSOR, etc.). * nsterm.m (ns_frame_rehighlight): Remove commented code. (draw_window_cursor): Simplify code. (EmacsView-windowDidBecomeKey:,-windowDidResignKey:): Don't change cursor type. In latter, call rehighlight instead of doing updates manually. (EmacsPrefsController-setPanelFromValues,-setValuesFromPanel): Use core emacs cursor types. * xdisp.c (draw_glyphs): Don't call notice_overwritten_cursor() under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98298
diff changeset
921 default: return intern ("no");
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
922 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
923 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
924
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
925 /* This is the same as the xfns.c definition. */
97568
b7e30775f9ce ns_set_cursor_type: replace with generic from xfns.c
David Reitter <david.reitter@gmail.com>
parents: 97270
diff changeset
926 void
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
927 x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
928 {
97568
b7e30775f9ce ns_set_cursor_type: replace with generic from xfns.c
David Reitter <david.reitter@gmail.com>
parents: 97270
diff changeset
929 set_frame_cursor_types (f, arg);
b7e30775f9ce ns_set_cursor_type: replace with generic from xfns.c
David Reitter <david.reitter@gmail.com>
parents: 97270
diff changeset
930
b7e30775f9ce ns_set_cursor_type: replace with generic from xfns.c
David Reitter <david.reitter@gmail.com>
parents: 97270
diff changeset
931 /* Make sure the cursor gets redrawn. */
b7e30775f9ce ns_set_cursor_type: replace with generic from xfns.c
David Reitter <david.reitter@gmail.com>
parents: 97270
diff changeset
932 cursor_type_changed = 1;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
933 }
97568
b7e30775f9ce ns_set_cursor_type: replace with generic from xfns.c
David Reitter <david.reitter@gmail.com>
parents: 97270
diff changeset
934
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
935
101357
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
936 /* called to set mouse pointer color, but all other terms use it to
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
937 initialize pointer types (and don't set the color ;) */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
938 static void
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
939 x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
940 {
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
941 /* don't think we can do this on Nextstep */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
942 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
943
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
944
99028
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
945 #define Str(x) #x
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
946 #define Xstr(x) Str(x)
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
947
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
948 static Lisp_Object
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
949 ns_appkit_version_str (void)
99028
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
950 {
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
951 char tmp[80];
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
952
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
953 #ifdef NS_IMPL_GNUSTEP
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
954 sprintf(tmp, "gnustep-gui-%s", Xstr(GNUSTEP_GUI_VERSION));
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
955 #elif defined(NS_IMPL_COCOA)
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
956 sprintf(tmp, "apple-appkit-%.2f", NSAppKitVersionNumber);
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
957 #else
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
958 tmp = "ns-unknown";
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
959 #endif
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
960 return build_string (tmp);
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
961 }
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
962
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
963
100802
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
964 /* This is for use by x-server-version and collapses all version info we
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
965 have into a single int. For a better picture of the implementation
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
966 running, use ns_appkit_version_str.*/
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
967 static int
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
968 ns_appkit_version_int (void)
100802
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
969 {
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
970 #ifdef NS_IMPL_GNUSTEP
102431
ccae12dc75d9 (ns_appkit_version_int): Fix typo in the version macro.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 102004
diff changeset
971 return GNUSTEP_GUI_MAJOR_VERSION * 100 + GNUSTEP_GUI_MINOR_VERSION;
100802
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
972 #elif defined(NS_IMPL_COCOA)
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
973 return (int)NSAppKitVersionNumber;
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
974 #endif
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
975 return 0;
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
976 }
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
977
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
978
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
979 static void
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
980 x_icon (struct frame *f, Lisp_Object parms)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
981 /* --------------------------------------------------------------------------
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
982 Strangely-named function to set icon position parameters in frame.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
983 This is irrelevant under OS X, but might be needed under GNUstep,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
984 depending on the window manager used. Note, this is not a standard
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
985 frame parameter-setter; it is called directly from x-create-frame.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
986 -------------------------------------------------------------------------- */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
987 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
988 Lisp_Object icon_x, icon_y;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
989 struct ns_display_info *dpyinfo = check_ns_display_info (Qnil);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
990
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
991 f->output_data.ns->icon_top = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
992 f->output_data.ns->icon_left = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
993
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
994 /* Set the position of the icon. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
995 icon_x = x_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
996 icon_y = x_get_arg (dpyinfo, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
997 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
998 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
999 CHECK_NUMBER (icon_x);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1000 CHECK_NUMBER (icon_y);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1001 f->output_data.ns->icon_top = icon_y;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1002 f->output_data.ns->icon_left = icon_x;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1003 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1004 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1005 error ("Both left and top icon corners of icon must be specified");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1006 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1007
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1008
101357
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
1009 /* Note: see frame.c for template, also where generic functions are impl */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1010 frame_parm_handler ns_frame_parm_handlers[] =
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1011 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1012 x_set_autoraise, /* generic OK */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1013 x_set_autolower, /* generic OK */
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1014 x_set_background_color,
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1015 0, /* x_set_border_color, may be impossible under Nextstep */
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1016 0, /* x_set_border_width, may be impossible under Nextstep */
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1017 x_set_cursor_color,
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1018 x_set_cursor_type,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1019 x_set_font, /* generic OK */
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1020 x_set_foreground_color,
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1021 x_set_icon_name,
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1022 x_set_icon_type,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1023 x_set_internal_border_width, /* generic OK */
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
1024 x_set_menu_bar_lines,
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1025 x_set_mouse_color,
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1026 x_explicitly_set_name,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1027 x_set_scroll_bar_width, /* generic OK */
100839
03cb6ea90f92 * nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100802
diff changeset
1028 x_set_title,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1029 x_set_unsplittable, /* generic OK */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1030 x_set_vertical_scroll_bars, /* generic OK */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1031 x_set_visibility, /* generic OK */
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
1032 x_set_tool_bar_lines,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1033 0, /* x_set_scroll_bar_foreground, will ignore (not possible on NS) */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1034 0, /* x_set_scroll_bar_background, will ignore (not possible on NS) */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1035 x_set_screen_gamma, /* generic OK */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1036 x_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1037 x_set_fringe_width, /* generic OK */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1038 x_set_fringe_width, /* generic OK */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1039 0, /* x_set_wait_for_wm, will ignore */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1040 0, /* x_set_fullscreen will ignore */
97208
8fb5367ed2f1 (ns_frame_parm_handlers): Add empty entry for x_set_alpha.
Chong Yidong <cyd@stupidchicken.com>
parents: 97198
diff changeset
1041 x_set_font_backend, /* generic OK */
103674
1867be80e595 * w32fns.c (w32_frame_parm_handlers): Set 0 for sticky.
Jan Djärv <jan.h.d@swipnet.se>
parents: 103341
diff changeset
1042 x_set_alpha,
1867be80e595 * w32fns.c (w32_frame_parm_handlers): Set 0 for sticky.
Jan Djärv <jan.h.d@swipnet.se>
parents: 103341
diff changeset
1043 0, /* x_set_sticky */
109820
33724382fa3f * nsfns.m (ns_frame_parm_handlers): Add a slot for the
Jan D <jan.h.d@swipnet.se>
parents: 109653
diff changeset
1044 0, /* x_set_tool_bar_position */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1045 };
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1046
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1047
99028
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
1048
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
1049 /* ==========================================================================
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
1050
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
1051 Lisp definitions
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
1052
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
1053 ========================================================================== */
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
1054
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1055 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1056 1, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1057 doc: /* Make a new Nextstep window, called a \"frame\" in Emacs terms.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1058 Return an Emacs frame object.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1059 PARMS is an alist of frame parameters.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1060 If the parameters specify that the frame should not have a minibuffer,
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1061 and do not specify a specific minibuffer window to use,
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1062 then `default-minibuffer-frame' must be a frame whose minibuffer can
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1063 be shared by the new frame. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1064 (Lisp_Object parms)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1065 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1066 static int desc_ctr = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1067 struct frame *f;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1068 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1069 Lisp_Object frame, tem;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1070 Lisp_Object name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1071 int minibuffer_only = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1072 int count = specpdl_ptr - specpdl;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1073 Lisp_Object display;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1074 struct ns_display_info *dpyinfo = NULL;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1075 Lisp_Object parent;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1076 struct kboard *kb;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1077 Lisp_Object tfont, tfontsize;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1078 int window_prompting = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1079 int width, height;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1080
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1081 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1082
97047
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1083 /* Seems a little strange, but other terms do it. Perhaps the code below
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1084 is modifying something? */
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1085 parms = Fcopy_alist (parms);
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1086
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1087 display = x_get_arg (dpyinfo, parms, Qterminal, 0, 0, RES_TYPE_STRING);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1088 if (EQ (display, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1089 display = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1090 dpyinfo = check_ns_display_info (display);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1091
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1092 if (!dpyinfo->terminal->name)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1093 error ("Terminal is not live, can't create new frames on it");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1094
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1095 kb = dpyinfo->terminal->kboard;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1096
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1097 name = x_get_arg (dpyinfo, parms, Qname, 0, 0, RES_TYPE_STRING);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1098 if (!STRINGP (name)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1099 && ! EQ (name, Qunbound)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1100 && ! NILP (name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1101 error ("Invalid frame name--not a string or nil");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1102
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1103 if (STRINGP (name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1104 Vx_resource_name = name;
97047
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1105 else
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1106 Vx_resource_name = Vinvocation_name;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1107
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1108 parent = x_get_arg (dpyinfo, parms, Qparent_id, 0, 0, RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1109 if (EQ (parent, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1110 parent = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1111 if (! NILP (parent))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1112 CHECK_NUMBER (parent);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1113
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1114 frame = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1115 GCPRO4 (parms, parent, name, frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1116
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1117 tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer",
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1118 RES_TYPE_SYMBOL);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1119 if (EQ (tem, Qnone) || NILP (tem))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1120 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1121 f = make_frame_without_minibuffer (Qnil, kb, display);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1122 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1123 else if (EQ (tem, Qonly))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1124 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1125 f = make_minibuffer_frame ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1126 minibuffer_only = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1127 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1128 else if (WINDOWP (tem))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1129 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1130 f = make_frame_without_minibuffer (tem, kb, display);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1131 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1132 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1133 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1134 f = make_frame (1);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1135 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1136
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1137 /* Set the name; the functions to which we pass f expect the name to
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1138 be set. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1139 if (EQ (name, Qunbound) || NILP (name) || (XTYPE (name) != Lisp_String))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1140 {
105227
4d1103e3ad15 (ns_set_name_iconic, ns_set_name, ns_set_name_as_filename, x-create-frame, ns-get-resource, ns-set-resource): Use ns_app_name instead of NSProcessInfo call.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105099
diff changeset
1141 f->name = build_string ([ns_app_name UTF8String]);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1142 f->explicit_name =0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1143 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1144 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1145 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1146 f->name = name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1147 f->explicit_name = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1148 specbind (Qx_resource_name, name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1149 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1150
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1151 XSETFRAME (frame, f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1152 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1153
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1154 f->terminal = dpyinfo->terminal;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1155 f->terminal->reference_count++;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1156
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1157 f->output_method = output_ns;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1158 f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
109165
750db9f3e6d8 Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents: 109093
diff changeset
1159 memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns)));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1160
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1161 FRAME_FONTSET (f) = -1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1162
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1163 /* record_unwind_protect (unwind_create_frame, frame); safety; maybe later? */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1164
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1165 f->icon_name = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1166 RES_TYPE_STRING);
97047
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1167 if (! STRINGP (f->icon_name))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1168 f->icon_name = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1169
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1170 FRAME_NS_DISPLAY_INFO (f) = dpyinfo;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1171
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1172 f->output_data.ns->window_desc = desc_ctr++;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1173 if (!NILP (parent))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1174 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1175 f->output_data.ns->parent_desc = (Window) XFASTINT (parent);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1176 f->output_data.ns->explicit_parent = 1;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1177 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1178 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1179 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1180 f->output_data.ns->parent_desc = FRAME_NS_DISPLAY_INFO (f)->root_window;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1181 f->output_data.ns->explicit_parent = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1182 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1183
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1184 f->resx = dpyinfo->resx;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1185 f->resy = dpyinfo->resy;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1186
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1187 BLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1188 register_font_driver (&nsfont_driver, f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1189 x_default_parameter (f, parms, Qfont_backend, Qnil,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1190 "fontBackend", "FontBackend", RES_TYPE_STRING);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1191
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1192 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1193 /* use for default font name */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1194 id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1195 tfontsize = x_default_parameter (f, parms, Qfontsize,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1196 make_number (0 /*(int)[font pointSize]*/),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1197 "fontSize", "FontSize", RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1198 tfont = x_default_parameter (f, parms, Qfont,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1199 build_string ([[font fontName] UTF8String]),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1200 "font", "Font", RES_TYPE_STRING);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1201 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1202 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1203
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1204 x_default_parameter (f, parms, Qborder_width, make_number (0),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1205 "borderwidth", "BorderWidth", RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1206 x_default_parameter (f, parms, Qinternal_border_width, make_number (2),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1207 "internalBorderWidth", "InternalBorderWidth",
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1208 RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1209
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1210 /* default scrollbars on right on Mac */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1211 {
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1212 Lisp_Object spos
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1213 #ifdef NS_IMPL_GNUSTEP
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1214 = Qt;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1215 #else
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1216 = Qright;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1217 #endif
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1218 x_default_parameter (f, parms, Qvertical_scroll_bars, spos,
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1219 "verticalScrollBars", "VerticalScrollBars",
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1220 RES_TYPE_SYMBOL);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1221 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1222 x_default_parameter (f, parms, Qforeground_color, build_string ("Black"),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1223 "foreground", "Foreground", RES_TYPE_STRING);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1224 x_default_parameter (f, parms, Qbackground_color, build_string ("White"),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1225 "background", "Background", RES_TYPE_STRING);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1226 x_default_parameter (f, parms, Qcursor_color, build_string ("grey"),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1227 "cursorColor", "CursorColor", RES_TYPE_STRING);
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1228 /* FIXME: not suppported yet in Nextstep */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1229 x_default_parameter (f, parms, Qline_spacing, Qnil,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1230 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1231 x_default_parameter (f, parms, Qleft_fringe, Qnil,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1232 "leftFringe", "LeftFringe", RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1233 x_default_parameter (f, parms, Qright_fringe, Qnil,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1234 "rightFringe", "RightFringe", RES_TYPE_NUMBER);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1235 /* end PENDING */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1236
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1237 init_frame_faces (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1238
109058
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1239 /* The X resources controlling the menu-bar and tool-bar are
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1240 processed specially at startup, and reflected in the mode
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1241 variables; ignore them here. */
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1242 x_default_parameter (f, parms, Qmenu_bar_lines,
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1243 NILP (Vmenu_bar_mode)
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1244 ? make_number (0) : make_number (1),
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1245 NULL, NULL, RES_TYPE_NUMBER);
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1246 x_default_parameter (f, parms, Qtool_bar_lines,
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1247 NILP (Vtool_bar_mode)
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1248 ? make_number (0) : make_number (1),
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1249 NULL, NULL, RES_TYPE_NUMBER);
2f0720afc474 Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Chong Yidong <cyd@stupidchicken.com>
parents: 108861
diff changeset
1250
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1251 x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate",
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1252 "BufferPredicate", RES_TYPE_SYMBOL);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1253 x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1254 RES_TYPE_STRING);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1255
96763
a27390a84360 change most cases of PENDING to TODO, some to FIXME or XXX
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96759
diff changeset
1256 /* TODO: other terms seem to get away w/o this complexity.. */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1257 if (NILP (Fassq (Qwidth, parms)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1258 {
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1259 Lisp_Object value
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1260 = x_get_arg (dpyinfo, parms, Qwidth, "width", "Width",
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1261 RES_TYPE_NUMBER);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1262 if (! EQ (value, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1263 parms = Fcons (Fcons (Qwidth, value), parms);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1264 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1265 if (NILP (Fassq (Qheight, parms)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1266 {
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1267 Lisp_Object value
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1268 = x_get_arg (dpyinfo, parms, Qheight, "height", "Height",
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1269 RES_TYPE_NUMBER);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1270 if (! EQ (value, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1271 parms = Fcons (Fcons (Qheight, value), parms);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1272 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1273 if (NILP (Fassq (Qleft, parms)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1274 {
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1275 Lisp_Object value
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1276 = x_get_arg (dpyinfo, parms, Qleft, "left", "Left", RES_TYPE_NUMBER);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1277 if (! EQ (value, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1278 parms = Fcons (Fcons (Qleft, value), parms);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1279 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1280 if (NILP (Fassq (Qtop, parms)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1281 {
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1282 Lisp_Object value
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1283 = x_get_arg (dpyinfo, parms, Qtop, "top", "Top", RES_TYPE_NUMBER);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1284 if (! EQ (value, Qunbound))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1285 parms = Fcons (Fcons (Qtop, value), parms);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1286 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1287
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1288 window_prompting = x_figure_window_size (f, parms, 1);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1289
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1290 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1291 f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !EQ (tem, Qnil));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1292
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1293 /* NOTE: on other terms, this is done in set_mouse_color, however this
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1294 was not getting called under Nextstep */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1295 f->output_data.ns->text_cursor = [NSCursor IBeamCursor];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1296 f->output_data.ns->nontext_cursor = [NSCursor arrowCursor];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1297 f->output_data.ns->modeline_cursor = [NSCursor pointingHandCursor];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1298 f->output_data.ns->hand_cursor = [NSCursor pointingHandCursor];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1299 f->output_data.ns->hourglass_cursor = [NSCursor disappearingItemCursor];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1300 f->output_data.ns->horizontal_drag_cursor = [NSCursor resizeLeftRightCursor];
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1301 FRAME_NS_DISPLAY_INFO (f)->vertical_scroll_bar_cursor
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1302 = [NSCursor arrowCursor];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1303 f->output_data.ns->current_pointer = f->output_data.ns->text_cursor;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1304
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1305 [[EmacsView alloc] initFrameFromEmacs: f];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1306
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
1307 x_icon (f, parms);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1308
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1309 /* It is now ok to make the frame official even if we get an error below.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1310 The frame needs to be on Vframe_list or making it visible won't work. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1311 Vframe_list = Fcons (frame, Vframe_list);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1312 /*FRAME_NS_DISPLAY_INFO (f)->reference_count++; */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1313
97047
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1314 x_default_parameter (f, parms, Qicon_type, Qnil, "bitmapIcon", "BitmapIcon",
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1315 RES_TYPE_SYMBOL);
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1316 x_default_parameter (f, parms, Qauto_raise, Qnil, "autoRaise", "AutoRaiseLower",
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1317 RES_TYPE_BOOLEAN);
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1318 x_default_parameter (f, parms, Qauto_lower, Qnil, "autoLower", "AutoLower",
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1319 RES_TYPE_BOOLEAN);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1320 x_default_parameter (f, parms, Qcursor_type, Qbox, "cursorType", "CursorType",
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1321 RES_TYPE_SYMBOL);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1322 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, "scrollBarWidth",
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1323 "ScrollBarWidth", RES_TYPE_NUMBER);
97270
6366d7b348f2 Set the frame parameter alpha to Qnil
Seiji Zenitani <zenitani@mac.com>
parents: 97208
diff changeset
1324 x_default_parameter (f, parms, Qalpha, Qnil, "alpha", "Alpha",
97047
c628dd388bdb code cleanups in NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
1325 RES_TYPE_NUMBER);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1326
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1327 width = FRAME_COLS (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1328 height = FRAME_LINES (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1329
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1330 SET_FRAME_COLS (f, 0);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1331 FRAME_LINES (f) = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1332 change_frame_size (f, height, width, 1, 0, 0);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1333
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1334 if (! f->output_data.ns->explicit_parent)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1335 {
103296
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1336 tem = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1337 if (EQ (tem, Qunbound))
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1338 tem = Qt;
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1339 x_set_visibility (f, tem, Qnil);
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1340 if (EQ (tem, Qicon))
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1341 x_iconify_frame (f);
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1342 else if (! NILP (tem))
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1343 {
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1344 x_make_frame_visible (f);
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1345 f->async_visible = 1;
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1346 [[FRAME_NS_VIEW (f) window] makeKeyWindow];
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1347 }
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1348 else
a23e4364bf6e Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents: 103196
diff changeset
1349 f->async_visible = 0;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1350 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1351
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1352 if (FRAME_HAS_MINIBUF_P (f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1353 && (!FRAMEP (kb->Vdefault_minibuffer_frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1354 || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1355 kb->Vdefault_minibuffer_frame = frame;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1356
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1357 /* All remaining specified parameters, which have not been "used"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1358 by x_get_arg and friends, now go in the misc. alist of the frame. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1359 for (tem = parms; CONSP (tem); tem = XCDR (tem))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1360 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1361 f->param_alist = Fcons (XCAR (tem), f->param_alist);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1362
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1363 UNGCPRO;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1364 Vwindow_list = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1365
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1366 return unbind_to (count, frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1367 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1368
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1369
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1370 DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1371 doc: /* Set the input focus to FRAME.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1372 FRAME nil means use the selected frame. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1373 (Lisp_Object frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1374 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1375 struct frame *f = check_ns_frame (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1376 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1377
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1378 if (dpyinfo->x_focus_frame != f)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1379 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1380 EmacsView *view = FRAME_NS_VIEW (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1381 BLOCK_INPUT;
105099
bb1e824539f2 * nsfns.m (x-focus-frame): Activate the app first.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105088
diff changeset
1382 [NSApp activateIgnoringOtherApps: YES];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1383 [[view window] makeKeyAndOrderFront: view];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1384 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1385 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1386
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1387 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1388 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1389
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1390
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1391 DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1392 0, 1, "",
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1393 doc: /* Pop up the font panel. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1394 (Lisp_Object frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1395 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1396 id fm;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1397 struct frame *f;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1398
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1399 check_ns ();
103341
1cd6f938ca95 nsfns.m (Fns_popup_font_panel): Use shared font manager.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 103296
diff changeset
1400 fm = [NSFontManager sharedFontManager];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1401 if (NILP (frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1402 f = SELECTED_FRAME ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1403 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1404 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1405 CHECK_FRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1406 f = XFRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1407 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1408
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1409 [fm setSelectedFont: ((struct nsfont_info *)f->output_data.ns->font)->nsfont
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1410 isMultiple: NO];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1411 [fm orderFrontFontPanel: NSApp];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1412 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1413 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1414
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1415
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1416 DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1417 0, 1, "",
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1418 doc: /* Pop up the color panel. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1419 (Lisp_Object frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1420 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1421 struct frame *f;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1422
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1423 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1424 if (NILP (frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1425 f = SELECTED_FRAME ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1426 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1427 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1428 CHECK_FRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1429 f = XFRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1430 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1431
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1432 [NSApp orderFrontColorPanel: NSApp];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1433 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1434 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1435
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1436
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1437 DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 4, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1438 doc: /* Use a graphical panel to read a file name, using prompt PROMPT.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1439 Optional arg DIR, if non-nil, supplies a default directory.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1440 Optional arg ISLOAD, if non-nil, means read a file name for saving.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1441 Optional arg INIT, if non-nil, provides a default file name to use. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1442 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object isLoad, Lisp_Object init)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1443 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1444 static id fileDelegate = nil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1445 int ret;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1446 id panel;
102004
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
1447 Lisp_Object fname;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1448
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1449 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1450 [NSString stringWithUTF8String: SDATA (prompt)];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1451 NSString *dirS = NILP (dir) || !STRINGP (dir) ?
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1452 [NSString stringWithUTF8String: SDATA (current_buffer->directory)] :
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1453 [NSString stringWithUTF8String: SDATA (dir)];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1454 NSString *initS = NILP (init) || !STRINGP (init) ? nil :
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1455 [NSString stringWithUTF8String: SDATA (init)];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1456
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1457 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1458
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1459 if (fileDelegate == nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1460 fileDelegate = [EmacsFileDelegate new];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1461
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1462 [NSCursor setHiddenUntilMouseMoves: NO];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1463
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1464 if ([dirS characterAtIndex: 0] == '~')
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1465 dirS = [dirS stringByExpandingTildeInPath];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1466
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1467 panel = NILP (isLoad) ?
97584
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1468 (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1469
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1470 [panel setTitle: promptS];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1471
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1472 /* Puma (10.1) does not have */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1473 if ([panel respondsToSelector: @selector (setAllowsOtherFileTypes:)])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1474 [panel setAllowsOtherFileTypes: YES];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1475
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1476 [panel setTreatsFilePackagesAsDirectories: YES];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1477 [panel setDelegate: fileDelegate];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1478
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1479 panelOK = 0;
102004
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
1480 BLOCK_INPUT;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1481 if (NILP (isLoad))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1482 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1483 ret = [panel runModalForDirectory: dirS file: initS];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1484 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1485 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1486 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1487 [panel setCanChooseDirectories: YES];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1488 ret = [panel runModalForDirectory: dirS file: initS types: nil];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1489 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1490
101356
a7544aafa1e1 * nsfns.m (ns-read-file-name): Fix typo in assignment statement.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101330
diff changeset
1491 ret = (ret == NSOKButton) || panelOK;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1492
102004
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
1493 if (ret)
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
1494 fname = build_string ([[panel filename] UTF8String]);
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1495
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1496 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
102004
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
1497 UNBLOCK_INPUT;
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
1498
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
1499 return ret ? fname : Qnil;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1500 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1501
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1502
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1503 DEFUN ("ns-get-resource", Fns_get_resource, Sns_get_resource, 2, 2, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1504 doc: /* Return the value of the property NAME of OWNER from the defaults database.
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1505 If OWNER is nil, Emacs is assumed. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1506 (Lisp_Object owner, Lisp_Object name)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1507 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1508 const char *value;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1509
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1510 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1511 if (NILP (owner))
105227
4d1103e3ad15 (ns_set_name_iconic, ns_set_name, ns_set_name_as_filename, x-create-frame, ns-get-resource, ns-set-resource): Use ns_app_name instead of NSProcessInfo call.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105099
diff changeset
1512 owner = build_string([ns_app_name UTF8String]);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1513 CHECK_STRING (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1514 /*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1515
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1516 value =[[[NSUserDefaults standardUserDefaults]
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1517 objectForKey: [NSString stringWithUTF8String: SDATA (name)]]
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1518 UTF8String];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1519
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1520 if (value)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1521 return build_string (value);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1522 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1523 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1524
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1525
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1526 DEFUN ("ns-set-resource", Fns_set_resource, Sns_set_resource, 3, 3, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1527 doc: /* Set property NAME of OWNER to VALUE, from the defaults database.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1528 If OWNER is nil, Emacs is assumed.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1529 If VALUE is nil, the default is removed. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1530 (Lisp_Object owner, Lisp_Object name, Lisp_Object value)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1531 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1532 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1533 if (NILP (owner))
105227
4d1103e3ad15 (ns_set_name_iconic, ns_set_name, ns_set_name_as_filename, x-create-frame, ns-get-resource, ns-set-resource): Use ns_app_name instead of NSProcessInfo call.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105099
diff changeset
1534 owner = build_string ([ns_app_name UTF8String]);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1535 CHECK_STRING (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1536 if (NILP (value))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1537 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1538 [[NSUserDefaults standardUserDefaults] removeObjectForKey:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1539 [NSString stringWithUTF8String: SDATA (name)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1540 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1541 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1542 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1543 CHECK_STRING (value);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1544 [[NSUserDefaults standardUserDefaults] setObject:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1545 [NSString stringWithUTF8String: SDATA (value)]
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1546 forKey: [NSString stringWithUTF8String:
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1547 SDATA (name)]];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1548 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1549
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1550 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1551 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1552
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1553
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
1554 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
1555 Sx_server_max_request_size,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1556 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1557 doc: /* This function is a no-op. It is only present for completeness. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1558 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1559 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1560 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1561 /* This function has no real equivalent under NeXTstep. Return nil to
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1562 indicate this. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1563 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1564 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1565
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1566
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1567 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1568 doc: /* Return the vendor ID string of Nextstep display server DISPLAY.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1569 DISPLAY should be either a frame or a display name (a string).
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1570 If omitted or nil, the selected frame's display is used. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1571 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1572 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1573 #ifdef NS_IMPL_GNUSTEP
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1574 return build_string ("GNU");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1575 #else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1576 return build_string ("Apple");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1577 #endif
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1578 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1579
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1580
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1581 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
100802
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1582 doc: /* Return the version numbers of the server of DISPLAY.
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1583 The value is a list of three integers: the major and minor
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1584 version numbers of the X Protocol in use, and the distributor-specific
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1585 release number. See also the function `x-server-vendor'.
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1586
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1587 The optional argument DISPLAY specifies which display to ask about.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1588 DISPLAY should be either a frame or a display name (a string).
100802
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1589 If omitted or nil, that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1590 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1591 {
100802
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1592 /*NOTE: it is unclear what would best correspond with "protocol";
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1593 we return 10.3, meaning Panther, since this is roughly the
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1594 level that GNUstep's APIs correspond to.
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1595 The last number is where we distinguish between the Apple
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1596 and GNUstep implementations ("distributor-specific release
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1597 number") and give int'ized versions of major.minor. */
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1598 return Fcons (make_number (10),
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1599 Fcons (make_number (3),
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
1600 Fcons (make_number (ns_appkit_version_int()), Qnil)));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1601 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1602
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1603
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1604 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1605 doc: /* Return the number of screens on Nextstep display server DISPLAY.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1606 DISPLAY should be a frame, the display name as a string, or a terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1607 If omitted or nil, the selected frame's display is used. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1608 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1609 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1610 int num;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1611
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1612 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1613 num = [[NSScreen screens] count];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1614
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1615 return (num != 0) ? make_number (num) : Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1616 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1617
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1618
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1619 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1620 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1621 doc: /* Return the height of Nextstep display server DISPLAY, in millimeters.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1622 DISPLAY should be a frame, the display name as a string, or a terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1623 If omitted or nil, the selected frame's display is used. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1624 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1625 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1626 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1627 return make_number ((int)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1628 ([ns_get_screen (display) frame].size.height/(92.0/25.4)));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1629 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1630
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1631
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1632 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1633 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1634 doc: /* Return the width of Nextstep display server DISPLAY, in millimeters.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1635 DISPLAY should be a frame, the display name as a string, or a terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1636 If omitted or nil, the selected frame's display is used. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1637 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1638 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1639 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1640 return make_number ((int)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1641 ([ns_get_screen (display) frame].size.width/(92.0/25.4)));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1642 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1643
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1644
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1645 DEFUN ("x-display-backing-store", Fx_display_backing_store,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1646 Sx_display_backing_store, 0, 1, 0,
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1647 doc: /* Return whether the Nexstep display DISPLAY supports backing store.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1648 The value may be `buffered', `retained', or `non-retained'.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1649 DISPLAY should be a frame, the display name as a string, or a terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1650 If omitted or nil, the selected frame's display is used. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1651 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1652 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1653 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1654 switch ([ns_get_window (display) backingType])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1655 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1656 case NSBackingStoreBuffered:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1657 return intern ("buffered");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1658 case NSBackingStoreRetained:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1659 return intern ("retained");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1660 case NSBackingStoreNonretained:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1661 return intern ("non-retained");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1662 default:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1663 error ("Strange value for backingType parameter of frame");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1664 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1665 return Qnil; /* not reached, shut compiler up */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1666 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1667
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1668
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1669 DEFUN ("x-display-visual-class", Fx_display_visual_class,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1670 Sx_display_visual_class, 0, 1, 0,
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1671 doc: /* Return the visual class of the Nextstep display server DISPLAY.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1672 The value is one of the symbols `static-gray', `gray-scale',
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1673 `static-color', `pseudo-color', `true-color', or `direct-color'.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1674 DISPLAY should be a frame, the display name as a string, or a terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1675 If omitted or nil, the selected frame's display is used. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1676 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1677 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1678 NSWindowDepth depth;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1679 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1680 depth = [ns_get_screen (display) depth];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1681
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1682 if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1683 return intern ("static-gray");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1684 else if (depth == NSBestDepth (NSCalibratedWhiteColorSpace, 8, 8, YES, NULL))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1685 return intern ("gray-scale");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1686 else if ( depth == NSBestDepth (NSCalibratedRGBColorSpace, 8, 8, YES, NULL))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1687 return intern ("pseudo-color");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1688 else if ( depth == NSBestDepth (NSCalibratedRGBColorSpace, 4, 12, NO, NULL))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1689 return intern ("true-color");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1690 else if ( depth == NSBestDepth (NSCalibratedRGBColorSpace, 8, 24, NO, NULL))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1691 return intern ("direct-color");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1692 else
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1693 /* color mgmt as far as we do it is really handled by Nextstep itself anyway */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1694 return intern ("direct-color");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1695 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1696
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1697
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1698 DEFUN ("x-display-save-under", Fx_display_save_under,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1699 Sx_display_save_under, 0, 1, 0,
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1700 doc: /* Non-nil if the Nextstep display server supports the save-under feature.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1701 The optional argument DISPLAY specifies which display to ask about.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1702 DISPLAY should be a frame, the display name as a string, or a terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1703 If omitted or nil, the selected frame's display is used. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1704 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1705 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1706 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1707 switch ([ns_get_window (display) backingType])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1708 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1709 case NSBackingStoreBuffered:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1710 return Qt;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1711
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1712 case NSBackingStoreRetained:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1713 case NSBackingStoreNonretained:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1714 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1715
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1716 default:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1717 error ("Strange value for backingType parameter of frame");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1718 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1719 return Qnil; /* not reached, shut compiler up */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1720 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1721
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1722
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1723 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1724 1, 3, 0,
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1725 doc: /* Open a connection to a Nextstep display server.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1726 DISPLAY is the name of the display to connect to.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1727 Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1728 (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1729 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1730 struct ns_display_info *dpyinfo;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1731
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1732 CHECK_STRING (display);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1733
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1734 nxatoms_of_nsselect ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1735 dpyinfo = ns_term_init (display);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1736 if (dpyinfo == 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1737 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1738 if (!NILP (must_succeed))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1739 fatal ("OpenStep on %s not responding.\n",
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1740 SDATA (display));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1741 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1742 error ("OpenStep on %s not responding.\n",
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1743 SDATA (display));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1744 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1745
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1746 /* Register our external input/output types, used for determining
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1747 applicable services and also drag/drop eligibility. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1748 ns_send_types = [[NSArray arrayWithObject: NSStringPboardType] retain];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1749 ns_return_types = [[NSArray arrayWithObject: NSStringPboardType] retain];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1750 ns_drag_types = [[NSArray arrayWithObjects:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1751 NSStringPboardType,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1752 NSTabularTextPboardType,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1753 NSFilenamesPboardType,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1754 NSURLPboardType,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1755 NSColorPboardType,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1756 NSFontPboardType, nil] retain];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1757
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1758 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1759 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1760
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1761
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1762 DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1763 1, 1, 0,
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1764 doc: /* Close the connection to the current Nextstep display server.
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1765 The argument DISPLAY is currently ignored. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1766 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1767 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1768 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1769 /*ns_delete_terminal (dpyinfo->terminal); */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1770 [NSApp terminate: NSApp];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1771 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1772 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1773
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1774
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
1775 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1776 doc: /* Return the list of display names that Emacs has connections to. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1777 (void)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1778 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1779 Lisp_Object tail, result;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1780
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1781 result = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1782 for (tail = ns_display_name_list; CONSP (tail); tail = XCDR (tail))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1783 result = Fcons (XCAR (XCAR (tail)), result);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1784
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1785 return result;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1786 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1787
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1788
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1789 DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1790 0, 0, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1791 doc: /* Hides all applications other than Emacs. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1792 (void)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1793 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1794 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1795 [NSApp hideOtherApplications: NSApp];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1796 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1797 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1798
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1799 DEFUN ("ns-hide-emacs", Fns_hide_emacs, Sns_hide_emacs,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1800 1, 1, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1801 doc: /* If ON is non-nil, the entire Emacs application is hidden.
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1802 Otherwise if Emacs is hidden, it is unhidden.
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1803 If ON is equal to `activate', Emacs is unhidden and becomes
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1804 the active application. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1805 (Lisp_Object on)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1806 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1807 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1808 if (EQ (on, intern ("activate")))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1809 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1810 [NSApp unhide: NSApp];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1811 [NSApp activateIgnoringOtherApps: YES];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1812 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1813 else if (NILP (on))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1814 [NSApp unhide: NSApp];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1815 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1816 [NSApp hide: NSApp];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1817 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1818 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1819
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1820
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1821 DEFUN ("ns-emacs-info-panel", Fns_emacs_info_panel, Sns_emacs_info_panel,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1822 0, 0, 0,
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1823 doc: /* Shows the 'Info' or 'About' panel for Emacs. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1824 (void)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1825 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1826 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1827 [NSApp orderFrontStandardAboutPanel: nil];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1828 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1829 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1830
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1831
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1832 DEFUN ("ns-font-name", Fns_font_name, Sns_font_name, 1, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1833 doc: /* Determine font postscript or family name for font NAME.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1834 NAME should be a string containing either the font name or an XLFD
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1835 font descriptor. If string contains `fontset' and not
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1836 `fontset-startup', it is left alone. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1837 (Lisp_Object name)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1838 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1839 char *nm;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1840 CHECK_STRING (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1841 nm = SDATA (name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1842
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1843 if (nm[0] != '-')
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1844 return name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1845 if (strstr (nm, "fontset") && !strstr (nm, "fontset-startup"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1846 return name;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1847
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1848 return build_string (ns_xlfd_to_fontname (SDATA (name)));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1849 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1850
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1851
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1852 DEFUN ("ns-list-colors", Fns_list_colors, Sns_list_colors, 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1853 doc: /* Return a list of all available colors.
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1854 The optional argument FRAME is currently ignored. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1855 (Lisp_Object frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1856 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1857 Lisp_Object list = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1858 NSEnumerator *colorlists;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1859 NSColorList *clist;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1860
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1861 if (!NILP (frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1862 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1863 CHECK_FRAME (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1864 if (! FRAME_NS_P (XFRAME (frame)))
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1865 error ("non-Nextstep frame used in `ns-list-colors'");
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1866 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1867
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1868 BLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1869
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1870 colorlists = [[NSColorList availableColorLists] objectEnumerator];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1871 while (clist = [colorlists nextObject])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1872 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1873 if ([[clist name] length] < 7 ||
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1874 [[clist name] rangeOfString: @"PANTONE"].location == 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1875 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1876 NSEnumerator *cnames = [[clist allKeys] reverseObjectEnumerator];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1877 NSString *cname;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1878 while (cname = [cnames nextObject])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1879 list = Fcons (build_string ([cname UTF8String]), list);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1880 /* for (i = [[clist allKeys] count] - 1; i >= 0; i--)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1881 list = Fcons (build_string ([[[clist allKeys] objectAtIndex: i]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1882 UTF8String]), list); */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1883 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1884 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1885
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1886 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1887
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1888 return list;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1889 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1890
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1891
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1892 DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1893 doc: /* List available Nextstep services by querying NSApp. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1894 (void)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1895 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1896 Lisp_Object ret = Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1897 NSMenu *svcs;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1898 id delegate;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1899
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1900 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1901 svcs = [[NSMenu alloc] initWithTitle: @"Services"];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1902 [NSApp setServicesMenu: svcs]; /* this and next rebuild on <10.4 */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1903 [NSApp registerServicesMenuSendTypes: ns_send_types
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1904 returnTypes: ns_return_types];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1905
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1906 /* On Tiger, services menu updating was made lazier (waits for user to
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1907 actually click on the menu), so we have to force things along: */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1908 #ifdef NS_IMPL_COCOA
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1909 if (NSAppKitVersionNumber >= 744.0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1910 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1911 delegate = [svcs delegate];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1912 if (delegate != nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1913 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1914 if ([delegate respondsToSelector: @selector (menuNeedsUpdate:)])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1915 [delegate menuNeedsUpdate: svcs];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1916 if ([delegate respondsToSelector:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1917 @selector (menu:updateItem:atIndex:shouldCancel:)])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1918 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1919 int i, len = [delegate numberOfItemsInMenu: svcs];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1920 for (i =0; i<len; i++)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1921 [svcs addItemWithTitle: @"" action: NULL keyEquivalent: @""];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1922 for (i =0; i<len; i++)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1923 if (![delegate menu: svcs
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1924 updateItem: (NSMenuItem *)[svcs itemAtIndex: i]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1925 atIndex: i shouldCancel: NO])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1926 break;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1927 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1928 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1929 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1930 #endif
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1931
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1932 [svcs setAutoenablesItems: NO];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1933 #ifdef NS_IMPL_COCOA
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1934 [svcs update]; /* on OS X, converts from '/' structure */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1935 #endif
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1936
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1937 ret = interpret_services_menu (svcs, Qnil, ret);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1938 return ret;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1939 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1940
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1941
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1942 DEFUN ("ns-perform-service", Fns_perform_service, Sns_perform_service,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1943 2, 2, 0,
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1944 doc: /* Perform Nextstep SERVICE on SEND.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1945 SEND should be either a string or nil.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
1946 The return value is the result of the service, as string, or nil if
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
1947 there was no result. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1948 (Lisp_Object service, Lisp_Object send)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1949 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1950 id pb;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1951 NSString *svcName;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1952 char *utfStr;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1953 int len;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1954
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1955 CHECK_STRING (service);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1956 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1957
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
1958 utfStr = SDATA (service);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1959 svcName = [NSString stringWithUTF8String: utfStr];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1960
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1961 pb =[NSPasteboard pasteboardWithUniqueName];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1962 ns_string_to_pasteboard (pb, send);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1963
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1964 if (NSPerformService (svcName, pb) == NO)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1965 Fsignal (Qquit, Fcons (build_string ("service not available"), Qnil));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1966
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1967 if ([[pb types] count] == 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1968 return build_string ("");
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1969 return ns_string_from_pasteboard (pb);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1970 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1971
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1972
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1973 DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1974 Sns_convert_utf8_nfd_to_nfc, 1, 1, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
1975 doc: /* Return an NFC string that matches the UTF-8 NFD string STR. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1976 (Lisp_Object str)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1977 {
97584
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1978 /* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping,
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1979 remove this. */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1980 NSString *utfStr;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1981
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1982 CHECK_STRING (str);
97584
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1983 utfStr = [NSString stringWithUTF8String: SDATA (str)];
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1984 if (![utfStr respondsToSelector:
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1985 @selector (precomposedStringWithCanonicalMapping)])
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1986 {
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1987 message1
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1988 ("Warning: ns-convert-utf8-nfd-to-nfc unsupported under GNUstep.\n");
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1989 return Qnil;
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1990 }
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1991 else
06f7d5858c5a * nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97568
diff changeset
1992 utfStr = [utfStr precomposedStringWithCanonicalMapping];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1993 return build_string ([utfStr UTF8String]);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1994 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1995
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1996
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
1997 #ifdef NS_IMPL_COCOA
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
1998
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
1999 /* Compile and execute the AppleScript SCRIPT and return the error
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2000 status as function value. A zero is returned if compilation and
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2001 execution is successful, in which case *RESULT is set to a Lisp
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2002 string or a number containing the resulting script value. Otherwise,
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2003 1 is returned. */
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2004 static int
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2005 ns_do_applescript (Lisp_Object script, Lisp_Object *result)
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2006 {
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2007 NSAppleEventDescriptor *desc;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2008 NSDictionary* errorDict;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2009 NSAppleEventDescriptor* returnDescriptor = NULL;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2010
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2011 NSAppleScript* scriptObject =
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2012 [[NSAppleScript alloc] initWithSource:
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2013 [NSString stringWithUTF8String: SDATA (script)]];
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2014
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2015 returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2016 [scriptObject release];
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2017
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2018 *result = Qnil;
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2019
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2020 if (returnDescriptor != NULL)
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2021 {
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2022 // successful execution
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2023 if (kAENullEvent != [returnDescriptor descriptorType])
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2024 {
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2025 *result = Qt;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2026 // script returned an AppleScript result
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2027 if ((typeUnicodeText == [returnDescriptor descriptorType]) ||
101330
eca9795f3903 * nsterm.h (EmacsApp-setAppleMenu:): Conditionalize more correctly on Tiger. * nsfns.m (ns_do_applescript): Conditionalize typeUTF16ExternalRepresentation on Tiger.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100951
diff changeset
2028 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2029 (typeUTF16ExternalRepresentation
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2030 == [returnDescriptor descriptorType]) ||
101330
eca9795f3903 * nsterm.h (EmacsApp-setAppleMenu:): Conditionalize more correctly on Tiger. * nsfns.m (ns_do_applescript): Conditionalize typeUTF16ExternalRepresentation on Tiger.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100951
diff changeset
2031 #endif
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2032 (typeUTF8Text == [returnDescriptor descriptorType]) ||
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2033 (typeCString == [returnDescriptor descriptorType]))
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2034 {
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2035 desc = [returnDescriptor coerceToDescriptorType: typeUTF8Text];
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2036 if (desc)
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2037 *result = build_string([[desc stringValue] UTF8String]);
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2038 }
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2039 else
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2040 {
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2041 /* use typeUTF16ExternalRepresentation? */
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2042 // coerce the result to the appropriate ObjC type
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2043 desc = [returnDescriptor coerceToDescriptorType: typeUTF8Text];
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2044 if (desc)
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2045 *result = make_number([desc int32Value]);
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2046 }
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2047 }
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2048 }
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2049 else
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2050 {
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2051 // no script result, return error
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2052 return 1;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2053 }
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2054 return 0;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2055 }
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2056
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2057 DEFUN ("ns-do-applescript", Fns_do_applescript, Sns_do_applescript, 1, 1, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2058 doc: /* Execute AppleScript SCRIPT and return the result.
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2059 If compilation and execution are successful, the resulting script value
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2060 is returned as a string, a number or, in the case of other constructs, t.
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2061 In case the execution fails, an error is signaled. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2062 (Lisp_Object script)
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2063 {
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2064 Lisp_Object result;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2065 long status;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2066
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2067 CHECK_STRING (script);
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2068 check_ns ();
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2069
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2070 BLOCK_INPUT;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2071 status = ns_do_applescript (script, &result);
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2072 UNBLOCK_INPUT;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2073 if (status == 0)
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2074 return result;
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2075 else if (!STRINGP (result))
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2076 error ("AppleScript error %d", status);
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2077 else
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2078 error ("%s", SDATA (result));
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2079 }
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2080 #endif
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2081
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2082
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2083
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2084 /* ==========================================================================
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2085
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2086 Miscellaneous functions not called through hooks
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2087
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2088 ========================================================================== */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2089
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2090
101357
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
2091 /* called from image.c */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2092 FRAME_PTR
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2093 check_x_frame (Lisp_Object frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2094 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2095 return check_ns_frame (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2096 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2097
101357
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
2098
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
2099 /* called from frame.c */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2100 struct ns_display_info *
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2101 check_x_display_info (Lisp_Object frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2102 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2103 return check_ns_display_info (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2104 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2105
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2106
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2107 void
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2108 x_set_scroll_bar_default_width (struct frame *f)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2109 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2110 int wid = FRAME_COLUMN_WIDTH (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2111 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = NS_SCROLL_BAR_WIDTH_DEFAULT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2112 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) +
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2113 wid - 1) / wid;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2114 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2115
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2116
101357
64413c753b62 Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101356
diff changeset
2117 /* terms impl this instead of x-get-resource directly */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2118 const char *
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2119 x_get_string_resource (XrmDatabase rdb, char *name, char *class)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2120 {
96763
a27390a84360 change most cases of PENDING to TODO, some to FIXME or XXX
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96759
diff changeset
2121 /* remove appname prefix; TODO: allow for !="Emacs" */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2122 char *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2123 const char *res;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2124 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2125
105085
767bf46c924d (x_get_string_resource): Ape just-previous changes to other platform versions. Drop support for emacs-20-style face specs.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 104372
diff changeset
2126 if (inhibit_x_resources)
767bf46c924d (x_get_string_resource): Ape just-previous changes to other platform versions. Drop support for emacs-20-style face specs.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 104372
diff changeset
2127 /* --quick was passed, so this is a no-op. */
767bf46c924d (x_get_string_resource): Ape just-previous changes to other platform versions. Drop support for emacs-20-style face specs.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 104372
diff changeset
2128 return NULL;
767bf46c924d (x_get_string_resource): Ape just-previous changes to other platform versions. Drop support for emacs-20-style face specs.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 104372
diff changeset
2129
767bf46c924d (x_get_string_resource): Ape just-previous changes to other platform versions. Drop support for emacs-20-style face specs.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 104372
diff changeset
2130 res = [[[NSUserDefaults standardUserDefaults] objectForKey:
767bf46c924d (x_get_string_resource): Ape just-previous changes to other platform versions. Drop support for emacs-20-style face specs.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 104372
diff changeset
2131 [NSString stringWithUTF8String: toCheck]] UTF8String];
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2132 return !res ? NULL :
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2133 (!strncasecmp (res, "YES", 3) ? "true" :
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2134 (!strncasecmp (res, "NO", 2) ? "false" : res));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2135 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2136
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2137
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2138 Lisp_Object
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2139 x_get_focus_frame (struct frame *frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2140 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2141 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2142 Lisp_Object nsfocus;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2143
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2144 if (!dpyinfo->x_focus_frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2145 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2146
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2147 XSETFRAME (nsfocus, dpyinfo->x_focus_frame);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2148 return nsfocus;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2149 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2150
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2151
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2152 int
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2153 x_pixel_width (struct frame *f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2154 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2155 return FRAME_PIXEL_WIDTH (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2156 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2157
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2158
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2159 int
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2160 x_pixel_height (struct frame *f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2161 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2162 return FRAME_PIXEL_HEIGHT (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2163 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2164
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2165
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2166 int
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2167 x_char_width (struct frame *f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2168 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2169 return FRAME_COLUMN_WIDTH (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2170 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2171
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2172
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2173 int
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2174 x_char_height (struct frame *f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2175 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2176 return FRAME_LINE_HEIGHT (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2177 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2178
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2179
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2180 int
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2181 x_screen_planes (struct frame *f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2182 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2183 return FRAME_NS_DISPLAY_INFO (f)->n_planes;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2184 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2185
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2186
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2187 void
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2188 x_sync (struct frame *f)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2189 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2190 /* XXX Not implemented XXX */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2191 return;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2192 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2193
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2194
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2195
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2196 /* ==========================================================================
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2197
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2198 Lisp definitions that, for whatever reason, we can't alias as 'ns-XXX'.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2199
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2200 ========================================================================== */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2201
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2202
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2203 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2204 doc: /* Return t if the current Nextstep display supports the color COLOR.
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2205 The optional argument FRAME is currently ignored. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2206 (Lisp_Object color, Lisp_Object frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2207 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2208 NSColor * col;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2209 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2210 return ns_lisp_to_color (color, &col) ? Qnil : Qt;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2211 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2212
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2213
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2214 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
104372
c1f72ea59c48 (Fxw_color_values): Return 3-element list. Doc fix.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 103929
diff changeset
2215 doc: /* Internal function called by `color-values', which see. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2216 (Lisp_Object color, Lisp_Object frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2217 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2218 NSColor * col;
105557
cbe7f8a45067 (xw-color-values): Use CGFloat where appropriate.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105227
diff changeset
2219 CGFloat red, green, blue, alpha;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2220
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2221 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2222 CHECK_STRING (color);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2223
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2224 if (ns_lisp_to_color (color, &col))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2225 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2226
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2227 [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2228 getRed: &red green: &green blue: &blue alpha: &alpha];
104372
c1f72ea59c48 (Fxw_color_values): Return 3-element list. Doc fix.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 103929
diff changeset
2229 return list3 (make_number (lrint (red*65280)),
c1f72ea59c48 (Fxw_color_values): Return 3-element list. Doc fix.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 103929
diff changeset
2230 make_number (lrint (green*65280)),
c1f72ea59c48 (Fxw_color_values): Return 3-element list. Doc fix.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 103929
diff changeset
2231 make_number (lrint (blue*65280)));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2232 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2233
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2234
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2235 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2236 doc: /* Return t if the Nextstep display supports color.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2237 The optional argument DISPLAY specifies which display to ask about.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2238 DISPLAY should be either a frame, a display name (a string), or terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2239 If omitted or nil, that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2240 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2241 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2242 NSWindowDepth depth;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2243 NSString *colorSpace;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2244 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2245 depth = [ns_get_screen (display) depth];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2246 colorSpace = NSColorSpaceFromDepth (depth);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2247
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2248 return [colorSpace isEqualToString: NSDeviceWhiteColorSpace]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2249 || [colorSpace isEqualToString: NSCalibratedWhiteColorSpace]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2250 ? Qnil : Qt;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2251 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2252
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2253
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2254 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2255 Sx_display_grayscale_p, 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2256 doc: /* Return t if the Nextstep display supports shades of gray.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2257 Note that color displays do support shades of gray.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2258 The optional argument DISPLAY specifies which display to ask about.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2259 DISPLAY should be either a frame, a display name (a string), or terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2260 If omitted or nil, that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2261 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2262 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2263 NSWindowDepth depth;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2264 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2265 depth = [ns_get_screen (display) depth];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2266
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2267 return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2268 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2269
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2270
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2271 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2272 0, 1, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2273 doc: /* Return the width in pixels of the Nextstep display DISPLAY.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2274 The optional argument DISPLAY specifies which display to ask about.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2275 DISPLAY should be either a frame, a display name (a string), or terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2276 If omitted or nil, that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2277 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2278 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2279 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2280 return make_number ((int) [ns_get_screen (display) frame].size.width);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2281 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2282
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2283
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2284 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2285 Sx_display_pixel_height, 0, 1, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2286 doc: /* Return the height in pixels of the Nextstep display DISPLAY.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2287 The optional argument DISPLAY specifies which display to ask about.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2288 DISPLAY should be either a frame, a display name (a string), or terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2289 If omitted or nil, that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2290 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2291 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2292 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2293 return make_number ((int) [ns_get_screen (display) frame].size.height);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2294 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2295
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2296
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2297 DEFUN ("display-usable-bounds", Fns_display_usable_bounds,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2298 Sns_display_usable_bounds, 0, 1, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2299 doc: /* Return the bounds of the usable part of the screen.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2300 The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2301 are the boundaries of the usable part of the screen, excluding areas
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2302 reserved for the Mac menu, dock, and so forth.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2303
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2304 The screen queried corresponds to DISPLAY, which should be either a
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2305 frame, a display name (a string), or terminal ID. If omitted or nil,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2306 that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2307 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2308 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2309 int top;
106753
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2310 NSScreen *screen;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2311 NSRect vScreen;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2312
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2313 check_ns ();
106753
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2314 screen = ns_get_screen (display);
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2315 if (!screen)
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2316 return Qnil;
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2317
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2318 vScreen = [screen visibleFrame];
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2319
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2320 /* NS coordinate system is upside-down.
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2321 Transform to screen-specific coordinates. */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2322 return list4 (make_number ((int) vScreen.origin.x),
106753
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2323 make_number ((int) [screen frame].size.height
16b52378e95a NS fixes for Bug#3233.
Chong Yidong <cyd@stupidchicken.com>
parents: 105751
diff changeset
2324 - vScreen.size.height - vScreen.origin.y),
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2325 make_number ((int) vScreen.size.width),
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2326 make_number ((int) vScreen.size.height));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2327 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2328
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2329
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2330 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2331 0, 1, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2332 doc: /* Return the number of bitplanes of the Nextstep display DISPLAY.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2333 The optional argument DISPLAY specifies which display to ask about.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2334 DISPLAY should be either a frame, a display name (a string), or terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2335 If omitted or nil, that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2336 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2337 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2338 check_ns ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2339 return make_number
103196
e0a85c405ceb * nsfns.m (Fx_display_planes): Compute bitplanes using
Chong Yidong <cyd@stupidchicken.com>
parents: 103163
diff changeset
2340 (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth]));
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2341 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2342
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2343
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2344 DEFUN ("x-display-color-cells", Fx_display_color_cells,
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2345 Sx_display_color_cells, 0, 1, 0,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2346 doc: /* Returns the number of color cells of the Nextstep display DISPLAY.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2347 The optional argument DISPLAY specifies which display to ask about.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2348 DISPLAY should be either a frame, a display name (a string), or terminal ID.
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2349 If omitted or nil, that stands for the selected frame's display. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2350 (Lisp_Object display)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2351 {
109071
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
2352 struct ns_display_info *dpyinfo;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2353 check_ns ();
109071
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
2354
8c3d79992849 Fix some compilation errors in nsfns.c
Jan D <jan.h.d@swipnet.se>
parents: 109058
diff changeset
2355 dpyinfo = check_ns_display_info (display);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2356 /* We force 24+ bit depths to 24-bit to prevent an overflow. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2357 return make_number (1 << min (dpyinfo->n_planes, 24));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2358 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2359
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2360
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2361 /* Unused dummy def needed for compatibility. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2362 Lisp_Object tip_frame;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2363
96763
a27390a84360 change most cases of PENDING to TODO, some to FIXME or XXX
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96759
diff changeset
2364 /* TODO: move to xdisp or similar */
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2365 static void
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2366 compute_tip_xy (struct frame *f,
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2367 Lisp_Object parms,
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2368 Lisp_Object dx,
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2369 Lisp_Object dy,
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2370 int width,
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2371 int height,
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2372 int *root_x,
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2373 int *root_y)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2374 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2375 Lisp_Object left, top;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2376 EmacsView *view = FRAME_NS_VIEW (f);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2377 NSPoint pt;
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2378
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2379 /* Start with user-specified or mouse position. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2380 left = Fcdr (Fassq (Qleft, parms));
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2381 top = Fcdr (Fassq (Qtop, parms));
109093
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2382
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2383 if (!INTEGERP (left) || !INTEGERP (top))
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2384 {
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2385 pt = last_mouse_motion_position;
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2386 /* Convert to screen coordinates */
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2387 pt = [view convertPoint: pt toView: nil];
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2388 pt = [[view window] convertBaseToScreen: pt];
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2389 }
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2390 else
109093
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2391 {
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2392 /* Absolute coordinates. */
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2393 pt.x = XINT (left);
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2394 pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top)
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2395 - height;
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2396 }
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2397
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2398 /* Ensure in bounds. (Note, screen origin = lower left.) */
109093
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2399 if (INTEGERP (left))
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2400 *root_x = pt.x;
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2401 else if (pt.x + XINT (dx) <= 0)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2402 *root_x = 0; /* Can happen for negative dx */
98298
6a64532bbc7b (compute_tip_xy): Use x_display_pixel_width and
Chong Yidong <cyd@stupidchicken.com>
parents: 97584
diff changeset
2403 else if (pt.x + XINT (dx) + width
6a64532bbc7b (compute_tip_xy): Use x_display_pixel_width and
Chong Yidong <cyd@stupidchicken.com>
parents: 97584
diff changeset
2404 <= x_display_pixel_width (FRAME_NS_DISPLAY_INFO (f)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2405 /* It fits to the right of the pointer. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2406 *root_x = pt.x + XINT (dx);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2407 else if (width + XINT (dx) <= pt.x)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2408 /* It fits to the left of the pointer. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2409 *root_x = pt.x - width - XINT (dx);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2410 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2411 /* Put it left justified on the screen -- it ought to fit that way. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2412 *root_x = 0;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2413
109093
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2414 if (INTEGERP (top))
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2415 *root_y = pt.y;
8c569638df0f * nsfns.m (compute_tip_xy): Do not convert coordinates from frame parameters.
Jan D <jan.h.d@swipnet.se>
parents: 109071
diff changeset
2416 else if (pt.y - XINT (dy) - height >= 0)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2417 /* It fits below the pointer. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2418 *root_y = pt.y - height - XINT (dy);
98298
6a64532bbc7b (compute_tip_xy): Use x_display_pixel_width and
Chong Yidong <cyd@stupidchicken.com>
parents: 97584
diff changeset
2419 else if (pt.y + XINT (dy) + height
6a64532bbc7b (compute_tip_xy): Use x_display_pixel_width and
Chong Yidong <cyd@stupidchicken.com>
parents: 97584
diff changeset
2420 <= x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2421 /* It fits above the pointer */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2422 *root_y = pt.y + XINT (dy);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2423 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2424 /* Put it on the top. */
98298
6a64532bbc7b (compute_tip_xy): Use x_display_pixel_width and
Chong Yidong <cyd@stupidchicken.com>
parents: 97584
diff changeset
2425 *root_y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - height;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2426 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2427
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2428
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2429 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
102509
85392f94785a * nsfns.m (Fx_close_connection): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 102468
diff changeset
2430 doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2431 A tooltip window is a small window displaying a string.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2432
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2433 FRAME nil or omitted means use the selected frame.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2434
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2435 PARMS is an optional list of frame parameters which can be used to
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2436 change the tooltip's appearance.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2437
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2438 Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2439 means use the default timeout of 5 seconds.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2440
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2441 If the list of frame parameters PARMS contains a `left' parameter,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2442 the tooltip is displayed at that x-position. Otherwise it is
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2443 displayed at the mouse position, with offset DX added (default is 5 if
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2444 DX isn't specified). Likewise for the y-position; if a `top' frame
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2445 parameter is specified, it determines the y-position of the tooltip
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2446 window, otherwise it is displayed at the mouse position, with offset
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2447 DY added (default is -10).
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2448
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2449 A tooltip's maximum size is specified by `x-max-tooltip-size'.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2450 Text larger than the specified size is clipped. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2451 (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2452 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2453 int root_x, root_y;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2454 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2455 int count = SPECPDL_INDEX ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2456 struct frame *f;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2457 char *str;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2458 NSSize size;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2459
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2460 specbind (Qinhibit_redisplay, Qt);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2461
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2462 GCPRO4 (string, parms, frame, timeout);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2463
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2464 CHECK_STRING (string);
96759
1e2f7aab70ba * Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96692
diff changeset
2465 str = SDATA (string);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2466 f = check_x_frame (frame);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2467 if (NILP (timeout))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2468 timeout = make_number (5);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2469 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2470 CHECK_NATNUM (timeout);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2471
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2472 if (NILP (dx))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2473 dx = make_number (5);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2474 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2475 CHECK_NUMBER (dx);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2476
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2477 if (NILP (dy))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2478 dy = make_number (-10);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2479 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2480 CHECK_NUMBER (dy);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2481
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2482 BLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2483 if (ns_tooltip == nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2484 ns_tooltip = [[EmacsTooltip alloc] init];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2485 else
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2486 Fx_hide_tip ();
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2487
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2488 [ns_tooltip setText: str];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2489 size = [ns_tooltip frame].size;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2490
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2491 /* Move the tooltip window where the mouse pointer is. Resize and
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2492 show it. */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2493 compute_tip_xy (f, parms, dx, dy, (int)size.width, (int)size.height,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2494 &root_x, &root_y);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2495
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2496 [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2497 UNBLOCK_INPUT;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2498
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2499 UNGCPRO;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2500 return unbind_to (count, Qnil);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2501 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2502
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2503
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2504 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2505 doc: /* Hide the current tooltip window, if there is any.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2506 Value is t if tooltip was open, nil otherwise. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
2507 (void)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2508 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2509 if (ns_tooltip == nil || ![ns_tooltip isActive])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2510 return Qnil;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2511 [ns_tooltip hide];
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2512 return Qt;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2513 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2514
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2515
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2516 /* ==========================================================================
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2517
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2518 Class implementations
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2519
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2520 ========================================================================== */
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2521
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2522
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2523 @implementation EmacsSavePanel
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2524 #ifdef NS_IMPL_COCOA
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2525 /* --------------------------------------------------------------------------
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2526 These are overridden to intercept on OS X: ending panel restarts NSApp
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2527 event loop if it is stopped. Not sure if this is correct behavior,
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2528 perhaps should check if running and if so send an appdefined.
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2529 -------------------------------------------------------------------------- */
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2530 - (void) ok: (id)sender
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2531 {
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2532 [super ok: sender];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2533 panelOK = 1;
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2534 [NSApp stop: self];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2535 }
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2536 - (void) cancel: (id)sender
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2537 {
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2538 [super cancel: sender];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2539 [NSApp stop: self];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2540 }
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2541 #endif
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2542 @end
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2543
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2544
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2545 @implementation EmacsOpenPanel
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2546 #ifdef NS_IMPL_COCOA
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2547 /* --------------------------------------------------------------------------
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2548 These are overridden to intercept on OS X: ending panel restarts NSApp
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2549 event loop if it is stopped. Not sure if this is correct behavior,
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2550 perhaps should check if running and if so send an appdefined.
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2551 -------------------------------------------------------------------------- */
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2552 - (void) ok: (id)sender
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2553 {
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2554 [super ok: sender];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2555 panelOK = 1;
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2556 [NSApp stop: self];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2557 }
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2558 - (void) cancel: (id)sender
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2559 {
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2560 [super cancel: sender];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2561 [NSApp stop: self];
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2562 }
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2563 #endif
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2564 @end
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2565
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2566
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2567 @implementation EmacsFileDelegate
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2568 /* --------------------------------------------------------------------------
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2569 Delegate methods for Open/Save panels
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2570 -------------------------------------------------------------------------- */
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2571 - (BOOL)panel: (id)sender isValidFilename: (NSString *)filename
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2572 {
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2573 return YES;
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2574 }
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2575 - (BOOL)panel: (id)sender shouldShowFilename: (NSString *)filename
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2576 {
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2577 return YES;
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2578 }
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2579 - (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2580 confirmed: (BOOL)okFlag
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2581 {
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2582 return filename;
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2583 }
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2584 @end
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2585
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2586 #endif
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2587
102004
e1a5d89a91dd * nsfns.m (ns-read-file-name): BLOCK_INPUT while showing dialog. \n \n* nsmenu.m (pop_down_menu): Check popup_activated_flag. \n(ns_popup_dialog, EmacsDialogPanel-runDialogAt:): Let \npop_down_menu do the cleanup work as it is always called. (Bug#2154) \n \n* nsfont.m (nsfont_make_fontset_for_font): For now, don't try to \nset fontset font for 'mathematical-' sub-scripts. (Bug #2218)\n
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101399
diff changeset
2588
96897
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2589 /* ==========================================================================
180a931a0af8 (x_set_menu_bar_lines, x_set_tool_bar_lines): Remove
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96885
diff changeset
2590
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2591 Lisp interface declaration
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2592
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2593 ========================================================================== */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2594
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2595
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2596 void
109653
9cfca8c9fb07 Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents: 109179
diff changeset
2597 syms_of_nsfns (void)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2598 {
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2599 int i;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2600
110678
7e83565f8d0e Use intern_c_string instead of intern.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109820
diff changeset
2601 Qfontsize = intern_c_string ("fontsize");
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2602 staticpro (&Qfontsize);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2603
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2604 DEFVAR_LISP ("ns-icon-type-alist", &Vns_icon_type_alist,
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2605 doc: /* Alist of elements (REGEXP . IMAGE) for images of icons associated to frames.
96857
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2606 If the title of a frame matches REGEXP, then IMAGE.tiff is
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2607 selected as the image of the icon representing the frame when it's
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2608 miniaturized. If an element is t, then Emacs tries to select an icon
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2609 based on the filetype of the visited file.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2610
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2611 The images have to be installed in a folder called English.lproj in the
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2612 Emacs folder. You have to restart Emacs after installing new icons.
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2613
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2614 Example: Install an icon Gnus.tiff and execute the following code
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2615
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2616 (setq ns-icon-type-alist
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2617 (append ns-icon-type-alist
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2618 '((\"^\\\\*\\\\(Group\\\\*$\\\\|Summary \\\\|Article\\\\*$\\\\)\"
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2619 . \"Gnus\"))))
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2620
571d51f3521f Change NS to Nextstep in docstrings and error messages.
Chong Yidong <cyd@stupidchicken.com>
parents: 96812
diff changeset
2621 When you miniaturize a Group, Summary or Article frame, Gnus.tiff will
96878
21843c5dd16a fix compile error in nsfns.m
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96870
diff changeset
2622 be used as the image of the icon representing the frame. */);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2623 Vns_icon_type_alist = Fcons (Qt, Qnil);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2624
99028
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
2625 DEFVAR_LISP ("ns-version-string", &Vns_version_string,
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
2626 doc: /* Toolkit version for NS Windowing. */);
100802
ded357c75f85 (ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 100263
diff changeset
2627 Vns_version_string = ns_appkit_version_str ();
99028
713fc3ab99e5 * lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other documentation. * src/nsfns.m (ns_appkit_version): New function. (x-server-version): Use it. (syms_of_nsfns): Define ns-version-string here, not nsterm.m. (x-server-vendor): Don't check_ns(). * nsterm.m (syms_of_nsterm): Drop ns-version-string.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 98516
diff changeset
2628
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2629 defsubr (&Sns_read_file_name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2630 defsubr (&Sns_get_resource);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2631 defsubr (&Sns_set_resource);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2632 defsubr (&Sxw_display_color_p); /* this and next called directly by C code */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2633 defsubr (&Sx_display_grayscale_p);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2634 defsubr (&Sns_font_name);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2635 defsubr (&Sns_list_colors);
96885
f669b344e719 do-applescript: NS version of the Carbon implementation of the same
David Reitter <david.reitter@gmail.com>
parents: 96878
diff changeset
2636 #ifdef NS_IMPL_COCOA
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96913
diff changeset
2637 defsubr (&Sns_do_applescript);
96885
f669b344e719 do-applescript: NS version of the Carbon implementation of the same
David Reitter <david.reitter@gmail.com>
parents: 96878
diff changeset
2638 #endif
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2639 defsubr (&Sxw_color_defined_p);
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2640 defsubr (&Sxw_color_values);
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2641 defsubr (&Sx_server_max_request_size);
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2642 defsubr (&Sx_server_vendor);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2643 defsubr (&Sx_server_version);
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2644 defsubr (&Sx_display_pixel_width);
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2645 defsubr (&Sx_display_pixel_height);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2646 defsubr (&Sns_display_usable_bounds);
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2647 defsubr (&Sx_display_mm_width);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2648 defsubr (&Sx_display_mm_height);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2649 defsubr (&Sx_display_screens);
96900
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2650 defsubr (&Sx_display_planes);
d3f5f5665a50 Rename ns prefixed functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96897
diff changeset
2651 defsubr (&Sx_display_color_cells);
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2652 defsubr (&Sx_display_visual_class);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2653 defsubr (&Sx_display_backing_store);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2654 defsubr (&Sx_display_save_under);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2655 defsubr (&Sx_create_frame);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2656 defsubr (&Sx_open_connection);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2657 defsubr (&Sx_close_connection);
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2658 defsubr (&Sx_display_list);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2659
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2660 defsubr (&Sns_hide_others);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2661 defsubr (&Sns_hide_emacs);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2662 defsubr (&Sns_emacs_info_panel);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2663 defsubr (&Sns_list_services);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2664 defsubr (&Sns_perform_service);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2665 defsubr (&Sns_convert_utf8_nfd_to_nfc);
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96857
diff changeset
2666 defsubr (&Sx_focus_frame);
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2667 defsubr (&Sns_popup_font_panel);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2668 defsubr (&Sns_popup_color_panel);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2669
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2670 defsubr (&Sx_show_tip);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2671 defsubr (&Sx_hide_tip);
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2672
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2673 /* used only in fontset.c */
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2674 check_window_system_func = check_ns;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2676 }
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
2677
96689
f34c4d928d39 Use nicer comment syntax for arch taglines in Objective-C files
Miles Bader <miles@gnu.org>
parents: 96685
diff changeset
2678 // arch-tag: dc2a3f74-1123-4daa-8eed-fb78db6a5642