Mercurial > emacs
annotate src/nsterm.m @ 111713:812a929d6b55
Fixing bug #7474 also fixes #7481.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Thu, 25 Nov 2010 22:28:14 +0200 |
parents | cb2bf4b8dd70 |
children | df9e4ed95f9b |
rev | line source |
---|---|
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1 /* NeXT/Open/GNUstep / MacOSX communication module. |
106815 | 2 Copyright (C) 1989, 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:
99558
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:
99558
diff
changeset
|
29 interpretation of even the system includes. */ |
108861
ad09f2bfce51
Fix config.h includes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107700
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:
99558
diff
changeset
|
31 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
32 #include <math.h> |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
33 #include <sys/types.h> |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
34 #include <time.h> |
102434
762aaa3e88a0
Include <signal.h> for SIGTERM used in ns_term_shutdown.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102429
diff
changeset
|
35 #include <signal.h> |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
36 #include <unistd.h> |
105676 | 37 #include <setjmp.h> |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
38 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
39 #include "lisp.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
40 #include "blockinput.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
41 #include "sysselect.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
42 #include "nsterm.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
43 #include "systime.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 "fontset.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
46 #include "composite.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
47 #include "ccl.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
48 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
49 #include "termhooks.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
50 #include "termopts.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
51 #include "termchar.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
52 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
53 #include "window.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
54 #include "keyboard.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
55 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
56 #include "font.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
57 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
58 /* call tracing */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
59 #if 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
60 int term_trace_num = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
61 #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
|
62 __FILE__, __LINE__, ++term_trace_num) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
63 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
64 #define NSTRACE(x) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
65 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
66 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
67 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
68 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
69 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
70 Local declarations |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
71 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
72 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
73 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
74 /* Convert a symbol indexed with an NSxxx value to a value as defined |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
75 in keyboard.c (lispy_function_key). I hope this is a correct way |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
76 of doing things... */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
77 static unsigned convert_ns_to_X_keysym[] = |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
78 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
79 NSHomeFunctionKey, 0x50, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
80 NSLeftArrowFunctionKey, 0x51, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
81 NSUpArrowFunctionKey, 0x52, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
82 NSRightArrowFunctionKey, 0x53, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
83 NSDownArrowFunctionKey, 0x54, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
84 NSPageUpFunctionKey, 0x55, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
85 NSPageDownFunctionKey, 0x56, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
86 NSEndFunctionKey, 0x57, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
87 NSBeginFunctionKey, 0x58, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
88 NSSelectFunctionKey, 0x60, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
89 NSPrintFunctionKey, 0x61, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
90 NSExecuteFunctionKey, 0x62, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
91 NSInsertFunctionKey, 0x63, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
92 NSUndoFunctionKey, 0x65, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
93 NSRedoFunctionKey, 0x66, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
94 NSMenuFunctionKey, 0x67, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
95 NSFindFunctionKey, 0x68, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
96 NSHelpFunctionKey, 0x6A, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
97 NSBreakFunctionKey, 0x6B, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
98 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
99 NSF1FunctionKey, 0xBE, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
100 NSF2FunctionKey, 0xBF, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
101 NSF3FunctionKey, 0xC0, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
102 NSF4FunctionKey, 0xC1, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
103 NSF5FunctionKey, 0xC2, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
104 NSF6FunctionKey, 0xC3, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
105 NSF7FunctionKey, 0xC4, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
106 NSF8FunctionKey, 0xC5, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
107 NSF9FunctionKey, 0xC6, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
108 NSF10FunctionKey, 0xC7, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
109 NSF11FunctionKey, 0xC8, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
110 NSF12FunctionKey, 0xC9, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
111 NSF13FunctionKey, 0xCA, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
112 NSF14FunctionKey, 0xCB, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
113 NSF15FunctionKey, 0xCC, |
103120
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
114 NSF16FunctionKey, 0xCD, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
115 NSF17FunctionKey, 0xCE, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
116 NSF18FunctionKey, 0xCF, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
117 NSF19FunctionKey, 0xD0, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
118 NSF20FunctionKey, 0xD1, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
119 NSF21FunctionKey, 0xD2, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
120 NSF22FunctionKey, 0xD3, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
121 NSF23FunctionKey, 0xD4, |
242ce371436e
convert_ns_to_X_keysym: define function keys f16 through f24.
David Reitter <david.reitter@gmail.com>
parents:
103023
diff
changeset
|
122 NSF24FunctionKey, 0xD5, |
96675
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 NSBackspaceCharacter, 0x08, /* 8: Not on some KBs. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
125 NSDeleteCharacter, 0xFF, /* 127: Big 'delete' key upper right. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
126 NSDeleteFunctionKey, 0x9F, /* 63272: Del forw key off main array. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
127 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
128 NSTabCharacter, 0x09, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
129 0x19, 0x09, /* left tab->regular since pass shift */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
130 NSCarriageReturnCharacter, 0x0D, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
131 NSNewlineCharacter, 0x0D, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
132 NSEnterCharacter, 0x8D, |
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 0x1B, 0x1B /* escape */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
135 }; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
136 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
137 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
138 /* Lisp communications */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
139 Lisp_Object ns_input_file, ns_input_font, ns_input_fontsize, ns_input_line; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
140 Lisp_Object ns_input_color, ns_input_text, ns_working_text; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
141 Lisp_Object ns_input_spi_name, ns_input_spi_arg; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
142 Lisp_Object Vx_toolkit_scroll_bars; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
143 static Lisp_Object Qmodifier_value; |
106843
36dd02b00382
Fix Qnone definition in NS files.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
144 Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper, Qnone; |
110930
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
145 extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
146 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
147 /* Specifies which emacs modifier should be generated when NS receives |
110987
cda2045a5ee8
Fix typos in docstrings, comments and ChangeLogs.
Juanma Barranquero <lekktu@gmail.com>
parents:
110930
diff
changeset
|
148 the Alternate modifier. May be Qnone or any of the modifier lisp symbols. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
149 Lisp_Object ns_alternate_modifier; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
150 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
151 /* Specifies which emacs modifier should be generated when NS receives |
110987
cda2045a5ee8
Fix typos in docstrings, comments and ChangeLogs.
Juanma Barranquero <lekktu@gmail.com>
parents:
110930
diff
changeset
|
152 the right Alternate modifier. Has same values as ns_alternate_modifier plus |
110930
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
153 the value Qleft which means whatever value ns_alternate_modifier has. */ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
154 Lisp_Object ns_right_alternate_modifier; |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
155 |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
156 /* Specifies which emacs modifier should be generated when NS receives |
110987
cda2045a5ee8
Fix typos in docstrings, comments and ChangeLogs.
Juanma Barranquero <lekktu@gmail.com>
parents:
110930
diff
changeset
|
157 the Command modifier. May be any of the modifier lisp symbols. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
158 Lisp_Object ns_command_modifier; |
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 /* Specifies which emacs modifier should be generated when NS receives |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
161 the right Command modifier. Has same values as ns_command_modifier plus |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
162 the value Qleft which means whatever value ns_command_modifier has. */ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
163 Lisp_Object ns_right_command_modifier; |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
164 |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
165 /* Specifies which emacs modifier should be generated when NS receives |
110987
cda2045a5ee8
Fix typos in docstrings, comments and ChangeLogs.
Juanma Barranquero <lekktu@gmail.com>
parents:
110930
diff
changeset
|
166 the Control modifier. May be any of the modifier lisp symbols. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
167 Lisp_Object ns_control_modifier; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
168 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
169 /* Specifies which emacs modifier should be generated when NS receives |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
170 the right Control modifier. Has same values as ns_control_modifier plus |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
171 the value Qleft which means whatever value ns_control_modifier has. */ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
172 Lisp_Object ns_right_control_modifier; |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
173 |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
174 /* Specifies which emacs modifier should be generated when NS receives |
110987
cda2045a5ee8
Fix typos in docstrings, comments and ChangeLogs.
Juanma Barranquero <lekktu@gmail.com>
parents:
110930
diff
changeset
|
175 the Function modifier (laptops). May be any of the modifier lisp symbols. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
176 Lisp_Object ns_function_modifier; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
177 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
178 /* Control via default 'GSFontAntiAlias' on OS X and GNUstep. */ |
96817
6b7bbb1d9eb1
fix bug with quickdraw smoothing; also, in Makefile, clean out ns_appdir in 'clean' target
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96812
diff
changeset
|
179 Lisp_Object ns_antialias_text; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
180 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
181 /* On OS X picks up the default NSGlobalDomain AppleAntiAliasingThreshold, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
182 the maximum font size to NOT antialias. On GNUstep there is currently |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
183 no way to control this behavior. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
184 float ns_antialias_threshold; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
185 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
186 /* Used to pick up AppleHighlightColor on OS X */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
187 NSString *ns_selection_color; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
188 |
101637
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
189 /* Confirm on exit. */ |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
190 Lisp_Object ns_confirm_quit; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
191 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
192 NSArray *ns_send_types =0, *ns_return_types =0, *ns_drag_types =0; |
105225
9f0244ca1777
(ns_app_name): New variable. (ns_term_init): Set and use it. (ns_term_shutdown): Use it.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105159
diff
changeset
|
193 NSString *ns_app_name = @"Emacs"; /* default changed later */ |
96675
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 /* Display variables */ |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
196 struct ns_display_info *x_display_list; /* Chain of existing displays */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
197 Lisp_Object ns_display_name_list; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
198 long context_menu_value = 0; |
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 /* display update */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
201 NSPoint last_mouse_motion_position; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
202 static NSRect last_mouse_glyph; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
203 static unsigned long last_mouse_movement_time = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
204 static Lisp_Object last_mouse_motion_frame; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
205 static EmacsScroller *last_mouse_scroll_bar = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
206 static struct frame *ns_updating_frame; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
207 static NSView *focus_view = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
208 static int ns_window_num =0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
209 static NSRect uRect; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
210 static BOOL gsaved = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
211 BOOL ns_in_resize = NO; |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
212 static BOOL ns_fake_keydown = NO; |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
213 int ns_tmp_flags; /* FIXME */ |
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
214 struct nsfont_info *ns_tmp_font; /* FIXME */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
215 /*static int debug_lock = 0; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
216 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
217 /* event loop */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
218 static BOOL send_appdefined = YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
219 static NSEvent *last_appdefined_event = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
220 static NSTimer *timed_entry = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
221 static NSTimer *fd_entry = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
222 static NSTimer *scroll_repeat_entry = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
223 static fd_set select_readfds, t_readfds; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
224 static struct timeval select_timeout; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
225 static int select_nfds; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
226 static NSAutoreleasePool *outerpool; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
227 static struct input_event *emacs_event = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
228 static struct input_event *q_event_ptr = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
229 static int n_emacs_events_pending = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
230 static NSMutableArray *ns_pending_files, *ns_pending_service_names, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
231 *ns_pending_service_args; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
232 static BOOL inNsSelect = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
233 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
234 /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
235 #define NS_FUNCTION_KEY_MASK 0x800000 |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
236 #define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
237 #define NSRightControlKeyMask (0x002000 | NSControlKeyMask) |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
238 #define NSLeftCommandKeyMask (0x000008 | NSCommandKeyMask) |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
239 #define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
240 #define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
241 #define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
242 #define EV_MODIFIERS(e) \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
243 ((([e modifierFlags] & NSHelpKeyMask) ? \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
244 hyper_modifier : 0) \ |
110930
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
245 | (!EQ (ns_right_alternate_modifier, Qleft) && \ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
246 (([e modifierFlags] & NSRightAlternateKeyMask) \ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
247 == NSRightAlternateKeyMask) ? \ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
248 parse_solitary_modifier (ns_right_alternate_modifier) : 0) \ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
249 | (([e modifierFlags] & NSAlternateKeyMask) ? \ |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
250 parse_solitary_modifier (ns_alternate_modifier) : 0) \ |
110930
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
251 | (([e modifierFlags] & NSShiftKeyMask) ? \ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
252 shift_modifier : 0) \ |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
253 | (!EQ (ns_right_control_modifier, Qleft) && \ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
254 (([e modifierFlags] & NSRightControlKeyMask) \ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
255 == NSRightControlKeyMask) ? \ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
256 parse_solitary_modifier (ns_right_control_modifier) : 0) \ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
257 | (([e modifierFlags] & NSControlKeyMask) ? \ |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
258 parse_solitary_modifier (ns_control_modifier) : 0) \ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
259 | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \ |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
260 parse_solitary_modifier (ns_function_modifier) : 0) \ |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
261 | (!EQ (ns_right_command_modifier, Qleft) && \ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
262 (([e modifierFlags] & NSRightCommandKeyMask) \ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
263 == NSRightCommandKeyMask) ? \ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
264 parse_solitary_modifier (ns_right_command_modifier) : 0) \ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
265 | (([e modifierFlags] & NSCommandKeyMask) ? \ |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
266 parse_solitary_modifier (ns_command_modifier):0)) |
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 #define EV_UDMODIFIERS(e) \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
269 ((([e type] == NSLeftMouseDown) ? down_modifier : 0) \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
270 | (([e type] == NSRightMouseDown) ? down_modifier : 0) \ |
99917
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
271 | (([e type] == NSOtherMouseDown) ? down_modifier : 0) \ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
272 | (([e type] == NSLeftMouseDragged) ? down_modifier : 0) \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
273 | (([e type] == NSRightMouseDragged) ? down_modifier : 0) \ |
99917
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
274 | (([e type] == NSOtherMouseDragged) ? down_modifier : 0) \ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
275 | (([e type] == NSLeftMouseUp) ? up_modifier : 0) \ |
99917
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
276 | (([e type] == NSRightMouseUp) ? up_modifier : 0) \ |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
277 | (([e type] == NSOtherMouseUp) ? up_modifier : 0)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
278 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
279 #define EV_BUTTON(e) \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
280 ((([e type] == NSLeftMouseDown) || ([e type] == NSLeftMouseUp)) ? 0 : \ |
99917
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
281 (([e type] == NSRightMouseDown) || ([e type] == NSRightMouseUp)) ? 2 : \ |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
282 [e buttonNumber] - 1) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
283 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
284 /* Convert the time field to a timestamp in milliseconds. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
285 #define EV_TIMESTAMP(e) ([e timestamp] * 1000) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
286 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
287 /* This is a piece of code which is common to all the event handling |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
288 methods. Maybe it should even be a function. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
289 #define EV_TRAILER(e) \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
290 { \ |
101324
ac37eb10f508
* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window. (ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101321
diff
changeset
|
291 XSETFRAME (emacs_event->frame_or_window, emacsframe); \ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
292 if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
293 n_emacs_events_pending++; \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
294 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
295 EVENT_INIT (*emacs_event); \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
296 ns_send_appdefined (-1); \ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
297 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
298 |
100839
03cb6ea90f92
* nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100666
diff
changeset
|
299 void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); |
03cb6ea90f92
* nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100666
diff
changeset
|
300 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
301 /* TODO: get rid of need for these forward declarations */ |
100839
03cb6ea90f92
* nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100666
diff
changeset
|
302 static void ns_condemn_scroll_bars (struct frame *f); |
03cb6ea90f92
* nsfns.m (x_set_foreground_color, x_set_background_color)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100666
diff
changeset
|
303 static void ns_judge_scroll_bars (struct frame *f); |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
304 void x_set_frame_alpha (struct frame *f); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
305 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
306 /* unused variables needed for compatibility reasons */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
307 int x_use_underline_position_properties, x_underline_at_descent_line; |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
308 /* FIXME: figure out what to do with underline_minimum_offset. */ |
96675
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 |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
313 Utilities |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
314 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
315 ========================================================================== */ |
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 static Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
319 append2 (Lisp_Object list, Lisp_Object item) |
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 Utility to append to a list |
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 Lisp_Object array[2]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
325 array[0] = list; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
326 array[1] = Fcons (item, Qnil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
327 return Fnconc (2, &array[0]); |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
331 void |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
332 ns_init_paths (void) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
333 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
334 Used to allow emacs to find its resources under Emacs.app |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
335 Called from emacs.c at startup. |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
338 NSBundle *bundle = [NSBundle mainBundle]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
339 NSString *binDir = [bundle bundlePath], *resourceDir = [bundle resourcePath]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
340 NSString *resourcePath, *resourcePaths; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
341 NSRange range; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
342 BOOL onWindows = NO; /* how do I determine this? */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
343 NSString *pathSeparator = onWindows ? @";" : @":"; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
344 NSFileManager *fileManager = [NSFileManager defaultManager]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
345 BOOL isDir; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
346 /*NSLog (@"ns_init_paths: '%@'\n%@\n", [[NSBundle mainBundle] bundlePath], [[NSBundle mainBundle] resourcePath]); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
347 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
348 /* get bindir from base */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
349 range = [resourceDir rangeOfString: @"Contents"]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
350 if (range.location != NSNotFound) |
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 binDir = [binDir stringByAppendingPathComponent: @"Contents"]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
353 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
354 binDir = [binDir stringByAppendingPathComponent: @"MacOS"]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
355 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
356 } |
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 /* the following based on Andrew Choi's init_mac_osx_environment () */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
359 if (!getenv ("EMACSLOADPATH")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
360 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
361 NSArray *paths = [resourceDir stringsByAppendingPaths: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
362 [NSArray arrayWithObjects: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
363 @"site-lisp", @"lisp", @"leim", nil]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
364 NSEnumerator *pathEnum = [paths objectEnumerator]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
365 resourcePaths = @""; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
366 while (resourcePath = [pathEnum nextObject]) |
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 if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
369 if (isDir) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
370 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
371 if ([resourcePaths length] > 0) |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
372 resourcePaths |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
373 = [resourcePaths stringByAppendingString: pathSeparator]; |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
374 resourcePaths |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
375 = [resourcePaths stringByAppendingString: resourcePath]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
376 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
377 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
378 if ([resourcePaths length] > 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
379 setenv ("EMACSLOADPATH", [resourcePaths UTF8String], 1); |
105147
4508a8827944
* nsterm.m (CGContextSetFontRenderingMode): Drop declaration.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105096
diff
changeset
|
380 /*NSLog (@"loadPath: '%@'\n", resourcePaths); */ |
96675
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
383 if (!getenv ("EMACSPATH")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
384 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
385 NSArray *paths = [binDir stringsByAppendingPaths: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
386 [NSArray arrayWithObjects: @"bin", |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
387 @"lib-exec", nil]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
388 NSEnumerator *pathEnum = [paths objectEnumerator]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
389 resourcePaths = @""; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
390 while (resourcePath = [pathEnum nextObject]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
391 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
392 if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
393 if (isDir) |
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 if ([resourcePaths length] > 0) |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
396 resourcePaths |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
397 = [resourcePaths stringByAppendingString: pathSeparator]; |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
398 resourcePaths |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
399 = [resourcePaths stringByAppendingString: resourcePath]; |
96675
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 if ([resourcePaths length] > 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
403 setenv ("EMACSPATH", [resourcePaths UTF8String], 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
404 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
405 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
406 resourcePath = [resourceDir stringByAppendingPathComponent: @"etc"]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
407 if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) |
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 (isDir) |
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 if (!getenv ("EMACSDATA")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
412 setenv ("EMACSDATA", [resourcePath UTF8String], 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
413 if (!getenv ("EMACSDOC")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
414 setenv ("EMACSDOC", [resourcePath UTF8String], 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
415 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
416 } |
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 (!getenv ("INFOPATH")) |
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 resourcePath = [resourceDir stringByAppendingPathComponent: @"info"]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
421 if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
422 if (isDir) |
103340
49d3f24a1a60
nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. (ns_init_paths): Append path separator to INFOPATH variable. (ns_use_system_highlight_color): Drop, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103296
diff
changeset
|
423 setenv ("INFOPATH", [[resourcePath stringByAppendingString: @":"] |
49d3f24a1a60
nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. (ns_init_paths): Append path separator to INFOPATH variable. (ns_use_system_highlight_color): Drop, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103296
diff
changeset
|
424 UTF8String], 1); |
49d3f24a1a60
nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. (ns_init_paths): Append path separator to INFOPATH variable. (ns_use_system_highlight_color): Drop, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103296
diff
changeset
|
425 /* Note, extra colon needed to cause merge w/later user additions. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
426 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
427 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
428 |
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 static int |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
431 timeval_subtract (struct timeval *result, struct timeval x, struct timeval y) |
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 Subtract the `struct timeval' values X and Y, storing the result in RESULT. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
434 Return 1 if the difference is negative, otherwise 0. |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
437 /* Perform the carry for the later subtraction by updating y. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
438 This is safer because on some systems |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
439 the tv_sec member is unsigned. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
440 if (x.tv_usec < y.tv_usec) |
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 int nsec = (y.tv_usec - x.tv_usec) / 1000000 + 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
443 y.tv_usec -= 1000000 * nsec; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
444 y.tv_sec += nsec; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
445 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
446 if (x.tv_usec - y.tv_usec > 1000000) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
447 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
448 int nsec = (y.tv_usec - x.tv_usec) / 1000000; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
449 y.tv_usec += 1000000 * nsec; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
450 y.tv_sec -= nsec; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
451 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
452 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
453 /* Compute the time remaining to wait. tv_usec is certainly positive. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
454 result->tv_sec = x.tv_sec - y.tv_sec; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
455 result->tv_usec = x.tv_usec - y.tv_usec; |
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 /* Return indication of whether the result should be considered negative. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
458 return x.tv_sec < y.tv_sec; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
459 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
460 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
461 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
462 ns_timeout (int usecs) |
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 Blocking timer utility used by ns_ring_bell |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
465 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
466 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
467 struct timeval wakeup; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
468 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
469 EMACS_GET_TIME (wakeup); |
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 /* Compute time to wait until, propagating carry from usecs. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
472 wakeup.tv_usec += usecs; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
473 wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
474 wakeup.tv_usec %= 1000000; |
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 /* Keep waiting until past the time wakeup. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
477 while (1) |
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 struct timeval timeout; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
480 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
481 EMACS_GET_TIME (timeout); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
482 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
483 /* In effect, timeout = wakeup - timeout. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
484 Break if result would be negative. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
485 if (timeval_subtract (&timeout, wakeup, timeout)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
486 break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
487 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
488 /* Try to wait that long--but we might wake up sooner. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
489 select (0, NULL, NULL, NULL, &timeout); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
490 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
491 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
492 |
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 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
495 ns_release_object (void *obj) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
496 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
497 Release an object (callable from C) |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
500 [(id)obj release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
501 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
504 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
505 ns_retain_object (void *obj) |
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 Retain an object (callable from C) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
508 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
509 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
510 [(id)obj retain]; |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
513 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
514 void * |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
515 ns_alloc_autorelease_pool (void) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
516 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
517 Allocate a pool for temporary objects (callable from C) |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
520 return [[NSAutoreleasePool alloc] init]; |
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 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
525 ns_release_autorelease_pool (void *pool) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
526 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
527 Free a pool and temporary objects it refers to (callable from C) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
528 -------------------------------------------------------------------------- */ |
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 ns_release_object (pool); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
531 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
534 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
535 /* ========================================================================== |
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 Focus (clipping) and screen update |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
538 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
539 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
540 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
541 static NSRect |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
542 ns_resize_handle_rect (NSWindow *window) |
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 NSRect r = [window frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
545 r.origin.x = r.size.width - RESIZE_HANDLE_SIZE; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
546 r.origin.y = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
547 r.size.width = r.size.height = RESIZE_HANDLE_SIZE; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
548 return r; |
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 |
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 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
553 ns_update_begin (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
554 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
555 Prepare for a grouped sequence of drawing calls |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
556 external (RIF) call; whole frame, called before update_window_begin |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
557 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
558 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
559 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
560 NSTRACE (ns_update_begin); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
561 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
562 ns_updating_frame = f; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
563 [view lockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
564 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
565 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
566 uRect = NSMakeRect (0, 0, 0, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
567 #endif |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
571 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
572 ns_update_window_begin (struct window *w) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
573 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
574 Prepare for a grouped sequence of drawing calls |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
575 external (RIF) call; for one window, called after update_begin |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
576 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
577 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
578 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
579 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
580 NSTRACE (ns_update_window_begin); |
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 updated_window = w; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
583 set_output_cursor (&w->cursor); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
584 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
585 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
586 |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
587 if (f == hlinfo->mouse_face_mouse_frame) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
588 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
589 /* Don't do highlighting for mouse motion during the update. */ |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
590 hlinfo->mouse_face_defer = 1; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
591 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
592 /* If the frame needs to be redrawn, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
593 simply forget about any prior mouse highlighting. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
594 if (FRAME_GARBAGED_P (f)) |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
595 hlinfo->mouse_face_window = Qnil; |
96675
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 /* (further code for mouse faces ifdef'd out in other terms elided) */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
598 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
599 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
600 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
601 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
602 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
603 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
604 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
605 ns_update_window_end (struct window *w, int cursor_on_p, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
606 int mouse_face_overwritten_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
607 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
608 Finished a grouped sequence of drawing calls |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
609 external (RIF) call; for one window called before update_end |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
610 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
611 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
612 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
613 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
614 /* note: this fn is nearly identical in all terms */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
615 if (!w->pseudo_window_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
616 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
617 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
618 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
619 if (cursor_on_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
620 display_and_set_cursor (w, 1, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
621 output_cursor.hpos, output_cursor.vpos, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
622 output_cursor.x, output_cursor.y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
623 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
624 if (draw_window_fringes (w, 1)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
625 x_draw_vertical_border (w); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
626 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
627 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
628 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
629 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
630 /* If a row with mouse-face was overwritten, arrange for |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
631 frame_up_to_date to redisplay the mouse highlight. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
632 if (mouse_face_overwritten_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
633 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
634 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
635 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
636 hlinfo->mouse_face_window = Qnil; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
637 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
638 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
639 updated_window = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
640 NSTRACE (update_window_end); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
641 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
644 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
645 ns_update_end (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
646 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
647 Finished a grouped sequence of drawing calls |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
648 external (RIF) call; for whole frame, called after update_window_end |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
649 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
650 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
651 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
652 |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
653 /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
654 MOUSE_HL_INFO (f)->mouse_face_defer = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
655 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
656 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
657 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
658 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
659 /* trigger flush only in the rectangle we tracked as being drawn */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
660 [view unlockFocusNeedsFlush: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
661 /*fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", uRect.origin.x, uRect.origin.y, uRect.size.width, uRect.size.height); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
662 [view lockFocusInRect: uRect]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
663 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
664 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
665 [view unlockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
666 [[view window] flushWindow]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
667 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
668 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
669 ns_updating_frame = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
670 NSTRACE (ns_update_end); |
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 |
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 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
675 ns_flush (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
676 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
677 external (RIF) call |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
678 NS impl is no-op since currently we flush in ns_update_end and elsewhere |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
679 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
680 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
681 NSTRACE (ns_flush); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
682 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
685 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
686 ns_focus (struct frame *f, NSRect *r, int n) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
687 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
688 Internal: Focus on given frame. During small local updates this is used to |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
689 draw, however during large updates, ns_update_begin and ns_update_end are |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
690 called to wrap the whole thing, in which case these calls are stubbed out. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
691 Except, on GNUstep, we accumulate the rectangle being drawn into, because |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
692 the back end won't do this automatically, and will just end up flushing |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
693 the entire window. |
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 { |
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:
98371
diff
changeset
|
696 // NSTRACE (ns_focus); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
697 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
698 NSRect u; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
699 if (n == 2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
700 u = NSUnionRect (r[0], r[1]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
701 else if (r) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
702 u = *r; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
703 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
704 /* static int c =0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
705 fprintf (stderr, "focus: %d", c++); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
706 if (r) fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", r->origin.x, r->origin.y, r->size.width, r->size.height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
707 fprintf (stderr, "\n"); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
708 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
709 if (f != ns_updating_frame) |
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 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
712 if (view != focus_view) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
713 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
714 if (focus_view != NULL) |
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 [focus_view unlockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
717 [[focus_view window] flushWindow]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
718 /*debug_lock--; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
719 } |
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 if (view) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
722 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
723 r ? [view lockFocusInRect: u] : [view lockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
724 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
725 [view lockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
726 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
727 focus_view = view; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
728 /*if (view) debug_lock++; */ |
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 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
731 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
732 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
733 /* more than one rect being drawn into */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
734 if (view && r) |
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 [view unlockFocus]; /* add prev rect to redraw list */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
737 [view lockFocusInRect: u]; /* focus for draw in new rect */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
738 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
739 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
740 #endif |
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 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
743 else |
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 /* in batch mode, but in GNUstep must still track rectangles explicitly */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
746 uRect = (r ? NSUnionRect (uRect, u) : [FRAME_NS_VIEW (f) visibleRect]); |
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 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
749 |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
750 /* clipping */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
751 if (r) |
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 [[NSGraphicsContext currentContext] saveGraphicsState]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
754 if (n == 2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
755 NSRectClipList (r, 2); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
756 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
757 NSRectClip (*r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
758 gsaved = YES; |
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 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
763 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
764 ns_unfocus (struct frame *f) |
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 Internal: Remove focus on given frame |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
767 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
768 { |
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:
98371
diff
changeset
|
769 // NSTRACE (ns_unfocus); |
96675
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 if (gsaved) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
772 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
773 [[NSGraphicsContext currentContext] restoreGraphicsState]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
774 gsaved = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
775 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
776 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
777 if (f != ns_updating_frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
778 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
779 if (focus_view != NULL) |
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 [focus_view unlockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
782 [[focus_view window] flushWindow]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
783 focus_view = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
784 /*debug_lock--; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
785 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
786 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
787 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
790 static void |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
791 ns_clip_to_row (struct window *w, struct glyph_row *row, int area, BOOL gc) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
792 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
793 Internal (but parallels other terms): Focus drawing on given row |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
794 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
795 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
796 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
797 NSRect clip_rect; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
798 int window_x, window_y, window_width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
799 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
800 window_box (w, area, &window_x, &window_y, &window_width, 0); |
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 clip_rect.origin.x = window_x - FRAME_INTERNAL_BORDER_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
803 clip_rect.origin.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
804 clip_rect.origin.y = max (clip_rect.origin.y, window_y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
805 clip_rect.size.width = window_width + 2 * FRAME_INTERNAL_BORDER_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
806 clip_rect.size.height = row->visible_height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
807 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
808 /* allow a full-height row at the top when requested |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
809 (used to draw fringe all the way through internal border area) */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
810 if (gc && clip_rect.origin.y < 5) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
811 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
812 clip_rect.origin.y -= FRAME_INTERNAL_BORDER_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
813 clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f); |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
816 /* likewise at bottom */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
817 if (gc && |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
818 FRAME_PIXEL_HEIGHT (f) - (clip_rect.origin.y + clip_rect.size.height) < 5) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
819 clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
820 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
821 ns_focus (f, &clip_rect, 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
822 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
823 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
824 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
825 static void |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
826 ns_ring_bell (struct frame *f) |
96675
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 "Beep" routine |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
831 NSTRACE (ns_ring_bell); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
832 if (visible_bell) |
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 NSAutoreleasePool *pool; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
835 struct frame *frame = SELECTED_FRAME (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
836 NSView *view; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
837 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
838 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
839 pool = [[NSAutoreleasePool alloc] init]; |
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 view = FRAME_NS_VIEW (frame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
842 if (view != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
843 { |
107183
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
844 NSRect r, surr; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
845 NSPoint dim = NSMakePoint (128, 128); |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
846 |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
847 r = [view bounds]; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
848 r.origin.x += (r.size.width - dim.x) / 2; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
849 r.origin.y += (r.size.height - dim.y) / 2; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
850 r.size.width = dim.x; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
851 r.size.height = dim.y; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
852 surr = NSInsetRect (r, -2, -2); |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
853 ns_focus (frame, &surr, 1); |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
854 [[view window] cacheImageInRect: [view convertRect: surr toView:nil]]; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
855 [ns_lookup_indexed_color (NS_FACE_FOREGROUND |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
856 (FRAME_DEFAULT_FACE (frame)), frame) set]; |
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
857 NSRectFill (r); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
858 [[view window] flushWindow]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
859 ns_timeout (150000); |
107183
4ab38ae694be
* nsterm.m (ns_ring_bell): Revert last change (Bug#5569).
Chong Yidong <cyd@stupidchicken.com>
parents:
107062
diff
changeset
|
860 [[view window] restoreCachedImage]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
861 [[view window] flushWindow]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
862 ns_unfocus (frame); |
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 [pool release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
865 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
866 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
867 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
868 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
869 NSBeep (); |
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 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
874 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
875 ns_reset_terminal_modes (struct terminal *terminal) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
876 /* Externally called as hook */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
877 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
878 NSTRACE (ns_reset_terminal_modes); |
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 |
105147
4508a8827944
* nsterm.m (CGContextSetFontRenderingMode): Drop declaration.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105096
diff
changeset
|
881 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
882 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
883 ns_set_terminal_modes (struct terminal *terminal) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
884 /* Externally called as hook */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
885 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
886 NSTRACE (ns_set_terminal_modes); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
887 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
888 |
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 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
892 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
893 Frame / window manager related functions |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
894 |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
897 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
898 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
899 ns_raise_frame (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
900 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
901 Bring window to foreground and make it active |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
902 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
903 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
904 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
905 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
906 BLOCK_INPUT; |
103296
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
907 FRAME_SAMPLE_VISIBILITY (f); |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
908 if (FRAME_VISIBLE_P (f)) |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
909 { |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
910 [[view window] makeKeyAndOrderFront: NSApp]; |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
911 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
912 UNBLOCK_INPUT; |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
915 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
916 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
917 ns_lower_frame (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
918 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
919 Send window to back |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
920 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
921 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
922 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
923 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
924 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
925 [[view window] orderBack: NSApp]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
926 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
927 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
928 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
929 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
930 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
931 ns_frame_raise_lower (struct frame *f, int raise) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
932 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
933 External (hook) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
934 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
935 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
936 NSTRACE (ns_frame_raise_lower); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
937 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
938 if (raise) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
939 ns_raise_frame (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
940 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
941 ns_lower_frame (f); |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
945 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
946 ns_frame_rehighlight (struct frame *frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
947 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
948 External (hook): called on things like window switching within frame |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
949 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
950 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
951 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (frame); |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
952 struct frame *old_highlight = dpyinfo->x_highlight_frame; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
953 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
954 NSTRACE (ns_frame_rehighlight); |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
955 if (dpyinfo->x_focus_frame) |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
956 { |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
957 dpyinfo->x_highlight_frame |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
958 = (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame)) |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
959 ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame)) |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
960 : dpyinfo->x_focus_frame); |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
961 if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
962 { |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
963 FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame) = Qnil; |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
964 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
965 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
966 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
967 else |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
968 dpyinfo->x_highlight_frame = 0; |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
969 |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
970 if (dpyinfo->x_highlight_frame && |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
971 dpyinfo->x_highlight_frame != old_highlight) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
972 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
973 if (old_highlight) |
100001
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
974 { |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
975 x_update_cursor (old_highlight, 1); |
100001
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
976 x_set_frame_alpha (old_highlight); |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
977 } |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
978 if (dpyinfo->x_highlight_frame) |
100001
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
979 { |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
980 x_update_cursor (dpyinfo->x_highlight_frame, 1); |
100001
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
981 x_set_frame_alpha (dpyinfo->x_highlight_frame); |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
982 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
983 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
984 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
985 |
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 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
988 x_make_frame_visible (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
989 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
990 External: Show the window (X11 semantics) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
991 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
992 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
993 NSTRACE (x_make_frame_visible); |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
994 /* XXX: at some points in past this was not needed, as the only place that |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
995 called this (frame.c:Fraise_frame ()) also called raise_lower; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
996 if this ends up the case again, comment this out again. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
997 if (!FRAME_VISIBLE_P (f)) |
103296
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
998 { |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
999 f->async_visible = 1; |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
1000 ns_raise_frame (f); |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
1001 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1002 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1005 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1006 x_make_frame_invisible (struct frame *f) |
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 External: Hide the window (X11 semantics) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1009 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1010 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1011 NSView * view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1012 NSTRACE (x_make_frame_invisible); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1013 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1014 [[view window] orderOut: NSApp]; |
102149
df135773c0eb
* nsterm.m (x_make_frame_invisible): Unset async_visible,
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101858
diff
changeset
|
1015 f->async_visible = 0; |
df135773c0eb
* nsterm.m (x_make_frame_invisible): Unset async_visible,
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101858
diff
changeset
|
1016 f->async_iconified = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1017 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1018 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1019 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1020 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1021 x_iconify_frame (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1022 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1023 External: Iconify window |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1024 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1025 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1026 NSView * view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1027 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
|
1028 NSTRACE (x_iconify_frame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1029 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1030 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
1031 if (dpyinfo->x_highlight_frame == f) |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
1032 dpyinfo->x_highlight_frame = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1033 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1034 if ([[view window] windowNumber] <= 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1035 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1036 /* the window is still deferred. Make it very small, bring it |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1037 on screen and order it out. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1038 NSRect s = { { 100, 100}, {0, 0} }; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1039 NSRect t; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1040 t = [[view window] frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1041 [[view window] setFrame: s display: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1042 [[view window] orderBack: NSApp]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1043 [[view window] orderOut: NSApp]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1044 [[view window] setFrame: t display: NO]; |
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 [[view window] miniaturize: NSApp]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1047 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1048 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1049 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1050 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1051 x_destroy_window (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1052 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1053 External: Delete the window |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1054 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1055 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1056 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1057 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1058 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1059 NSTRACE (x_destroy_window); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1060 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1061 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1062 [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1063 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1064 BLOCK_INPUT; |
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 free_frame_menubar (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1067 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1068 if (FRAME_FACE_CACHE (f)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1069 free_frame_faces (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1070 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
1071 if (f == dpyinfo->x_focus_frame) |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
1072 dpyinfo->x_focus_frame = 0; |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
1073 if (f == dpyinfo->x_highlight_frame) |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
1074 dpyinfo->x_highlight_frame = 0; |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1075 if (f == hlinfo->mouse_face_mouse_frame) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1076 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1077 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1078 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1079 hlinfo->mouse_face_window = Qnil; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1080 hlinfo->mouse_face_deferred_gc = 0; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1081 hlinfo->mouse_face_mouse_frame = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1082 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1083 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1084 xfree (f->output_data.ns); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1085 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1086 [[view window] close]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1087 [view release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1088 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1089 ns_window_num--; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1090 UNBLOCK_INPUT; |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1093 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1094 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1095 x_set_offset (struct frame *f, int xoff, int yoff, int change_grav) |
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 External: Position the window |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1098 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1099 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1100 NSScreen *screen; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1101 NSView *view = FRAME_NS_VIEW (f); |
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 NSTRACE (x_set_offset); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1104 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1105 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1106 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1107 f->left_pos = xoff; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1108 f->top_pos = yoff; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1109 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1110 if (xoff < 100) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1111 f->left_pos = 100; /* don't overlap menu */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1112 #endif |
105096
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
1113 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1114 if (view != nil && (screen = [[view window] screen])) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1115 [[view window] setFrameTopLeftPoint: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1116 NSMakePoint (SCREENMAXBOUND (f->left_pos), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1117 SCREENMAXBOUND ([screen frame].size.height |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1118 - NS_TOP_POS (f)))]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1119 UNBLOCK_INPUT; |
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 |
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 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1124 x_set_window_size (struct frame *f, int change_grav, int cols, int rows) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1125 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1126 Adjust window pixel size based on given character grid size |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1127 Impl is a bit more complex than other terms, need to do some |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1128 internal clipping and also pay attention to screen constraints. |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1131 EmacsView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1132 EmacsToolbar *toolbar = [view toolbar]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1133 NSWindow *window = [view window]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1134 NSScreen *screen = [window screen]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1135 NSRect wr = [window frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1136 int tb = FRAME_EXTERNAL_TOOL_BAR (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1137 int pixelwidth, pixelheight; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1138 static int oldRows, oldCols, oldFontWidth, oldFontHeight; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1139 static int oldTB; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1140 static struct frame *oldF; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1141 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1142 NSTRACE (x_set_window_size); |
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 if (view == nil || |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1145 (f == oldF |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1146 && rows == oldRows && cols == oldCols |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1147 && oldFontWidth == FRAME_COLUMN_WIDTH (f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1148 && oldFontHeight == FRAME_LINE_HEIGHT (f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1149 && oldTB == tb)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1150 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1151 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1152 /*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ |
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 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1155 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1156 check_frame_size (f, &rows, &cols); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1157 oldF = f; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1158 oldRows = rows; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1159 oldCols = cols; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1160 oldFontWidth = FRAME_COLUMN_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1161 oldFontHeight = FRAME_LINE_HEIGHT (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1162 oldTB = tb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1163 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1164 f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1165 compute_fringe_widths (f, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1166 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1167 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1168 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); |
100666
dab9cf44bf3f
In comments, write delete_frame instead of Fdelete_frame.
Martin Rudalics <rudalics@gmx.at>
parents:
100001
diff
changeset
|
1169 |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
1170 /* If we have a toolbar, take its height into account. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1171 if (tb) |
105159
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
1172 /* NOTE: previously this would generate wrong result if toolbar not |
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
1173 yet displayed and fixing toolbar_height=32 helped, but |
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
1174 now (200903) seems no longer needed */ |
109092
babf8e935ea8
Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT to aid common code.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
1175 FRAME_TOOLBAR_HEIGHT (f) = |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
1176 NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) |
105159
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
1177 - FRAME_NS_TITLEBAR_HEIGHT (f); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1178 else |
109092
babf8e935ea8
Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT to aid common code.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
1179 FRAME_TOOLBAR_HEIGHT (f) = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1180 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1181 wr.size.width = pixelwidth + f->border_width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1182 wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) |
109092
babf8e935ea8
Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT to aid common code.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
1183 + FRAME_TOOLBAR_HEIGHT (f); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1184 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1185 /* constrain to screen if we can */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1186 if (screen) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1187 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1188 NSSize sz = [screen visibleFrame].size; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1189 NSSize ez = { wr.size.width - sz.width, wr.size.height - sz.height }; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1190 if (ez.width > 0) |
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 int cr = ez.width / FRAME_COLUMN_WIDTH (f) + 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1193 cols -= cr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1194 oldCols = cols; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1195 wr.size.width -= cr * FRAME_COLUMN_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1196 pixelwidth -= cr * FRAME_COLUMN_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1197 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1198 if (ez.height > 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1199 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1200 int rr = ez.height / FRAME_LINE_HEIGHT (f) + 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1201 rows -= rr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1202 oldRows = rows; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1203 wr.size.height -= rr * FRAME_LINE_HEIGHT (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1204 pixelheight -= rr * FRAME_LINE_HEIGHT (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1205 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1206 wr.origin.x = f->left_pos; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1207 wr.origin.y = [screen frame].size.height - NS_TOP_POS (f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1208 - wr.size.height; |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1211 [view setRows: rows andColumns: cols]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1212 [window setFrame: wr display: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1213 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1214 /*fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1215 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1216 /* This is a trick to compensate for Emacs' managing the scrollbar area |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1217 as a fixed number of standard character columns. Instead of leaving |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1218 blank space for the extra, we chopped it off above. Now for |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1219 left-hand scrollbars, we shift all rendering to the left by the |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1220 difference between the real width and Emacs' imagined one. For |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1221 right-hand bars, don't worry about it since the extra is never used. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1222 (Obviously doesn't work for vertically split windows tho..) */ |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1223 { |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1224 NSPoint origin = FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1225 ? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1226 - NS_SCROLL_BAR_WIDTH (f), 0) |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1227 : NSMakePoint (0, 0); |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1228 [view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)]; |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1229 [view setBoundsOrigin: origin]; |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1230 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1231 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1232 change_frame_size (f, rows, cols, 0, 1, 0); /* pretend, delay, safe */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1233 FRAME_PIXEL_WIDTH (f) = pixelwidth; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1234 FRAME_PIXEL_HEIGHT (f) = pixelheight; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1235 /* SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */ |
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 mark_window_cursors_off (XWINDOW (f->root_window)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1238 cancel_mouse_face (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1239 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1240 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1241 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1242 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1243 |
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:
98371
diff
changeset
|
1244 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1245 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1246 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1247 Color management |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1248 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1249 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1250 |
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:
98371
diff
changeset
|
1251 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1252 NSColor * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1253 ns_lookup_indexed_color (unsigned long idx, struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1254 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1255 struct ns_color_table *color_table = FRAME_NS_DISPLAY_INFO (f)->color_table; |
104047
f3ac65e9abd6
* nsterm.m (ns_lookup_indexed_color): Check for bad index. (ns_index_color): Init unused slot to 0. (ns_dumpglyphs_box_or_relief): Replace useless xassert with an if(). Bug 3714, possibly 3082.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104046
diff
changeset
|
1256 if (idx < 1 || idx >= color_table->avail) |
f3ac65e9abd6
* nsterm.m (ns_lookup_indexed_color): Check for bad index. (ns_index_color): Init unused slot to 0. (ns_dumpglyphs_box_or_relief): Replace useless xassert with an if(). Bug 3714, possibly 3082.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104046
diff
changeset
|
1257 return nil; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1258 return color_table->colors[idx]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1259 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1260 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1261 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1262 unsigned long |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1263 ns_index_color (NSColor *color, struct frame *f) |
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 struct ns_color_table *color_table = FRAME_NS_DISPLAY_INFO (f)->color_table; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1266 int idx; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1267 NSNumber *index; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1268 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1269 if (!color_table->colors) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1270 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1271 color_table->size = NS_COLOR_CAPACITY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1272 color_table->avail = 1; /* skip idx=0 as marker */ |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
1273 color_table->colors |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
1274 = (NSColor **)xmalloc (color_table->size * sizeof (NSColor *)); |
104047
f3ac65e9abd6
* nsterm.m (ns_lookup_indexed_color): Check for bad index. (ns_index_color): Init unused slot to 0. (ns_dumpglyphs_box_or_relief): Replace useless xassert with an if(). Bug 3714, possibly 3082.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104046
diff
changeset
|
1275 color_table->colors[0] = nil; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1276 color_table->empty_indices = [[NSMutableSet alloc] init]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1277 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1278 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1279 /* do we already have this color ? */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1280 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1281 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1282 for (i = 1; i < color_table->avail; i++) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1283 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1284 if (color_table->colors[i] && [color_table->colors[i] isEqual: color]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1285 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1286 [color_table->colors[i] retain]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1287 return i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1288 } |
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 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1291 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1292 if ([color_table->empty_indices count] > 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1293 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1294 index = [color_table->empty_indices anyObject]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1295 [color_table->empty_indices removeObject: index]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1296 idx = [index unsignedIntValue]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1297 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1298 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1299 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1300 if (color_table->avail == color_table->size) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1301 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1302 color_table->size += NS_COLOR_CAPACITY; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
1303 color_table->colors |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
1304 = (NSColor **)xrealloc (color_table->colors, |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
1305 color_table->size * sizeof (NSColor *)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1306 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1307 idx = color_table->avail++; |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1310 color_table->colors[idx] = color; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1311 [color retain]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1312 /*fprintf(stderr, "color_table: allocated %d\n",idx);*/ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1313 return idx; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1314 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1315 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1316 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1317 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1318 ns_free_indexed_color (unsigned long idx, struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1319 { |
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:
99558
diff
changeset
|
1320 struct ns_color_table *color_table; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1321 NSColor *color; |
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:
99558
diff
changeset
|
1322 NSNumber *index; |
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:
99558
diff
changeset
|
1323 |
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:
99558
diff
changeset
|
1324 if (!f) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1325 return; |
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:
99558
diff
changeset
|
1326 |
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:
99558
diff
changeset
|
1327 color_table = FRAME_NS_DISPLAY_INFO (f)->color_table; |
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:
99558
diff
changeset
|
1328 |
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:
99558
diff
changeset
|
1329 if (idx <= 0 || idx >= color_table->size) { |
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:
99558
diff
changeset
|
1330 message1("ns_free_indexed_color: Color index out of range.\n"); |
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:
99558
diff
changeset
|
1331 return; |
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:
99558
diff
changeset
|
1332 } |
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:
99558
diff
changeset
|
1333 |
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:
99558
diff
changeset
|
1334 index = [NSNumber numberWithUnsignedInt: idx]; |
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:
99558
diff
changeset
|
1335 if ([color_table->empty_indices containsObject: index]) { |
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:
99558
diff
changeset
|
1336 message1("ns_free_indexed_color: attempt to free already freed color.\n"); |
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:
99558
diff
changeset
|
1337 return; |
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:
99558
diff
changeset
|
1338 } |
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:
99558
diff
changeset
|
1339 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1340 color = color_table->colors[idx]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1341 [color release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1342 color_table->colors[idx] = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1343 [color_table->empty_indices addObject: [NSNumber numberWithUnsignedInt: idx]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1344 /*fprintf(stderr, "color_table: FREED %d\n",idx);*/ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1345 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1346 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1347 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1348 static int |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1349 ns_get_color (const char *name, NSColor **col) |
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 Parse a color name |
104818
7045e9821995
CHENG Gao <chenggao at gmail.com>
Glenn Morris <rgm@gnu.org>
parents:
104400
diff
changeset
|
1352 -------------------------------------------------------------------------- */ |
104398
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1353 /* On *Step, we attempt to mimic the X11 platform here, down to installing an |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1354 X11 rgb.txt-compatible color list in Emacs.clr (see ns_term_init()). |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1355 See: http://thread.gmane.org/gmane.emacs.devel/113050/focus=113272). */ |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1356 { |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1357 NSColor *new = nil; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1358 static char hex[20]; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1359 int scaling; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1360 float r = -1.0, g, b; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1361 NSString *nsname = [NSString stringWithUTF8String: name]; |
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 /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1364 BLOCK_INPUT; |
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 if ([nsname isEqualToString: @"ns_selection_color"]) |
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 nsname = ns_selection_color; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1369 name = [ns_selection_color UTF8String]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1370 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1371 |
104398
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1372 /* First, check for some sort of numeric specification. */ |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1373 hex[0] = '\0'; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1374 |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1375 if (name[0] == '0' || name[0] == '1' || name[0] == '.') /* RGB decimal */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1376 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1377 NSScanner *scanner = [NSScanner scannerWithString: nsname]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1378 [scanner scanFloat: &r]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1379 [scanner scanFloat: &g]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1380 [scanner scanFloat: &b]; |
104398
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1381 } |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1382 else if (!strncmp(name, "rgb:", 4)) /* A newer X11 format -- rgb:r/g/b */ |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1383 { |
106694
7874e9166ee3
Fix buffer overflow in ns_get_color.
Chong Yidong <cyd@stupidchicken.com>
parents:
105676
diff
changeset
|
1384 strncpy (hex, name + 4, 19); |
7874e9166ee3
Fix buffer overflow in ns_get_color.
Chong Yidong <cyd@stupidchicken.com>
parents:
105676
diff
changeset
|
1385 hex[19] = '\0'; |
104400
ed5d844496e7
(ns_get_color): fix typo in last change
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104398
diff
changeset
|
1386 scaling = (strlen(hex) - 2) / 3; |
104398
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1387 } |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1388 else if (name[0] == '#') /* An old X11 format; convert to newer */ |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1389 { |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1390 int len = (strlen(name) - 1); |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1391 int start = (len % 3 == 0) ? 1 : len / 4 + 1; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1392 int i; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1393 scaling = strlen(name+start) / 3; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1394 for (i=0; i<3; i++) { |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1395 strncpy(hex + i * (scaling + 1), name + start + i * scaling, scaling); |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1396 hex[(i+1) * (scaling + 1) - 1] = '/'; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1397 } |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1398 hex[3 * (scaling + 1) - 1] = '\0'; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1399 } |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1400 |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1401 if (hex[0]) |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1402 { |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1403 int rr, gg, bb; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1404 float fscale = scaling == 4 ? 65535.0 : (scaling == 2 ? 255.0 : 15.0); |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1405 if (sscanf (hex, "%x/%x/%x", &rr, &gg, &bb)) |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1406 { |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1407 r = rr / fscale; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1408 g = gg / fscale; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1409 b = bb / fscale; |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1410 } |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1411 } |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1412 |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1413 if (r >= 0.0) |
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1414 { |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1415 *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1416 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1417 return 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1418 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1419 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1420 /* Otherwise, color is expected to be from a list */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1421 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1422 NSEnumerator *lenum, *cenum; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1423 NSString *name; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1424 NSColorList *clist; |
97266
80acedef7417
cleanup in s/darwin.h, define DARWIN_OS and use it instead of DARWIN and/or MAC_OSX; also, nsterm.m: small unrelated cleanups
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97256
diff
changeset
|
1425 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1426 #ifdef NS_IMPL_GNUSTEP |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
1427 /* XXX: who is wrong, the requestor or the implementation? */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1428 if ([nsname compare: @"Highlight" options: NSCaseInsensitiveSearch] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1429 == NSOrderedSame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1430 nsname = @"highlightColor"; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1431 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1432 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1433 lenum = [[NSColorList availableColorLists] objectEnumerator]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1434 while ( (clist = [lenum nextObject]) && new == nil) |
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 cenum = [[clist allKeys] objectEnumerator]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1437 while ( (name = [cenum nextObject]) && new == nil ) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1438 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1439 if ([name compare: nsname |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1440 options: NSCaseInsensitiveSearch] == NSOrderedSame ) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1441 new = [clist colorWithKey: name]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1442 } |
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 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1445 |
104398
73dca9808fbe
* nsterm.m (ns_get_color): Update documentation properly for last
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104373
diff
changeset
|
1446 if (new) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1447 *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1448 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1449 return new ? 0 : 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1450 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1451 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1452 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1453 static NSColor * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1454 ns_get_color_default (const char *name, NSColor *dflt) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1455 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1456 Parse a color or use a default value |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1457 -------------------------------------------------------------------------- */ |
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 NSColor * col; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1460 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1461 if (ns_get_color (name, &col)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1462 return dflt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1463 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1464 return col; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1465 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1468 int |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1469 ns_lisp_to_color (Lisp_Object color, NSColor **col) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1470 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1471 Convert a Lisp string object to a NS color |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1472 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1473 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1474 NSTRACE (ns_lisp_to_color); |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
1475 if (STRINGP (color)) |
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
1476 return ns_get_color (SDATA (color), col); |
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
1477 else if (SYMBOLP (color)) |
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
1478 return ns_get_color (SDATA (SYMBOL_NAME (color)), col); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1479 return 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1480 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1481 |
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 Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1484 ns_color_to_lisp (NSColor *col) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1485 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1486 Convert a color to a lisp string with the RGB equivalent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1487 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1488 { |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
1489 CGFloat red, green, blue, alpha, gray; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1490 char buf[1024]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1491 const char *str; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1492 NSTRACE (ns_color_to_lisp); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1493 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1494 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1495 if ([[col colorSpaceName] isEqualToString: NSNamedColorSpace]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1496 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1497 if ((str =[[col colorNameComponent] UTF8String])) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1498 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1499 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1500 return build_string ((char *)str); |
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 [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1504 getRed: &red green: &green blue: &blue alpha: &alpha]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1505 if (red ==green && red ==blue) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1506 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1507 [[col colorUsingColorSpaceName: NSCalibratedWhiteColorSpace] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1508 getWhite: &gray alpha: &alpha]; |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
1509 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", |
103930
acbdb25bae13
(ns_get_color): Remove incompatible color formats.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
103909
diff
changeset
|
1510 lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1511 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1512 return build_string (buf); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1513 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1514 |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
1515 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1516 lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1517 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1518 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1519 return build_string (buf); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1520 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1521 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1522 |
101637
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1523 void |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1524 ns_query_color(void *col, XColor *color_def, int setPixel) |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1525 /* -------------------------------------------------------------------------- |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1526 Get ARGB values out of NSColor col and put them into color_def. |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1527 If setPixel, set the pixel to a concatenated version. |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1528 and set color_def pixel to the resulting index. |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1529 -------------------------------------------------------------------------- */ |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1530 { |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
1531 CGFloat r, g, b, a; |
101637
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1532 |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1533 [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a]; |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1534 color_def->red = r * 65535; |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1535 color_def->green = g * 65535; |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1536 color_def->blue = b * 65535; |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1537 |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1538 if (setPixel == YES) |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1539 color_def->pixel |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1540 = ARGB_TO_ULONG((int)(a*255), |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1541 (int)(r*255), (int)(g*255), (int)(b*255)); |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1542 } |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1543 |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
1544 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1545 int |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1546 ns_defined_color (struct frame *f, |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1547 const char *name, |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1548 XColor *color_def, |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
1549 int alloc, |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1550 char makeIndex) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1551 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
1552 Return 1 if named color found, and set color_def rgb accordingly. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1553 If makeIndex and alloc are nonzero put the color in the color_table, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1554 and set color_def pixel to the resulting index. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1555 If makeIndex is zero, set color_def pixel to ARGB. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1556 Return 0 if not found |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1557 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1558 { |
107062
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1559 NSColor *col; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1560 NSTRACE (ns_defined_color); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1561 |
107062
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1562 BLOCK_INPUT; |
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1563 if (ns_get_color (name, &col) != 0) /* Color not found */ |
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1564 { |
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1565 UNBLOCK_INPUT; |
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1566 return 0; |
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1567 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1568 if (makeIndex && alloc) |
107062
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1569 color_def->pixel = ns_index_color (col, f); |
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1570 ns_query_color (col, color_def, !makeIndex); |
bb5cb7ece094
* nsterm.m (ns_defined_color): Block input. Suggested by Mike
Chong Yidong <cyd@stupidchicken.com>
parents:
107058
diff
changeset
|
1571 UNBLOCK_INPUT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1572 return 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1573 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1574 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1575 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1576 unsigned long |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1577 ns_get_rgb_color (struct frame *f, float r, float g, float b, float a) |
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 return an autoreleased RGB color |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1580 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1581 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1582 /*static int c = 1; fprintf (stderr, "color request %d\n", c++); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1583 if (r < 0.0) r = 0.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1584 else if (r > 1.0) r = 1.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1585 if (g < 0.0) g = 0.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1586 else if (g > 1.0) g = 1.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1587 if (b < 0.0) b = 0.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1588 else if (b > 1.0) b = 1.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1589 if (a < 0.0) a = 0.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1590 else if (a > 1.0) a = 1.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1591 return (unsigned long) ns_index_color( |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1592 [NSColor colorWithCalibratedRed: r green: g blue: b alpha: a], f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1593 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1594 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1595 |
100001
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1596 void |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1597 x_set_frame_alpha (struct frame *f) |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1598 /* -------------------------------------------------------------------------- |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1599 change the entire-frame transparency |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1600 -------------------------------------------------------------------------- */ |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1601 { |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1602 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1603 EmacsView *view = FRAME_NS_VIEW (f); |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1604 double alpha = 1.0; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1605 double alpha_min = 1.0; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1606 |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1607 if (dpyinfo->x_highlight_frame == f) |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1608 alpha = f->alpha[0]; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1609 else |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1610 alpha = f->alpha[1]; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1611 |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1612 if (FLOATP (Vframe_alpha_lower_limit)) |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1613 alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit); |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1614 else if (INTEGERP (Vframe_alpha_lower_limit)) |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1615 alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1616 |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1617 if (alpha < 0.0) |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1618 return; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1619 else if (1.0 < alpha) |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1620 alpha = 1.0; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1621 else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0) |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1622 alpha = alpha_min; |
100666
dab9cf44bf3f
In comments, write delete_frame instead of Fdelete_frame.
Martin Rudalics <rudalics@gmx.at>
parents:
100001
diff
changeset
|
1623 |
100001
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1624 #ifdef NS_IMPL_COCOA |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1625 [[view window] setAlphaValue: alpha]; |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1626 #endif |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1627 } |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
1628 |
96675
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1632 Mouse handling |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1633 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1634 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1635 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1636 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1637 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1638 x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1639 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1640 Programmatically reposition mouse pointer in pixel coordinates |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1641 -------------------------------------------------------------------------- */ |
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 NSTRACE (x_set_mouse_pixel_position); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1644 ns_raise_frame (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1645 #if 0 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
1646 /* FIXME: this does not work, and what about GNUstep? */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1647 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1648 [FRAME_NS_VIEW (f) lockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1649 PSsetmouse ((float)pix_x, (float)pix_y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1650 [FRAME_NS_VIEW (f) unlockFocus]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1651 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1652 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1653 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1654 |
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 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1657 x_set_mouse_position (struct frame *f, int h, int v) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1658 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1659 Programmatically reposition mouse pointer in character coordinates |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1660 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1661 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1662 int pix_x, pix_y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1663 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1664 pix_x = FRAME_COL_TO_PIXEL_X (f, h) + FRAME_COLUMN_WIDTH (f) / 2; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1665 pix_y = FRAME_LINE_TO_PIXEL_Y (f, v) + FRAME_LINE_HEIGHT (f) / 2; |
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 if (pix_x < 0) pix_x = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1668 if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1669 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1670 if (pix_y < 0) pix_y = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1671 if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1672 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1673 x_set_mouse_pixel_position (f, pix_x, pix_y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1674 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1675 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1676 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1677 static int |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1678 note_mouse_movement (struct frame *frame, float x, float y) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1679 /* ------------------------------------------------------------------------ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1680 Called by EmacsView on mouseMovement events. Passes on |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1681 to emacs mainstream code if we moved off of a rect of interest |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1682 known as last_mouse_glyph. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1683 ------------------------------------------------------------------------ */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1684 { |
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:
98371
diff
changeset
|
1685 // NSTRACE (note_mouse_movement); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1686 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1687 XSETFRAME (last_mouse_motion_frame, frame); |
100666
dab9cf44bf3f
In comments, write delete_frame instead of Fdelete_frame.
Martin Rudalics <rudalics@gmx.at>
parents:
100001
diff
changeset
|
1688 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1689 /* Note, this doesn't get called for enter/leave, since we don't have a |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1690 position. Those are taken care of in the corresponding NSView methods. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1691 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1692 /* has movement gone beyond last rect we were tracking? */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1693 if (x < last_mouse_glyph.origin.x || |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1694 x >= (last_mouse_glyph.origin.x + last_mouse_glyph.size.width) || |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1695 y < last_mouse_glyph.origin.y || |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1696 y >= (last_mouse_glyph.origin.y + last_mouse_glyph.size.height)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1697 { |
103173
80d012abe015
mouse movement/highlight: bracket drawing operations in ns_update_begin and ns_update_end.
David Reitter <david.reitter@gmail.com>
parents:
103160
diff
changeset
|
1698 ns_update_begin(frame); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1699 frame->mouse_moved = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1700 note_mouse_highlight (frame, x, y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1701 remember_mouse_glyph (frame, x, y, &last_mouse_glyph); |
103173
80d012abe015
mouse movement/highlight: bracket drawing operations in ns_update_begin and ns_update_end.
David Reitter <david.reitter@gmail.com>
parents:
103160
diff
changeset
|
1702 ns_update_end(frame); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1703 return 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1704 } |
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 return 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1707 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1710 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1711 ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1712 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1713 unsigned long *time) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1714 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1715 External (hook): inform emacs about mouse position and hit parts. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1716 If a scrollbar is being dragged, set bar_window, part, x, y, time. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1717 x & y should be position in the scrollbar (the whole bar, not the handle) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1718 and length of scrollbar respectively |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1719 -------------------------------------------------------------------------- */ |
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 id view; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1722 NSPoint position; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1723 int xchar, ychar; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1724 Lisp_Object frame, tail; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1725 struct frame *f; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1726 struct ns_display_info *dpyinfo; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1727 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1728 NSTRACE (ns_mouse_position); |
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 if (*fp == NULL) |
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 fprintf (stderr, "Warning: ns_mouse_position () called with null *fp.\n"); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1733 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1734 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1735 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1736 dpyinfo = FRAME_NS_DISPLAY_INFO (*fp); |
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 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1739 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1740 if (last_mouse_scroll_bar != nil && insist == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1741 { |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
1742 /* TODO: we do not use this path at the moment because drag events will |
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
1743 go directly to the EmacsScroller. Leaving code in for now. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1744 [last_mouse_scroll_bar getMouseMotionPart: (int *)part window: bar_window |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1745 x: x y: y]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1746 if (time) *time = last_mouse_movement_time; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1747 last_mouse_scroll_bar = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1748 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1749 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1750 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1751 /* Clear the mouse-moved flag for every frame on this display. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1752 FOR_EACH_FRAME (tail, frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1753 if (FRAME_NS_P (XFRAME (frame)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1754 && FRAME_NS_DISPLAY (XFRAME (frame)) == FRAME_NS_DISPLAY (*fp)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1755 XFRAME (frame)->mouse_moved = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1756 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1757 last_mouse_scroll_bar = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1758 if (last_mouse_frame && FRAME_LIVE_P (last_mouse_frame)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1759 f = last_mouse_frame; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1760 else |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
1761 f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1762 : SELECTED_FRAME (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1763 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
1764 if (f && f->output_data.ns) /* TODO: 2nd check no longer needed? */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1765 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1766 view = FRAME_NS_VIEW (*fp); |
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 position = [[view window] mouseLocationOutsideOfEventStream]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1769 position = [view convertPoint: position fromView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1770 remember_mouse_glyph (f, position.x, position.y, &last_mouse_glyph); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1771 /*fprintf (stderr, "ns_mouse_position: %.0f, %.0f\n", position.x, position.y); */ |
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 if (bar_window) *bar_window = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1774 if (part) *part = 0; /*scroll_bar_handle; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1775 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1776 if (x) XSETINT (*x, lrint (position.x)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1777 if (y) XSETINT (*y, lrint (position.y)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1778 if (time) *time = last_mouse_movement_time; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1779 *fp = f; |
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 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1782 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1783 UNBLOCK_INPUT; |
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 |
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 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1788 ns_frame_up_to_date (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1789 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1790 External (hook): Fix up mouse highlighting right after a full update. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1791 Some highlighting was deferred if GC was happening during |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1792 note_mouse_highlight (), while other highlighting was deferred for update. |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1795 NSTRACE (ns_frame_up_to_date); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1796 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1797 if (FRAME_NS_P (f)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1798 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1799 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1800 if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1801 /*&& hlinfo->mouse_face_mouse_frame*/) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1802 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1803 BLOCK_INPUT; |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1804 ns_update_begin(f); |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1805 if (hlinfo->mouse_face_mouse_frame) |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1806 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1807 hlinfo->mouse_face_mouse_x, |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1808 hlinfo->mouse_face_mouse_y); |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1809 hlinfo->mouse_face_deferred_gc = 0; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
1810 ns_update_end(f); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1811 UNBLOCK_INPUT; |
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 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1814 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1815 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1816 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1817 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1818 ns_define_frame_cursor (struct frame *f, Cursor cursor) |
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 External (RIF): set frame mouse pointer type. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1821 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1822 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1823 NSTRACE (ns_define_frame_cursor); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1824 if (FRAME_POINTER_TYPE (f) != cursor) |
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 EmacsView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1827 FRAME_POINTER_TYPE (f) = cursor; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1828 [[view window] invalidateCursorRectsForView: view]; |
109835
58e44f7a82d5
* nsterm.m (ns_define_frame_cursor): Call x_update_cursor (Bug#6868).
Jan D <jan.h.d@swipnet.se>
parents:
109653
diff
changeset
|
1829 /* Redisplay assumes this function also draws the changed frame |
58e44f7a82d5
* nsterm.m (ns_define_frame_cursor): Call x_update_cursor (Bug#6868).
Jan D <jan.h.d@swipnet.se>
parents:
109653
diff
changeset
|
1830 cursor, but this function doesn't, so do it explicitly. */ |
58e44f7a82d5
* nsterm.m (ns_define_frame_cursor): Call x_update_cursor (Bug#6868).
Jan D <jan.h.d@swipnet.se>
parents:
109653
diff
changeset
|
1831 x_update_cursor (f, 1); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1832 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1833 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1834 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1835 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1836 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1837 /* ========================================================================== |
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 Keyboard handling |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1840 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1841 ========================================================================== */ |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1844 static unsigned |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1845 ns_convert_key (unsigned code) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1846 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1847 Internal call used by NSView-keyDown. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1848 -------------------------------------------------------------------------- */ |
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 const unsigned last_keysym = (sizeof (convert_ns_to_X_keysym) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1851 / sizeof (convert_ns_to_X_keysym[0])); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1852 unsigned keysym; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1853 /* An array would be faster, but less easy to read. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1854 for (keysym = 0; keysym < last_keysym; keysym += 2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1855 if (code == convert_ns_to_X_keysym[keysym]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1856 return 0xFF00 | convert_ns_to_X_keysym[keysym+1]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1857 return 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1858 /* if decide to use keyCode and Carbon table, use this line: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1859 return code > 0xff ? 0 : 0xFF00 | ns_keycode_to_xkeysym_table[code]; */ |
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 |
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 char * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1864 x_get_keysym_name (int keysym) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1865 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1866 Called by keyboard.c. Not sure if the return val is important, except |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1867 that it be unique. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1868 -------------------------------------------------------------------------- */ |
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 static char value[16]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1871 NSTRACE (x_get_keysym_name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1872 sprintf (value, "%d", keysym); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1873 return value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1874 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1877 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1878 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1879 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1880 Block drawing operations |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1881 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1882 ========================================================================== */ |
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 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1886 ns_redraw_scroll_bars (struct frame *f) |
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 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1889 id view; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1890 NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1891 NSTRACE (ns_judge_scroll_bars); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1892 for (i =[subviews count]-1; i >= 0; i--) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1893 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1894 view = [subviews objectAtIndex: i]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1895 if (![view isKindOfClass: [EmacsScroller class]]) continue; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1896 [view display]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1897 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1898 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1901 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1902 ns_clear_frame (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1903 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1904 External (hook): Erase the entire frame |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1907 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1908 NSRect r; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1909 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1910 NSTRACE (ns_clear_frame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1911 if (ns_in_resize) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1912 return; |
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 /* comes on initial frame because we have |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1915 after-make-frame-functions = select-frame */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1916 if (!FRAME_DEFAULT_FACE (f)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1917 return; |
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 mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1920 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1921 output_cursor.hpos = output_cursor.vpos = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1922 output_cursor.x = -1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1923 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1924 r = [view bounds]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1925 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1926 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1927 ns_focus (f, &r, 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1928 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f) set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1929 NSRectFill (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1930 ns_unfocus (f); |
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 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1933 [[view window] display]; /* redraw resize handle */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1934 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1935 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1936 /* as of 2006/11 or so this is now needed */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1937 ns_redraw_scroll_bars (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1938 UNBLOCK_INPUT; |
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 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1943 ns_clear_frame_area (struct frame *f, int x, int y, int width, int height) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1944 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
1945 External (RIF): Clear section of frame |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1946 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1947 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1948 NSRect r = NSMakeRect (x, y, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1949 NSView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1950 struct face *face = FRAME_DEFAULT_FACE (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1951 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1952 if (!view || !face) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1953 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1954 |
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:
98371
diff
changeset
|
1955 NSTRACE (ns_clear_frame_area); |
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:
98371
diff
changeset
|
1956 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1957 r = NSIntersectionRect (r, [view frame]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1958 ns_focus (f, &r, 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1959 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; |
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 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1962 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1963 /* clip out the resize handle */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1964 NSWindow *window = [FRAME_NS_VIEW (f) window]; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
1965 NSRect ir |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
1966 = [view convertRect: ns_resize_handle_rect (window) fromView: nil]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1967 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1968 ir = NSIntersectionRect (r, ir); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1969 if (NSIsEmptyRect (ir)) |
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 #endif |
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 NSRectFill (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1974 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1975 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1976 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1977 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1978 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1979 NSRect r1 = r, r2 = r; /* upper and lower non-intersecting */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1980 r1.size.height -= ir.size.height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1981 r2.origin.y += r1.size.height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1982 r2.size.width -= ir.size.width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1983 r2.size.height = ir.size.height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1984 NSRectFill (r1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1985 NSRectFill (r2); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1986 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1987 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1988 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1989 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1990 ns_unfocus (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1991 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1992 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1993 |
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 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1996 ns_scroll_run (struct window *w, struct run *run) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1997 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
1998 External (RIF): Insert or delete n lines at line vpos |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1999 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2000 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2001 struct frame *f = XFRAME (w->frame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2002 int x, y, width, height, from_y, to_y, bottom_y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2003 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2004 NSTRACE (ns_scroll_run); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2005 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2006 /* begin copy from other terms */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2007 /* Get frame-relative bounding box of the text display area of W, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2008 without mode lines. Include in this box the left and right |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2009 fringe of W. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2010 window_box (w, -1, &x, &y, &width, &height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2011 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2012 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2013 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2014 bottom_y = y + height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2015 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2016 if (to_y < from_y) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2017 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2018 /* Scrolling up. Make sure we don't copy part of the mode |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2019 line at the bottom. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2020 if (from_y + run->height > bottom_y) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2021 height = bottom_y - from_y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2022 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2023 height = run->height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2024 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2025 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2026 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2027 /* Scolling down. Make sure we don't copy over the mode line. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2028 at the bottom. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2029 if (to_y + run->height > bottom_y) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2030 height = bottom_y - to_y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2031 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2032 height = run->height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2033 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2034 /* end copy from other terms */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2035 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2036 if (height == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2037 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2038 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2039 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2040 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2041 updated_window = w; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2042 x_clear_cursor (w); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2043 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2044 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2045 NSRect srcRect = NSMakeRect (x, from_y, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2046 NSRect dstRect = NSMakeRect (x, to_y, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2047 NSPoint dstOrigin = NSMakePoint (x, to_y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2048 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2049 ns_focus (f, &dstRect, 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2050 NSCopyBits (0, srcRect , dstOrigin); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2051 ns_unfocus (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2052 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2053 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2054 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2055 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2056 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2057 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2058 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2059 ns_after_update_window_line (struct glyph_row *desired_row) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2060 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
2061 External (RIF): preparatory to fringe update after text was updated |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2062 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2063 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2064 struct window *w = updated_window; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2065 struct frame *f; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2066 int width, height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2067 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2068 NSTRACE (ns_after_update_window_line); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2069 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2070 /* begin copy from other terms */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2071 xassert (w); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2072 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2073 if (!desired_row->mode_line_p && !w->pseudo_window_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2074 desired_row->redraw_fringe_bitmaps_p = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2075 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2076 /* When a window has disappeared, make sure that no rest of |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2077 full-width rows stays visible in the internal border. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2078 Under NS this is drawn inside the fringes. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2079 if (windows_or_buffers_changed |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2080 && (f = XFRAME (w->frame), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2081 width = FRAME_INTERNAL_BORDER_WIDTH (f), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2082 width != 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2083 && (height = desired_row->visible_height, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2084 height > 0)) |
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 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); |
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 /* Internal border is drawn below the tool bar. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2089 if (WINDOWP (f->tool_bar_window) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2090 && w == XWINDOW (f->tool_bar_window)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2091 y -= width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2092 /* end copy from other terms */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2093 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2094 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2095 if (!desired_row->full_width_p) |
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 int x1 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2098 + WINDOW_LEFT_FRINGE_WIDTH (w); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2099 int x2 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2100 + FRAME_PIXEL_WIDTH (f) - NS_SCROLL_BAR_WIDTH (f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2101 - WINDOW_RIGHT_FRINGE_WIDTH (w) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2102 - FRAME_INTERNAL_BORDER_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2103 ns_clear_frame_area (f, x1, y, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2104 ns_clear_frame_area (f, x2, y, width, height); |
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 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2107 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2108 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2111 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2112 ns_shift_glyphs_for_insert (struct frame *f, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2113 int x, int y, int width, int height, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2114 int shift_by) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2115 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
2116 External (RIF): copy an area horizontally, don't worry about clearing src |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2117 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2118 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2119 NSRect srcRect = NSMakeRect (x, y, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2120 NSRect dstRect = NSMakeRect (x+shift_by, y, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2121 NSPoint dstOrigin = dstRect.origin; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2122 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2123 NSTRACE (ns_shift_glyphs_for_insert); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2124 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2125 ns_focus (f, &dstRect, 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2126 NSCopyBits (0, srcRect, dstOrigin); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2127 ns_unfocus (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2128 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2129 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2130 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2131 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2132 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2133 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2134 Character encoding and metrics |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2139 static inline void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2140 ns_compute_glyph_string_overhangs (struct glyph_string *s) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2141 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
2142 External (RIF); compute left/right overhang of whole string and set in s |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2143 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2144 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2145 struct face *face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2146 struct font *font = s->font; /*face->font; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2147 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2148 if (s->char2b) |
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 struct font_metrics metrics; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2151 unsigned int codes[2]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2152 codes[0] = *(s->char2b); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2153 codes[1] = *(s->char2b + s->nchars - 1); |
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 font->driver->text_extents (font, codes, 2, &metrics); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2156 s->left_overhang = -metrics.lbearing; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2157 s->right_overhang |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2158 = metrics.rbearing > metrics.width |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2159 ? metrics.rbearing - metrics.width : 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2160 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2161 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2162 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2163 s->left_overhang = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2164 s->right_overhang = ((struct nsfont_info *)font)->ital ? |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2165 FONT_HEIGHT (font) * 0.2 : 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2166 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2167 } |
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 |
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 Fringe and cursor drawing |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2174 |
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 |
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 extern int max_used_fringe_bitmap; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2179 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2180 ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2181 struct draw_fringe_bitmap_params *p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2182 /* -------------------------------------------------------------------------- |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
2183 External (RIF); fringe-related |
96675
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 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2187 struct face *face = p->face; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2188 int rowY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2189 static EmacsImage **bimgs = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2190 static int nBimgs = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2191 /* NS-specific: move internal border inside fringe */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2192 int x = p->bx < 0 ? p->x : p->bx; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2193 int wd = p->bx < 0 ? p->wd : p->nx; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2194 BOOL fringeOnVeryLeft |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2195 = x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2196 - FRAME_INTERNAL_BORDER_WIDTH (f) < 10; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2197 BOOL fringeOnVeryRight |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2198 = FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2199 - WINDOW_RIGHT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) < 10; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2200 int xAdjust = FRAME_INTERNAL_BORDER_WIDTH (f) * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2201 (fringeOnVeryLeft ? -1 : (fringeOnVeryRight ? 1 : 0)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2202 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2203 /* grow bimgs if needed */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2204 if (nBimgs < max_used_fringe_bitmap) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2205 { |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2206 EmacsImage **newBimgs |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
2207 = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109092
diff
changeset
|
2208 memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2209 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2210 if (nBimgs) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2211 { |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109092
diff
changeset
|
2212 memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2213 xfree (bimgs); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2214 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2215 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2216 bimgs = newBimgs; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2217 nBimgs = max_used_fringe_bitmap; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2218 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2219 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2220 /* Must clip because of partially visible lines. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2221 rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); |
109296
f6f0d450d542
Fix ghost buffer boundary indicators in fringes (Bug#5634, Bug#6325).
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
107700
diff
changeset
|
2222 ns_clip_to_row (w, row, -1, YES); |
96675
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 (p->bx >= 0 && !p->overlay_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2225 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2226 int yAdjust = rowY - FRAME_INTERNAL_BORDER_WIDTH (f) < 5 ? |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2227 -FRAME_INTERNAL_BORDER_WIDTH (f) : 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2228 int yIncr = FRAME_PIXEL_HEIGHT (f) - (p->by+yAdjust + p->ny) < 5 ? |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
2229 FRAME_INTERNAL_BORDER_WIDTH (f) : 0 |
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
2230 + (yAdjust ? FRAME_INTERNAL_BORDER_WIDTH (f) : 0); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2231 NSRect r = NSMakeRect (p->bx+xAdjust, p->by+yAdjust, p->nx, p->ny+yIncr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2232 NSRectClip (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2233 [ns_lookup_indexed_color(face->background, f) set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2234 NSRectFill (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2235 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2236 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2237 if (p->which) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2238 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2239 NSRect r = NSMakeRect (p->x+xAdjust, p->y, p->wd, p->h); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2240 NSPoint pt = r.origin; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2241 EmacsImage *img = bimgs[p->which - 1]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2242 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2243 if (!img) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2244 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2245 unsigned short *bits = p->bits + p->dh; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2246 int len = 8 * p->h/8; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2247 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2248 unsigned char *cbits = xmalloc (len); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2249 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2250 for (i =0; i<len; i++) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2251 cbits[i] = ~(bits[i] & 0xff); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2252 img = [[EmacsImage alloc] initFromXBM: cbits width: 8 height: p->h |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2253 flip: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2254 bimgs[p->which - 1] = img; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2255 xfree (cbits); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2256 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2257 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2258 NSRectClip (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2259 /* Since we composite the bitmap instead of just blitting it, we need |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2260 to erase the whole background. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2261 [ns_lookup_indexed_color(face->background, f) set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2262 NSRectFill (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2263 pt.y += p->h; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2264 [img setXBMColor: ns_lookup_indexed_color(face->foreground, f)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2265 [img compositeToPoint: pt operation: NSCompositeSourceOver]; |
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 ns_unfocus (f); |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2271 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2272 ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2273 int x, int y, int cursor_type, int cursor_width, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2274 int on_p, int active_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2275 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2276 External call (RIF): draw cursor |
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:
98371
diff
changeset
|
2277 (modeled after x_draw_window_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:
98371
diff
changeset
|
2278 FIXME: cursor_width is effectively bogus -- it sometimes gets set |
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:
98371
diff
changeset
|
2279 in xdisp.c set_frame_cursor_types, sometimes left uninitialized; |
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:
98371
diff
changeset
|
2280 DON'T USE IT (no other terms do) |
96675
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 NSRect r, s; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2284 int fx, fy, h; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2285 struct frame *f = WINDOW_XFRAME (w); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2286 struct glyph *phys_cursor_glyph; |
103340
49d3f24a1a60
nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. (ns_init_paths): Append path separator to INFOPATH variable. (ns_use_system_highlight_color): Drop, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103296
diff
changeset
|
2287 int overspill; |
110014
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2288 struct glyph *cursor_glyph; |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2289 |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2290 /* If cursor is out of bounds, don't draw garbage. This can happen |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2291 in mini-buffer windows when switching between echo area glyphs |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2292 and mini-buffer. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2293 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2294 NSTRACE (dumpcursor); |
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:
98371
diff
changeset
|
2295 //fprintf(stderr, "drawcursor (%d,%d) activep = %d\tonp = %d\tc_type = %d\twidth = %d\n",x,y, active_p,on_p,cursor_type,cursor_width); |
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:
98371
diff
changeset
|
2296 |
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:
98371
diff
changeset
|
2297 if (!on_p) |
97605
d5535f9696b8
ns_draw_window_cursor: fix bug in setting cursor type in inactive
David Reitter <david.reitter@gmail.com>
parents:
97584
diff
changeset
|
2298 return; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2299 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2300 w->phys_cursor_type = cursor_type; |
97569
09c3a29de655
Clear cursor properly rather than redrawing the area. Respect width of
David Reitter <david.reitter@gmail.com>
parents:
97279
diff
changeset
|
2301 w->phys_cursor_on_p = on_p; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2302 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2303 if (cursor_type == NO_CURSOR) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2304 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2305 w->phys_cursor_width = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2306 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2307 } |
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 if ((phys_cursor_glyph = get_phys_cursor_glyph (w)) == NULL) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2310 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2311 if (glyph_row->exact_window_width_line_p |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2312 && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2313 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2314 glyph_row->cursor_in_fringe_p = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2315 draw_fringe_bitmap (w, glyph_row, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2316 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2317 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2318 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2319 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2320 get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2321 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2322 r.origin.x = fx, r.origin.y = fy; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2323 r.size.height = h; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2324 r.size.width = w->phys_cursor_width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2325 |
97194
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
2326 /* FIXME: if we overwrite the internal border area, it does not get erased; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2327 fix by truncating cursor, but better would be to erase properly */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2328 overspill = r.origin.x + r.size.width - |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2329 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, WINDOW_BOX_RIGHT_EDGE_X (w) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2330 - WINDOW_TOTAL_FRINGE_WIDTH (w) - FRAME_INTERNAL_BORDER_WIDTH (f)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2331 if (overspill > 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2332 r.size.width -= overspill; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2333 |
97194
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
2334 /* TODO: only needed in rare cases with last-resort font in HELLO.. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2335 should we do this more efficiently? */ |
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:
98371
diff
changeset
|
2336 ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */ |
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:
98371
diff
changeset
|
2337 [FRAME_CURSOR_COLOR (f) set]; |
97569
09c3a29de655
Clear cursor properly rather than redrawing the area. Respect width of
David Reitter <david.reitter@gmail.com>
parents:
97279
diff
changeset
|
2338 |
97678
82049cd6b1d9
(ns_draw_window_cursor): .*ScreenUpdates() calls only if NS_IMPL_COCOA
David Reitter <david.reitter@gmail.com>
parents:
97605
diff
changeset
|
2339 #ifdef NS_IMPL_COCOA |
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:
98371
diff
changeset
|
2340 /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph |
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:
98371
diff
changeset
|
2341 atomic. Cleaner ways of doing this should be investigated. |
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:
98371
diff
changeset
|
2342 One way would be to set a global variable DRAWING_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:
98371
diff
changeset
|
2343 when making the call to draw_phys..(), don't focus in that |
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:
98371
diff
changeset
|
2344 case, then move the ns_unfocus() here after that call. */ |
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:
98371
diff
changeset
|
2345 NSDisableScreenUpdates (); |
97678
82049cd6b1d9
(ns_draw_window_cursor): .*ScreenUpdates() calls only if NS_IMPL_COCOA
David Reitter <david.reitter@gmail.com>
parents:
97605
diff
changeset
|
2346 #endif |
97569
09c3a29de655
Clear cursor properly rather than redrawing the area. Respect width of
David Reitter <david.reitter@gmail.com>
parents:
97279
diff
changeset
|
2347 |
103340
49d3f24a1a60
nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. (ns_init_paths): Append path separator to INFOPATH variable. (ns_use_system_highlight_color): Drop, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103296
diff
changeset
|
2348 switch (cursor_type) |
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:
98371
diff
changeset
|
2349 { |
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:
98371
diff
changeset
|
2350 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:
98371
diff
changeset
|
2351 break; |
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:
98371
diff
changeset
|
2352 case 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:
98371
diff
changeset
|
2353 NSRectFill (r); |
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:
98371
diff
changeset
|
2354 break; |
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:
98371
diff
changeset
|
2355 case 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:
98371
diff
changeset
|
2356 NSRectFill (r); |
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:
98371
diff
changeset
|
2357 [FRAME_BACKGROUND_COLOR (f) set]; |
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:
98371
diff
changeset
|
2358 NSRectFill (NSInsetRect (r, 1, 1)); |
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:
98371
diff
changeset
|
2359 [FRAME_CURSOR_COLOR (f) set]; |
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:
98371
diff
changeset
|
2360 break; |
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:
98371
diff
changeset
|
2361 case 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:
98371
diff
changeset
|
2362 s = r; |
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:
98371
diff
changeset
|
2363 s.origin.y += lrint (0.75 * s.size.height); |
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:
98371
diff
changeset
|
2364 s.size.height = lrint (s.size.height * 0.25); |
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:
98371
diff
changeset
|
2365 NSRectFill (s); |
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:
98371
diff
changeset
|
2366 break; |
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:
98371
diff
changeset
|
2367 case 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:
98371
diff
changeset
|
2368 s = r; |
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:
98371
diff
changeset
|
2369 s.size.width = min (cursor_width, 2); //FIXME(see above) |
110014
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2370 |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2371 /* If the character under cursor is R2L, draw the bar cursor |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2372 on the right of its glyph, rather than on the left. */ |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2373 cursor_glyph = get_phys_cursor_glyph (w); |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2374 if ((cursor_glyph->resolved_level & 1) != 0) |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2375 s.origin.x += cursor_glyph->pixel_width - s.size.width; |
f576b550fb69
* nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
Jan D <jan.h.d@swipnet.se>
parents:
109835
diff
changeset
|
2376 |
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:
98371
diff
changeset
|
2377 NSRectFill (s); |
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:
98371
diff
changeset
|
2378 break; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2379 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2380 ns_unfocus (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2381 |
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:
98371
diff
changeset
|
2382 /* draw the character under the cursor */ |
103340
49d3f24a1a60
nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. (ns_init_paths): Append path separator to INFOPATH variable. (ns_use_system_highlight_color): Drop, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103296
diff
changeset
|
2383 if (cursor_type != NO_CURSOR) |
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:
98371
diff
changeset
|
2384 draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); |
97569
09c3a29de655
Clear cursor properly rather than redrawing the area. Respect width of
David Reitter <david.reitter@gmail.com>
parents:
97279
diff
changeset
|
2385 |
97678
82049cd6b1d9
(ns_draw_window_cursor): .*ScreenUpdates() calls only if NS_IMPL_COCOA
David Reitter <david.reitter@gmail.com>
parents:
97605
diff
changeset
|
2386 #ifdef NS_IMPL_COCOA |
97569
09c3a29de655
Clear cursor properly rather than redrawing the area. Respect width of
David Reitter <david.reitter@gmail.com>
parents:
97279
diff
changeset
|
2387 NSEnableScreenUpdates (); |
97678
82049cd6b1d9
(ns_draw_window_cursor): .*ScreenUpdates() calls only if NS_IMPL_COCOA
David Reitter <david.reitter@gmail.com>
parents:
97605
diff
changeset
|
2388 #endif |
97569
09c3a29de655
Clear cursor properly rather than redrawing the area. Respect width of
David Reitter <david.reitter@gmail.com>
parents:
97279
diff
changeset
|
2389 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2390 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2391 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2392 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2393 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2394 ns_draw_vertical_window_border (struct window *w, int x, int y0, int y1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2395 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2396 External (RIF): Draw a vertical line. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2397 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2398 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2399 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2400 struct face *face; |
102429
6ad9dc785e40
(ns_draw_vertical_window_border): Draw 1 pixel wide, not two, and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102427
diff
changeset
|
2401 NSRect r = NSMakeRect (x, y0, 1, y1-y0); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2402 |
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:
98371
diff
changeset
|
2403 NSTRACE (ns_draw_vertical_window_border); |
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:
98371
diff
changeset
|
2404 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2405 face = FACE_FROM_ID (f, VERTICAL_BORDER_FACE_ID); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2406 if (face) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2407 [ns_lookup_indexed_color(face->foreground, f) set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2408 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2409 ns_focus (f, &r, 1); |
102429
6ad9dc785e40
(ns_draw_vertical_window_border): Draw 1 pixel wide, not two, and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102427
diff
changeset
|
2410 NSRectFill(r); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2411 ns_unfocus (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2412 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2413 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2414 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2415 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2416 show_hourglass (struct atimer *timer) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2417 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2418 if (hourglass_shown_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2419 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2420 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2421 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2422 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
2423 /* TODO: add NSProgressIndicator to selected frame (see macfns.c) */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2424 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2425 hourglass_shown_p = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2426 UNBLOCK_INPUT; |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2430 void |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
2431 hide_hourglass (void) |
96675
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 if (!hourglass_shown_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2434 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2435 |
97194
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
2436 BLOCK_INPUT; |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
2437 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
2438 /* TODO: remove NSProgressIndicator from all frames */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2439 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2440 hourglass_shown_p = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2441 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2442 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2443 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2444 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2445 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2446 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2447 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2448 Glyph drawing operations |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2449 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2450 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2451 |
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 static inline NSRect |
98371
713cc05ca791
* nsfont.m (nsfont_draw): Fix up composition rendering.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
98229
diff
changeset
|
2454 ns_fix_rect_ibw (NSRect r, int fibw, int frame_pixel_width) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2455 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2456 Under NS we draw internal borders inside fringes, and want full-width |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2457 rendering to go all the way to edge. This function makes that correction. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2458 -------------------------------------------------------------------------- */ |
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 if (r.origin.y <= fibw+1) |
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 r.size.height += r.origin.y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2463 r.origin.y = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2464 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2465 if (r.origin.x <= fibw+1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2466 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2467 r.size.width += r.origin.x; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2468 r.origin.x = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2469 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2470 if (frame_pixel_width - (r.origin.x+r.size.width) <= fibw+1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2471 r.size.width += fibw; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2472 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2473 return r; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2474 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2475 |
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 static int |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2478 ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2479 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2480 Wrapper utility to account for internal border width on full-width lines, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2481 and allow top full-width rows to hit the frame top. nr should be pointer |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2482 to two successive NSRects. Number of rects actually used is returned. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2483 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2484 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2485 int n = get_glyph_string_clip_rects (s, nr, 2); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2486 if (s->row->full_width_p) |
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 *nr = ns_fix_rect_ibw (*nr, FRAME_INTERNAL_BORDER_WIDTH (s->f), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2489 FRAME_PIXEL_WIDTH (s->f)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2490 if (n == 2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2491 *nr = ns_fix_rect_ibw (*(nr+1), FRAME_INTERNAL_BORDER_WIDTH (s->f), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2492 FRAME_PIXEL_WIDTH (s->f)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2493 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2494 return n; |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2497 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2498 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2499 ns_draw_box (NSRect r, float thickness, NSColor *col, char left_p, char right_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2500 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2501 Draw an unfilled rect inside r, optionally leaving left and/or right open. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2502 Note we can't just use an NSDrawRect command, because of the possibility |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2503 of some sides not being drawn, and because the rect will be filled. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2504 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2505 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2506 NSRect s = r; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2507 [col set]; |
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 /* top, bottom */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2510 s.size.height = thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2511 NSRectFill (s); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2512 s.origin.y += r.size.height - thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2513 NSRectFill (s); |
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 s.size.height = r.size.height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2516 s.origin.y = r.origin.y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2517 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2518 /* left, right (optional) */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2519 s.size.width = thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2520 if (left_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2521 NSRectFill (s); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2522 if (right_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2523 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2524 s.origin.x += r.size.width - thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2525 NSRectFill (s); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2526 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2527 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2528 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2529 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2530 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2531 ns_draw_relief (NSRect r, int thickness, char raised_p, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2532 char top_p, char bottom_p, char left_p, char right_p, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2533 struct glyph_string *s) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2534 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2535 Draw a relief rect inside r, optionally leaving some sides open. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2536 Note we can't just use an NSDrawBezel command, because of the possibility |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2537 of some sides not being drawn, and because the rect will be filled. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2538 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2539 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2540 static NSColor *baseCol = nil, *lightCol = nil, *darkCol = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2541 NSColor *newBaseCol = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2542 NSRect sr = r; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2543 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2544 NSTRACE (ns_draw_relief); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2545 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2546 /* set up colors */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2547 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2548 if (s->face->use_box_color_for_shadows_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2549 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2550 newBaseCol = ns_lookup_indexed_color (s->face->box_color, s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2551 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2552 /* else if (s->first_glyph->type == IMAGE_GLYPH |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2553 && s->img->pixmap |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2554 && !IMAGE_BACKGROUND_TRANSPARENT (s->img, s->f, 0)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2555 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2556 newBaseCol = IMAGE_BACKGROUND (s->img, s->f, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2557 } */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2558 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2559 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2560 newBaseCol = ns_lookup_indexed_color (s->face->background, s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2561 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2562 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2563 if (newBaseCol == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2564 newBaseCol = [NSColor grayColor]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2565 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
2566 if (newBaseCol != baseCol) /* TODO: better check */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2567 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2568 [baseCol release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2569 baseCol = [newBaseCol retain]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2570 [lightCol release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2571 lightCol = [[baseCol highlightWithLevel: 0.2] retain]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2572 [darkCol release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2573 darkCol = [[baseCol shadowWithLevel: 0.3] retain]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2574 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2575 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2576 [(raised_p ? lightCol : darkCol) set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2577 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2578 /* TODO: mitering. Using NSBezierPath doesn't work because of color switch. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2579 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2580 /* top */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2581 sr.size.height = thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2582 if (top_p) NSRectFill (sr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2583 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2584 /* left */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2585 sr.size.height = r.size.height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2586 sr.size.width = thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2587 if (left_p) NSRectFill (sr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2588 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2589 [(raised_p ? darkCol : lightCol) set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2590 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2591 /* bottom */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2592 sr.size.width = r.size.width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2593 sr.size.height = thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2594 sr.origin.y += r.size.height - thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2595 if (bottom_p) NSRectFill (sr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2596 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2597 /* right */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2598 sr.size.height = r.size.height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2599 sr.origin.y = r.origin.y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2600 sr.size.width = thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2601 sr.origin.x += r.size.width - thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2602 if (right_p) NSRectFill (sr); |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2605 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2606 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2607 ns_dumpglyphs_box_or_relief (struct glyph_string *s) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2608 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2609 Function modeled after x_draw_glyph_string_box (). |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2610 Sets up parameters for drawing. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2611 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2612 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2613 int right_x, last_x; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2614 char left_p, right_p; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2615 struct glyph *last_glyph; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2616 NSRect r; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2617 int thickness; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2618 struct face *face; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2619 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2620 if (s->hl == DRAW_MOUSE_FACE) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2621 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
2622 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2623 if (!face) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2624 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2625 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2626 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2627 face = s->face; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2628 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2629 thickness = face->box_line_width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2630 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2631 NSTRACE (ns_dumpglyphs_box_or_relief); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2632 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2633 last_x = ((s->row->full_width_p && !s->w->pseudo_window_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2634 ? WINDOW_RIGHT_EDGE_X (s->w) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2635 : window_box_right (s->w, s->area)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2636 last_glyph = (s->cmp || s->img |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2637 ? s->first_glyph : s->first_glyph + s->nchars-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2638 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2639 right_x = ((s->row->full_width_p && s->extends_to_end_of_line_p |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2640 ? last_x - 1 : min (last_x, s->x + s->background_width) - 1)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2641 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2642 left_p = (s->first_glyph->left_box_line_p |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2643 || (s->hl == DRAW_MOUSE_FACE |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2644 && (s->prev == NULL || s->prev->hl != s->hl))); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2645 right_p = (last_glyph->right_box_line_p |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2646 || (s->hl == DRAW_MOUSE_FACE |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2647 && (s->next == NULL || s->next->hl != s->hl))); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2648 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2649 r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2650 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2651 /* expand full-width row over internal borders */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2652 if (s->row->full_width_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2653 r = ns_fix_rect_ibw (r, FRAME_INTERNAL_BORDER_WIDTH (s->f), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2654 FRAME_PIXEL_WIDTH (s->f)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2655 |
104069
13c45bf5b233
* nsfont.m (nsfont_draw): Revert 2009-07-15 change.
Chong Yidong <cyd@stupidchicken.com>
parents:
104047
diff
changeset
|
2656 /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ |
13c45bf5b233
* nsfont.m (nsfont_draw): Revert 2009-07-15 change.
Chong Yidong <cyd@stupidchicken.com>
parents:
104047
diff
changeset
|
2657 if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2658 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2659 ns_draw_box (r, abs (thickness), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2660 ns_lookup_indexed_color (face->box_color, s->f), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2661 left_p, right_p); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2662 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2663 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2664 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2665 ns_draw_relief (r, abs (thickness), s->face->box == FACE_RAISED_BOX, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2666 1, 1, left_p, right_p, s); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2667 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2668 } |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2671 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2672 ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2673 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2674 Modeled after x_draw_glyph_string_background, which draws BG in |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2675 certain cases. Others are left to the text rendering routine. |
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 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2678 NSTRACE (ns_maybe_dumpglyphs_background); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2679 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2680 if (!s->background_filled_p/* || s->hl == DRAW_MOUSE_FACE*/) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2681 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2682 int box_line_width = max (s->face->box_line_width, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2683 if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2684 || s->font_not_found_p || s->extends_to_end_of_line_p || force_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2685 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2686 struct face *face; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2687 if (s->hl == DRAW_MOUSE_FACE) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2688 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
2689 face = FACE_FROM_ID (s->f, |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
2690 MOUSE_HL_INFO (s->f)->mouse_face_face_id); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2691 if (!face) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2692 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2693 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2694 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2695 face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2696 if (!face->stipple) |
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:
96759
diff
changeset
|
2697 [(NS_FACE_BACKGROUND (face) != 0 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2698 ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2699 : FRAME_BACKGROUND_COLOR (s->f)) set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2700 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2701 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2702 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2703 [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2704 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2705 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2706 if (s->hl != DRAW_CURSOR) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2707 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2708 NSRect r = NSMakeRect (s->x, s->y + box_line_width, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2709 s->background_width, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2710 s->height-2*box_line_width); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2711 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2712 /* expand full-width row over internal borders */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2713 if (s->row->full_width_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2714 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2715 int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2716 if (r.origin.y <= fibw+1 + box_line_width) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2717 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2718 r.size.height += r.origin.y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2719 r.origin.y = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2720 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2721 if (r.origin.x <= fibw+1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2722 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2723 r.size.width += 2*r.origin.x; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2724 r.origin.x = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2725 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2726 if (FRAME_PIXEL_WIDTH (s->f) - (r.origin.x + r.size.width) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2727 <= fibw+1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2728 r.size.width += fibw; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2729 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2730 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2731 NSRectFill (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2732 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2733 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2734 s->background_filled_p = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2735 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2736 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2737 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2738 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2739 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2740 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2741 ns_dumpglyphs_image (struct glyph_string *s, NSRect r) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2742 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2743 Renders an image and associated borders. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2744 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2745 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2746 EmacsImage *img = s->img->pixmap; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2747 int box_line_vwidth = max (s->face->box_line_width, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2748 int x = s->x, y = s->ybase - image_ascent (s->img, s->face, &s->slice); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2749 int bg_x, bg_y, bg_height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2750 int th; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2751 char raised_p; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2752 NSRect br; |
103176
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2753 struct face *face; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2754 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2755 NSTRACE (ns_dumpglyphs_image); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2756 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2757 if (s->face->box != FACE_NO_BOX |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2758 && s->first_glyph->left_box_line_p && s->slice.x == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2759 x += abs (s->face->box_line_width); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2760 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2761 bg_x = x; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2762 bg_y = s->slice.y == 0 ? s->y : s->y + box_line_vwidth; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2763 bg_height = s->height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2764 /* other terms have this, but was causing problems w/tabbar mode */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2765 /* - 2 * box_line_vwidth; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2766 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2767 if (s->slice.x == 0) x += s->img->hmargin; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2768 if (s->slice.y == 0) y += s->img->vmargin; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2769 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2770 /* Draw BG: if we need larger area than image itself cleared, do that, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2771 otherwise, since we composite the image under NS (instead of mucking |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2772 with its background color), we must clear just the image area. */ |
103176
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2773 if (s->hl == DRAW_MOUSE_FACE) |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2774 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
2775 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); |
103176
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2776 if (!face) |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2777 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2778 } |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2779 else |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2780 face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2781 |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2782 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2783 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2784 if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2785 || s->img->mask || s->img->pixmap == 0 || s->width != s->background_width) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2786 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2787 br = NSMakeRect (bg_x, bg_y, s->background_width, bg_height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2788 s->background_filled_p = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2789 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2790 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2791 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2792 br = NSMakeRect (x, y, s->slice.width, s->slice.height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2793 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2794 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2795 /* expand full-width row over internal borders */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2796 if (s->row->full_width_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2797 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2798 int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2799 if (br.origin.y <= fibw+1 + box_line_vwidth) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2800 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2801 br.size.height += br.origin.y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2802 br.origin.y = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2803 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2804 if (br.origin.x <= fibw+1 + box_line_vwidth) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2805 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2806 br.size.width += br.origin.x; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2807 br.origin.x = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2808 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2809 if (FRAME_PIXEL_WIDTH (s->f) - (br.origin.x + br.size.width) <= fibw+1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2810 br.size.width += fibw; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2811 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2812 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2813 NSRectFill (br); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2814 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2815 /* Draw the image.. do we need to draw placeholder if img ==nil? */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2816 if (img != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2817 [img compositeToPoint: NSMakePoint (x, y + s->slice.height) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2818 operation: NSCompositeSourceOver]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2819 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2820 /* Draw relief, if requested */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2821 if (s->img->relief || s->hl ==DRAW_IMAGE_RAISED || s->hl ==DRAW_IMAGE_SUNKEN) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2822 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2823 if (s->hl == DRAW_IMAGE_SUNKEN || s->hl == DRAW_IMAGE_RAISED) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2824 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2825 th = tool_bar_button_relief >= 0 ? |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2826 tool_bar_button_relief : DEFAULT_TOOL_BAR_BUTTON_RELIEF; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2827 raised_p = (s->hl == DRAW_IMAGE_RAISED); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2828 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2829 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2830 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2831 th = abs (s->img->relief); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2832 raised_p = (s->img->relief > 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2833 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2834 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2835 r.origin.x = x - th; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2836 r.origin.y = y - th; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2837 r.size.width = s->slice.width + 2*th-1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2838 r.size.height = s->slice.height + 2*th-1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2839 ns_draw_relief (r, th, raised_p, |
101405
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2840 s->slice.y == 0, |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2841 s->slice.y + s->slice.height == s->img->height, |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2842 s->slice.x == 0, |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2843 s->slice.x + s->slice.width == s->img->width, s); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2844 } |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2845 } |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2846 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2847 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2848 static void |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2849 ns_dumpglyphs_stretch (struct glyph_string *s) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2850 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2851 NSRect r[2]; |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2852 int n, i; |
103176
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2853 struct face *face; |
101405
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2854 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2855 if (!s->background_filled_p) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2856 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2857 n = ns_get_glyph_string_clip_rect (s, r); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2858 *r = NSMakeRect (s->x, s->y, s->background_width, s->height); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2859 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2860 for (i=0; i<n; i++) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2861 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2862 if (!s->row->full_width_p) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2863 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2864 /* truncate to avoid overwriting fringe and/or scrollbar */ |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2865 int overrun = max (0, (s->x + s->background_width) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2866 - (WINDOW_BOX_RIGHT_EDGE_X (s->w) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2867 - WINDOW_RIGHT_FRINGE_WIDTH (s->w))); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2868 r[i].size.width -= overrun; |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2869 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2870 /* XXX: Try to work between problem where a stretch glyph on |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2871 a partially-visible bottom row will clear part of the |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2872 modeline, and another where list-buffers headers and similar |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2873 rows erroneously have visible_height set to 0. Not sure |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2874 where this is coming from as other terms seem not to show. */ |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2875 r[i].size.height = min (s->height, s->row->visible_height); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2876 } |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2877 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2878 /* expand full-width rows over internal borders */ |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2879 else |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2880 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2881 r[i] = ns_fix_rect_ibw (r[i], FRAME_INTERNAL_BORDER_WIDTH (s->f), |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2882 FRAME_PIXEL_WIDTH (s->f)); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2883 } |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2884 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2885 /* NOTE: under NS this is NOT used to draw cursors, but we must avoid |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2886 overwriting cursor (usually when cursor on a tab) */ |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2887 if (s->hl == DRAW_CURSOR) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2888 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2889 r[i].origin.x += s->width; |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2890 r[i].size.width -= s->width; |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2891 } |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2892 } |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2893 |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2894 ns_focus (s->f, r, n); |
103176
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2895 |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2896 if (s->hl == DRAW_MOUSE_FACE) |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2897 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
2898 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); |
103176
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2899 if (!face) |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2900 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2901 } |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2902 else |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2903 face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2904 |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2905 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; |
578b120df701
ns_dumpglyphs_stretch, ns_dumpglyphs_image: respect mouse face background.
David Reitter <david.reitter@gmail.com>
parents:
103173
diff
changeset
|
2906 |
101405
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2907 NSRectFill (r[0]); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2908 NSRectFill (r[1]); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2909 ns_unfocus (s->f); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2910 s->background_filled_p = 1; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2911 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2912 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2913 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2914 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2915 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2916 ns_draw_glyph_string (struct glyph_string *s) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2917 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2918 External (RIF): Main draw-text call. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2919 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2920 { |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
2921 /* TODO (optimize): focus for box and contents draw */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2922 NSRect r[2]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2923 int n; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2924 char box_drawn_p = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2925 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2926 NSTRACE (ns_draw_glyph_string); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2927 |
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:
98371
diff
changeset
|
2928 if (s->next && s->right_overhang && !s->for_overlaps/*&&s->hl!=DRAW_CURSOR*/) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2929 { |
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:
97569
diff
changeset
|
2930 int width; |
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:
97569
diff
changeset
|
2931 struct glyph_string *next; |
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:
97569
diff
changeset
|
2932 |
99558
de06f7b71b82
(ns_draw_glyph_string): Stop drawing the background of the next glyph
Chong Yidong <cyd@stupidchicken.com>
parents:
99172
diff
changeset
|
2933 for (width = 0, next = s->next; |
de06f7b71b82
(ns_draw_glyph_string): Stop drawing the background of the next glyph
Chong Yidong <cyd@stupidchicken.com>
parents:
99172
diff
changeset
|
2934 next && width < s->right_overhang; |
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:
97569
diff
changeset
|
2935 width += next->width, next = next->next) |
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:
97569
diff
changeset
|
2936 if (next->first_glyph->type != IMAGE_GLYPH) |
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:
97569
diff
changeset
|
2937 { |
101405
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2938 if (next->first_glyph->type != STRETCH_GLYPH) |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2939 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2940 n = ns_get_glyph_string_clip_rect (s->next, r); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2941 ns_focus (s->f, r, n); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2942 ns_maybe_dumpglyphs_background (s->next, 1); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2943 ns_unfocus (s->f); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2944 } |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2945 else |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2946 { |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2947 ns_dumpglyphs_stretch (s->next); |
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2948 } |
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:
97569
diff
changeset
|
2949 next->num_clips = 0; |
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:
97569
diff
changeset
|
2950 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2951 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2952 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2953 if (!s->for_overlaps && s->face->box != FACE_NO_BOX |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2954 && (s->first_glyph->type == CHAR_GLYPH |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2955 || s->first_glyph->type == COMPOSITE_GLYPH)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2956 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2957 n = ns_get_glyph_string_clip_rect (s, r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2958 ns_focus (s->f, r, n); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2959 ns_maybe_dumpglyphs_background (s, 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2960 ns_dumpglyphs_box_or_relief (s); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2961 ns_unfocus (s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2962 box_drawn_p = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2963 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2964 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2965 switch (s->first_glyph->type) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2966 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2967 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2968 case IMAGE_GLYPH: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2969 n = ns_get_glyph_string_clip_rect (s, r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2970 ns_focus (s->f, r, n); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2971 ns_dumpglyphs_image (s, r[0]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2972 ns_unfocus (s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2973 break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2974 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2975 case STRETCH_GLYPH: |
101405
fd15717d12c3
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101400
diff
changeset
|
2976 ns_dumpglyphs_stretch (s); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2977 break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2978 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2979 case CHAR_GLYPH: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2980 case COMPOSITE_GLYPH: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2981 n = ns_get_glyph_string_clip_rect (s, r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2982 ns_focus (s->f, r, n); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2983 |
97829
99a0b68bcc29
(ns_draw_glyph_string): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
97678
diff
changeset
|
2984 if (s->for_overlaps || (s->cmp_from > 0 |
99a0b68bcc29
(ns_draw_glyph_string): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
97678
diff
changeset
|
2985 && ! s->first_glyph->u.cmp.automatic)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2986 s->background_filled_p = 1; |
103340
49d3f24a1a60
nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. (ns_init_paths): Append path separator to INFOPATH variable. (ns_use_system_highlight_color): Drop, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103296
diff
changeset
|
2987 else |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2988 ns_maybe_dumpglyphs_background |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2989 (s, s->first_glyph->type == COMPOSITE_GLYPH); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2990 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2991 ns_tmp_flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR : |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2992 (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE : |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2993 (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND : |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2994 NS_DUMPGLYPH_NORMAL)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2995 ns_tmp_font = (struct nsfont_info *)s->face->font; |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
2996 if (ns_tmp_font == NULL) |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
2997 ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2998 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
2999 ns_tmp_font->font.driver->draw |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3000 (s, 0, s->nchars, s->x, s->y, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3001 (ns_tmp_flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3002 || ns_tmp_flags == NS_DUMPGLYPH_MOUSEFACE); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3003 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3004 ns_unfocus (s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3005 break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3006 |
111235
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3007 case GLYPHLESS_GLYPH: |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3008 n = ns_get_glyph_string_clip_rect (s, r); |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3009 ns_focus (s->f, r, n); |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3010 |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3011 if (s->for_overlaps || (s->cmp_from > 0 |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3012 && ! s->first_glyph->u.cmp.automatic)) |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3013 s->background_filled_p = 1; |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3014 else |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3015 ns_maybe_dumpglyphs_background |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3016 (s, s->first_glyph->type == COMPOSITE_GLYPH); |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3017 /* ... */ |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3018 /* Not yet implemented. */ |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3019 /* ... */ |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3020 ns_unfocus (s->f); |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3021 break; |
24c75a5f002a
Implement various display methods for glyphless characters.
Kenichi Handa <handa@m17n.org>
parents:
110997
diff
changeset
|
3022 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3023 default: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3024 abort (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3025 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3026 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3027 /* Draw box if not done already. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3028 if (!s->for_overlaps && !box_drawn_p && s->face->box != FACE_NO_BOX) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3029 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3030 n = ns_get_glyph_string_clip_rect (s, r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3031 ns_focus (s->f, r, n); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3032 ns_dumpglyphs_box_or_relief (s); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3033 ns_unfocus (s->f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3034 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3035 |
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:
97569
diff
changeset
|
3036 s->num_clips = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3037 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3038 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3039 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3040 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3041 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3042 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3043 Event loop |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3044 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3045 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3046 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3047 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3048 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3049 ns_send_appdefined (int value) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3050 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3051 Internal: post an appdefined event which EmacsApp-sendEvent will |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3052 recognize and take as a command to halt the event loop. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3053 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3054 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3055 /*NSTRACE (ns_send_appdefined); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3056 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3057 /* Only post this event if we haven't already posted one. This will end |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3058 the [NXApp run] main loop after having processed all events queued at |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3059 this moment. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3060 if (send_appdefined) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3061 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3062 NSEvent *nxev; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3063 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3064 /* We only need one NX_APPDEFINED event to stop NXApp from running. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3065 send_appdefined = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3066 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3067 /* Don't need wakeup timer any more */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3068 if (timed_entry) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3069 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3070 [timed_entry invalidate]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3071 [timed_entry release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3072 timed_entry = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3073 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3074 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3075 /* Ditto for file descriptor poller */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3076 if (fd_entry) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3077 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3078 [fd_entry invalidate]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3079 [fd_entry release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3080 fd_entry = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3081 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3082 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3083 nxev = [NSEvent otherEventWithType: NSApplicationDefined |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3084 location: NSMakePoint (0, 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3085 modifierFlags: 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3086 timestamp: 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3087 windowNumber: [[NSApp mainWindow] windowNumber] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3088 context: [NSApp context] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3089 subtype: 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3090 data1: value |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3091 data2: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3092 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3093 /* Post an application defined event on the event queue. When this is |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3094 received the [NXApp run] will return, thus having processed all |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3095 events which are currently queued. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3096 [NSApp postEvent: nxev atStart: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3097 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3098 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3099 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3100 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3101 static int |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3102 ns_read_socket (struct terminal *terminal, int expected, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3103 struct input_event *hold_quit) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3104 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3105 External (hook): Post an event to ourself and keep reading events until |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3106 we read it back again. In effect process all events which were waiting. |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3107 From 21+ we have to manage the event buffer ourselves. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3108 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3109 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3110 struct input_event ev; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3111 int nevents; |
101739
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3112 |
101797
2dad5b4d31d5
* nsmenu.m (pop_down_menu): New function.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101751
diff
changeset
|
3113 /* NSTRACE (ns_read_socket); */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3114 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3115 if (interrupt_input_blocked) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3116 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3117 interrupt_input_pending = 1; |
101739
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3118 #ifdef SYNC_INPUT |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3119 pending_signals = 1; |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3120 #endif |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3121 return -1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3122 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3123 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3124 interrupt_input_pending = 0; |
101739
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3125 #ifdef SYNC_INPUT |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3126 pending_signals = pending_atimers; |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3127 #endif |
101797
2dad5b4d31d5
* nsmenu.m (pop_down_menu): New function.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101751
diff
changeset
|
3128 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3129 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3130 n_emacs_events_pending = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3131 EVENT_INIT (ev); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3132 emacs_event = &ev; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3133 q_event_ptr = hold_quit; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3134 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3135 /* we manage autorelease pools by allocate/reallocate each time around |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3136 the loop; strict nesting is occasionally violated but seems not to |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3137 matter.. earlier methods using full nesting caused major memory leaks */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3138 [outerpool release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3139 outerpool = [[NSAutoreleasePool alloc] init]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3140 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3141 /* If have pending open-file requests, attend to the next one of those. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3142 if (ns_pending_files && [ns_pending_files count] != 0 |
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:
97569
diff
changeset
|
3143 && [(EmacsApp *)NSApp openFile: [ns_pending_files objectAtIndex: 0]]) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3144 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3145 [ns_pending_files removeObjectAtIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3146 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3147 /* Deal with pending service requests. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3148 else if (ns_pending_service_names && [ns_pending_service_names count] != 0 |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
3149 && [(EmacsApp *) |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
3150 NSApp fulfillService: [ns_pending_service_names objectAtIndex: 0] |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
3151 withArg: [ns_pending_service_args objectAtIndex: 0]]) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3152 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3153 [ns_pending_service_names removeObjectAtIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3154 [ns_pending_service_args removeObjectAtIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3155 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3156 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3157 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3158 /* Run and wait for events. We must always send one NX_APPDEFINED event |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3159 to ourself, otherwise [NXApp run] will never exit. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3160 send_appdefined = YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3161 |
101739
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3162 /* If called via ns_select, this is called once with expected=1, |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3163 because we expect either the timeout or file descriptor activity. |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3164 In this case the first event through will either be real input or |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3165 one of these. read_avail_input() then calls once more with expected=0 |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3166 and in that case we need to return quickly if there is nothing. |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3167 If we're being called outside of that, it's also OK to return quickly |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3168 after one iteration through the event loop, since other terms do |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3169 this and emacs expects it. */ |
105147
4508a8827944
* nsterm.m (CGContextSetFontRenderingMode): Drop declaration.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105096
diff
changeset
|
3170 if (!(inNsSelect && expected)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3171 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3172 /* Post an application defined event on the event queue. When this is |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3173 received the [NXApp run] will return, thus having processed all |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3174 events which are currently queued, if any. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3175 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3176 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3177 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3178 [NSApp run]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3179 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3180 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3181 nevents = n_emacs_events_pending; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3182 n_emacs_events_pending = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3183 emacs_event = q_event_ptr = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3184 UNBLOCK_INPUT; |
101739
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3185 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3186 return nevents; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3187 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3188 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3189 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3190 int |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3191 ns_select (int nfds, fd_set *readfds, fd_set *writefds, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3192 fd_set *exceptfds, struct timeval *timeout) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3193 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3194 Replacement for select, checking for events |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3195 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3196 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3197 int result; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3198 double time; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3199 NSEvent *ev; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3200 /* NSTRACE (ns_select); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3201 |
102418
b14d67d22033
* nsterm.m (ns_select): Shortcircuit if reentrant call.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102279
diff
changeset
|
3202 if (NSApp == nil || inNsSelect == 1 /* || ([NSApp isActive] == NO && |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3203 [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3204 inMode:NSDefaultRunLoopMode dequeue:NO] == nil) */) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3205 return select (nfds, readfds, writefds, exceptfds, timeout); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3206 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3207 /* Save file descriptor set, which gets overwritten in calls to select () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3208 Note, this is called from process.c, and only readfds is ever set */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3209 if (readfds) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3210 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3211 memcpy (&select_readfds, readfds, sizeof (fd_set)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3212 select_nfds = nfds; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3213 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3214 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3215 select_nfds = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3216 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3217 /* Try an initial select for pending data on input files */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3218 select_timeout.tv_sec = select_timeout.tv_usec = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3219 result = select (nfds, readfds, writefds, exceptfds, &select_timeout); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3220 if (result) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3221 return result; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3222 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3223 /* if (!timeout || timed_entry || fd_entry) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3224 fprintf (stderr, "assertion failed: timeout null or timed_entry/fd_entry non-null in ns_select\n"); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3225 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3226 /* set a timeout and run the main AppKit event loop while continuing |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3227 to monitor the files */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3228 time = ((double) timeout->tv_sec) + ((double) timeout->tv_usec)/1000000.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3229 timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3230 target: NSApp |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3231 selector: @selector (timeout_handler:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3232 userInfo: 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3233 repeats: YES] /* for safe removal */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3234 retain]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3235 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3236 /* set a periodic task to try the select () again */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3237 fd_entry = [[NSTimer scheduledTimerWithTimeInterval: 0.1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3238 target: NSApp |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3239 selector: @selector (fd_handler:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3240 userInfo: 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3241 repeats: YES] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3242 retain]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3243 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3244 /* Let Application dispatch events until it receives an event of the type |
101739
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3245 NX_APPDEFINED, which should only be sent by timeout_handler. |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3246 We tell read_avail_input() that input is "expected" because we do expect |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3247 either the timeout or fd handler to fire, and if they don't, the original |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3248 call from process.c that got us here expects us to wait until some input |
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3249 comes. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3250 inNsSelect = 1; |
101739
6e5d03f673c7
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101637
diff
changeset
|
3251 gobble_input (1); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3252 ev = last_appdefined_event; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3253 inNsSelect = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3254 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3255 if (ev) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3256 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3257 int t; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3258 if ([ev type] != NSApplicationDefined) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3259 abort (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3260 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3261 t = [ev data1]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3262 last_appdefined_event = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3263 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3264 if (t == -2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3265 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3266 /* The NX_APPDEFINED event we received was a timeout. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3267 return 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3268 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3269 else if (t == -1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3270 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3271 /* The NX_APPDEFINED event we received was the result of |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3272 at least one real input event arriving. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3273 errno = EINTR; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3274 return -1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3275 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3276 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3277 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3278 /* Received back from select () in fd_handler; copy the results */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3279 if (readfds) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3280 memcpy (readfds, &select_readfds, sizeof (fd_set)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3281 return t; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3282 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3283 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3284 /* never reached, shut compiler up */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3285 return 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3286 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3287 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3288 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3289 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3290 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3291 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3292 Scrollbar handling |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3293 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3294 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3295 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3296 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3297 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3298 ns_set_vertical_scroll_bar (struct window *window, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3299 int portion, int whole, int position) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3300 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3301 External (hook): Update or add scrollbar |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3302 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3303 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3304 Lisp_Object win; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3305 NSRect r, v; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3306 struct frame *f = XFRAME (WINDOW_FRAME (window)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3307 EmacsView *view = FRAME_NS_VIEW (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3308 int window_y, window_height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3309 BOOL barOnVeryLeft, barOnVeryRight; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3310 int top, left, height, width, sb_width, sb_left; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3311 EmacsScroller *bar; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3312 static int count = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3313 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3314 /* optimization; display engine sends WAY too many of these.. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3315 if (!NILP (window->vertical_scroll_bar)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3316 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3317 bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3318 if ([bar checkSamePosition: position portion: portion whole: whole]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3319 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3320 if (view->scrollbarsNeedingUpdate == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3321 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3322 if (!windows_or_buffers_changed) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3323 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3324 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3325 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3326 view->scrollbarsNeedingUpdate--; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3327 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3328 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3329 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3330 NSTRACE (ns_set_vertical_scroll_bar); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3331 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3332 /* Get dimensions. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3333 window_box (window, -1, 0, &window_y, 0, &window_height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3334 top = window_y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3335 height = window_height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3336 width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3337 left = WINDOW_SCROLL_BAR_AREA_X (window); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3338 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3339 if (top < 5) /* top scrollbar adjustment */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3340 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3341 top -= FRAME_INTERNAL_BORDER_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3342 height += FRAME_INTERNAL_BORDER_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3343 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3344 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3345 /* allow for displaying a skinnier scrollbar than char area allotted */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3346 sb_width = (WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) > 0) ? |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3347 WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) : width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3348 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3349 barOnVeryLeft = left < 5; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3350 barOnVeryRight = FRAME_PIXEL_WIDTH (f) - left - width < 5; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3351 sb_left = left + FRAME_INTERNAL_BORDER_WIDTH (f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3352 * (barOnVeryLeft ? -1 : (barOnVeryRight ? 1 : 0)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3353 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3354 r = NSMakeRect (sb_left, top, sb_width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3355 /* the parent view is flipped, so we need to flip y value */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3356 v = [view frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3357 r.origin.y = (v.size.height - r.size.height - r.origin.y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3358 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3359 XSETWINDOW (win, window); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3360 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3361 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3362 /* we want at least 5 lines to display a scrollbar */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3363 if (WINDOW_TOTAL_LINES (window) < 5) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3364 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3365 if (!NILP (window->vertical_scroll_bar)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3366 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3367 bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3368 [bar removeFromSuperview]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3369 window->vertical_scroll_bar = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3370 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3371 ns_clear_frame_area (f, sb_left, top, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3372 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3373 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3374 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3375 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3376 if (NILP (window->vertical_scroll_bar)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3377 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3378 ns_clear_frame_area (f, sb_left, top, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3379 bar = [[EmacsScroller alloc] initFrame: r window: win]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3380 window->vertical_scroll_bar = make_save_value (bar, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3381 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3382 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3383 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3384 NSRect oldRect; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3385 bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3386 oldRect = [bar frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3387 r.size.width = oldRect.size.width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3388 if (FRAME_LIVE_P (f) && !NSEqualRects (oldRect, r)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3389 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3390 if (oldRect.origin.x != r.origin.x) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3391 ns_clear_frame_area (f, sb_left, top, width, height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3392 [bar setFrame: r]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3393 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3394 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3395 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3396 [bar setPosition: position portion: portion whole: whole]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3397 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3398 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3399 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3400 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3401 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3402 ns_condemn_scroll_bars (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3403 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3404 External (hook): arrange for all frame's scrollbars to be removed |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3405 at next call to judge_scroll_bars, except for those redeemed. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3406 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3407 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3408 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3409 id view; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3410 NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3411 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3412 NSTRACE (ns_condemn_scroll_bars); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3413 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3414 for (i =[subviews count]-1; i >= 0; i--) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3415 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3416 view = [subviews objectAtIndex: i]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3417 if ([view isKindOfClass: [EmacsScroller class]]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3418 [view condemn]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3419 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3420 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3421 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3422 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3423 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3424 ns_redeem_scroll_bar (struct window *window) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3425 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3426 External (hook): arrange to spare this window's scrollbar |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3427 at next call to judge_scroll_bars. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3428 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3429 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3430 id bar; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3431 NSTRACE (ns_redeem_scroll_bar); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3432 if (!NILP (window->vertical_scroll_bar)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3433 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3434 bar =XNS_SCROLL_BAR (window->vertical_scroll_bar); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3435 [bar reprieve]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3436 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3437 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3438 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3439 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3440 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3441 ns_judge_scroll_bars (struct frame *f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3442 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3443 External (hook): destroy all scrollbars on frame that weren't |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3444 redeemed after call to condemn_scroll_bars. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3445 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3446 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3447 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3448 id view; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3449 NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3450 NSTRACE (ns_judge_scroll_bars); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3451 for (i =[subviews count]-1; i >= 0; i--) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3452 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3453 view = [subviews objectAtIndex: i]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3454 if (![view isKindOfClass: [EmacsScroller class]]) continue; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3455 [view judge]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3456 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3457 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3458 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3459 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3460 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3461 x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3462 { |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3463 /* XXX irrelevant under NS */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3464 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3465 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3466 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3467 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3468 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3469 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3470 Initialization |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3471 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3472 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3473 |
98229
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3474 int |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
3475 x_display_pixel_height (struct ns_display_info *dpyinfo) |
98229
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3476 { |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3477 NSScreen *screen = [NSScreen mainScreen]; |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3478 return [screen frame].size.height; |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3479 } |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3480 |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3481 int |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
3482 x_display_pixel_width (struct ns_display_info *dpyinfo) |
98229
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3483 { |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3484 NSScreen *screen = [NSScreen mainScreen]; |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3485 return [screen frame].size.width; |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3486 } |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3487 |
c3b661108b5c
(x_display_pixel_height, x_display_pixel_width): New functions.
Chong Yidong <cyd@stupidchicken.com>
parents:
97829
diff
changeset
|
3488 |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
3489 static Lisp_Object ns_string_to_lispmod (const char *s) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3490 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3491 Convert modifier name to lisp symbol |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3492 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3493 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3494 if (!strncmp (SDATA (SYMBOL_NAME (Qmeta)), s, 10)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3495 return Qmeta; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3496 else if (!strncmp (SDATA (SYMBOL_NAME (Qsuper)), s, 10)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3497 return Qsuper; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3498 else if (!strncmp (SDATA (SYMBOL_NAME (Qcontrol)), s, 10)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3499 return Qcontrol; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3500 else if (!strncmp (SDATA (SYMBOL_NAME (Qalt)), s, 10)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3501 return Qalt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3502 else if (!strncmp (SDATA (SYMBOL_NAME (Qhyper)), s, 10)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3503 return Qhyper; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3504 else if (!strncmp (SDATA (SYMBOL_NAME (Qnone)), s, 10)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3505 return Qnone; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3506 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3507 return Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3508 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3509 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3510 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3511 static Lisp_Object ns_mod_to_lisp (int m) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3512 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3513 Convert modifier code (see lisp.h) to lisp symbol |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3514 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3515 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3516 if (m == CHAR_META) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3517 return Qmeta; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3518 else if (m == CHAR_SUPER) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3519 return Qsuper; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3520 else if (m == CHAR_CTL) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3521 return Qcontrol; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3522 else if (m == CHAR_ALT) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3523 return Qalt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3524 else if (m == CHAR_HYPER) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3525 return Qhyper; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3526 else /* if (m == 0) */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3527 return Qnone; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3528 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3529 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3530 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3531 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3532 ns_default (const char *parameter, Lisp_Object *result, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3533 Lisp_Object yesval, Lisp_Object noval, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3534 BOOL is_float, BOOL is_modstring) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3535 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3536 Check a parameter value in user's preferences |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3537 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3538 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3539 const char *value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3540 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3541 if ( (value =[[[NSUserDefaults standardUserDefaults] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3542 stringForKey: [NSString stringWithUTF8String: parameter]] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3543 UTF8String]) ) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3544 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3545 double f; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3546 char *pos; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3547 if (strcasecmp (value, "YES") == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3548 *result = yesval; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3549 else if (strcasecmp (value, "NO") == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3550 *result = noval; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3551 else if (is_float && (f = strtod (value, &pos), pos != value)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3552 *result = make_float (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3553 else if (is_modstring && value) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3554 *result = ns_string_to_lispmod (value); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3555 else fprintf (stderr, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3556 "Bad value for default \"%s\": \"%s\"\n", parameter, value); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3557 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3558 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3559 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3560 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3561 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3562 ns_initialize_display_info (struct ns_display_info *dpyinfo) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3563 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3564 Initialize global info and storage for display. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3565 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3566 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3567 NSScreen *screen = [NSScreen mainScreen]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3568 NSWindowDepth depth = [screen depth]; |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3569 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3570 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3571 dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3572 dpyinfo->resy = 72.27; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3573 dpyinfo->color_p = ![NSDeviceWhiteColorSpace isEqualToString: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3574 NSColorSpaceFromDepth (depth)] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3575 && ![NSCalibratedWhiteColorSpace isEqualToString: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3576 NSColorSpaceFromDepth (depth)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3577 dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3578 dpyinfo->image_cache = make_image_cache (); |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
3579 dpyinfo->color_table |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
3580 = (struct ns_color_table *)xmalloc (sizeof (struct ns_color_table)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3581 dpyinfo->color_table->colors = NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3582 dpyinfo->root_window = 42; /* a placeholder.. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3583 |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3584 hlinfo->mouse_face_mouse_frame = NULL; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3585 hlinfo->mouse_face_deferred_gc = 0; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3586 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3587 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3588 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3589 hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3590 hlinfo->mouse_face_hidden = 0; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3591 |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3592 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
3593 hlinfo->mouse_face_defer = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3594 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
3595 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3596 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3597 dpyinfo->n_fonts = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3598 dpyinfo->smallest_font_height = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3599 dpyinfo->smallest_char_width = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3600 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3601 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3602 |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3603 /* This and next define (many of the) public functions in this file. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3604 /* x_... are generic versions in xdisp.c that we, and other terms, get away |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3605 with using despite presence in the "system dependent" redisplay |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3606 interface. In addition, many of the ns_ methods have code that is |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3607 shared with all terms, indicating need for further refactoring. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3608 extern frame_parm_handler ns_frame_parm_handlers[]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3609 static struct redisplay_interface ns_redisplay_interface = |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3610 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3611 ns_frame_parm_handlers, |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3612 x_produce_glyphs, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3613 x_write_glyphs, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3614 x_insert_glyphs, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3615 x_clear_end_of_line, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3616 ns_scroll_run, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3617 ns_after_update_window_line, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3618 ns_update_window_begin, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3619 ns_update_window_end, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3620 x_cursor_to, |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3621 ns_flush, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3622 0, /* flush_display_optional */ |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3623 x_clear_window_mouse_face, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3624 x_get_glyph_overhangs, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3625 x_fix_overlapping_area, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3626 ns_draw_fringe_bitmap, |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
3627 0, /* define_fringe_bitmap */ /* FIXME: simplify ns_draw_fringe_bitmap */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3628 0, /* destroy_fringe_bitmap */ |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3629 ns_compute_glyph_string_overhangs, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3630 ns_draw_glyph_string, /* interface to nsfont.m */ |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3631 ns_define_frame_cursor, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3632 ns_clear_frame_area, |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3633 ns_draw_window_cursor, |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3634 ns_draw_vertical_window_border, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3635 ns_shift_glyphs_for_insert |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3636 }; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3637 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3638 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3639 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3640 ns_delete_display (struct ns_display_info *dpyinfo) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3641 { |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
3642 /* TODO... */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3643 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3644 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3645 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3646 /* This function is called when the last frame on a display is deleted. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3647 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3648 ns_delete_terminal (struct terminal *terminal) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3649 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3650 struct ns_display_info *dpyinfo = terminal->display_info.ns; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3651 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3652 |
100666
dab9cf44bf3f
In comments, write delete_frame instead of Fdelete_frame.
Martin Rudalics <rudalics@gmx.at>
parents:
100001
diff
changeset
|
3653 /* Protect against recursive calls. delete_frame in |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3654 delete_terminal calls us back when it deletes our last frame. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3655 if (!terminal->name) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3656 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3657 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3658 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3659 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3660 x_destroy_all_bitmaps (dpyinfo); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3661 ns_delete_display (dpyinfo); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3662 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3663 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3664 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3665 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3666 static struct terminal * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3667 ns_create_terminal (struct ns_display_info *dpyinfo) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3668 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3669 Set up use of NS before we make the first connection. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3670 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3671 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3672 struct terminal *terminal; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3673 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3674 NSTRACE (ns_create_terminal); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3675 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3676 terminal = create_terminal (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3677 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3678 terminal->type = output_ns; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3679 terminal->display_info.ns = dpyinfo; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3680 dpyinfo->terminal = terminal; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3681 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3682 terminal->rif = &ns_redisplay_interface; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3683 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3684 terminal->clear_frame_hook = ns_clear_frame; |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3685 terminal->ins_del_lines_hook = 0; /* XXX vestigial? */ |
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3686 terminal->delete_glyphs_hook = 0; /* XXX vestigial? */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3687 terminal->ring_bell_hook = ns_ring_bell; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3688 terminal->reset_terminal_modes_hook = ns_reset_terminal_modes; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3689 terminal->set_terminal_modes_hook = ns_set_terminal_modes; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3690 terminal->update_begin_hook = ns_update_begin; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3691 terminal->update_end_hook = ns_update_end; |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3692 terminal->set_terminal_window_hook = NULL; /* XXX vestigial? */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3693 terminal->read_socket_hook = ns_read_socket; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3694 terminal->frame_up_to_date_hook = ns_frame_up_to_date; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3695 terminal->mouse_position_hook = ns_mouse_position; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3696 terminal->frame_rehighlight_hook = ns_frame_rehighlight; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3697 terminal->frame_raise_lower_hook = ns_frame_raise_lower; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3698 |
101357
64413c753b62
Remove '23' comments that indicated code added during update from emacs-20 -> emacs-23.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101351
diff
changeset
|
3699 terminal->fullscreen_hook = 0; /* see XTfullscreen_hook */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3700 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3701 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3702 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3703 terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3704 terminal->judge_scroll_bars_hook = ns_judge_scroll_bars; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3705 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3706 terminal->delete_frame_hook = x_destroy_window; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3707 terminal->delete_terminal_hook = ns_delete_terminal; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3708 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3709 terminal->scroll_region_ok = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3710 terminal->char_ins_del_ok = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3711 terminal->line_ins_del_ok = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3712 terminal->fast_clear_end_of_line = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3713 terminal->memory_below_frame = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3714 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3715 return terminal; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3716 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3717 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3718 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3719 struct ns_display_info * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3720 ns_term_init (Lisp_Object display_name) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3721 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3722 Start the Application and get things rolling. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3723 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3724 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3725 struct terminal *terminal; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3726 struct ns_display_info *dpyinfo; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3727 static int ns_initialized = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3728 Lisp_Object tmp; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3729 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3730 NSTRACE (ns_term_init); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3731 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3732 /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3733 /*GSDebugAllocationActive (YES); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3734 BLOCK_INPUT; |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
3735 handling_signal = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3736 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3737 if (!ns_initialized) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3738 { |
101637
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
3739 baud_rate = 38400; |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
3740 Fset_input_interrupt_mode (Qnil); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3741 ns_initialized = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3742 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3743 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3744 ns_pending_files = [[NSMutableArray alloc] init]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3745 ns_pending_service_names = [[NSMutableArray alloc] init]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3746 ns_pending_service_args = [[NSMutableArray alloc] init]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3747 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3748 /* Start app and create the main menu, window, view. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3749 Needs to be here because ns_initialize_display_info () uses AppKit classes. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3750 The view will then ask the NSApp to stop and return to Emacs. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3751 [EmacsApp sharedApplication]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3752 if (NSApp == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3753 return NULL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3754 [NSApp setDelegate: NSApp]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3755 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3756 /* debugging: log all notifications */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3757 /* [[NSNotificationCenter defaultCenter] addObserver: NSApp |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3758 selector: @selector (logNotification:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3759 name: nil object: nil]; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3760 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3761 dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info)); |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109092
diff
changeset
|
3762 memset (dpyinfo, 0, sizeof (struct ns_display_info)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3763 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3764 ns_initialize_display_info (dpyinfo); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3765 terminal = ns_create_terminal (dpyinfo); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3766 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3767 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3768 init_kboard (terminal->kboard); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3769 terminal->kboard->Vwindow_system = Qns; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3770 terminal->kboard->next_kboard = all_kboards; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3771 all_kboards = terminal->kboard; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3772 /* Don't let the initial kboard remain current longer than necessary. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3773 That would cause problems if a file loaded on startup tries to |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3774 prompt in the mini-buffer. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3775 if (current_kboard == initial_kboard) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3776 current_kboard = terminal->kboard; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3777 terminal->kboard->reference_count++; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3778 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
3779 dpyinfo->next = x_display_list; |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
3780 x_display_list = dpyinfo; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3781 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3782 /* Put it on ns_display_name_list */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3783 ns_display_name_list = Fcons (Fcons (display_name, Qnil), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3784 ns_display_name_list); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3785 dpyinfo->name_list_element = XCAR (ns_display_name_list); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3786 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3787 /* Set the name of the terminal. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3788 terminal->name = (char *) xmalloc (SBYTES (display_name) + 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3789 strncpy (terminal->name, SDATA (display_name), SBYTES (display_name)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3790 terminal->name[SBYTES (display_name)] = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3791 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3792 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3793 |
105083
544f5b209a5b
(ns_no_defaults): Remove. (ns_term_init): Switch ns_no_defaults -> inhibit_x_resources. (ns_use_qd_smoothing): Remove legacy variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104818
diff
changeset
|
3794 if (!inhibit_x_resources) |
101399
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3795 { |
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3796 ns_default ("GSFontAntiAlias", &ns_antialias_text, |
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3797 Qt, Qnil, NO, NO); |
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3798 tmp = Qnil; |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
3799 /* this is a standard variable */ |
101399
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3800 ns_default ("AppleAntiAliasingThreshold", &tmp, |
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3801 make_float (10.0), make_float (6.0), YES, NO); |
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3802 ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); |
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3803 } |
5b58e8f46076
* emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101357
diff
changeset
|
3804 |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
3805 ns_selection_color = [[NSUserDefaults standardUserDefaults] |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
3806 stringForKey: @"AppleHighlightColor"]; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
3807 if (ns_selection_color == nil) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3808 ns_selection_color = NS_SELECTION_COLOR_DEFAULT; |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
3809 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3810 { |
97194
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3811 NSColorList *cl = [NSColorList colorListNamed: @"Emacs"]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3812 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3813 if ( cl == nil ) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3814 { |
97194
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3815 Lisp_Object color_file, color_map, color; |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3816 int r,g,b; |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3817 unsigned long c; |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3818 char *name; |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3819 |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3820 color_file = Fexpand_file_name (build_string ("rgb.txt"), |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3821 Fsymbol_value (intern ("data-directory"))); |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3822 if (NILP (Ffile_readable_p (color_file))) |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3823 fatal ("Could not find %s.\n", SDATA (color_file)); |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3824 |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3825 color_map = Fx_load_color_file (color_file); |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3826 if (NILP (color_map)) |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3827 fatal ("Could not read %s.\n", SDATA (color_file)); |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3828 |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3829 cl = [[NSColorList alloc] initWithName: @"Emacs"]; |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3830 for ( ; CONSP (color_map); color_map = XCDR (color_map)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3831 { |
97194
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3832 color = XCAR (color_map); |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3833 name = SDATA (XCAR (color)); |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3834 c = XINT (XCDR (color)); |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3835 [cl setColor: |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3836 [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0 |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3837 green: GREEN_FROM_ULONG (c) / 255.0 |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3838 blue: BLUE_FROM_ULONG (c) / 255.0 |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3839 alpha: 1.0] |
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
3840 forKey: [NSString stringWithUTF8String: name]]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3841 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3842 [cl writeToFile: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3843 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3844 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3845 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3846 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3847 char c[128]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3848 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3849 strncpy (c, gnustep_base_version, sizeof (c)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3850 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3851 /*PSnextrelease (128, c); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3852 snprintf (c, sizeof (c), "%g", NSAppKitVersionNumber); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3853 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3854 Vwindow_system_version = build_string (c); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3855 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3856 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3857 delete_keyboard_wait_descriptor (0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3858 |
105225
9f0244ca1777
(ns_app_name): New variable. (ns_term_init): Set and use it. (ns_term_shutdown): Use it.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105159
diff
changeset
|
3859 ns_app_name = [[NSProcessInfo processInfo] processName]; |
9f0244ca1777
(ns_app_name): New variable. (ns_term_init): Set and use it. (ns_term_shutdown): Use it.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105159
diff
changeset
|
3860 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3861 /* Set up OS X app menu */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3862 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3863 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3864 NSMenu *appMenu; |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
3865 NSMenuItem *item; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3866 /* set up the application menu */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3867 svcsMenu = [[EmacsMenu alloc] initWithTitle: @"Services"]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3868 [svcsMenu setAutoenablesItems: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3869 appMenu = [[EmacsMenu alloc] initWithTitle: @"Emacs"]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3870 [appMenu setAutoenablesItems: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3871 mainMenu = [[EmacsMenu alloc] initWithTitle: @""]; |
97279
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
3872 dockMenu = [[EmacsMenu alloc] initWithTitle: @""]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3873 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3874 [appMenu insertItemWithTitle: @"About Emacs" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3875 action: @selector (orderFrontStandardAboutPanel:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3876 keyEquivalent: @"" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3877 atIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3878 [appMenu insertItem: [NSMenuItem separatorItem] atIndex: 1]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3879 [appMenu insertItemWithTitle: @"Preferences..." |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3880 action: @selector (showPreferencesWindow:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3881 keyEquivalent: @"," |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3882 atIndex: 2]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3883 [appMenu insertItem: [NSMenuItem separatorItem] atIndex: 3]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3884 item = [appMenu insertItemWithTitle: @"Services" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3885 action: @selector (menuDown:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3886 keyEquivalent: @"" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3887 atIndex: 4]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3888 [appMenu setSubmenu: svcsMenu forItem: item]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3889 [appMenu insertItem: [NSMenuItem separatorItem] atIndex: 5]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3890 [appMenu insertItemWithTitle: @"Hide Emacs" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3891 action: @selector (hide:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3892 keyEquivalent: @"h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3893 atIndex: 6]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3894 item = [appMenu insertItemWithTitle: @"Hide Others" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3895 action: @selector (hideOtherApplications:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3896 keyEquivalent: @"h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3897 atIndex: 7]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3898 [item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3899 [appMenu insertItem: [NSMenuItem separatorItem] atIndex: 8]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3900 [appMenu insertItemWithTitle: @"Quit Emacs" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3901 action: @selector (terminate:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3902 keyEquivalent: @"q" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3903 atIndex: 9]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3904 |
105225
9f0244ca1777
(ns_app_name): New variable. (ns_term_init): Set and use it. (ns_term_shutdown): Use it.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105159
diff
changeset
|
3905 item = [mainMenu insertItemWithTitle: ns_app_name |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3906 action: @selector (menuDown:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3907 keyEquivalent: @"" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3908 atIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3909 [mainMenu setSubmenu: appMenu forItem: item]; |
97279
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
3910 [dockMenu insertItemWithTitle: @"New Frame" |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
3911 action: @selector (newFrame:) |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
3912 keyEquivalent: @"" |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
3913 atIndex: 0]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3914 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3915 [NSApp setMainMenu: mainMenu]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3916 [NSApp setAppleMenu: appMenu]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3917 [NSApp setServicesMenu: svcsMenu]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3918 /* Needed at least on Cocoa, to get dock menu to show windows */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3919 [NSApp setWindowsMenu: [[NSMenu alloc] init]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3920 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3921 #endif /* MAC OS X menu setup */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3922 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3923 [NSApp run]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3924 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3925 return dpyinfo; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3926 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3927 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3928 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3929 extern Lisp_Object Vauto_save_list_file_name; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3930 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3931 ns_term_shutdown (int sig) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3932 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3933 /* code not reached in emacs.c after this is called by shut_down_emacs: */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3934 if (STRINGP (Vauto_save_list_file_name)) |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
3935 unlink (SDATA (Vauto_save_list_file_name)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3936 |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3937 if (sig == 0 || sig == SIGTERM) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3938 { |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3939 [NSApp terminate: NSApp]; |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3940 } |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3941 else // force a stack trace to happen |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3942 { |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3943 abort(); |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
3944 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3945 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3946 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3947 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3948 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3949 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3950 EmacsApp implementation |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3951 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3952 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3953 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3954 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3955 @implementation EmacsApp |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3956 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3957 - (void)logNotification: (NSNotification *)notification |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3958 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3959 const char *name = [[notification name] UTF8String]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3960 if (!strstr (name, "Update") && !strstr (name, "NSMenu") |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3961 && !strstr (name, "WindowNumber")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3962 NSLog (@"notification: '%@'", [notification name]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3963 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3964 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3965 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3966 - (void)sendEvent: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3967 /* -------------------------------------------------------------------------- |
101858
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
3968 Called when NSApp is running for each event received. Used to stop |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
3969 the loop when we choose, since there's no way to just run one iteration. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3970 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3971 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3972 int type = [theEvent type]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3973 NSWindow *window = [theEvent window]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3974 /* NSTRACE (sendEvent); */ |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
3975 /*fprintf (stderr, "received event of type %d\t%d\n", type);*/ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3976 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3977 if (type == NSCursorUpdate && window == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3978 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3979 fprintf (stderr, "Dropping external cursor update event.\n"); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3980 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3981 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3982 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3983 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3984 /* pass mouse down in resize handle and subsequent drags directly to |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3985 EmacsWindow so we can generate continuous redisplays */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3986 if (ns_in_resize) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3987 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3988 if (type == NSLeftMouseDragged) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3989 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3990 [window mouseDragged: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3991 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3992 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3993 else if (type == NSLeftMouseUp) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3994 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3995 [window mouseUp: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3996 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3997 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3998 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
3999 else if (type == NSLeftMouseDown) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4000 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4001 NSRect r = ns_resize_handle_rect (window); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4002 if (NSPointInRect ([theEvent locationInWindow], r)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4003 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4004 ns_in_resize = YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4005 [window mouseDown: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4006 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4007 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4008 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4009 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4010 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4011 if (type == NSApplicationDefined) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4012 { |
101858
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4013 /* Events posted by ns_send_appdefined interrupt the run loop here. |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4014 But, if a modal window is up, an appdefined can still come through, |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4015 (e.g., from a makeKeyWindow event) but stopping self also stops the |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4016 modal loop. Just defer it until later. */ |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4017 if ([NSApp modalWindow] == nil) |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4018 { |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4019 last_appdefined_event = theEvent; |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4020 [self stop: self]; |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4021 } |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4022 else |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4023 { |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4024 send_appdefined = YES; |
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4025 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4026 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4027 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4028 [super sendEvent: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4029 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4030 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4031 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4032 - (void)showPreferencesWindow: (id)sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4033 { |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4034 struct frame *emacsframe = SELECTED_FRAME (); |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4035 NSEvent *theEvent = [NSApp currentEvent]; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4036 |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4037 if (!emacs_event) |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4038 return; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4039 emacs_event->kind = NS_NONKEY_EVENT; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4040 emacs_event->code = KEY_NS_SHOW_PREFS; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4041 emacs_event->modifiers = 0; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4042 EV_TRAILER (theEvent); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4043 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4044 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4045 |
97279
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4046 - (void)newFrame: (id)sender |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4047 { |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4048 struct frame *emacsframe = SELECTED_FRAME (); |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4049 NSEvent *theEvent = [NSApp currentEvent]; |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4050 |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4051 if (!emacs_event) |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4052 return; |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
4053 emacs_event->kind = NS_NONKEY_EVENT; |
97279
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4054 emacs_event->code = KEY_NS_NEW_FRAME; |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4055 emacs_event->modifiers = 0; |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4056 EV_TRAILER (theEvent); |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4057 } |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4058 |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4059 |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4060 /* Open a file (used by below, after going into queue read by ns_read_socket) */ |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4061 - (BOOL) openFile: (NSString *)fileName |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4062 { |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4063 struct frame *emacsframe = SELECTED_FRAME (); |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4064 NSEvent *theEvent = [NSApp currentEvent]; |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4065 |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4066 if (!emacs_event) |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4067 return NO; |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4068 |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
4069 emacs_event->kind = NS_NONKEY_EVENT; |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4070 emacs_event->code = KEY_NS_OPEN_FILE_LINE; |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4071 ns_input_file = append2 (ns_input_file, build_string ([fileName UTF8String])); |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4072 ns_input_line = Qnil; /* can be start or cons start,end */ |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4073 emacs_event->modifiers =0; |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4074 EV_TRAILER (theEvent); |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4075 |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4076 return YES; |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4077 } |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4078 |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4079 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4080 /* ************************************************************************** |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4081 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4082 EmacsApp delegate implementation |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4083 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4084 ************************************************************************** */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4085 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4086 - (void)applicationDidFinishLaunching: (NSNotification *)notification |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4087 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4088 When application is loaded, terminate event loop in ns_term_init |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4089 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4090 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4091 NSTRACE (applicationDidFinishLaunching); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4092 [NSApp setServicesProvider: NSApp]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4093 ns_send_appdefined (-2); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4094 } |
100666
dab9cf44bf3f
In comments, write delete_frame instead of Fdelete_frame.
Martin Rudalics <rudalics@gmx.at>
parents:
100001
diff
changeset
|
4095 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4096 |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4097 /* Termination sequences: |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4098 C-x C-c: |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4099 Cmd-Q: |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4100 MenuBar | File | Exit: |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4101 Select Quit from App menubar: |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4102 -terminate |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4103 KEY_NS_POWER_OFF, (save-buffers-kill-emacs) |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4104 ns_term_shutdown() |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4105 |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4106 Select Quit from Dock menu: |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4107 Logout attempt: |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4108 -appShouldTerminate |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4109 Cancel -> Nothing else |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4110 Accept -> |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4111 |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4112 -terminate |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4113 KEY_NS_POWER_OFF, (save-buffers-kill-emacs) |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4114 ns_term_shutdown() |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4115 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4116 */ |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4117 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4118 - (void) terminate: (id)sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4119 { |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4120 struct frame *emacsframe = SELECTED_FRAME (); |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4121 |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4122 if (!emacs_event) |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4123 return; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4124 |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4125 emacs_event->kind = NS_NONKEY_EVENT; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4126 emacs_event->code = KEY_NS_POWER_OFF; |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4127 emacs_event->arg = Qt; /* mark as non-key event */ |
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4128 EV_TRAILER ((id)nil); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4129 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4130 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4131 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4132 - (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4133 { |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4134 int ret; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4135 |
102560
291f6c889881
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents:
102504
diff
changeset
|
4136 if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4137 return NSTerminateNow; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4138 |
105225
9f0244ca1777
(ns_app_name): New variable. (ns_term_init): Set and use it. (ns_term_shutdown): Use it.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105159
diff
changeset
|
4139 ret = NSRunAlertPanel(ns_app_name, |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4140 [NSString stringWithUTF8String:"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?"], |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4141 @"Save Buffers and Exit", @"Cancel", nil); |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4142 |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4143 if (ret == NSAlertDefaultReturn) |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4144 return NSTerminateNow; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4145 else if (ret == NSAlertAlternateReturn) |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4146 return NSTerminateCancel; |
101858
b1643c6cb416
* nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined event
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101797
diff
changeset
|
4147 return NSTerminateNow; /* just in case */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4148 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4149 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4150 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4151 /* Notification from the Workspace to open a file */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4152 - (BOOL)application: sender openFile: (NSString *)file |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4153 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4154 [ns_pending_files addObject: file]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4155 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4156 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4157 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4158 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4159 /* Open a file as a temporary file */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4160 - (BOOL)application: sender openTempFile: (NSString *)file |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4161 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4162 [ns_pending_files addObject: file]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4163 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4164 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4165 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4166 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4167 /* Notification from the Workspace to open a file noninteractively (?) */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4168 - (BOOL)application: sender openFileWithoutUI: (NSString *)file |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4169 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4170 [ns_pending_files addObject: file]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4171 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4172 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4173 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4174 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4175 /* Notification from the Workspace to open multiple files */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4176 - (void)application: sender openFiles: (NSArray *)fileList |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4177 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4178 NSEnumerator *files = [fileList objectEnumerator]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4179 NSString *file; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4180 while ((file = [files nextObject]) != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4181 [ns_pending_files addObject: file]; |
97206
03666fbbecf2
(EmacsApp -application:openFiles:): GNUStep does not
Chong Yidong <cyd@stupidchicken.com>
parents:
97198
diff
changeset
|
4182 |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
4183 [self replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; |
97206
03666fbbecf2
(EmacsApp -application:openFiles:): GNUStep does not
Chong Yidong <cyd@stupidchicken.com>
parents:
97198
diff
changeset
|
4184 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4185 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4186 |
97279
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4187 |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4188 /* Handle dock menu requests. */ |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4189 - (NSMenu *)applicationDockMenu: (NSApplication *) sender |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4190 { |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4191 return dockMenu; |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4192 } |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4193 |
76ed169d532c
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97266
diff
changeset
|
4194 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
4195 /* TODO: these may help w/IO switching btwn terminal and NSApp */ |
101351
1789feb8fd54
* nsterm.m (EmavsView-keyDown:): Treat nil as Qnone for ns_alternate_modifier. (Bug#1217)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101329
diff
changeset
|
4196 - (void)applicationWillBecomeActive: (NSNotification *)notification |
1789feb8fd54
* nsterm.m (EmavsView-keyDown:): Treat nil as Qnone for ns_alternate_modifier. (Bug#1217)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101329
diff
changeset
|
4197 { |
1789feb8fd54
* nsterm.m (EmavsView-keyDown:): Treat nil as Qnone for ns_alternate_modifier. (Bug#1217)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101329
diff
changeset
|
4198 //ns_app_active=YES; |
1789feb8fd54
* nsterm.m (EmavsView-keyDown:): Treat nil as Qnone for ns_alternate_modifier. (Bug#1217)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101329
diff
changeset
|
4199 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4200 - (void)applicationDidBecomeActive: (NSNotification *)notification |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4201 { |
101351
1789feb8fd54
* nsterm.m (EmavsView-keyDown:): Treat nil as Qnone for ns_alternate_modifier. (Bug#1217)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101329
diff
changeset
|
4202 //ns_app_active=YES; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4203 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4204 - (void)applicationDidResignActive: (NSNotification *)notification |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4205 { |
101351
1789feb8fd54
* nsterm.m (EmavsView-keyDown:): Treat nil as Qnone for ns_alternate_modifier. (Bug#1217)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101329
diff
changeset
|
4206 //ns_app_active=NO; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4207 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4208 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4209 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4210 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4211 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4212 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4213 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4214 EmacsApp aux handlers for managing event loop |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4215 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4216 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4217 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4218 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4219 - (void)timeout_handler: (NSTimer *)timedEntry |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4220 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4221 The timeout specified to ns_select has passed. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4222 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4223 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4224 /*NSTRACE (timeout_handler); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4225 ns_send_appdefined (-2); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4226 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4227 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4228 - (void)fd_handler: (NSTimer *) fdEntry |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4229 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4230 Check data waiting on file descriptors and terminate if so |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4231 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4232 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4233 int result; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4234 /* NSTRACE (fd_handler); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4235 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4236 if (select_nfds == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4237 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4238 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4239 memcpy (&t_readfds, &select_readfds, sizeof (fd_set)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4240 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4241 select_timeout.tv_sec = select_timeout.tv_usec = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4242 result = select (select_nfds, &t_readfds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4243 &select_timeout); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4244 if (result) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4245 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4246 memcpy (&select_readfds, &t_readfds, sizeof (fd_set)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4247 ns_send_appdefined (result); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4248 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4249 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4250 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4251 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4252 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4253 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4254 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4255 Service provision |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4256 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4257 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4258 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4259 /* called from system: queue for next pass through event loop */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4260 - (void)requestService: (NSPasteboard *)pboard |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4261 userData: (NSString *)userData |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4262 error: (NSString **)error |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4263 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4264 [ns_pending_service_names addObject: userData]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4265 [ns_pending_service_args addObject: [NSString stringWithUTF8String: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4266 SDATA (ns_string_from_pasteboard (pboard))]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4267 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4268 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4269 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4270 /* called from ns_read_socket to clear queue */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4271 - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4272 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4273 struct frame *emacsframe = SELECTED_FRAME (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4274 NSEvent *theEvent = [NSApp currentEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4275 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4276 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4277 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4278 |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
4279 emacs_event->kind = NS_NONKEY_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4280 emacs_event->code = KEY_NS_SPI_SERVICE_CALL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4281 ns_input_spi_name = build_string ([name UTF8String]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4282 ns_input_spi_arg = build_string ([arg UTF8String]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4283 emacs_event->modifiers = EV_MODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4284 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4285 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4286 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4287 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4288 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4289 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4290 @end /* EmacsApp */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4291 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4292 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4293 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4294 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4295 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4296 EmacsView implementation |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4297 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4298 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4299 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4300 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4301 @implementation EmacsView |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4302 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4303 /* needed to inform when window closed from LISP */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4304 - (void) setWindowClosing: (BOOL)closing |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4305 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4306 windowClosing = closing; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4307 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4308 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4309 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4310 - (void)dealloc |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4311 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4312 NSTRACE (EmacsView_dealloc); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4313 [toolbar release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4314 [super dealloc]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4315 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4316 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4317 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4318 /* called on font panel selection */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4319 - (void)changeFont: (id)sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4320 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4321 NSEvent *e =[[self window] currentEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4322 struct face *face =FRAME_DEFAULT_FACE (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4323 id newFont; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4324 float size; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4325 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4326 NSTRACE (changeFont); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4327 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4328 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4329 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4330 if (newFont = [sender convertFont: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4331 ((struct nsfont_info *)face->font)->nsfont]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4332 { |
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:
98371
diff
changeset
|
4333 SET_FRAME_GARBAGED (emacsframe); /* now needed as of 2008/10 */ |
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:
98371
diff
changeset
|
4334 |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
4335 emacs_event->kind = NS_NONKEY_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4336 emacs_event->modifiers = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4337 emacs_event->code = KEY_NS_CHANGE_FONT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4338 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4339 size = [newFont pointSize]; |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96817
diff
changeset
|
4340 ns_input_fontsize = make_number (lrint (size)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4341 ns_input_font = build_string ([[newFont familyName] UTF8String]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4342 EV_TRAILER (e); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4343 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4344 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4345 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4346 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4347 - (BOOL)acceptsFirstResponder |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4348 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4349 NSTRACE (acceptsFirstResponder); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4350 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4351 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4352 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4353 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4354 - (void)resetCursorRects |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4355 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4356 NSRect visible = [self visibleRect]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4357 NSCursor *currentCursor = FRAME_POINTER_TYPE (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4358 NSTRACE (resetCursorRects); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4359 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4360 if (currentCursor == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4361 currentCursor = [NSCursor arrowCursor]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4362 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4363 if (!NSIsEmptyRect (visible)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4364 [self addCursorRect: visible cursor: currentCursor]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4365 [currentCursor setOnMouseEntered: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4366 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4367 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4368 |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4369 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4370 /*****************************************************************************/ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4371 /* Keyboard handling. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4372 #define NS_KEYLOG 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4373 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4374 - (void)keyDown: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4375 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4376 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4377 int code; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4378 unsigned fnKeysym = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4379 int flags; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4380 static NSMutableArray *nsEvArray; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4381 static BOOL firstTime = YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4382 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4383 NSTRACE (keyDown); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4384 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4385 /* Rhapsody and OS X give up and down events for the arrow keys */ |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4386 if (ns_fake_keydown == YES) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4387 ns_fake_keydown = NO; |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4388 else if ([theEvent type] != NSKeyDown) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4389 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4390 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4391 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4392 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4393 |
103296
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
4394 if (![[self window] isKeyWindow] |
103594
18711f21d4a9
nsterm.m (keydown): avoid infinite loop
David Reitter <david.reitter@gmail.com>
parents:
103340
diff
changeset
|
4395 && [[theEvent window] isKindOfClass: [EmacsWindow class]] |
18711f21d4a9
nsterm.m (keydown): avoid infinite loop
David Reitter <david.reitter@gmail.com>
parents:
103340
diff
changeset
|
4396 /* we must avoid an infinite loop here. */ |
18711f21d4a9
nsterm.m (keydown): avoid infinite loop
David Reitter <david.reitter@gmail.com>
parents:
103340
diff
changeset
|
4397 && (EmacsView *)[[theEvent window] delegate] != self) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4398 { |
102434
762aaa3e88a0
Include <signal.h> for SIGTERM used in ns_term_shutdown.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102429
diff
changeset
|
4399 /* XXX: There is an occasional condition in which, when Emacs display |
762aaa3e88a0
Include <signal.h> for SIGTERM used in ns_term_shutdown.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102429
diff
changeset
|
4400 updates a different frame from the current one, and temporarily |
762aaa3e88a0
Include <signal.h> for SIGTERM used in ns_term_shutdown.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102429
diff
changeset
|
4401 selects it, then processes some interrupt-driven input |
762aaa3e88a0
Include <signal.h> for SIGTERM used in ns_term_shutdown.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102429
diff
changeset
|
4402 (dispnew.c:3878), OS will send the event to the correct NSWindow, but |
762aaa3e88a0
Include <signal.h> for SIGTERM used in ns_term_shutdown.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102429
diff
changeset
|
4403 for some reason that window has its first responder set to the NSView |
762aaa3e88a0
Include <signal.h> for SIGTERM used in ns_term_shutdown.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102429
diff
changeset
|
4404 most recently updated (I guess), which is not the correct one. */ |
103296
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
4405 [(EmacsView *)[[theEvent window] delegate] keyDown: theEvent]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4406 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4407 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4408 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4409 if (nsEvArray == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4410 nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4411 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4412 [NSCursor setHiddenUntilMouseMoves: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4413 |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4414 if (hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4415 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4416 clear_mouse_face (hlinfo); |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4417 hlinfo->mouse_face_hidden = 1; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4418 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4419 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4420 if (!processingCompose) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4421 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4422 code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4423 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4424 /* (Carbon way: [theEvent keyCode]) */ |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4425 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4426 /* is it a "function key"? */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4427 fnKeysym = ns_convert_key (code); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4428 if (fnKeysym) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4429 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4430 /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4431 because Emacs treats Delete and KP-Delete same (in simple.el). */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4432 if (fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4433 code = 0xFF08; /* backspace */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4434 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4435 code = fnKeysym; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4436 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4437 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4438 /* are there modifiers? */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4439 emacs_event->modifiers = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4440 flags = [theEvent modifierFlags]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4441 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4442 if (flags & NSHelpKeyMask) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4443 emacs_event->modifiers |= hyper_modifier; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4444 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4445 if (flags & NSShiftKeyMask) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4446 emacs_event->modifiers |= shift_modifier; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4447 |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4448 if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4449 emacs_event->modifiers |= parse_solitary_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4450 (EQ (ns_right_command_modifier, Qleft) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4451 ? ns_command_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4452 : ns_right_command_modifier); |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4453 |
111703
cb2bf4b8dd70
nsterm.m (keyDown): Compare Left key masks exactly (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111700
diff
changeset
|
4454 if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4455 { |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4456 emacs_event->modifiers |= parse_solitary_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4457 (ns_command_modifier); |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
4458 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4459 /* if super (default), take input manager's word so things like |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4460 dvorak / qwerty layout work */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4461 if (EQ (ns_command_modifier, Qsuper) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4462 && !fnKeysym |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4463 && [[theEvent characters] length] != 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4464 { |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
4465 /* XXX: the code we get will be unshifted, so if we have |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4466 a shift modifier, must convert ourselves */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4467 if (!(flags & NSShiftKeyMask)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4468 code = [[theEvent characters] characterAtIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4469 #if 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4470 /* this is ugly and also requires linking w/Carbon framework |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4471 (for LMGetKbdType) so for now leave this rare (?) case |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4472 undealt with.. in future look into CGEvent methods */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4473 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4474 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4475 long smv = GetScriptManagerVariable (smKeyScript); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4476 Handle uchrHandle = GetResource |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4477 ('uchr', GetScriptVariable (smv, smScriptKeys)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4478 UInt32 dummy = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4479 UCKeyTranslate ((UCKeyboardLayout*)*uchrHandle, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4480 [[theEvent characters] characterAtIndex: 0], |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4481 kUCKeyActionDisplay, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4482 (flags & ~NSCommandKeyMask) >> 8, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4483 LMGetKbdType (), kUCKeyTranslateNoDeadKeysMask, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4484 &dummy, 1, &dummy, &code); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4485 code &= 0xFF; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4486 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4487 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4488 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4489 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4490 |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4491 if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4492 emacs_event->modifiers |= parse_solitary_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4493 (EQ (ns_right_control_modifier, Qleft) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4494 ? ns_control_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4495 : ns_right_control_modifier); |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4496 |
111703
cb2bf4b8dd70
nsterm.m (keyDown): Compare Left key masks exactly (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111700
diff
changeset
|
4497 if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask) |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4498 emacs_event->modifiers |= parse_solitary_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4499 (ns_control_modifier); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4500 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4501 if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4502 emacs_event->modifiers |= |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4503 parse_solitary_modifier (ns_function_modifier); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4504 |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4505 if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4506 { |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4507 if ((NILP (ns_right_alternate_modifier) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4508 || EQ (ns_right_alternate_modifier, Qnone)) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4509 && !fnKeysym) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4510 { /* accept pre-interp alt comb */ |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4511 if ([[theEvent characters] length] > 0) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4512 code = [[theEvent characters] characterAtIndex: 0]; |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4513 /*HACK: clear lone shift modifier to stop next if from firing */ |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4514 if (emacs_event->modifiers == shift_modifier) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4515 emacs_event->modifiers = 0; |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4516 } |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4517 else |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4518 emacs_event->modifiers |= parse_solitary_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4519 (EQ (ns_right_alternate_modifier, Qleft) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4520 ? ns_alternate_modifier |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4521 : ns_right_alternate_modifier); |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4522 } |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4523 |
111703
cb2bf4b8dd70
nsterm.m (keyDown): Compare Left key masks exactly (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111700
diff
changeset
|
4524 if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */ |
111700
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4525 { |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4526 if ((NILP (ns_alternate_modifier) |
3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Jan D. <jan.h.d@swipnet.se>
parents:
111662
diff
changeset
|
4527 || EQ (ns_alternate_modifier, Qnone)) |
101351
1789feb8fd54
* nsterm.m (EmavsView-keyDown:): Treat nil as Qnone for ns_alternate_modifier. (Bug#1217)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101329
diff
changeset
|
4528 && !fnKeysym) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4529 { /* accept pre-interp alt comb */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4530 if ([[theEvent characters] length] > 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4531 code = [[theEvent characters] characterAtIndex: 0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4532 /*HACK: clear lone shift modifier to stop next if from firing */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4533 if (emacs_event->modifiers == shift_modifier) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4534 emacs_event->modifiers = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4535 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4536 else |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4537 emacs_event->modifiers |= |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4538 parse_solitary_modifier (ns_alternate_modifier); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4539 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4540 |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4541 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4542 fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4543 code, fnKeysym, flags, emacs_event->modifiers); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4544 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4545 /* if it was a function key or had modifiers, pass it directly to emacs */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4546 if (fnKeysym || (emacs_event->modifiers |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4547 && [[theEvent charactersIgnoringModifiers] length] > 0)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4548 /*[[theEvent characters] length] */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4549 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4550 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4551 if (code < 0x20) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4552 code |= (1<<28)|(3<<16); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4553 else if (code == 0x7f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4554 code |= (1<<28)|(3<<16); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4555 else if (!fnKeysym) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4556 emacs_event->kind = code > 0xFF |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4557 ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4558 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4559 emacs_event->code = code; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4560 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4561 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4562 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4563 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4564 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4565 /* if we get here we should send the key for input manager processing */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4566 if (firstTime && [[NSInputManager currentInputManager] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4567 wantsToDelayTextChangeNotifications] == NO) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4568 fprintf (stderr, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4569 "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4570 firstTime = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4571 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4572 if (NS_KEYLOG && !processingCompose) |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4573 fprintf (stderr, "keyDown: Begin compose sequence.\n"); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4574 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4575 processingCompose = YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4576 [nsEvArray addObject: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4577 [self interpretKeyEvents: nsEvArray]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4578 [nsEvArray removeObject: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4579 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4580 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4581 |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4582 #ifdef NS_IMPL_COCOA |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4583 /* Needed to pick up Ctrl-tab and possibly other events that OS X has |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4584 decided not to send key-down for. |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4585 See http://osdir.com/ml/editors.vim.mac/2007-10/msg00141.html |
104046
95a3747ab8d5
* nsterm.m (EmacsView-keyUp:): Only act when running under Tiger.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103930
diff
changeset
|
4586 This only applies on Tiger and earlier. |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4587 If it matches one of these, send it on to keyDown. */ |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4588 -(void)keyUp: (NSEvent *)theEvent |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4589 { |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4590 int flags = [theEvent modifierFlags]; |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4591 int code = [theEvent keyCode]; |
104046
95a3747ab8d5
* nsterm.m (EmacsView-keyUp:): Only act when running under Tiger.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103930
diff
changeset
|
4592 if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ && |
95a3747ab8d5
* nsterm.m (EmacsView-keyUp:): Only act when running under Tiger.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
103930
diff
changeset
|
4593 code == 0x30 && (flags & NSControlKeyMask) && !(flags & NSCommandKeyMask)) |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4594 { |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4595 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4596 fprintf (stderr, "keyUp: passed test"); |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4597 ns_fake_keydown = YES; |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4598 [self keyDown: theEvent]; |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4599 } |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4600 } |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4601 #endif |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4602 |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4603 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4604 /* <NSTextInput> implementation (called through super interpretKeyEvents:]). */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4605 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4606 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4607 /* <NSTextInput>: called when done composing; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4608 NOTE: also called when we delete over working text, followed immed. |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4609 by doCommandBySelector: deleteBackward: */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4610 - (void)insertText: (id)aString |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4611 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4612 int code; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4613 int len = [(NSString *)aString length]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4614 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4615 |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4616 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4617 NSLog (@"insertText '%@'\tlen = %d", aString, len); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4618 processingCompose = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4619 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4620 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4621 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4622 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4623 /* first, clear any working text */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4624 if (workingText != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4625 [self deleteWorkingText]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4626 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4627 /* now insert the string as keystrokes */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4628 for (i =0; i<len; i++) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4629 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4630 code = [aString characterAtIndex: i]; |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
4631 /* TODO: still need this? */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4632 if (code == 0x2DC) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4633 code = '~'; /* 0x7E */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4634 emacs_event->modifiers = 0; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
4635 emacs_event->kind |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
4636 = code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4637 emacs_event->code = code; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4638 EV_TRAILER ((id)nil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4639 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4640 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4641 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4642 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4643 /* <NSTextInput>: inserts display of composing characters */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4644 - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4645 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4646 NSString *str = [aString respondsToSelector: @selector (string)] ? |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4647 [aString string] : aString; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4648 if (NS_KEYLOG) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4649 NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length], |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4650 selRange.length, selRange.location); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4651 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4652 if (workingText != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4653 [self deleteWorkingText]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4654 if ([str length] == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4655 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4656 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4657 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4658 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4659 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4660 processingCompose = YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4661 workingText = [str copy]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4662 ns_working_text = build_string ([workingText UTF8String]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4663 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4664 emacs_event->kind = NS_TEXT_EVENT; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4665 emacs_event->code = KEY_NS_PUT_WORKING_TEXT; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4666 EV_TRAILER ((id)nil); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4667 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4668 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4669 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4670 /* delete display of composing characters [not in <NSTextInput>] */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4671 - (void)deleteWorkingText |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4672 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4673 if (workingText == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4674 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4675 if (NS_KEYLOG) |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4676 NSLog(@"deleteWorkingText len =%d\n", [workingText length]); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4677 [workingText release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4678 workingText = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4679 processingCompose = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4680 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4681 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4682 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4683 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4684 emacs_event->kind = NS_TEXT_EVENT; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4685 emacs_event->code = KEY_NS_UNPUT_WORKING_TEXT; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4686 EV_TRAILER ((id)nil); |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4687 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4688 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4689 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4690 - (BOOL)hasMarkedText |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4691 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4692 return workingText != nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4693 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4694 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4695 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4696 - (NSRange)markedRange |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4697 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4698 NSRange rng = workingText != nil |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4699 ? NSMakeRange (0, [workingText length]) : NSMakeRange (NSNotFound, 0); |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4700 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4701 NSLog (@"markedRange request"); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4702 return rng; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4703 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4704 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4705 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4706 - (void)unmarkText |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4707 { |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4708 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4709 NSLog (@"unmark (accept) text"); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4710 [self deleteWorkingText]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4711 processingCompose = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4712 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4713 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4714 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4715 /* used to position char selection windows, etc. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4716 - (NSRect)firstRectForCharacterRange: (NSRange)theRange |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4717 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4718 NSRect rect; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4719 NSPoint pt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4720 struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4721 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4722 NSLog (@"firstRectForCharRange request"); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4723 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4724 rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4725 rect.size.height = FRAME_LINE_HEIGHT (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4726 pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4727 pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4728 +FRAME_LINE_HEIGHT (emacsframe)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4729 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4730 pt = [self convertPoint: pt toView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4731 pt = [[self window] convertBaseToScreen: pt]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4732 rect.origin = pt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4733 return rect; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4734 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4735 |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
4736 |
105624
6f9c7db80c0c
(EmacsView-conversationIdentifier): Arg is long.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105579
diff
changeset
|
4737 - (long)conversationIdentifier |
6f9c7db80c0c
(EmacsView-conversationIdentifier): Arg is long.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105579
diff
changeset
|
4738 { |
6f9c7db80c0c
(EmacsView-conversationIdentifier): Arg is long.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105579
diff
changeset
|
4739 return (long)self; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4740 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4741 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4742 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4743 - (void)doCommandBySelector: (SEL)aSelector |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4744 { |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4745 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4746 NSLog (@"doCommandBySelector: %@", NSStringFromSelector (aSelector)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4747 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4748 if (aSelector == @selector (deleteBackward:)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4749 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4750 /* happens when user backspaces over an ongoing composition: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4751 throw a 'delete' into the event queue */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4752 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4753 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4754 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4755 emacs_event->code = 0xFF08; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4756 EV_TRAILER ((id)nil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4757 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4758 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4759 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4760 - (NSArray *)validAttributesForMarkedText |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4761 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4762 static NSArray *arr = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4763 if (arr == nil) arr = [NSArray new]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4764 /* [[NSArray arrayWithObject: NSUnderlineStyleAttributeName] retain]; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4765 return arr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4766 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4767 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4768 - (NSRange)selectedRange |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4769 { |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4770 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4771 NSLog (@"selectedRange request"); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4772 return NSMakeRange (NSNotFound, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4773 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4774 |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
4775 - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4776 { |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4777 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4778 NSLog (@"characterIndexForPoint request"); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4779 return 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4780 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4781 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4782 - (NSAttributedString *)attributedSubstringFromRange: (NSRange)theRange |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4783 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4784 static NSAttributedString *str = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4785 if (str == nil) str = [NSAttributedString new]; |
101316
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4786 if (NS_KEYLOG) |
f4441bcb2612
* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab. (ns_get_color): Use unsigned long long for scanned hex string value. (ns_term_shutdown): Abort on non SIGTERM signals.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
100951
diff
changeset
|
4787 NSLog (@"attributedSubstringFromRange request"); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4788 return str; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4789 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4790 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4791 /* End <NSTextInput> impl. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4792 /*****************************************************************************/ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4793 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4794 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4795 /* This is what happens when the user presses a mouse button. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4796 - (void)mouseDown: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4797 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4798 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4799 Lisp_Object window; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4800 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4801 NSTRACE (mouseDown); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4802 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4803 [self deleteWorkingText]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4804 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4805 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4806 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4807 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4808 last_mouse_frame = emacsframe; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4809 /* appears to be needed to prevent spurious movement events generated on |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4810 button clicks */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4811 last_mouse_frame->mouse_moved = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4812 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4813 if ([theEvent type] == NSScrollWheel) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4814 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4815 float delta = [theEvent deltaY]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4816 /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4817 if (delta == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4818 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4819 emacs_event->kind = WHEEL_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4820 emacs_event->code = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4821 emacs_event->modifiers = EV_MODIFIERS (theEvent) | |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4822 ((delta > 0) ? up_modifier : down_modifier); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4823 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4824 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4825 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4826 emacs_event->kind = MOUSE_CLICK_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4827 emacs_event->code = EV_BUTTON (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4828 emacs_event->modifiers = EV_MODIFIERS (theEvent) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4829 | EV_UDMODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4830 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4831 XSETINT (emacs_event->x, lrint (p.x)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4832 XSETINT (emacs_event->y, lrint (p.y)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4833 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4834 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4835 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4836 |
99917
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4837 - (void)rightMouseDown: (NSEvent *)theEvent |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4838 { |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4839 NSTRACE (rightMouseDown); |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4840 [self mouseDown: theEvent]; |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4841 } |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4842 |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4843 |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4844 - (void)otherMouseDown: (NSEvent *)theEvent |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4845 { |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4846 NSTRACE (otherMouseDown); |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4847 [self mouseDown: theEvent]; |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4848 } |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4849 |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4850 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4851 - (void)mouseUp: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4852 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4853 NSTRACE (mouseUp); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4854 [self mouseDown: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4855 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4856 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4857 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4858 - (void)rightMouseUp: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4859 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4860 NSTRACE (rightMouseUp); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4861 [self mouseDown: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4862 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4863 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4864 |
99917
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4865 - (void)otherMouseUp: (NSEvent *)theEvent |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4866 { |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4867 NSTRACE (otherMouseUp); |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4868 [self mouseDown: theEvent]; |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4869 } |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4870 |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4871 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4872 - (void) scrollWheel: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4873 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4874 NSTRACE (scrollWheel); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4875 [self mouseDown: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4876 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4877 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4878 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4879 /* Tell emacs the mouse has moved. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4880 - (void)mouseMoved: (NSEvent *)e |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4881 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4882 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4883 Lisp_Object frame; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4884 |
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:
98371
diff
changeset
|
4885 // NSTRACE (mouseMoved); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4886 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4887 last_mouse_movement_time = EV_TIMESTAMP (e); |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
4888 last_mouse_motion_position |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
4889 = [self convertPoint: [e locationInWindow] fromView: nil]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4890 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4891 /* update any mouse face */ |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4892 if (hlinfo->mouse_face_hidden) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4893 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4894 hlinfo->mouse_face_hidden = 0; |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
4895 clear_mouse_face (hlinfo); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4896 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4897 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4898 /* tooltip handling */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4899 previous_help_echo_string = help_echo_string; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4900 help_echo_string = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4901 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4902 if (!note_mouse_movement (emacsframe, last_mouse_motion_position.x, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4903 last_mouse_motion_position.y)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4904 help_echo_string = previous_help_echo_string; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4905 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4906 XSETFRAME (frame, emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4907 if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4908 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4909 /* NOTE: help_echo_{window,pos,object} are set in xdisp.c |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4910 (note_mouse_highlight), which is called through the |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4911 note_mouse_movement () call above */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4912 gen_help_event (help_echo_string, frame, help_echo_window, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4913 help_echo_object, help_echo_pos); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4914 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4915 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4916 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4917 help_echo_string = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4918 gen_help_event (Qnil, frame, Qnil, Qnil, 0); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4919 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4920 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4921 if (emacsframe->mouse_moved && send_appdefined) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4922 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4923 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4924 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4925 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4926 - (void)mouseDragged: (NSEvent *)e |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4927 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4928 NSTRACE (mouseDragged); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4929 [self mouseMoved: e]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4930 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4931 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4932 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4933 - (void)rightMouseDragged: (NSEvent *)e |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4934 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4935 NSTRACE (rightMouseDragged); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4936 [self mouseMoved: e]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4937 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4938 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4939 |
99917
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4940 - (void)otherMouseDragged: (NSEvent *)e |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4941 { |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4942 NSTRACE (otherMouseDragged); |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4943 [self mouseMoved: e]; |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4944 } |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4945 |
d7ec854f5dc4
* nsterm.m (-otherMouseDown:, -otherMouseUp:, -otherMouseDragged): New EmacsView methods. (EV_UDMODIFIERS, EV_BUTTON): Add OtherMouse constants. Fixes bug #1048,1357,1414.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
99904
diff
changeset
|
4946 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4947 - (BOOL)windowShouldClose: (id)sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4948 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4949 NSEvent *e =[[self window] currentEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4950 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4951 NSTRACE (windowShouldClose); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4952 windowClosing = YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4953 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4954 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4955 emacs_event->kind = DELETE_WINDOW_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4956 emacs_event->modifiers = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4957 emacs_event->code = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4958 EV_TRAILER (e); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4959 /* Don't close this window, let this be done from lisp code. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4960 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4961 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4962 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4963 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4964 - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4965 /* normalize frame to gridded text size */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4966 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4967 NSTRACE (windowWillResize); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4968 /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4969 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4970 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4971 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4972 frameSize.width + 3); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4973 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4974 frameSize.width); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4975 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4976 if (cols < MINWIDTH) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4977 cols = MINWIDTH; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4978 frameSize.width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (emacsframe, cols); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4979 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4980 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4981 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4982 - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3 |
109092
babf8e935ea8
Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT to aid common code.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
4983 - FRAME_TOOLBAR_HEIGHT (emacsframe)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4984 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4985 - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) |
109092
babf8e935ea8
Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT to aid common code.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
4986 - FRAME_TOOLBAR_HEIGHT (emacsframe)); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4987 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4988 if (rows < MINHEIGHT) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4989 rows = MINHEIGHT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4990 frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4991 + FRAME_NS_TITLEBAR_HEIGHT (emacsframe) |
109092
babf8e935ea8
Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT to aid common code.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
4992 + FRAME_TOOLBAR_HEIGHT (emacsframe); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4993 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4994 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4995 /* this sets window title to have size in it; the wm does this under GS */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4996 NSRect r = [[self window] frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4997 if (r.size.height == frameSize.height && r.size.width == frameSize.width) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4998 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4999 if (old_title != 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5000 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5001 xfree (old_title); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5002 old_title = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5003 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5004 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5005 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5006 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5007 char *size_title; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5008 NSWindow *window = [self window]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5009 if (old_title == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5010 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5011 const char *t = [[[self window] title] UTF8String]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5012 char *pos = strstr (t, " — "); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5013 if (pos) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5014 *pos = '\0'; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5015 old_title = (char *) xmalloc (strlen (t) + 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5016 strcpy (old_title, t); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5017 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5018 size_title = xmalloc (strlen (old_title) + 40); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5019 sprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5020 [window setTitle: [NSString stringWithUTF8String: size_title]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5021 [window display]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5022 xfree (size_title); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5023 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5024 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5025 #endif /* NS_IMPL_COCOA */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5026 /*fprintf (stderr," ...size became %.0f x %.0f (%d x %d)\n",frameSize.width,frameSize.height,cols,rows); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5027 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5028 return frameSize; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5029 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5030 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5031 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5032 - (void)windowDidResize: (NSNotification *)notification |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5033 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5034 NSWindow *theWindow = [notification object]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5035 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5036 #ifdef NS_IMPL_GNUSTEP |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5037 /* in GNUstep, at least currently, it's possible to get a didResize |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5038 without getting a willResize.. therefore we need to act as if we got |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5039 the willResize now */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5040 NSSize sz = [theWindow frame].size; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5041 sz = [self windowWillResize: theWindow toSize: sz]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5042 #endif /* NS_IMPL_GNUSTEP */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5043 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5044 NSTRACE (windowDidResize); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5045 /*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5046 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5047 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5048 if (old_title != 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5049 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5050 xfree (old_title); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5051 old_title = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5052 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5053 #endif /* NS_IMPL_COCOA */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5054 |
105083
544f5b209a5b
(ns_no_defaults): Remove. (ns_term_init): Switch ns_no_defaults -> inhibit_x_resources. (ns_use_qd_smoothing): Remove legacy variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104818
diff
changeset
|
5055 /* Avoid loop under GNUstep due to call at beginning of this function. |
544f5b209a5b
(ns_no_defaults): Remove. (ns_term_init): Switch ns_no_defaults -> inhibit_x_resources. (ns_use_qd_smoothing): Remove legacy variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104818
diff
changeset
|
5056 (x_set_window_size causes a resize which causes |
544f5b209a5b
(ns_no_defaults): Remove. (ns_term_init): Switch ns_no_defaults -> inhibit_x_resources. (ns_use_qd_smoothing): Remove legacy variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104818
diff
changeset
|
5057 a "windowDidResize" which calls x_set_window_size). */ |
103160
505b0e9f0379
(-windowDidResize:): Avoid inf-loop under GNUStep.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103120
diff
changeset
|
5058 #ifndef NS_IMPL_GNUSTEP |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5059 if (cols > 0 && rows > 0) |
103160
505b0e9f0379
(-windowDidResize:): Avoid inf-loop under GNUStep.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103120
diff
changeset
|
5060 x_set_window_size (emacsframe, 0, cols, rows); |
505b0e9f0379
(-windowDidResize:): Avoid inf-loop under GNUStep.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103120
diff
changeset
|
5061 #endif |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5062 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5063 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5064 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5065 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5066 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5067 - (void)windowDidBecomeKey: (NSNotification *)notification |
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:
98371
diff
changeset
|
5068 /* cf. x_detect_focus_change(), x_focus_changed(), x_new_focus_frame() */ |
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:
98371
diff
changeset
|
5069 { |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5070 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
5071 struct frame *old_focus = dpyinfo->x_focus_frame; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5072 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5073 NSTRACE (windowDidBecomeKey); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5074 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5075 if (emacsframe != old_focus) |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
5076 dpyinfo->x_focus_frame = emacsframe; |
98371
713cc05ca791
* nsfont.m (nsfont_draw): Fix up composition rendering.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
98229
diff
changeset
|
5077 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5078 ns_frame_rehighlight (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5079 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5080 if (emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5081 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5082 emacs_event->kind = FOCUS_IN_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5083 EV_TRAILER ((id)nil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5084 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5085 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5086 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5087 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5088 - (void)windowDidResignKey: (NSNotification *)notification |
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:
98371
diff
changeset
|
5089 /* cf. x_detect_focus_change(), x_focus_changed(), x_new_focus_frame() */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5090 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5091 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5092 NSTRACE (windowDidResignKey); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5093 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
5094 if (dpyinfo->x_focus_frame == emacsframe) |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96835
diff
changeset
|
5095 dpyinfo->x_focus_frame = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5096 |
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:
98371
diff
changeset
|
5097 ns_frame_rehighlight (emacsframe); |
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:
98371
diff
changeset
|
5098 |
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:
98371
diff
changeset
|
5099 /* FIXME: for some reason needed on second and subsequent clicks away |
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:
98371
diff
changeset
|
5100 from sole-frame Emacs to get hollow box to show */ |
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:
98371
diff
changeset
|
5101 if (!windowClosing && [[self window] isVisible] == YES) |
100001
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
5102 { |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
5103 x_update_cursor (emacsframe, 1); |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
5104 x_set_frame_alpha (emacsframe); |
28d216f71b5a
* frame.c (x_set_alpha) [NS_IMPL_COCOA]: Call x_set_frame_alpha.
Seiji Zenitani <zenitani@mac.com>
parents:
99925
diff
changeset
|
5105 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5106 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5107 if (emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5108 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5109 [self deleteWorkingText]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5110 emacs_event->kind = FOCUS_IN_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5111 EV_TRAILER ((id)nil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5112 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5113 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5114 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5115 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5116 - (void)windowWillMiniaturize: sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5117 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5118 NSTRACE (windowWillMiniaturize); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5119 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5120 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5121 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5122 - (BOOL)isFlipped |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5123 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5124 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5125 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5126 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5127 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5128 - (BOOL)isOpaque |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5129 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5130 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5131 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5132 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5133 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5134 - initFrameFromEmacs: (struct frame *)f |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5135 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5136 NSRect r, wr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5137 Lisp_Object tem; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5138 NSWindow *win; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5139 NSButton *toggleButton; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5140 int vbextra = NS_SCROLL_BAR_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5141 NSSize sz; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5142 NSColor *col; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5143 NSString *name; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5144 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5145 NSTRACE (initFrameFromEmacs); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5146 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5147 windowClosing = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5148 processingCompose = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5149 scrollbarsNeedingUpdate = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5150 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5151 /*fprintf (stderr,"init with %d, %d\n",f->text_cols, f->text_lines); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5152 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5153 r = NSMakeRect (0, 0, FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, f->text_cols), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5154 FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, f->text_lines)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5155 [self initWithFrame: r]; |
105159
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
5156 [self setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5157 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5158 FRAME_NS_VIEW (f) = self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5159 emacsframe = f; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5160 old_title = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5161 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5162 win = [[EmacsWindow alloc] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5163 initWithContentRect: r |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5164 styleMask: (NSResizableWindowMask | |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5165 NSMiniaturizableWindowMask | |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5166 NSClosableWindowMask) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5167 backing: NSBackingStoreBuffered |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5168 defer: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5169 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5170 wr = [win frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5171 f->border_width = wr.size.width - r.size.width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5172 FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5173 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5174 [win setAcceptsMouseMovedEvents: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5175 [win setDelegate: self]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5176 [win useOptimizedDrawing: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5177 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5178 sz.width = FRAME_COLUMN_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5179 sz.height = FRAME_LINE_HEIGHT (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5180 [win setResizeIncrements: sz]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5181 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5182 [[win contentView] addSubview: self]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5183 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5184 if (ns_drag_types) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5185 [self registerForDraggedTypes: ns_drag_types]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5186 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5187 tem = f->name; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5188 name = [NSString stringWithUTF8String: |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
5189 NILP (tem) ? (unsigned char *)"Emacs" : SDATA (tem)]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5190 [win setTitle: name]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5191 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5192 /* toolbar support */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5193 toolbar = [[EmacsToolbar alloc] initForView: self withIdentifier: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5194 [NSString stringWithFormat: @"Emacs Frame %d", |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5195 ns_window_num]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5196 [win setToolbar: toolbar]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5197 [toolbar setVisible: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5198 #ifdef NS_IMPL_COCOA |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5199 toggleButton = [win standardWindowButton: NSWindowToolbarButton]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5200 [toggleButton setTarget: self]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5201 [toggleButton setAction: @selector (toggleToolbar: )]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5202 #endif |
109092
babf8e935ea8
Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT to aid common code.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
5203 FRAME_TOOLBAR_HEIGHT (f) = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5204 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5205 tem = f->icon_name; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5206 if (!NILP (tem)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5207 [win setMiniwindowTitle: |
96749
e18e64789955
(lisp_to_mod): Use parse_solitary_modifier instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
5208 [NSString stringWithUTF8String: SDATA (tem)]]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5209 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5210 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5211 NSScreen *screen = [win screen]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5212 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5213 if (screen != 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5214 [win setFrameTopLeftPoint: NSMakePoint |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5215 (IN_BOUND (-SCREENMAX, f->left_pos, SCREENMAX), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5216 IN_BOUND (-SCREENMAX, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5217 [screen frame].size.height - NS_TOP_POS (f), SCREENMAX))]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5218 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5219 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5220 [win makeFirstResponder: self]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5221 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5222 col = ns_lookup_indexed_color (NS_FACE_BACKGROUND |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5223 (FRAME_DEFAULT_FACE (emacsframe)), emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5224 [win setBackgroundColor: col]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5225 if ([col alphaComponent] != 1.0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5226 [win setOpaque: NO]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5227 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5228 [self allocateGState]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5229 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5230 ns_window_num++; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5231 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5232 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5233 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5234 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5235 - (void)windowDidMove: sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5236 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5237 NSWindow *win = [self window]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5238 NSRect r = [win frame]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5239 NSScreen *screen = [win screen]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5240 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5241 NSTRACE (windowDidMove); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5242 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5243 if (!emacsframe->output_data.ns) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5244 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5245 if (screen != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5246 { |
105096
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5247 emacsframe->left_pos = r.origin.x; |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5248 emacsframe->top_pos = |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5249 [screen frame].size.height - (r.origin.y + r.size.height); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5250 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5251 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5252 |
105096
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5253 |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5254 /* Called AFTER method below, but before our windowWillResize call there leads |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5255 to windowDidResize -> x_set_window_size. Update emacs' notion of frame |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5256 location so set_window_size moves the frame. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5257 - (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5258 { |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5259 NSTRACE (windowShouldZoom); |
105096
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5260 emacsframe->left_pos = (int)newFrame.origin.x; |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5261 emacsframe->top_pos = [[sender screen] frame].size.height |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5262 - (newFrame.origin.y+newFrame.size.height); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5263 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5264 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5265 |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5266 |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5267 /* Override to do something slightly nonstandard, but nice. First click on |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5268 zoom button will zoom vertically. Second will zoom completely. Third |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5269 returns to original. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5270 - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5271 defaultFrame:(NSRect)defaultFrame |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5272 { |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5273 NSRect result = [sender frame]; |
105096
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5274 static NSRect ns_userRect = { 0, 0, 0, 0 }; |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5275 |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5276 NSTRACE (windowWillUseStandardFrame); |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5277 |
105096
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5278 if (abs (defaultFrame.size.height - result.size.height) |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5279 > FRAME_LINE_HEIGHT (emacsframe)) |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5280 { |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5281 /* first click */ |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5282 ns_userRect = result; |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5283 result.size.height = defaultFrame.size.height; |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5284 result.origin.y = defaultFrame.origin.y; |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5285 } |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5286 else |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5287 { |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5288 if (abs (defaultFrame.size.width - result.size.width) |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5289 > FRAME_COLUMN_WIDTH (emacsframe)) |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5290 result = defaultFrame; /* second click */ |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5291 else |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5292 result = ns_userRect.size.height ? ns_userRect : result; /* restore */ |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5293 } |
ec8c2bbf049e
* nsterm.m (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105083
diff
changeset
|
5294 |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5295 [self windowWillResize: sender toSize: result.size]; |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5296 return result; |
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5297 } |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5298 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5299 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5300 - (void)windowDidDeminiaturize: sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5301 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5302 NSTRACE (windowDidDeminiaturize); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5303 if (!emacsframe->output_data.ns) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5304 return; |
102149
df135773c0eb
* nsterm.m (x_make_frame_invisible): Unset async_visible,
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101858
diff
changeset
|
5305 emacsframe->async_iconified = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5306 emacsframe->async_visible = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5307 windows_or_buffers_changed++; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5308 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5309 if (emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5310 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5311 emacs_event->kind = ICONIFY_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5312 EV_TRAILER ((id)nil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5313 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5314 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5315 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5316 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5317 - (void)windowDidExpose: sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5318 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5319 NSTRACE (windowDidExpose); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5320 if (!emacsframe->output_data.ns) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5321 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5322 emacsframe->async_visible = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5323 SET_FRAME_GARBAGED (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5324 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5325 if (send_appdefined) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5326 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5327 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5328 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5329 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5330 - (void)windowDidMiniaturize: sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5331 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5332 NSTRACE (windowDidMiniaturize); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5333 if (!emacsframe->output_data.ns) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5334 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5335 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5336 emacsframe->async_iconified = 1; |
102149
df135773c0eb
* nsterm.m (x_make_frame_invisible): Unset async_visible,
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101858
diff
changeset
|
5337 emacsframe->async_visible = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5338 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5339 if (emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5340 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5341 emacs_event->kind = ICONIFY_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5342 EV_TRAILER ((id)nil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5343 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5344 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5345 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5346 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5347 - (void)mouseEntered: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5348 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5349 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5350 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5351 NSTRACE (mouseEntered); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5352 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5353 last_mouse_movement_time = EV_TIMESTAMP (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5354 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5355 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5356 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5357 - (void)mouseExited: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5358 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5359 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5360 NSRect r; |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
5361 Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5362 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5363 NSTRACE (mouseExited); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5364 |
111413
d53ee71e7e89
Unify mouse-highlight code for all GUI and TTY sessions.
Eli Zaretskii <eliz@gnu.org>
diff
changeset
|
5365 if (!hlinfo) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5366 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5367 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5368 last_mouse_movement_time = EV_TIMESTAMP (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5369 |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
5370 if (emacsframe == hlinfo->mouse_face_mouse_frame) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5371 { |
111341
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
5372 clear_mouse_face (hlinfo); |
f79bd5f589f7
Finish coding mouse highlight redesigned for portability.
Eli Zaretskii <eliz@gnu.org>
parents:
110997
diff
changeset
|
5373 hlinfo->mouse_face_mouse_frame = 0; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5374 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5375 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5376 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5377 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5378 - menuDown: sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5379 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5380 NSTRACE (menuDown); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5381 if (context_menu_value == -1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5382 context_menu_value = [sender tag]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5383 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5384 find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used, |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
5385 emacsframe->menu_bar_vector, |
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
5386 (void *)[sender tag]); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5387 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5388 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5389 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5390 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5391 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5392 - (EmacsToolbar *)toolbar |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5393 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5394 return toolbar; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5395 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5396 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5397 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5398 /* this gets called on toolbar button click */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5399 - toolbarClicked: (id)item |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5400 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5401 NSEvent *theEvent; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5402 int idx = [item tag] * TOOL_BAR_ITEM_NSLOTS; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5403 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5404 NSTRACE (toolbarClicked); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5405 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5406 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5407 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5408 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5409 /* send first event (for some reason two needed) */ |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
5410 theEvent = [[self window] currentEvent]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5411 emacs_event->kind = TOOL_BAR_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5412 XSETFRAME (emacs_event->arg, emacsframe); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5413 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5414 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5415 emacs_event->kind = TOOL_BAR_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5416 /* XSETINT (emacs_event->code, 0); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5417 emacs_event->arg = AREF (emacsframe->tool_bar_items, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5418 idx + TOOL_BAR_ITEM_KEY); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5419 emacs_event->modifiers = EV_MODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5420 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5421 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5422 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5423 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5424 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5425 - toggleToolbar: (id)sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5426 { |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
5427 if (!emacs_event) |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
5428 return self; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
5429 |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
5430 emacs_event->kind = NS_NONKEY_EVENT; |
101490
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
5431 emacs_event->code = KEY_NS_TOGGLE_TOOLBAR; |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
5432 EV_TRAILER ((id)nil); |
cfaf6934d659
Changes to remove Feval calls from GUI under NS.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101405
diff
changeset
|
5433 return self; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5434 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5435 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5436 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5437 - (void)drawRect: (NSRect)rect |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5438 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5439 int x = NSMinX (rect), y = NSMinY (rect); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5440 int width = NSWidth (rect), height = NSHeight (rect); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5441 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5442 NSTRACE (drawRect); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5443 |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5444 if (!emacsframe || !emacsframe->output_data.ns || ns_in_resize) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5445 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5446 |
102427
03f8a267cd56
* nsterm.m (x_set_window_size): Change back to calculated method
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
102418
diff
changeset
|
5447 ns_clear_frame_area (emacsframe, x, y, width, height); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5448 expose_frame (emacsframe, x, y, width, height); |
103296
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5449 |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5450 /* |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5451 drawRect: may be called (at least in OS X 10.5) for invisible |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5452 views as well for some reason. Thus, do not infer visibility |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5453 here. |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5454 |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5455 emacsframe->async_visible = 1; |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5456 emacsframe->async_iconified = 0; |
a23e4364bf6e
Ensure NS frames remain hidden when invisible
David Reitter <david.reitter@gmail.com>
parents:
103241
diff
changeset
|
5457 */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5458 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5459 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5460 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5461 /* NSDraggingDestination protocol methods. Actually this is not really a |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5462 protocol, but a category of Object. O well... */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5463 |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
5464 -(NSUInteger) draggingEntered: (id <NSDraggingInfo>) sender |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5465 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5466 NSTRACE (draggingEntered); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5467 return NSDragOperationGeneric; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5468 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5469 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5470 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5471 -(BOOL)prepareForDragOperation: (id <NSDraggingInfo>) sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5472 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5473 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5474 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5475 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5476 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5477 -(BOOL)performDragOperation: (id <NSDraggingInfo>) sender |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5478 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5479 id pb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5480 int x, y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5481 NSString *type; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5482 NSEvent *theEvent = [[self window] currentEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5483 NSPoint position; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5484 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5485 NSTRACE (performDragOperation); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5486 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5487 if (!emacs_event) |
111398
4afa0b625189
* nsfont.m (nsfont_draw) * nsimage.m (EmacsImage-setXBMColor:) * nsterm.m (EmacsView-performDragOperation:): Correct empty return statements. Based on a patch by Ismail Donmez <ismail@namtrac.org>.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
111235
diff
changeset
|
5488 return NO; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5489 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5490 position = [self convertPoint: [sender draggingLocation] fromView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5491 x = lrint (position.x); y = lrint (position.y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5492 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5493 pb = [sender draggingPasteboard]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5494 type = [pb availableTypeFromArray: ns_drag_types]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5495 if (type == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5496 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5497 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5498 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5499 else if ([type isEqualToString: NSFilenamesPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5500 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5501 NSArray *files; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5502 NSEnumerator *fenum; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5503 NSString *file; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5504 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5505 if (!(files = [pb propertyListForType: type])) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5506 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5507 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5508 fenum = [files objectEnumerator]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5509 while ( (file = [fenum nextObject]) ) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5510 { |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
5511 emacs_event->kind = NS_NONKEY_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5512 emacs_event->code = KEY_NS_DRAG_FILE; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5513 XSETINT (emacs_event->x, x); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5514 XSETINT (emacs_event->y, y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5515 ns_input_file = append2 (ns_input_file, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5516 build_string ([file UTF8String])); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5517 emacs_event->modifiers = EV_MODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5518 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5519 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5520 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5521 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5522 else if ([type isEqualToString: NSURLPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5523 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5524 NSString *file; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5525 NSURL *fileURL; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5526 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5527 if (!(fileURL = [NSURL URLFromPasteboard: pb]) || |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5528 [fileURL isFileURL] == NO) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5529 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5530 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5531 file = [fileURL path]; |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
5532 emacs_event->kind = NS_NONKEY_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5533 emacs_event->code = KEY_NS_DRAG_FILE; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5534 XSETINT (emacs_event->x, x); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5535 XSETINT (emacs_event->y, y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5536 ns_input_file = append2 (ns_input_file, build_string ([file UTF8String])); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5537 emacs_event->modifiers = EV_MODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5538 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5539 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5540 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5541 else if ([type isEqualToString: NSStringPboardType] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5542 || [type isEqualToString: NSTabularTextPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5543 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5544 NSString *data; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5545 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5546 if (! (data = [pb stringForType: type])) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5547 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5548 |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
5549 emacs_event->kind = NS_NONKEY_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5550 emacs_event->code = KEY_NS_DRAG_TEXT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5551 XSETINT (emacs_event->x, x); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5552 XSETINT (emacs_event->y, y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5553 ns_input_text = build_string ([data UTF8String]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5554 emacs_event->modifiers = EV_MODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5555 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5556 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5557 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5558 else if ([type isEqualToString: NSColorPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5559 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5560 NSColor *c = [NSColor colorFromPasteboard: pb]; |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
5561 emacs_event->kind = NS_NONKEY_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5562 emacs_event->code = KEY_NS_DRAG_COLOR; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5563 XSETINT (emacs_event->x, x); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5564 XSETINT (emacs_event->y, y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5565 ns_input_color = ns_color_to_lisp (c); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5566 emacs_event->modifiers = EV_MODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5567 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5568 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5569 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5570 else if ([type isEqualToString: NSFontPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5571 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5572 /* impl based on GNUstep NSTextView.m */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5573 NSData *data = [pb dataForType: NSFontPboardType]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5574 NSDictionary *dict = [NSUnarchiver unarchiveObjectWithData: data]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5575 NSFont *font = [dict objectForKey: NSFontAttributeName]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5576 char fontSize[10]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5577 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5578 if (font == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5579 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5580 |
102504
a8e5be48f21f
newFrame, openFile, fulfillService, changeFont, toggleToolbar, performDragOperation, runHelp: use the new NS_NONKEY_EVENT event type.
David Reitter <david.reitter@gmail.com>
parents:
102434
diff
changeset
|
5581 emacs_event->kind = NS_NONKEY_EVENT; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5582 emacs_event->code = KEY_NS_CHANGE_FONT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5583 XSETINT (emacs_event->x, x); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5584 XSETINT (emacs_event->y, y); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5585 ns_input_font = build_string ([[font fontName] UTF8String]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5586 snprintf (fontSize, 10, "%f", [font pointSize]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5587 ns_input_fontsize = build_string (fontSize); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5588 emacs_event->modifiers = EV_MODIFIERS (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5589 EV_TRAILER (theEvent); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5590 return YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5591 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5592 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5593 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5594 error ("Invalid data type in dragging pasteboard."); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5595 return NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5596 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5597 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5598 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5599 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5600 - validRequestorForSendType: (NSString *)typeSent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5601 returnType: (NSString *)typeReturned |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5602 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5603 NSTRACE (validRequestorForSendType); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5604 if ([ns_send_types indexOfObjectIdenticalTo: typeSent] != NSNotFound && |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5605 [ns_return_types indexOfObjectIdenticalTo: typeSent] != NSNotFound) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5606 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5607 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5608 return [super validRequestorForSendType: typeSent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5609 returnType: typeReturned]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5610 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5611 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5612 |
101400
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5613 /* The next two methods are part of NSServicesRequests informal protocol, |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5614 supposedly called when a services menu item is chosen from this app. |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5615 But this should not happen because we override the services menu with our |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5616 own entries which call ns-perform-service. |
102279
87d779fe8006
Comment (don't hard-code bug address).
Glenn Morris <rgm@gnu.org>
parents:
102242
diff
changeset
|
5617 Nonetheless, it appeared to happen (under strange circumstances): bug#1435. |
101400
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5618 So let's at least stub them out until further investigation can be done. */ |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5619 |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5620 - (BOOL) readSelectionFromPasteboard: (NSPasteboard *)pb |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5621 { |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5622 /* we could call ns_string_from_pasteboard(pboard) here but then it should |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5623 be written into the buffer in place of the existing selection.. |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5624 ordinary service calls go through functions defined in ns-win.el */ |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5625 return NO; |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5626 } |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5627 |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5628 - (BOOL) writeSelectionToPasteboard: (NSPasteboard *)pb types: (NSArray *)types |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5629 { |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5630 /* supposed to write for as many of types as we are able */ |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5631 return NO; |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5632 } |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5633 |
27828d2e3209
* nsterm.m (EmacsView-readSelectionFromPasteboard:) (writeSelectionToPasteboard:types:): New stubbed-out methods for NSServicesRequests protocol. (Bug#1435)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101399
diff
changeset
|
5634 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5635 /* setMini =YES means set from internal (gives a finder icon), NO means set nil |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5636 (gives a miniaturized version of the window); currently we use the latter for |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5637 frames whose active buffer doesn't correspond to any file |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5638 (e.g., '*scratch*') */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5639 - setMiniwindowImage: (BOOL) setMini |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5640 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5641 id image = [[self window] miniwindowImage]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5642 NSTRACE (setMiniwindowImage); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5643 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5644 /* NOTE: under Cocoa miniwindowImage always returns nil, documentation |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5645 about "AppleDockIconEnabled" notwithstanding, however the set message |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5646 below has its effect nonetheless. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5647 if (image != emacsframe->output_data.ns->miniimage) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5648 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5649 if (image && [image isKindOfClass: [EmacsImage class]]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5650 [image release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5651 [[self window] setMiniwindowImage: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5652 setMini ? emacsframe->output_data.ns->miniimage : nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5653 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5654 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5655 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5656 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5657 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5658 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5659 - (void) setRows: (int) r andColumns: (int) c |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5660 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5661 rows = r; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5662 cols = c; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5663 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5664 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5665 @end /* EmacsView */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5666 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5667 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5668 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5669 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5670 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5671 EmacsWindow implementation |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5672 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5673 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5674 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5675 @implementation EmacsWindow |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5676 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5677 /* called only on resize clicks by special case in EmacsApp-sendEvent */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5678 - (void)mouseDown: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5679 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5680 if (ns_in_resize) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5681 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5682 NSSize size = [[theEvent window] frame].size; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5683 grabOffset = [theEvent locationInWindow]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5684 grabOffset.x = size.width - grabOffset.x; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5685 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5686 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5687 [super mouseDown: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5688 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5689 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5690 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5691 /* stop resizing */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5692 - (void)mouseUp: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5693 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5694 if (ns_in_resize) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5695 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5696 struct frame *f = ((EmacsView *)[self delegate])->emacsframe; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5697 ns_in_resize = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5698 ns_set_name_as_filename (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5699 [self display]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5700 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5701 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5702 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5703 [super mouseUp: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5704 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5705 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5706 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5707 /* send resize events */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5708 - (void)mouseDragged: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5709 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5710 if (ns_in_resize) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5711 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5712 NSPoint p = [theEvent locationInWindow]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5713 NSSize size, vettedSize, origSize = [self frame].size; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5714 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5715 size.width = p.x + grabOffset.x; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5716 size.height = origSize.height - p.y + grabOffset.y; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5717 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5718 if (size.width == origSize.width && size.height == origSize.height) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5719 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5720 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5721 vettedSize = [[self delegate] windowWillResize: self toSize: size]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5722 if (vettedSize.width != size.width || vettedSize.height != size.height) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5723 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5724 [[NSNotificationCenter defaultCenter] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5725 postNotificationName: NSWindowDidResizeNotification |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5726 object: self]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5727 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5728 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5729 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5730 [super mouseDragged: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5731 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5732 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5733 @end /* EmacsWindow */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5734 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5735 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5736 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5737 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5738 EmacsScroller implementation |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5739 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5740 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5741 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5742 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5743 @implementation EmacsScroller |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5744 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5745 /* for repeat button push */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5746 #define SCROLL_BAR_FIRST_DELAY 0.5 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5747 #define SCROLL_BAR_CONTINUOUS_DELAY (1.0 / 15) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5748 |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
5749 + (CGFloat) scrollerWidth |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5750 { |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
5751 /* TODO: if we want to allow variable widths, this is the place to do it, |
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
5752 however neither GNUstep nor Cocoa support it very well */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5753 return [NSScroller scrollerWidth]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5754 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5755 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5756 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5757 - initFrame: (NSRect )r window: (Lisp_Object)nwin |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5758 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5759 NSTRACE (EmacsScroller_initFrame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5760 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5761 r.size.width = [EmacsScroller scrollerWidth]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5762 [super initWithFrame: r/*NSMakeRect (0, 0, 0, 0)*/]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5763 [self setContinuous: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5764 [self setEnabled: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5765 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5766 /* Ensure auto resizing of scrollbars occurs within the emacs frame's view |
105159
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
5767 locked against the top and bottom edges, and right edge on OS X, where |
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
5768 scrollers are on right. */ |
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
5769 #ifdef NS_IMPL_GNUSTEP |
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
5770 [self setAutoresizingMask: NSViewMaxXMargin | NSViewHeightSizable]; |
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
5771 #else |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5772 [self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable]; |
105159
4b9dd8a2de69
* nsterm.m (EV_TIMESTAMP, x_set_window_size)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105153
diff
changeset
|
5773 #endif |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5774 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5775 win = nwin; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5776 condemned = NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5777 pixel_height = NSHeight (r); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5778 min_portion = 20 / pixel_height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5779 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5780 frame = XFRAME (XWINDOW (win)->frame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5781 if (FRAME_LIVE_P (frame)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5782 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5783 int i; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5784 EmacsView *view = FRAME_NS_VIEW (frame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5785 NSView *sview = [[view window] contentView]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5786 NSArray *subs = [sview subviews]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5787 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5788 /* disable optimization stopping redraw of other scrollbars */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5789 view->scrollbarsNeedingUpdate = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5790 for (i =[subs count]-1; i >= 0; i--) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5791 if ([[subs objectAtIndex: i] isKindOfClass: [EmacsScroller class]]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5792 view->scrollbarsNeedingUpdate++; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5793 [sview addSubview: self]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5794 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5795 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5796 /* [self setFrame: r]; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5797 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5798 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5799 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5800 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5801 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5802 - (void)setFrame: (NSRect)newRect |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5803 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5804 NSTRACE (EmacsScroller_setFrame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5805 /* BLOCK_INPUT; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5806 pixel_height = NSHeight (newRect); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5807 min_portion = 20 / pixel_height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5808 [super setFrame: newRect]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5809 [self display]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5810 /* UNBLOCK_INPUT; */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5811 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5812 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5813 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5814 - (void)dealloc |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5815 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5816 NSTRACE (EmacsScroller_dealloc); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5817 if (!NILP (win)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5818 XWINDOW (win)->vertical_scroll_bar = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5819 [super dealloc]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5820 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5821 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5822 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5823 - condemn |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5824 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5825 NSTRACE (condemn); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5826 condemned =YES; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5827 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5828 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5829 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5830 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5831 - reprieve |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5832 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5833 NSTRACE (reprieve); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5834 condemned =NO; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5835 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5836 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5837 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5838 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5839 - judge |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5840 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5841 NSTRACE (judge); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5842 if (condemned) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5843 { |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
5844 EmacsView *view; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5845 BLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5846 /* ensure other scrollbar updates after deletion */ |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
5847 view = (EmacsView *)FRAME_NS_VIEW (frame); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5848 if (view != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5849 view->scrollbarsNeedingUpdate++; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5850 [self removeFromSuperview]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5851 [self release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5852 UNBLOCK_INPUT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5853 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5854 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5855 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5856 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5857 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5858 - (void)resetCursorRects |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5859 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5860 NSRect visible = [self visibleRect]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5861 NSTRACE (resetCursorRects); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5862 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5863 if (!NSIsEmptyRect (visible)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5864 [self addCursorRect: visible cursor: [NSCursor arrowCursor]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5865 [[NSCursor arrowCursor] setOnMouseEntered: YES]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5866 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5867 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5868 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5869 - (int) checkSamePosition: (int) position portion: (int) portion |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5870 whole: (int) whole |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5871 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5872 return em_position ==position && em_portion ==portion && em_whole ==whole |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5873 && portion != whole; /* needed for resize empty buf */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5874 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5875 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5876 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5877 - setPosition: (int)position portion: (int)portion whole: (int)whole |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5878 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5879 NSTRACE (setPosition); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5880 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5881 em_position = position; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5882 em_portion = portion; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5883 em_whole = whole; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5884 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5885 if (portion >= whole) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5886 [self setFloatValue: 0.0 knobProportion: 1.0]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5887 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5888 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5889 float pos, por; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5890 portion = max ((float)whole*min_portion/pixel_height, portion); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5891 pos = (float)position / (whole - portion); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5892 por = (float)portion/whole; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5893 [self setFloatValue: pos knobProportion: por]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5894 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5895 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5896 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5897 |
96892
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
5898 /* FIXME: unused at moment (see ns_mouse_position) at the moment because |
4aec559b9f05
NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96891
diff
changeset
|
5899 drag events will go directly to the EmacsScroller. Leaving in for now. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5900 -(void)getMouseMotionPart: (int *)part window: (Lisp_Object *)window |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5901 x: (Lisp_Object *)x y: ( Lisp_Object *)y |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5902 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5903 *part = last_hit_part; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5904 *window = win; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5905 XSETINT (*y, pixel_height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5906 if ([self floatValue] > 0.999) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5907 XSETINT (*x, pixel_height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5908 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5909 XSETINT (*x, pixel_height * [self floatValue]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5910 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5911 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5912 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5913 /* set up emacs_event */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5914 - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5915 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5916 if (!emacs_event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5917 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5918 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5919 emacs_event->part = last_hit_part; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5920 emacs_event->code = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5921 emacs_event->modifiers = EV_MODIFIERS (e) | down_modifier; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5922 emacs_event->frame_or_window = win; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5923 emacs_event->timestamp = EV_TIMESTAMP (e); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5924 emacs_event->kind = SCROLL_BAR_CLICK_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5925 emacs_event->arg = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5926 XSETINT (emacs_event->x, loc * pixel_height); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5927 XSETINT (emacs_event->y, pixel_height-20); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5928 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5929 n_emacs_events_pending++; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5930 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5931 EVENT_INIT (*emacs_event); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5932 ns_send_appdefined (-1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5933 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5934 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5935 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5936 /* called manually thru timer to implement repeated button action w/hold-down */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5937 - repeatScroll: (NSTimer *)scrollEntry |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5938 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5939 NSEvent *e = [[self window] currentEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5940 NSPoint p = [[self window] mouseLocationOutsideOfEventStream]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5941 BOOL inKnob = [self testPart: p] == NSScrollerKnob; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5942 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5943 /* clear timer if need be */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5944 if (inKnob || [scroll_repeat_entry timeInterval] == SCROLL_BAR_FIRST_DELAY) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5945 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5946 [scroll_repeat_entry invalidate]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5947 [scroll_repeat_entry release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5948 scroll_repeat_entry = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5949 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5950 if (inKnob) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5951 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5952 |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
5953 scroll_repeat_entry |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
5954 = [[NSTimer scheduledTimerWithTimeInterval: |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
5955 SCROLL_BAR_CONTINUOUS_DELAY |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5956 target: self |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5957 selector: @selector (repeatScroll:) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5958 userInfo: 0 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5959 repeats: YES] |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
5960 retain]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5961 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5962 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5963 [self sendScrollEventAtLoc: 0 fromEvent: e]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5964 return self; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5965 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5966 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5967 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5968 /* Asynchronous mouse tracking for scroller. This allows us to dispatch |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5969 mouseDragged events without going into a modal loop. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5970 - (void)mouseDown: (NSEvent *)e |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5971 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5972 NSRect sr, kr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5973 /* hitPart is only updated AFTER event is passed on */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5974 NSScrollerPart part = [self testPart: [e locationInWindow]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5975 double inc = 0.0, loc, kloc, pos; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5976 int edge = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5977 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5978 NSTRACE (EmacsScroller_mouseDown); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5979 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5980 switch (part) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5981 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5982 case NSScrollerDecrementPage: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5983 last_hit_part = scroll_bar_above_handle; inc = -1.0; break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5984 case NSScrollerIncrementPage: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5985 last_hit_part = scroll_bar_below_handle; inc = 1.0; break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5986 case NSScrollerDecrementLine: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5987 last_hit_part = scroll_bar_up_arrow; inc = -0.1; break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5988 case NSScrollerIncrementLine: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5989 last_hit_part = scroll_bar_down_arrow; inc = 0.1; break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5990 case NSScrollerKnob: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5991 last_hit_part = scroll_bar_handle; break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5992 case NSScrollerKnobSlot: /* GNUstep-only */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5993 last_hit_part = scroll_bar_move_ratio; break; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5994 default: /* NSScrollerNoPart? */ |
105562
5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105225
diff
changeset
|
5995 fprintf (stderr, "EmacsScoller-mouseDown: unexpected part %ld\n", |
105579
f846b59ab251
Add space after casts in last change.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105562
diff
changeset
|
5996 (long) part); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5997 return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5998 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5999 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6000 if (inc != 0.0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6001 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6002 pos = 0; /* ignored */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6003 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6004 /* set a timer to repeat, as we can't let superclass do this modally */ |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
6005 scroll_repeat_entry |
105153
fd551d987ca7
* nsterm.m (EmacsScroller-mouseDown:): Use SCROLL_BAR_FIRST_DELAY.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105147
diff
changeset
|
6006 = [[NSTimer scheduledTimerWithTimeInterval: SCROLL_BAR_FIRST_DELAY |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
6007 target: self |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
6008 selector: @selector (repeatScroll:) |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
6009 userInfo: 0 |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
6010 repeats: YES] |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96749
diff
changeset
|
6011 retain]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6012 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6013 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6014 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6015 /* handle, or on GNUstep possibly slot */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6016 NSEvent *fake_event; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6017 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6018 /* compute float loc in slot and mouse offset on knob */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6019 sr = [self convertRect: [self rectForPart: NSScrollerKnobSlot] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6020 toView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6021 loc = NSHeight (sr) - ([e locationInWindow].y - NSMinY (sr)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6022 if (loc <= 0.0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6023 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6024 loc = 0.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6025 edge = -1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6026 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6027 else if (loc >= NSHeight (sr)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6028 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6029 loc = NSHeight (sr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6030 edge = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6031 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6032 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6033 if (edge) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6034 kloc = 0.5 * edge; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6035 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6036 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6037 kr = [self convertRect: [self rectForPart: NSScrollerKnob] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6038 toView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6039 kloc = NSHeight (kr) - ([e locationInWindow].y - NSMinY (kr)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6040 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6041 last_mouse_offset = kloc; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6042 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6043 /* if knob, tell emacs a location offset by knob pos |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6044 (to indicate top of handle) */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6045 if (part == NSScrollerKnob) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6046 pos = (loc - last_mouse_offset) / NSHeight (sr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6047 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6048 /* else this is a slot click on GNUstep: go straight there */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6049 pos = loc / NSHeight (sr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6050 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6051 /* send a fake mouse-up to super to preempt modal -trackKnob: mode */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6052 fake_event = [NSEvent mouseEventWithType: NSLeftMouseUp |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6053 location: [e locationInWindow] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6054 modifierFlags: [e modifierFlags] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6055 timestamp: [e timestamp] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6056 windowNumber: [e windowNumber] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6057 context: [e context] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6058 eventNumber: [e eventNumber] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6059 clickCount: [e clickCount] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6060 pressure: [e pressure]]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6061 [super mouseUp: fake_event]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6062 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6063 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6064 if (part != NSScrollerKnob) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6065 [self sendScrollEventAtLoc: pos fromEvent: e]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6066 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6067 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6068 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6069 /* Called as we manually track scroller drags, rather than superclass. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6070 - (void)mouseDragged: (NSEvent *)e |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6071 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6072 NSRect sr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6073 double loc, pos; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6074 int edge = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6075 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6076 NSTRACE (EmacsScroller_mouseDragged); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6077 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6078 sr = [self convertRect: [self rectForPart: NSScrollerKnobSlot] |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6079 toView: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6080 loc = NSHeight (sr) - ([e locationInWindow].y - NSMinY (sr)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6081 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6082 if (loc <= 0.0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6083 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6084 loc = 0.0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6085 edge = -1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6086 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6087 else if (loc >= NSHeight (sr) + last_mouse_offset) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6088 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6089 loc = NSHeight (sr) + last_mouse_offset; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6090 edge = 1; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6091 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6092 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6093 pos = /*(edge ? loc :*/ (loc - last_mouse_offset) / NSHeight (sr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6094 [self sendScrollEventAtLoc: pos fromEvent: e]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6095 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6096 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6097 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6098 - (void)mouseUp: (NSEvent *)e |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6099 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6100 if (scroll_repeat_entry) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6101 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6102 [scroll_repeat_entry invalidate]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6103 [scroll_repeat_entry release]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6104 scroll_repeat_entry = nil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6105 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6106 last_hit_part = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6107 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6108 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6109 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6110 /* treat scrollwheel events in the bar as though they were in the main window */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6111 - (void) scrollWheel: (NSEvent *)theEvent |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6112 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6113 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (frame); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6114 [view mouseDown: theEvent]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6115 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6116 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6117 @end /* EmacsScroller */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6118 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6119 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6120 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6121 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6122 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6123 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6124 Font-related functions; these used to be in nsfaces.m |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6125 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6126 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6127 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6128 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6129 Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6130 x_new_font (struct frame *f, Lisp_Object font_object, int fontset) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6131 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6132 struct font *font = XFONT_OBJECT (font_object); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6133 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6134 if (fontset < 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6135 fontset = fontset_from_font (font_object); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6136 FRAME_FONTSET (f) = fontset; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6137 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6138 if (FRAME_FONT (f) == font) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6139 /* This font is already set in frame F. There's nothing more to |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6140 do. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6141 return font_object; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6142 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6143 FRAME_FONT (f) = font; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6144 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6145 FRAME_BASELINE_OFFSET (f) = font->baseline_offset; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6146 FRAME_COLUMN_WIDTH (f) = font->average_width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6147 FRAME_SPACE_WIDTH (f) = font->space_width; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6148 FRAME_LINE_HEIGHT (f) = font->height; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6149 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6150 compute_fringe_widths (f, 1); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6151 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6152 /* Compute the scroll bar width in character columns. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6153 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6154 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6155 int wid = FRAME_COLUMN_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6156 FRAME_CONFIG_SCROLL_BAR_COLS (f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6157 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid - 1) / wid; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6158 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6159 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6160 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6161 int wid = FRAME_COLUMN_WIDTH (f); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6162 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6163 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6164 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6165 /* Now make the frame display the given font. */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6166 if (FRAME_NS_WINDOW (f) != 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6167 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6168 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6169 return font_object; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6170 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6171 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6172 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6173 /* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */ |
101324
ac37eb10f508
* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window. (ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101321
diff
changeset
|
6174 /* Note: ns_font_to_xlfd and ns_fontname_to_xlfd no longer needed, removed |
ac37eb10f508
* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window. (ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101321
diff
changeset
|
6175 in 1.43. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6176 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6177 const char * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6178 ns_xlfd_to_fontname (const char *xlfd) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6179 /* -------------------------------------------------------------------------- |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6180 Convert an X font name (XLFD) to an NS font name. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6181 Only family is used. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6182 The string returned is temporarily allocated. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6183 -------------------------------------------------------------------------- */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6184 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6185 char *name = xmalloc (180); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6186 int i, len; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6187 const char *ret; |
100666
dab9cf44bf3f
In comments, write delete_frame instead of Fdelete_frame.
Martin Rudalics <rudalics@gmx.at>
parents:
100001
diff
changeset
|
6188 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6189 if (!strncmp (xlfd, "--", 2)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6190 sscanf (xlfd, "--%*[^-]-%[^-]179-", name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6191 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6192 sscanf (xlfd, "-%*[^-]-%[^-]179-", name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6193 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6194 /* stopgap for malformed XLFD input */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6195 if (strlen (name) == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6196 strcpy (name, "Monaco"); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6197 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6198 /* undo hack in ns_fontname_to_xlfd, converting '$' to '-', '_' to ' ' |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6199 also uppercase after '-' or ' ' */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6200 name[0] = toupper (name[0]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6201 for (len =strlen (name), i =0; i<len; i++) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6202 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6203 if (name[i] == '$') |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6204 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6205 name[i] = '-'; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6206 if (i+1<len) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6207 name[i+1] = toupper (name[i+1]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6208 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6209 else if (name[i] == '_') |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6210 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6211 name[i] = ' '; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6212 if (i+1<len) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6213 name[i+1] = toupper (name[i+1]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6214 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6215 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6216 /*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6217 ret = [[NSString stringWithUTF8String: name] UTF8String]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6218 xfree (name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6219 return ret; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6220 } |
96685 | 6221 |
97198
cf43f4e3ecc8
clear warnings and clean up NS port
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97194
diff
changeset
|
6222 |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6223 void |
109653
9cfca8c9fb07
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109302
diff
changeset
|
6224 syms_of_nsterm (void) |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6225 { |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6226 NSTRACE (syms_of_nsterm); |
106776 | 6227 |
6228 ns_antialias_threshold = 10.0; | |
6229 | |
106791
4d61ac1aa561
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
Chong Yidong <cyd@stupidchicken.com>
parents:
106776
diff
changeset
|
6230 /* from 23+ we need to tell emacs what modifiers there are.. */ |
106792
f1f76bd00c9f
* nsterm.m: Use DEFSYM for last change.
Chong Yidong <cyd@stupidchicken.com>
parents:
106791
diff
changeset
|
6231 DEFSYM (Qmodifier_value, "modifier-value"); |
f1f76bd00c9f
* nsterm.m: Use DEFSYM for last change.
Chong Yidong <cyd@stupidchicken.com>
parents:
106791
diff
changeset
|
6232 DEFSYM (Qalt, "alt"); |
f1f76bd00c9f
* nsterm.m: Use DEFSYM for last change.
Chong Yidong <cyd@stupidchicken.com>
parents:
106791
diff
changeset
|
6233 DEFSYM (Qhyper, "hyper"); |
f1f76bd00c9f
* nsterm.m: Use DEFSYM for last change.
Chong Yidong <cyd@stupidchicken.com>
parents:
106791
diff
changeset
|
6234 DEFSYM (Qmeta, "meta"); |
f1f76bd00c9f
* nsterm.m: Use DEFSYM for last change.
Chong Yidong <cyd@stupidchicken.com>
parents:
106791
diff
changeset
|
6235 DEFSYM (Qsuper, "super"); |
f1f76bd00c9f
* nsterm.m: Use DEFSYM for last change.
Chong Yidong <cyd@stupidchicken.com>
parents:
106791
diff
changeset
|
6236 DEFSYM (Qcontrol, "control"); |
106843
36dd02b00382
Fix Qnone definition in NS files.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
6237 DEFSYM (Qnone, "none"); |
106791
4d61ac1aa561
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
Chong Yidong <cyd@stupidchicken.com>
parents:
106776
diff
changeset
|
6238 Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); |
4d61ac1aa561
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
Chong Yidong <cyd@stupidchicken.com>
parents:
106776
diff
changeset
|
6239 Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); |
4d61ac1aa561
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
Chong Yidong <cyd@stupidchicken.com>
parents:
106776
diff
changeset
|
6240 Fput (Qmeta, Qmodifier_value, make_number (meta_modifier)); |
4d61ac1aa561
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
Chong Yidong <cyd@stupidchicken.com>
parents:
106776
diff
changeset
|
6241 Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); |
4d61ac1aa561
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
Chong Yidong <cyd@stupidchicken.com>
parents:
106776
diff
changeset
|
6242 Fput (Qcontrol, Qmodifier_value, make_number (ctrl_modifier)); |
4d61ac1aa561
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
Chong Yidong <cyd@stupidchicken.com>
parents:
106776
diff
changeset
|
6243 |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6244 DEFVAR_LISP ("ns-input-file", &ns_input_file, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6245 "The file specified in the last NS event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6246 ns_input_file =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6247 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6248 DEFVAR_LISP ("ns-input-text", &ns_input_text, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6249 "The data received in the last NS text drag event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6250 ns_input_text =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6251 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6252 DEFVAR_LISP ("ns-working-text", &ns_working_text, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6253 "String for visualizing working composition sequence."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6254 ns_working_text =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6255 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6256 DEFVAR_LISP ("ns-input-font", &ns_input_font, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6257 "The font specified in the last NS event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6258 ns_input_font =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6259 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6260 DEFVAR_LISP ("ns-input-fontsize", &ns_input_fontsize, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6261 "The fontsize specified in the last NS event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6262 ns_input_fontsize =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6263 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6264 DEFVAR_LISP ("ns-input-line", &ns_input_line, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6265 "The line specified in the last NS event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6266 ns_input_line =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6267 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6268 DEFVAR_LISP ("ns-input-color", &ns_input_color, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6269 "The color specified in the last NS event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6270 ns_input_color =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6271 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6272 DEFVAR_LISP ("ns-input-spi-name", &ns_input_spi_name, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6273 "The service name specified in the last NS event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6274 ns_input_spi_name =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6275 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6276 DEFVAR_LISP ("ns-input-spi-arg", &ns_input_spi_arg, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6277 "The service argument specified in the last NS event."); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6278 ns_input_spi_arg =Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6279 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6280 DEFVAR_LISP ("ns-alternate-modifier", &ns_alternate_modifier, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6281 "This variable describes the behavior of the alternate or option key.\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6282 Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6283 Set to none means that the alternate / option key is not interpreted by Emacs\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6284 at all, allowing it to be used at a lower level for accented character entry."); |
106776 | 6285 ns_alternate_modifier = Qmeta; |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6286 |
110930
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6287 DEFVAR_LISP ("ns-right-alternate-modifier", &ns_right_alternate_modifier, |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6288 "This variable describes the behavior of the right alternate or option key.\n\ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6289 Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6290 Set to left means be the same key as `ns-alternate-modifier'.\n\ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6291 Set to none means that the alternate / option key is not interpreted by Emacs\n\ |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6292 at all, allowing it to be used at a lower level for accented character entry."); |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6293 ns_right_alternate_modifier = Qleft; |
b6cf32bb07a1
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents:
109296
diff
changeset
|
6294 |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6295 DEFVAR_LISP ("ns-command-modifier", &ns_command_modifier, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6296 "This variable describes the behavior of the command key.\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6297 Set to control, meta, alt, super, or hyper means it is taken to be that key."); |
106776 | 6298 ns_command_modifier = Qsuper; |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6299 |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6300 DEFVAR_LISP ("ns-right-command-modifier", &ns_right_command_modifier, |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6301 "This variable describes the behavior of the right command key.\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6302 Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6303 Set to left means be the same key as `ns-command-modifier'.\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6304 Set to none means that the command / option key is not interpreted by Emacs\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6305 at all, allowing it to be used at a lower level for accented character entry."); |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6306 ns_right_command_modifier = Qleft; |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6307 |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6308 DEFVAR_LISP ("ns-control-modifier", &ns_control_modifier, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6309 "This variable describes the behavior of the control key.\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6310 Set to control, meta, alt, super, or hyper means it is taken to be that key."); |
106776 | 6311 ns_control_modifier = Qcontrol; |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6312 |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6313 DEFVAR_LISP ("ns-right-control-modifier", &ns_right_control_modifier, |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6314 "This variable describes the behavior of the right control key.\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6315 Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6316 Set to left means be the same key as `ns-control-modifier'.\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6317 Set to none means that the control / option key is not interpreted by Emacs\n\ |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6318 at all, allowing it to be used at a lower level for accented character entry."); |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6319 ns_right_control_modifier = Qleft; |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111413
diff
changeset
|
6320 |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6321 DEFVAR_LISP ("ns-function-modifier", &ns_function_modifier, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6322 "This variable describes the behavior of the function key (on laptops).\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6323 Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6324 Set to none means that the function key is not interpreted by Emacs at all,\n\ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6325 allowing it to be used at a lower level for accented character entry."); |
106776 | 6326 ns_function_modifier = Qnone; |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6327 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6328 DEFVAR_LISP ("ns-antialias-text", &ns_antialias_text, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6329 "Non-nil (the default) means to render text antialiased. Only has an effect on OS X Panther and above."); |
106776 | 6330 ns_antialias_text = Qt; |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6331 |
101637
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
6332 DEFVAR_LISP ("ns-confirm-quit", &ns_confirm_quit, |
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
6333 "Whether to confirm application quit using dialog."); |
106776 | 6334 ns_confirm_quit = Qnil; |
101637
c32306216562
* nsterm.m (ns_confirm_quit): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101490
diff
changeset
|
6335 |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6336 staticpro (&ns_display_name_list); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6337 ns_display_name_list = Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6338 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6339 staticpro (&last_mouse_motion_frame); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6340 last_mouse_motion_frame = Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6341 |
97194
d45e07b45d86
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
6342 /* TODO: move to common code */ |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6343 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6344 doc: /* If not nil, Emacs uses toolkit scroll bars. */); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6345 #ifdef USE_TOOLKIT_SCROLL_BARS |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6346 Vx_toolkit_scroll_bars = Qt; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6347 #else |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6348 Vx_toolkit_scroll_bars = Qnil; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6349 #endif |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6350 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6351 /* these are unsupported but we need the declarations to avoid whining |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6352 messages from cus-start.el */ |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6353 DEFVAR_BOOL ("x-use-underline-position-properties", |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6354 &x_use_underline_position_properties, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6355 doc: /* NOT SUPPORTED UNDER NS. |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6356 *Non-nil means make use of UNDERLINE_POSITION font properties. |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6357 A value of nil means ignore them. If you encounter fonts with bogus |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6358 UNDERLINE_POSITION font properties, for example 7x13 on XFree prior |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6359 to 4.1, set this to nil. |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6360 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6361 NOTE: Not supported on Mac yet. */); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6362 x_use_underline_position_properties = 0; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6363 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6364 DEFVAR_BOOL ("x-underline-at-descent-line", |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6365 &x_underline_at_descent_line, |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6366 doc: /* NOT SUPPORTED UNDER NS. |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6367 *Non-nil means to draw the underline at the same place as the descent line. |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6368 A value of nil means to draw the underline according to the value of the |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6369 variable `x-use-underline-position-properties', which is usually at the |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6370 baseline level. The default value is nil. */); |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6371 x_underline_at_descent_line = 0; |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6372 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6373 /* Tell emacs about this window system. */ |
96922
35abcad873d6
(syms_of_nsterm): Provide ns, not ns-windowing,
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96912
diff
changeset
|
6374 Fprovide (intern ("ns"), Qnil); |
96896
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6375 } |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6376 |
3d5ec36564b0
(syms_of_nsterm): Move to the end of file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96892
diff
changeset
|
6377 |
96689
f34c4d928d39
Use nicer comment syntax for arch taglines in Objective-C files
Miles Bader <miles@gnu.org>
parents:
96685
diff
changeset
|
6378 // arch-tag: 6eaa8f7d-a69b-4e1c-b43d-ab31defbe0d2 |