aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnders Lindgren2015-11-15 20:19:34 +0100
committerAnders Lindgren2015-11-15 20:19:34 +0100
commitae16894d1e19601e19b1e70461dc0f69ae1f1059 (patch)
treeb03e162dece6682428a53e047eadf5f96d6a3ff3 /src
parent6d109c051c482bbd5b01f8ed19ed78069efaee42 (diff)
downloademacs-ae16894d1e19601e19b1e70461dc0f69ae1f1059.tar.gz
emacs-ae16894d1e19601e19b1e70461dc0f69ae1f1059.zip
Enhance NSTRACE (trace output for NextStep).
Trace can be disabled for groups of functions. By default, event functions and functions that generate lots of output are disabled. Trace output of Objective-C functions now use the "[ClassName parameter:]" form. * src/nsterm.h (NSTRACE_ALL_GROUPS, NSTRACE_GROUP_EVENTS) (NSTRACE_GROUP_UPDATES, NSTRACE_GROUP_FRINGE, NSTRACE_GROUP_COLOR) (NSTRACE_GROUP_GLYPHS, NSTRACE_GROUP_FOCUS): New macros, controlling in which function groups trace should be active. (NSTRACE_WHEN): Support for silencing a function, this also silencing all called functions. (NSTRACE_UNSILENCE): New macro, used to re-enable trace. (NSTRACE_FMT_FSTYPE, NSTRACE_ARG_FSTYPE): New macros, used to print the full screen state in NSTRACE functions. * src/nsterm.m (nstrace_depth, nstrace_num): Made volatile as they can be accessed from multiple threads. (nstrace_enabled_global): New variable, when FALSE, trace is silenced. (nstrace_restore_global_trace_state): New function, used to restore `nstrace_enabled_global' at end of block. ([EmacsView setFrame:], [EmacsWindow setFrame:display:]) ([EmacsWindow setFrame:display:animation:]) ([EmacsWindow setFrameTopLeftPoint:]): New functions, print trace and call corresponding super function. (Many functions): Add or enhance trace output. * src/nsimage.m (ns_image_from_file): Enhanced trace output. * src/nsfns.m (x_set_tool_bar_lines): Add trace output. * src/nsmenu.m ([EmacsToolbar setVisible:]): New function, print trace and call corresponding super function.
Diffstat (limited to 'src')
-rw-r--r--src/nsfns.m4
-rw-r--r--src/nsimage.m2
-rw-r--r--src/nsmenu.m8
-rw-r--r--src/nsterm.h169
-rw-r--r--src/nsterm.m376
5 files changed, 361 insertions, 198 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 94294de1bac..434fd6aa944 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -655,6 +655,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
655 `frame-inhibit-implied-resize'. */ 655 `frame-inhibit-implied-resize'. */
656 int nlines; 656 int nlines;
657 657
658 NSTRACE ("x_set_tool_bar_lines");
659
658 if (FRAME_MINIBUF_ONLY_P (f)) 660 if (FRAME_MINIBUF_ONLY_P (f))
659 return; 661 return;
660 662
@@ -703,6 +705,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
703 ? 0 705 ? 0
704 : 2); 706 : 2);
705 707
708 NSTRACE_MSG ("inhibit:%d", inhibit);
709
706 frame_size_history_add (f, Qupdate_frame_tool_bar, 0, 0, Qnil); 710 frame_size_history_add (f, Qupdate_frame_tool_bar, 0, 0, Qnil);
707 adjust_frame_size (f, -1, -1, inhibit, 0, Qtool_bar_lines); 711 adjust_frame_size (f, -1, -1, inhibit, 0, Qtool_bar_lines);
708 } 712 }
diff --git a/src/nsimage.m b/src/nsimage.m
index bdaf6a46b83..fad2538a0cb 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -66,7 +66,7 @@ ns_image_for_XPM (int width, int height, int depth)
66void * 66void *
67ns_image_from_file (Lisp_Object file) 67ns_image_from_file (Lisp_Object file)
68{ 68{
69 NSTRACE ("ns_image_from_bitmap_file"); 69 NSTRACE ("ns_image_from_file");
70 return [EmacsImage allocInitFromFile: file]; 70 return [EmacsImage allocInitFromFile: file];
71} 71}
72 72
diff --git a/src/nsmenu.m b/src/nsmenu.m
index ddc5dc20a82..3cb61e50f7f 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1293,6 +1293,14 @@ update_frame_tool_bar (struct frame *f)
1293 //return [identifierToItem allKeys]; 1293 //return [identifierToItem allKeys];
1294} 1294}
1295 1295
1296- (void)setVisible:(BOOL)shown
1297{
1298 NSTRACE ("[EmacsToolbar setVisible:%d]", shown);
1299
1300 [super setVisible:shown];
1301}
1302
1303
1296/* optional and unneeded */ 1304/* optional and unneeded */
1297/* - toolbarWillAddItem: (NSNotification *)notification { } */ 1305/* - toolbarWillAddItem: (NSNotification *)notification { } */
1298/* - toolbarDidRemoveItem: (NSNotification *)notification { } */ 1306/* - toolbarDidRemoveItem: (NSNotification *)notification { } */
diff --git a/src/nsterm.h b/src/nsterm.h
index 7828af73f68..7a618141c9c 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -67,12 +67,27 @@ typedef float EmacsCGFloat;
67 67
68/* Uncomment the following line to enable trace. 68/* Uncomment the following line to enable trace.
69 69
70 Uncomment suitable NSTRACE_GROUP_xxx lines to trace more.
71
70 Hint: keep the trailing whitespace -- the version control system 72 Hint: keep the trailing whitespace -- the version control system
71 will reject accidental commits. */ 73 will reject accidental commits. */
72 74
73/* #define NSTRACE_ENABLED 1 */ 75/* #define NSTRACE_ENABLED 1 */
74 76
75 77
78/* When non-zero, trace output is enbled for all parts, except those
79 explicitly disabled. */
80/* #define NSTRACE_ALL_GROUPS 1 */
81
82/* When non-zero, trace output is enabled in the corresponding part. */
83/* #define NSTRACE_GROUP_EVENTS 1 */
84/* #define NSTRACE_GROUP_UPDATES 1 */
85/* #define NSTRACE_GROUP_FRINGE 1 */
86/* #define NSTRACE_GROUP_COLOR 1 */
87/* #define NSTRACE_GROUP_GLYPHS 1 */
88/* #define NSTRACE_GROUP_FOCUS 1 */
89
90
76/* Print a call tree containing all annotated functions. 91/* Print a call tree containing all annotated functions.
77 92
78 The call structure of the functions is represented using 93 The call structure of the functions is represented using
@@ -87,60 +102,94 @@ typedef float EmacsCGFloat;
87 The first column contains the file name, the second the line 102 The first column contains the file name, the second the line
88 number, and the third a number increasing for each trace line. 103 number, and the third a number increasing for each trace line.
89 104
105 Note, when trace output from several threads are mixed, the output
106 can become misaligned, as all threads (currently) share one state.
107 This is post prominent when the EVENTS part is enabled.
108
90 Note that the trace system, when enabled, use the GCC/Clang 109 Note that the trace system, when enabled, use the GCC/Clang
91 "cleanup" extension. 110 "cleanup" extension. */
92 111
93 For example (long lines manually split to reduce width): 112/* For example, the following is the output of `M-x
94 113 toggle-frame-maximized RET'.
95nsterm.m : 1600: [ 4428] ns_fullscreen_hook 114
96nsterm.m : 7006: [ 4429] | handleFS 115 (Long lines manually split to reduced width):
97nsterm.m : 7035: [ 4430] | +--- FULLSCREEN_MAXIMIZED 116
98nsterm.m : 7627: [ 4431] | | performZoom 117nsterm.m : 1608: [ 354] ns_fullscreen_hook
99nsterm.m : 7636: [ 4432] | | | zoom 118nsterm.m : 7180: [ 355] | [EmacsView handleFS]
100nsterm.m : 874: [ 4433] | | | | ns_update_auto_hide_menu_bar 119nsterm.m : 7209: [ 356] | +--- FULLSCREEN_MAXIMIZED
101nsterm.m : 6615: [ 4434] | | | | [windowWillUseStandardFrame: 120nsterm.m : 7706: [ 357] | | [EmacsWindow performZoom:]
102 defaultFrame:(X:0 Y:0)/(W:1600 H:1177)] 121nsterm.m : 7715: [ 358] | | | [EmacsWindow zoom:]
103nsterm.m : 99: [ 4435] | | | | +--- fs_state: FULLSCREEN_NONE 122nsterm.m : 882: [ 359] | | | | ns_update_auto_hide_menu_bar
104nsterm.m : 119: [ 4436] | | | | +--- fs_before_fs: -1 123nsterm.m : 6752: [ 360] | | | |
105nsterm.m : 115: [ 4437] | | | | +--- next_maximized: FULLSCREEN_MAXIMIZED 124 [EmacsView windowWillUseStandardFrame:defaultFrame:(X:0 Y:0)/(W:1600 H:1177)]
106nsterm.m : 6619: [ 4438] | | | | +--- ns_userRect: (X:0 Y:0)/(W:0 H:0) 125nsterm.m : 6753: [ 361] | | | | +--- fs_state: FULLSCREEN_NONE
107nsterm.m : 6620: [ 4439] | | | | +--- [sender frame]: 126nsterm.m : 6754: [ 362] | | | | +--- fs_before_fs: -1
108 (X:0 Y:626)/(W:595 H:551) 127nsterm.m : 6755: [ 363] | | | | +--- next_maximized: FULLSCREEN_MAXIMIZED
109nsterm.m : 6644: [ 4440] | | | | +--- ns_userRect (2): 128nsterm.m : 6756: [ 364] | | | | +--- ns_userRect: (X:0 Y:0)/(W:0 H:0)
110 (X:0 Y:626)/(W:595 H:551) 129nsterm.m : 6757: [ 365] | | | | +---
111nsterm.m : 6684: [ 4441] | | | | +--- FULLSCREEN_MAXIMIZED 130 [sender frame]: (X:0 Y:626)/(W:595 H:551)
112nsterm.m : 7057: [ 4442] | | | | | setFSValue 131nsterm.m : 6781: [ 366] | | | | +---
113nsterm.m : 115: [ 4443] | | | | | +--- value: FULLSCREEN_MAXIMIZED 132 ns_userRect (2): (X:0 Y:626)/(W:595 H:551)
114nsterm.m : 6711: [ 4444] | | | | +--- Final ns_userRect: 133nsterm.m : 6821: [ 367] | | | | +--- FULLSCREEN_MAXIMIZED
115 (X:0 Y:626)/(W:595 H:551) 134nsterm.m : 7232: [ 368] | | | | |
116nsterm.m : 6712: [ 4445] | | | | +--- Final maximized_width: 1600 135 [EmacsView setFSValue:FULLSCREEN_MAXIMIZED]
117nsterm.m : 6713: [ 4446] | | | | +--- Final maximized_height: 1177 136nsterm.m : 6848: [ 369] | | | | +---
118nsterm.m : 119: [ 4447] | | | | +--- Final next_maximized: -1 137 Final ns_userRect: (X:0 Y:626)/(W:595 H:551)
119nsterm.m : 6209: [ 4448] | | | | | windowWillResize: toSize: (W:1600 H:1177) 138nsterm.m : 6849: [ 370] | | | | +--- Final maximized_width: 1600
120nsterm.m : 6210: [ 4449] | | | | | +--- [sender frame]: 139nsterm.m : 6850: [ 371] | | | | +--- Final maximized_height: 1177
121 (X:0 Y:626)/(W:595 H:551) 140nsterm.m : 6851: [ 372] | | | | +--- Final next_maximized: -1
122nsterm.m : 115: [ 4450] | | | | | +--- fs_state: FULLSCREEN_MAXIMIZED 141nsterm.m : 6322: [ 373] | | | | |
123nsterm.m : 6274: [ 4451] | | | | | +--- cols: 223 rows: 79 142 [EmacsView windowWillResize:toSize: (W:1600 H:1177)]
124nsterm.m : 6299: [ 4452] | | | | | +->> (W:1596 H:1167) 143nsterm.m : 6323: [ 374] | | | | | +---
125nsterm.m : 6718: [ 4453] | | | | +->> (X:0 Y:0)/(W:1600 H:1177) 144 [sender frame]: (X:0 Y:626)/(W:595 H:551)
126 145nsterm.m : 6324: [ 375] | | | | | +--- fs_state: FULLSCREEN_MAXIMIZED
127 Here, "ns_fullscreen_hook" calls "handleFS", which is turn calls 146nsterm.m : 7027: [ 376] | | | | | | [EmacsView isFullscreen]
128 "performZoom". This function calls "[super performZoom]", which 147nsterm.m : 6387: [ 377] | | | | | +--- cols: 223 rows: 79
129 isn't annotated (so it doesn't show up in the trace). However, it 148nsterm.m : 6412: [ 378] | | | | | +->> (W:1596 H:1167)
130 calls "zoom" which is annotated so it is part of the call trace. 149nsterm.m : 6855: [ 379] | | | | +->> (X:0 Y:0)/(W:1600 H:1177)
131 Later, the method "windowWillUseStandardFrame" and the function 150*/
132 "setFSValue" are called. The lines with "+---" contain extra
133 information and lines containing "->>" represent return values. */
134 151
135#ifndef NSTRACE_ENABLED 152#ifndef NSTRACE_ENABLED
136#define NSTRACE_ENABLED 0 153#define NSTRACE_ENABLED 0
137#endif 154#endif
138 155
139#if NSTRACE_ENABLED 156#if NSTRACE_ENABLED
140extern int nstrace_num; 157
141extern int nstrace_depth; 158#ifndef NSTRACE_ALL_GROUPS
159#define NSTRACE_ALL_GROUPS 0
160#endif
161
162#ifndef NSTRACE_GROUP_EVENTS
163#define NSTRACE_GROUP_EVENTS NSTRACE_ALL_GROUPS
164#endif
165
166#ifndef NSTRACE_GROUP_UPDATES
167#define NSTRACE_GROUP_UPDATES NSTRACE_ALL_GROUPS
168#endif
169
170#ifndef NSTRACE_GROUP_FRINGE
171#define NSTRACE_GROUP_FRINGE NSTRACE_ALL_GROUPS
172#endif
173
174#ifndef NSTRACE_GROUP_COLOR
175#define NSTRACE_GROUP_COLOR NSTRACE_ALL_GROUPS
176#endif
177
178#ifndef NSTRACE_GROUP_GLYPHS
179#define NSTRACE_GROUP_GLYPHS NSTRACE_ALL_GROUPS
180#endif
181
182#ifndef NSTRACE_GROUP_FOCUS
183#define NSTRACE_GROUP_FOCUS NSTRACE_ALL_GROUPS
184#endif
185
186extern volatile int nstrace_num;
187extern volatile int nstrace_depth;
188extern volatile int nstrace_enabled_global;
142 189
143void nstrace_leave(int *); 190void nstrace_leave(int *);
191void nstrace_restore_global_trace_state(int *);
192char const * nstrace_fullscreen_type_name (int);
144 193
145/* printf-style trace output. Output is aligned with contained heading. */ 194/* printf-style trace output. Output is aligned with contained heading. */
146#define NSTRACE_MSG_NO_DASHES(...) \ 195#define NSTRACE_MSG_NO_DASHES(...) \
@@ -149,7 +198,7 @@ void nstrace_leave(int *);
149 if (nstrace_enabled) \ 198 if (nstrace_enabled) \
150 { \ 199 { \
151 fprintf (stderr, "%-10s:%5d: [%5d]%.*s", \ 200 fprintf (stderr, "%-10s:%5d: [%5d]%.*s", \
152 __FILE__, __LINE__, ++nstrace_num, \ 201 __FILE__, __LINE__, nstrace_num++, \
153 2*nstrace_depth, " | | | | | | | | | | | | | | | .."); \ 202 2*nstrace_depth, " | | | | | | | | | | | | | | | .."); \
154 fprintf (stderr, __VA_ARGS__); \ 203 fprintf (stderr, __VA_ARGS__); \
155 fprintf (stderr, "\n"); \ 204 fprintf (stderr, "\n"); \
@@ -176,6 +225,9 @@ void nstrace_leave(int *);
176#define NSTRACE_ARG_RECT(elt) \ 225#define NSTRACE_ARG_RECT(elt) \
177 NSTRACE_ARG_POINT((elt).origin), NSTRACE_ARG_SIZE((elt).size) 226 NSTRACE_ARG_POINT((elt).origin), NSTRACE_ARG_SIZE((elt).size)
178 227
228#define NSTRACE_FMT_FSTYPE "%s"
229#define NSTRACE_ARG_FSTYPE(elt) nstrace_fullscreen_type_name(elt)
230
179 231
180/* Macros for printing complex types as extra information. */ 232/* Macros for printing complex types as extra information. */
181 233
@@ -192,14 +244,8 @@ void nstrace_leave(int *);
192 NSTRACE_ARG_RECT (rect)); 244 NSTRACE_ARG_RECT (rect));
193 245
194#define NSTRACE_FSTYPE(str,fs_type) \ 246#define NSTRACE_FSTYPE(str,fs_type) \
195 do \ 247 NSTRACE_MSG (str ": " NSTRACE_FMT_FSTYPE, \
196 { \ 248 NSTRACE_ARG_FSTYPE (fs_type));
197 if (nstrace_enabled) \
198 { \
199 ns_print_fullscreen_type_name(str, fs_type); \
200 } \
201 } \
202 while(0)
203 249
204 250
205/* Return value macros. 251/* Return value macros.
@@ -242,17 +288,25 @@ void nstrace_leave(int *);
242 288
243 289
244#define NSTRACE_WHEN(cond, ...) \ 290#define NSTRACE_WHEN(cond, ...) \
291 __attribute__((cleanup(nstrace_restore_global_trace_state))) \
292 int nstrace_saved_enabled_global = nstrace_enabled_global; \
245 __attribute__((cleanup(nstrace_leave))) \ 293 __attribute__((cleanup(nstrace_leave))) \
246 int nstrace_enabled = (cond); \ 294 int nstrace_enabled = nstrace_enabled_global && (cond); \
247 if (nstrace_enabled) { ++nstrace_depth; } \ 295 if (nstrace_enabled) { ++nstrace_depth; } \
296 else { nstrace_enabled_global = 0; } \
248 NSTRACE_MSG_NO_DASHES(__VA_ARGS__); 297 NSTRACE_MSG_NO_DASHES(__VA_ARGS__);
249 298
299/* Unsilence called functions.
300
301 Concretely, this us used to allow "event" functions to be silenced
302 while trace output can be printed for functions they call. */
303#define NSTRACE_UNSILENCE() do { nstrace_enabled_global = 1; } while(0)
304
250#endif /* NSTRACE_ENABLED */ 305#endif /* NSTRACE_ENABLED */
251 306
252#define NSTRACE(...) NSTRACE_WHEN(1, __VA_ARGS__) 307#define NSTRACE(...) NSTRACE_WHEN(1, __VA_ARGS__)
253#define NSTRACE_UNLESS(cond, ...) NSTRACE_WHEN(!(cond), __VA_ARGS__) 308#define NSTRACE_UNLESS(cond, ...) NSTRACE_WHEN(!(cond), __VA_ARGS__)
254 309
255
256/* Non-trace replacement versions. */ 310/* Non-trace replacement versions. */
257#ifndef NSTRACE_WHEN 311#ifndef NSTRACE_WHEN
258#define NSTRACE_WHEN(...) 312#define NSTRACE_WHEN(...)
@@ -294,6 +348,9 @@ void nstrace_leave(int *);
294#define NSTRACE_RETURN_FSTYPE(fs_type) 348#define NSTRACE_RETURN_FSTYPE(fs_type)
295#endif 349#endif
296 350
351#ifndef NSTRACE_UNSILENCE
352#define NSTRACE_UNSILENCE()
353#endif
297 354
298 355
299/* ========================================================================== 356/* ==========================================================================
diff --git a/src/nsterm.m b/src/nsterm.m
index 397ade12f02..58ace4830b8 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -72,9 +72,26 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
72extern NSString *NSMenuDidBeginTrackingNotification; 72extern NSString *NSMenuDidBeginTrackingNotification;
73 73
74 74
75/* ==========================================================================
76
77 NSTRACE, Trace support.
78
79 ========================================================================== */
80
75#if NSTRACE_ENABLED 81#if NSTRACE_ENABLED
76int nstrace_num = 0; 82
77int nstrace_depth = 0; 83/* The following use "volatile" since they can be accessed from
84 parallel threads. */
85volatile int nstrace_num = 0;
86volatile int nstrace_depth = 0;
87
88/* When 0, no trace is emitted. This is used by NSTRACE_WHEN and
89 NSTRACE_UNLESS to silence functions called.
90
91 TODO: This should really be a thread-local variable, to avoid that
92 a function with disabled trace thread silence trace output in
93 another. However, in practice this seldom is a problem. */
94volatile int nstrace_enabled_global = 1;
78 95
79/* Called when nstrace_enabled goes out of scope. */ 96/* Called when nstrace_enabled goes out of scope. */
80void nstrace_leave(int * pointer_to_nstrace_enabled) 97void nstrace_leave(int * pointer_to_nstrace_enabled)
@@ -86,38 +103,24 @@ void nstrace_leave(int * pointer_to_nstrace_enabled)
86} 103}
87 104
88 105
89void ns_print_fullscreen_type_name (char const * s, int fs_type) 106/* Called when nstrace_saved_enabled_global goes out of scope. */
107void nstrace_restore_global_trace_state(int * pointer_to_saved_enabled_global)
90{ 108{
91 // This is a support function for the NSTRACE system, don't add a 109 nstrace_enabled_global = *pointer_to_saved_enabled_global;
92 // NSTRACE () here. However, a local `nstrace_enabled' variable is 110}
93 // needed by the NSTRACE_MSG macros.
94 int nstrace_enabled = 1;
95 111
112
113char const * nstrace_fullscreen_type_name (int fs_type)
114{
96 switch (fs_type) 115 switch (fs_type)
97 { 116 {
98 case FULLSCREEN_NONE: 117 case -1: return "-1";
99 NSTRACE_MSG ("%s: FULLSCREEN_NONE", s); 118 case FULLSCREEN_NONE: return "FULLSCREEN_NONE";
100 break; 119 case FULLSCREEN_WIDTH: return "FULLSCREEN_WIDTH";
101 120 case FULLSCREEN_HEIGHT: return "FULLSCREEN_HEIGHT";
102 case FULLSCREEN_WIDTH: 121 case FULLSCREEN_BOTH: return "FULLSCREEN_BOTH";
103 NSTRACE_MSG ("%s: FULLSCREEN_WIDTH", s); 122 case FULLSCREEN_MAXIMIZED: return "FULLSCREEN_MAXIMIZED";
104 break; 123 default: return "FULLSCREEN_?????";
105
106 case FULLSCREEN_HEIGHT:
107 NSTRACE_MSG ("%s: FULLSCREEN_HEIGHT", s);
108 break;
109
110 case FULLSCREEN_BOTH:
111 NSTRACE_MSG ("%s: FULLSCREEN_BOTH", s);
112 break;
113
114 case FULLSCREEN_MAXIMIZED:
115 NSTRACE_MSG ("%s: FULLSCREEN_MAXIMIZED", s);
116 break;
117
118 default:
119 NSTRACE_MSG ("%s: %d", s, fs_type);
120 break;
121 } 124 }
122} 125}
123#endif 126#endif
@@ -919,7 +922,7 @@ ns_update_begin (struct frame *f)
919 -------------------------------------------------------------------------- */ 922 -------------------------------------------------------------------------- */
920{ 923{
921 EmacsView *view = FRAME_NS_VIEW (f); 924 EmacsView *view = FRAME_NS_VIEW (f);
922 NSTRACE ("ns_update_begin"); 925 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_begin");
923 926
924 ns_update_auto_hide_menu_bar (); 927 ns_update_auto_hide_menu_bar ();
925 928
@@ -976,7 +979,7 @@ ns_update_window_begin (struct window *w)
976 struct frame *f = XFRAME (WINDOW_FRAME (w)); 979 struct frame *f = XFRAME (WINDOW_FRAME (w));
977 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 980 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
978 981
979 NSTRACE ("ns_update_window_begin"); 982 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_begin");
980 w->output_cursor = w->cursor; 983 w->output_cursor = w->cursor;
981 984
982 block_input (); 985 block_input ();
@@ -1006,7 +1009,7 @@ ns_update_window_end (struct window *w, bool cursor_on_p,
1006 external (RIF) call; for one window called before update_end 1009 external (RIF) call; for one window called before update_end
1007 -------------------------------------------------------------------------- */ 1010 -------------------------------------------------------------------------- */
1008{ 1011{
1009 NSTRACE ("update_window_end"); 1012 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_end");
1010 1013
1011 /* note: this fn is nearly identical in all terms */ 1014 /* note: this fn is nearly identical in all terms */
1012 if (!w->pseudo_window_p) 1015 if (!w->pseudo_window_p)
@@ -1045,7 +1048,7 @@ ns_update_end (struct frame *f)
1045{ 1048{
1046 EmacsView *view = FRAME_NS_VIEW (f); 1049 EmacsView *view = FRAME_NS_VIEW (f);
1047 1050
1048 NSTRACE ("ns_update_end"); 1051 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end");
1049 1052
1050/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ 1053/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
1051 MOUSE_HL_INFO (f)->mouse_face_defer = 0; 1054 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
@@ -1070,11 +1073,11 @@ ns_focus (struct frame *f, NSRect *r, int n)
1070 the entire window. 1073 the entire window.
1071 -------------------------------------------------------------------------- */ 1074 -------------------------------------------------------------------------- */
1072{ 1075{
1073// NSTRACE ("ns_focus"); 1076 NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_focus");
1074/* static int c =0; 1077 if (r != NULL)
1075 fprintf (stderr, "focus: %d", c++); 1078 {
1076 if (r) fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", r->origin.x, r->origin.y, r->size.width, r->size.height); 1079 NSTRACE_RECT ("r", *r);
1077 fprintf (stderr, "\n"); */ 1080 }
1078 1081
1079 if (f != ns_updating_frame) 1082 if (f != ns_updating_frame)
1080 { 1083 {
@@ -1114,7 +1117,7 @@ ns_unfocus (struct frame *f)
1114 Internal: Remove focus on given frame 1117 Internal: Remove focus on given frame
1115 -------------------------------------------------------------------------- */ 1118 -------------------------------------------------------------------------- */
1116{ 1119{
1117// NSTRACE ("ns_unfocus"); 1120 NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_unfocus");
1118 1121
1119 if (gsaved) 1122 if (gsaved)
1120 { 1123 {
@@ -1220,6 +1223,7 @@ ns_raise_frame (struct frame *f)
1220 -------------------------------------------------------------------------- */ 1223 -------------------------------------------------------------------------- */
1221{ 1224{
1222 NSView *view; 1225 NSView *view;
1226
1223 check_window_system (f); 1227 check_window_system (f);
1224 view = FRAME_NS_VIEW (f); 1228 view = FRAME_NS_VIEW (f);
1225 block_input (); 1229 block_input ();
@@ -1236,6 +1240,7 @@ ns_lower_frame (struct frame *f)
1236 -------------------------------------------------------------------------- */ 1240 -------------------------------------------------------------------------- */
1237{ 1241{
1238 NSView *view; 1242 NSView *view;
1243
1239 check_window_system (f); 1244 check_window_system (f);
1240 view = FRAME_NS_VIEW (f); 1245 view = FRAME_NS_VIEW (f);
1241 block_input (); 1246 block_input ();
@@ -1510,8 +1515,8 @@ x_set_window_size (struct frame *f,
1510 return; 1515 return;
1511 1516
1512 NSTRACE_RECT ("current", wr); 1517 NSTRACE_RECT ("current", wr);
1513 1518 NSTRACE_MSG ("Width:%d Height:%d Pixelwise:%d", width, height, pixelwise);
1514/*fprintf (stderr, "\tsetWindowSize: %d x %d, pixelwise %d, font size %d x %d\n", width, height, pixelwise, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));*/ 1519 NSTRACE_MSG ("Font %d x %d", FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));
1515 1520
1516 block_input (); 1521 block_input ();
1517 1522
@@ -1571,7 +1576,6 @@ x_set_window_size (struct frame *f,
1571 make_number (FRAME_NS_TITLEBAR_HEIGHT (f)), 1576 make_number (FRAME_NS_TITLEBAR_HEIGHT (f)),
1572 make_number (FRAME_TOOLBAR_HEIGHT (f)))); 1577 make_number (FRAME_TOOLBAR_HEIGHT (f))));
1573 1578
1574 NSTRACE_RECT ("setFrame", wr);
1575 [window setFrame: wr display: YES]; 1579 [window setFrame: wr display: YES];
1576 1580
1577 /* This is a trick to compensate for Emacs' managing the scrollbar area 1581 /* This is a trick to compensate for Emacs' managing the scrollbar area
@@ -1586,7 +1590,7 @@ x_set_window_size (struct frame *f,
1586 ? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) 1590 ? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)
1587 - NS_SCROLL_BAR_WIDTH (f), 0) 1591 - NS_SCROLL_BAR_WIDTH (f), 0)
1588 : NSMakePoint (0, 0); 1592 : NSMakePoint (0, 0);
1589 NSTRACE_RECT ("setFrame", wr); 1593
1590 [view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)]; 1594 [view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)];
1591 [view setBoundsOrigin: origin]; 1595 [view setBoundsOrigin: origin];
1592 } 1596 }
@@ -1728,7 +1732,8 @@ ns_get_color (const char *name, NSColor **col)
1728 float r = -1.0, g, b; 1732 float r = -1.0, g, b;
1729 NSString *nsname = [NSString stringWithUTF8String: name]; 1733 NSString *nsname = [NSString stringWithUTF8String: name];
1730 1734
1731/*fprintf (stderr, "ns_get_color: '%s'\n", name); */ 1735 NSTRACE ("ns_get_color(%s, **)", name);
1736
1732 block_input (); 1737 block_input ();
1733 1738
1734 if ([nsname isEqualToString: @"ns_selection_bg_color"]) 1739 if ([nsname isEqualToString: @"ns_selection_bg_color"])
@@ -1935,7 +1940,7 @@ ns_defined_color (struct frame *f,
1935 -------------------------------------------------------------------------- */ 1940 -------------------------------------------------------------------------- */
1936{ 1941{
1937 NSColor *col; 1942 NSColor *col;
1938 NSTRACE ("ns_defined_color"); 1943 NSTRACE_WHEN (NSTRACE_GROUP_COLOR, "ns_defined_color");
1939 1944
1940 block_input (); 1945 block_input ();
1941 if (ns_get_color (name, &col) != 0) /* Color not found */ 1946 if (ns_get_color (name, &col) != 0) /* Color not found */
@@ -1961,6 +1966,8 @@ x_set_frame_alpha (struct frame *f)
1961 double alpha = 1.0; 1966 double alpha = 1.0;
1962 double alpha_min = 1.0; 1967 double alpha_min = 1.0;
1963 1968
1969 NSTRACE ("x_set_frame_alpha");
1970
1964 if (dpyinfo->x_highlight_frame == f) 1971 if (dpyinfo->x_highlight_frame == f)
1965 alpha = f->alpha[0]; 1972 alpha = f->alpha[0];
1966 else 1973 else
@@ -2097,7 +2104,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
2097 position = [view convertPoint: position fromView: nil]; 2104 position = [view convertPoint: position fromView: nil];
2098 remember_mouse_glyph (f, position.x, position.y, 2105 remember_mouse_glyph (f, position.x, position.y,
2099 &dpyinfo->last_mouse_glyph); 2106 &dpyinfo->last_mouse_glyph);
2100/*fprintf (stderr, "ns_mouse_position: %.0f, %.0f\n", position.x, position.y); */ 2107 NSTRACE_POINT ("position", position);
2101 2108
2102 if (bar_window) *bar_window = Qnil; 2109 if (bar_window) *bar_window = Qnil;
2103 if (part) *part = scroll_bar_above_handle; 2110 if (part) *part = scroll_bar_above_handle;
@@ -2120,7 +2127,7 @@ ns_frame_up_to_date (struct frame *f)
2120 Can't use FRAME_MOUSE_UPDATE due to ns_frame_begin and ns_frame_end calls. 2127 Can't use FRAME_MOUSE_UPDATE due to ns_frame_begin and ns_frame_end calls.
2121 -------------------------------------------------------------------------- */ 2128 -------------------------------------------------------------------------- */
2122{ 2129{
2123 NSTRACE ("ns_frame_up_to_date"); 2130 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_frame_up_to_date");
2124 2131
2125 if (FRAME_NS_P (f)) 2132 if (FRAME_NS_P (f))
2126 { 2133 {
@@ -2231,7 +2238,7 @@ ns_clear_frame (struct frame *f)
2231 NSView *view = FRAME_NS_VIEW (f); 2238 NSView *view = FRAME_NS_VIEW (f);
2232 NSRect r; 2239 NSRect r;
2233 2240
2234 NSTRACE ("ns_clear_frame"); 2241 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_clear_frame");
2235 2242
2236 /* comes on initial frame because we have 2243 /* comes on initial frame because we have
2237 after-make-frame-functions = select-frame */ 2244 after-make-frame-functions = select-frame */
@@ -2267,7 +2274,7 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
2267 if (!view || !face) 2274 if (!view || !face)
2268 return; 2275 return;
2269 2276
2270 NSTRACE ("ns_clear_frame_area"); 2277 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_clear_frame_area");
2271 2278
2272 r = NSIntersectionRect (r, [view frame]); 2279 r = NSIntersectionRect (r, [view frame]);
2273 ns_focus (f, &r, 1); 2280 ns_focus (f, &r, 1);
@@ -2360,7 +2367,7 @@ ns_after_update_window_line (struct window *w, struct glyph_row *desired_row)
2360 struct frame *f; 2367 struct frame *f;
2361 int width, height; 2368 int width, height;
2362 2369
2363 NSTRACE ("ns_after_update_window_line"); 2370 NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_after_update_window_line");
2364 2371
2365 /* begin copy from other terms */ 2372 /* begin copy from other terms */
2366 eassert (w); 2373 eassert (w);
@@ -2485,7 +2492,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2485 static EmacsImage **bimgs = NULL; 2492 static EmacsImage **bimgs = NULL;
2486 static int nBimgs = 0; 2493 static int nBimgs = 0;
2487 2494
2488 NSTRACE ("ns_draw_fringe_bitmap"); 2495 NSTRACE_WHEN (NSTRACE_GROUP_FRINGE, "ns_draw_fringe_bitmap");
2489 NSTRACE_MSG ("which:%d cursor:%d overlay:%d width:%d height:%d period:%d", 2496 NSTRACE_MSG ("which:%d cursor:%d overlay:%d width:%d height:%d period:%d",
2490 p->which, p->cursor_p, p->overlay_p, p->wd, p->h, p->dh); 2497 p->which, p->cursor_p, p->overlay_p, p->wd, p->h, p->dh);
2491 2498
@@ -2602,7 +2609,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2602 in mini-buffer windows when switching between echo area glyphs 2609 in mini-buffer windows when switching between echo area glyphs
2603 and mini-buffer. */ 2610 and mini-buffer. */
2604 2611
2605 NSTRACE ("dumpcursor"); 2612 NSTRACE ("ns_draw_window_cursor");
2606 2613
2607 if (!on_p) 2614 if (!on_p)
2608 return; 2615 return;
@@ -3519,7 +3526,7 @@ ns_draw_glyph_string (struct glyph_string *s)
3519 struct font *font = s->face->font; 3526 struct font *font = s->face->font;
3520 if (! font) font = FRAME_FONT (s->f); 3527 if (! font) font = FRAME_FONT (s->f);
3521 3528
3522 NSTRACE ("ns_draw_glyph_string"); 3529 NSTRACE_WHEN (NSTRACE_GROUP_GLYPHS, "ns_draw_glyph_string");
3523 3530
3524 if (s->next && s->right_overhang && !s->for_overlaps/*&&s->hl!=DRAW_CURSOR*/) 3531 if (s->next && s->right_overhang && !s->for_overlaps/*&&s->hl!=DRAW_CURSOR*/)
3525 { 3532 {
@@ -3677,7 +3684,7 @@ ns_send_appdefined (int value)
3677 recognize and take as a command to halt the event loop. 3684 recognize and take as a command to halt the event loop.
3678 -------------------------------------------------------------------------- */ 3685 -------------------------------------------------------------------------- */
3679{ 3686{
3680 NSTRACE ("ns_send_appdefined"); 3687 NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_send_appdefined(%d)", value);
3681 3688
3682#ifdef NS_IMPL_GNUSTEP 3689#ifdef NS_IMPL_GNUSTEP
3683 // GNUstep needs postEvent to happen on the main thread. 3690 // GNUstep needs postEvent to happen on the main thread.
@@ -3851,7 +3858,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3851 struct input_event ev; 3858 struct input_event ev;
3852 int nevents; 3859 int nevents;
3853 3860
3854/* NSTRACE ("ns_read_socket"); */ 3861 NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_read_socket");
3855 3862
3856#ifdef HAVE_NATIVE_FS 3863#ifdef HAVE_NATIVE_FS
3857 check_native_fs (); 3864 check_native_fs ();
@@ -3935,7 +3942,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
3935 struct input_event event; 3942 struct input_event event;
3936 char c; 3943 char c;
3937 3944
3938/* NSTRACE ("ns_select"); */ 3945 NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select");
3939 3946
3940#ifdef HAVE_NATIVE_FS 3947#ifdef HAVE_NATIVE_FS
3941 check_native_fs (); 3948 check_native_fs ();
@@ -4905,7 +4912,7 @@ ns_term_shutdown (int sig)
4905 4912
4906- (void)stop: (id)sender 4913- (void)stop: (id)sender
4907{ 4914{
4908 NSTRACE ("[EmacsApp stop]"); 4915 NSTRACE ("[EmacsApp stop:]");
4909 4916
4910 shouldKeepRunning = NO; 4917 shouldKeepRunning = NO;
4911 // Stop possible dialog also. Noop if no dialog present. 4918 // Stop possible dialog also. Noop if no dialog present.
@@ -4916,7 +4923,7 @@ ns_term_shutdown (int sig)
4916 4923
4917- (void)logNotification: (NSNotification *)notification 4924- (void)logNotification: (NSNotification *)notification
4918{ 4925{
4919 NSTRACE ("[EmacsApp logNotification]"); 4926 NSTRACE ("[EmacsApp logNotification:]");
4920 4927
4921 const char *name = [[notification name] UTF8String]; 4928 const char *name = [[notification name] UTF8String];
4922 if (!strstr (name, "Update") && !strstr (name, "NSMenu") 4929 if (!strstr (name, "Update") && !strstr (name, "NSMenu")
@@ -4934,8 +4941,8 @@ ns_term_shutdown (int sig)
4934 int type = [theEvent type]; 4941 int type = [theEvent type];
4935 NSWindow *window = [theEvent window]; 4942 NSWindow *window = [theEvent window];
4936 4943
4937 NSTRACE ("[EmacsApp sendEvent]"); 4944 NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "[EmacsApp sendEvent:]");
4938/*fprintf (stderr, "received event of type %d\t%d\n", type);*/ 4945 NSTRACE_MSG ("Type: %d", type);
4939 4946
4940#ifdef NS_IMPL_GNUSTEP 4947#ifdef NS_IMPL_GNUSTEP
4941 // Keyboard events aren't propagated to file dialogs for some reason. 4948 // Keyboard events aren't propagated to file dialogs for some reason.
@@ -5021,6 +5028,8 @@ ns_term_shutdown (int sig)
5021 } 5028 }
5022#endif 5029#endif
5023 5030
5031 NSTRACE_UNSILENCE();
5032
5024 [super sendEvent: theEvent]; 5033 [super sendEvent: theEvent];
5025} 5034}
5026 5035
@@ -5041,7 +5050,7 @@ ns_term_shutdown (int sig)
5041 5050
5042- (void)newFrame: (id)sender 5051- (void)newFrame: (id)sender
5043{ 5052{
5044 NSTRACE ("[EmacsApp newFrame]"); 5053 NSTRACE ("[EmacsApp newFrame:]");
5045 5054
5046 struct frame *emacsframe = SELECTED_FRAME (); 5055 struct frame *emacsframe = SELECTED_FRAME ();
5047 NSEvent *theEvent = [NSApp currentEvent]; 5056 NSEvent *theEvent = [NSApp currentEvent];
@@ -5058,7 +5067,7 @@ ns_term_shutdown (int sig)
5058/* Open a file (used by below, after going into queue read by ns_read_socket) */ 5067/* Open a file (used by below, after going into queue read by ns_read_socket) */
5059- (BOOL) openFile: (NSString *)fileName 5068- (BOOL) openFile: (NSString *)fileName
5060{ 5069{
5061 NSTRACE ("[EmacsApp openFile]"); 5070 NSTRACE ("[EmacsApp openFile:]");
5062 5071
5063 struct frame *emacsframe = SELECTED_FRAME (); 5072 struct frame *emacsframe = SELECTED_FRAME ();
5064 NSEvent *theEvent = [NSApp currentEvent]; 5073 NSEvent *theEvent = [NSApp currentEvent];
@@ -5088,7 +5097,7 @@ ns_term_shutdown (int sig)
5088 When application is loaded, terminate event loop in ns_term_init 5097 When application is loaded, terminate event loop in ns_term_init
5089 -------------------------------------------------------------------------- */ 5098 -------------------------------------------------------------------------- */
5090{ 5099{
5091 NSTRACE ("[EmacsApp applicationDidFinishLaunching]"); 5100 NSTRACE ("[EmacsApp applicationDidFinishLaunching:]");
5092 5101
5093#ifdef NS_IMPL_GNUSTEP 5102#ifdef NS_IMPL_GNUSTEP
5094 ((EmacsApp *)self)->applicationDidFinishLaunchingCalled = YES; 5103 ((EmacsApp *)self)->applicationDidFinishLaunchingCalled = YES;
@@ -5138,7 +5147,7 @@ ns_term_shutdown (int sig)
5138 5147
5139- (void) terminate: (id)sender 5148- (void) terminate: (id)sender
5140{ 5149{
5141 NSTRACE ("[EmacsApp terminate]"); 5150 NSTRACE ("[EmacsApp terminate:]");
5142 5151
5143 struct frame *emacsframe = SELECTED_FRAME (); 5152 struct frame *emacsframe = SELECTED_FRAME ();
5144 5153
@@ -5176,7 +5185,7 @@ runAlertPanel(NSString *title,
5176 5185
5177- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender 5186- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
5178{ 5187{
5179 NSTRACE ("[EmacsApp applicationShouldTerminate]"); 5188 NSTRACE ("[EmacsApp applicationShouldTerminate:]");
5180 5189
5181 bool ret; 5190 bool ret;
5182 5191
@@ -5257,13 +5266,13 @@ not_in_argv (NSString *arg)
5257/* TODO: these may help w/IO switching btwn terminal and NSApp */ 5266/* TODO: these may help w/IO switching btwn terminal and NSApp */
5258- (void)applicationWillBecomeActive: (NSNotification *)notification 5267- (void)applicationWillBecomeActive: (NSNotification *)notification
5259{ 5268{
5260 NSTRACE ("[EmacsApp applicationWillBecomeActive]"); 5269 NSTRACE ("[EmacsApp applicationWillBecomeActive:]");
5261 //ns_app_active=YES; 5270 //ns_app_active=YES;
5262} 5271}
5263 5272
5264- (void)applicationDidBecomeActive: (NSNotification *)notification 5273- (void)applicationDidBecomeActive: (NSNotification *)notification
5265{ 5274{
5266 NSTRACE ("[EmacsApp applicationDidBecomeActive]"); 5275 NSTRACE ("[EmacsApp applicationDidBecomeActive:]");
5267 5276
5268#ifdef NS_IMPL_GNUSTEP 5277#ifdef NS_IMPL_GNUSTEP
5269 if (! applicationDidFinishLaunchingCalled) 5278 if (! applicationDidFinishLaunchingCalled)
@@ -5277,7 +5286,7 @@ not_in_argv (NSString *arg)
5277} 5286}
5278- (void)applicationDidResignActive: (NSNotification *)notification 5287- (void)applicationDidResignActive: (NSNotification *)notification
5279{ 5288{
5280 NSTRACE ("[EmacsApp applicationDidResignActive]"); 5289 NSTRACE ("[EmacsApp applicationDidResignActive:]");
5281 5290
5282 //ns_app_active=NO; 5291 //ns_app_active=NO;
5283 ns_send_appdefined (-1); 5292 ns_send_appdefined (-1);
@@ -5422,6 +5431,8 @@ not_in_argv (NSString *arg)
5422 struct frame *emacsframe = SELECTED_FRAME (); 5431 struct frame *emacsframe = SELECTED_FRAME ();
5423 NSEvent *theEvent = [NSApp currentEvent]; 5432 NSEvent *theEvent = [NSApp currentEvent];
5424 5433
5434 NSTRACE ("[EmacsApp fulfillService:withArg:]");
5435
5425 if (!emacs_event) 5436 if (!emacs_event)
5426 return NO; 5437 return NO;
5427 5438
@@ -5452,13 +5463,15 @@ not_in_argv (NSString *arg)
5452/* needed to inform when window closed from LISP */ 5463/* needed to inform when window closed from LISP */
5453- (void) setWindowClosing: (BOOL)closing 5464- (void) setWindowClosing: (BOOL)closing
5454{ 5465{
5466 NSTRACE ("[EmacsView setWindowClosing:%d]", closing);
5467
5455 windowClosing = closing; 5468 windowClosing = closing;
5456} 5469}
5457 5470
5458 5471
5459- (void)dealloc 5472- (void)dealloc
5460{ 5473{
5461 NSTRACE ("EmacsView_dealloc"); 5474 NSTRACE ("[EmacsView dealloc]");
5462 [toolbar release]; 5475 [toolbar release];
5463 if (fs_state == FULLSCREEN_BOTH) 5476 if (fs_state == FULLSCREEN_BOTH)
5464 [nonfs_window release]; 5477 [nonfs_window release];
@@ -5476,7 +5489,7 @@ not_in_argv (NSString *arg)
5476 CGFloat size; 5489 CGFloat size;
5477 NSFont *nsfont; 5490 NSFont *nsfont;
5478 5491
5479 NSTRACE ("changeFont"); 5492 NSTRACE ("[EmacsView changeFont:]");
5480 5493
5481 if (!emacs_event) 5494 if (!emacs_event)
5482 return; 5495 return;
@@ -5506,7 +5519,7 @@ not_in_argv (NSString *arg)
5506 5519
5507- (BOOL)acceptsFirstResponder 5520- (BOOL)acceptsFirstResponder
5508{ 5521{
5509 NSTRACE ("acceptsFirstResponder"); 5522 NSTRACE ("[EmacsView acceptsFirstResponder]");
5510 return YES; 5523 return YES;
5511} 5524}
5512 5525
@@ -5515,7 +5528,7 @@ not_in_argv (NSString *arg)
5515{ 5528{
5516 NSRect visible = [self visibleRect]; 5529 NSRect visible = [self visibleRect];
5517 NSCursor *currentCursor = FRAME_POINTER_TYPE (emacsframe); 5530 NSCursor *currentCursor = FRAME_POINTER_TYPE (emacsframe);
5518 NSTRACE ("resetCursorRects"); 5531 NSTRACE ("[EmacsView resetCursorRects]");
5519 5532
5520 if (currentCursor == nil) 5533 if (currentCursor == nil)
5521 currentCursor = [NSCursor arrowCursor]; 5534 currentCursor = [NSCursor arrowCursor];
@@ -5540,7 +5553,7 @@ not_in_argv (NSString *arg)
5540 int left_is_none; 5553 int left_is_none;
5541 unsigned int flags = [theEvent modifierFlags]; 5554 unsigned int flags = [theEvent modifierFlags];
5542 5555
5543 NSTRACE ("keyDown"); 5556 NSTRACE ("[EmacsView keyDown:]");
5544 5557
5545 /* Rhapsody and OS X give up and down events for the arrow keys */ 5558 /* Rhapsody and OS X give up and down events for the arrow keys */
5546 if (ns_fake_keydown == YES) 5559 if (ns_fake_keydown == YES)
@@ -5785,6 +5798,9 @@ not_in_argv (NSString *arg)
5785{ 5798{
5786 int flags = [theEvent modifierFlags]; 5799 int flags = [theEvent modifierFlags];
5787 int code = [theEvent keyCode]; 5800 int code = [theEvent keyCode];
5801
5802 NSTRACE ("[EmacsView keyUp:]");
5803
5788 if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ && 5804 if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ &&
5789 code == 0x30 && (flags & NSControlKeyMask) && !(flags & NSCommandKeyMask)) 5805 code == 0x30 && (flags & NSControlKeyMask) && !(flags & NSCommandKeyMask))
5790 { 5806 {
@@ -5809,6 +5825,8 @@ not_in_argv (NSString *arg)
5809 int len = [(NSString *)aString length]; 5825 int len = [(NSString *)aString length];
5810 int i; 5826 int i;
5811 5827
5828 NSTRACE ("[EmacsView insertText:]");
5829
5812 if (NS_KEYLOG) 5830 if (NS_KEYLOG)
5813 NSLog (@"insertText '%@'\tlen = %d", aString, len); 5831 NSLog (@"insertText '%@'\tlen = %d", aString, len);
5814 processingCompose = NO; 5832 processingCompose = NO;
@@ -5842,6 +5860,9 @@ not_in_argv (NSString *arg)
5842{ 5860{
5843 NSString *str = [aString respondsToSelector: @selector (string)] ? 5861 NSString *str = [aString respondsToSelector: @selector (string)] ?
5844 [aString string] : aString; 5862 [aString string] : aString;
5863
5864 NSTRACE ("[EmacsView setMarkedText:selectedRange:]");
5865
5845 if (NS_KEYLOG) 5866 if (NS_KEYLOG)
5846 NSLog (@"setMarkedText '%@' len =%lu range %lu from %lu", 5867 NSLog (@"setMarkedText '%@' len =%lu range %lu from %lu",
5847 str, (unsigned long)[str length], 5868 str, (unsigned long)[str length],
@@ -5869,6 +5890,8 @@ not_in_argv (NSString *arg)
5869/* delete display of composing characters [not in <NSTextInput>] */ 5890/* delete display of composing characters [not in <NSTextInput>] */
5870- (void)deleteWorkingText 5891- (void)deleteWorkingText
5871{ 5892{
5893 NSTRACE ("[EmacsView deleteWorkingText]");
5894
5872 if (workingText == nil) 5895 if (workingText == nil)
5873 return; 5896 return;
5874 if (NS_KEYLOG) 5897 if (NS_KEYLOG)
@@ -5888,12 +5911,16 @@ not_in_argv (NSString *arg)
5888 5911
5889- (BOOL)hasMarkedText 5912- (BOOL)hasMarkedText
5890{ 5913{
5914 NSTRACE ("[EmacsView hasMarkedText]");
5915
5891 return workingText != nil; 5916 return workingText != nil;
5892} 5917}
5893 5918
5894 5919
5895- (NSRange)markedRange 5920- (NSRange)markedRange
5896{ 5921{
5922 NSTRACE ("[EmacsView markedRange]");
5923
5897 NSRange rng = workingText != nil 5924 NSRange rng = workingText != nil
5898 ? NSMakeRange (0, [workingText length]) : NSMakeRange (NSNotFound, 0); 5925 ? NSMakeRange (0, [workingText length]) : NSMakeRange (NSNotFound, 0);
5899 if (NS_KEYLOG) 5926 if (NS_KEYLOG)
@@ -5904,6 +5931,8 @@ not_in_argv (NSString *arg)
5904 5931
5905- (void)unmarkText 5932- (void)unmarkText
5906{ 5933{
5934 NSTRACE ("[EmacsView unmarkText]");
5935
5907 if (NS_KEYLOG) 5936 if (NS_KEYLOG)
5908 NSLog (@"unmark (accept) text"); 5937 NSLog (@"unmark (accept) text");
5909 [self deleteWorkingText]; 5938 [self deleteWorkingText];
@@ -5917,6 +5946,9 @@ not_in_argv (NSString *arg)
5917 NSRect rect; 5946 NSRect rect;
5918 NSPoint pt; 5947 NSPoint pt;
5919 struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); 5948 struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
5949
5950 NSTRACE ("[EmacsView firstRectForCharacterRange:]");
5951
5920 if (NS_KEYLOG) 5952 if (NS_KEYLOG)
5921 NSLog (@"firstRectForCharRange request"); 5953 NSLog (@"firstRectForCharRange request");
5922 5954
@@ -5941,6 +5973,8 @@ not_in_argv (NSString *arg)
5941 5973
5942- (void)doCommandBySelector: (SEL)aSelector 5974- (void)doCommandBySelector: (SEL)aSelector
5943{ 5975{
5976 NSTRACE ("[EmacsView doCommandBySelector:]");
5977
5944 if (NS_KEYLOG) 5978 if (NS_KEYLOG)
5945 NSLog (@"doCommandBySelector: %@", NSStringFromSelector (aSelector)); 5979 NSLog (@"doCommandBySelector: %@", NSStringFromSelector (aSelector));
5946 5980
@@ -6003,7 +6037,7 @@ not_in_argv (NSString *arg)
6003 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); 6037 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
6004 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; 6038 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
6005 6039
6006 NSTRACE ("mouseDown"); 6040 NSTRACE ("[EmacsView mouseDown:]");
6007 6041
6008 [self deleteWorkingText]; 6042 [self deleteWorkingText];
6009 6043
@@ -6024,7 +6058,7 @@ not_in_argv (NSString *arg)
6024 delta = [theEvent deltaX]; 6058 delta = [theEvent deltaX];
6025 if (delta == 0) 6059 if (delta == 0)
6026 { 6060 {
6027 NSTRACE ("deltaIsZero"); 6061 NSTRACE_MSG ("deltaIsZero");
6028 return; 6062 return;
6029 } 6063 }
6030 emacs_event->kind = HORIZ_WHEEL_EVENT; 6064 emacs_event->kind = HORIZ_WHEEL_EVENT;
@@ -6051,42 +6085,42 @@ not_in_argv (NSString *arg)
6051 6085
6052- (void)rightMouseDown: (NSEvent *)theEvent 6086- (void)rightMouseDown: (NSEvent *)theEvent
6053{ 6087{
6054 NSTRACE ("rightMouseDown"); 6088 NSTRACE ("[EmacsView rightMouseDown:]");
6055 [self mouseDown: theEvent]; 6089 [self mouseDown: theEvent];
6056} 6090}
6057 6091
6058 6092
6059- (void)otherMouseDown: (NSEvent *)theEvent 6093- (void)otherMouseDown: (NSEvent *)theEvent
6060{ 6094{
6061 NSTRACE ("otherMouseDown"); 6095 NSTRACE ("[EmacsView otherMouseDown:]");
6062 [self mouseDown: theEvent]; 6096 [self mouseDown: theEvent];
6063} 6097}
6064 6098
6065 6099
6066- (void)mouseUp: (NSEvent *)theEvent 6100- (void)mouseUp: (NSEvent *)theEvent
6067{ 6101{
6068 NSTRACE ("mouseUp"); 6102 NSTRACE ("[EmacsView mouseUp:]");
6069 [self mouseDown: theEvent]; 6103 [self mouseDown: theEvent];
6070} 6104}
6071 6105
6072 6106
6073- (void)rightMouseUp: (NSEvent *)theEvent 6107- (void)rightMouseUp: (NSEvent *)theEvent
6074{ 6108{
6075 NSTRACE ("rightMouseUp"); 6109 NSTRACE ("[EmacsView rightMouseUp:]");
6076 [self mouseDown: theEvent]; 6110 [self mouseDown: theEvent];
6077} 6111}
6078 6112
6079 6113
6080- (void)otherMouseUp: (NSEvent *)theEvent 6114- (void)otherMouseUp: (NSEvent *)theEvent
6081{ 6115{
6082 NSTRACE ("otherMouseUp"); 6116 NSTRACE ("[EmacsView otherMouseUp:]");
6083 [self mouseDown: theEvent]; 6117 [self mouseDown: theEvent];
6084} 6118}
6085 6119
6086 6120
6087- (void) scrollWheel: (NSEvent *)theEvent 6121- (void) scrollWheel: (NSEvent *)theEvent
6088{ 6122{
6089 NSTRACE ("scrollWheel"); 6123 NSTRACE ("[EmacsView scrollWheel:]");
6090 [self mouseDown: theEvent]; 6124 [self mouseDown: theEvent];
6091} 6125}
6092 6126
@@ -6099,7 +6133,7 @@ not_in_argv (NSString *arg)
6099 Lisp_Object frame; 6133 Lisp_Object frame;
6100 NSPoint pt; 6134 NSPoint pt;
6101 6135
6102// NSTRACE ("mouseMoved"); 6136 NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "[EmacsView mouseMoved:]");
6103 6137
6104 dpyinfo->last_mouse_movement_time = EV_TIMESTAMP (e); 6138 dpyinfo->last_mouse_movement_time = EV_TIMESTAMP (e);
6105 pt = [self convertPoint: [e locationInWindow] fromView: nil]; 6139 pt = [self convertPoint: [e locationInWindow] fromView: nil];
@@ -6119,7 +6153,7 @@ not_in_argv (NSString *arg)
6119 6153
6120 if (!NILP (Vmouse_autoselect_window)) 6154 if (!NILP (Vmouse_autoselect_window))
6121 { 6155 {
6122 NSTRACE ("mouse_autoselect_window"); 6156 NSTRACE_MSG ("mouse_autoselect_window");
6123 static Lisp_Object last_mouse_window; 6157 static Lisp_Object last_mouse_window;
6124 Lisp_Object window 6158 Lisp_Object window
6125 = window_from_coordinates (emacsframe, pt.x, pt.y, 0, 0); 6159 = window_from_coordinates (emacsframe, pt.x, pt.y, 0, 0);
@@ -6131,7 +6165,7 @@ not_in_argv (NSString *arg)
6131 || (EQ (XWINDOW (window)->frame, 6165 || (EQ (XWINDOW (window)->frame,
6132 XWINDOW (selected_window)->frame)))) 6166 XWINDOW (selected_window)->frame))))
6133 { 6167 {
6134 NSTRACE ("in_window"); 6168 NSTRACE_MSG ("in_window");
6135 emacs_event->kind = SELECT_WINDOW_EVENT; 6169 emacs_event->kind = SELECT_WINDOW_EVENT;
6136 emacs_event->frame_or_window = window; 6170 emacs_event->frame_or_window = window;
6137 EV_TRAILER2 (e); 6171 EV_TRAILER2 (e);
@@ -6161,21 +6195,21 @@ not_in_argv (NSString *arg)
6161 6195
6162- (void)mouseDragged: (NSEvent *)e 6196- (void)mouseDragged: (NSEvent *)e
6163{ 6197{
6164 NSTRACE ("mouseDragged"); 6198 NSTRACE ("[EmacsView mouseDragged:]");
6165 [self mouseMoved: e]; 6199 [self mouseMoved: e];
6166} 6200}
6167 6201
6168 6202
6169- (void)rightMouseDragged: (NSEvent *)e 6203- (void)rightMouseDragged: (NSEvent *)e
6170{ 6204{
6171 NSTRACE ("rightMouseDragged"); 6205 NSTRACE ("[EmacsView rightMouseDragged:]");
6172 [self mouseMoved: e]; 6206 [self mouseMoved: e];
6173} 6207}
6174 6208
6175 6209
6176- (void)otherMouseDragged: (NSEvent *)e 6210- (void)otherMouseDragged: (NSEvent *)e
6177{ 6211{
6178 NSTRACE ("otherMouseDragged"); 6212 NSTRACE ("[EmacsView otherMouseDragged:]");
6179 [self mouseMoved: e]; 6213 [self mouseMoved: e];
6180} 6214}
6181 6215
@@ -6184,7 +6218,7 @@ not_in_argv (NSString *arg)
6184{ 6218{
6185 NSEvent *e =[[self window] currentEvent]; 6219 NSEvent *e =[[self window] currentEvent];
6186 6220
6187 NSTRACE ("windowShouldClose"); 6221 NSTRACE ("[EmacsView windowShouldClose:]");
6188 windowClosing = YES; 6222 windowClosing = YES;
6189 if (!emacs_event) 6223 if (!emacs_event)
6190 return NO; 6224 return NO;
@@ -6206,7 +6240,7 @@ not_in_argv (NSString *arg)
6206 int oldh = FRAME_PIXEL_HEIGHT (emacsframe); 6240 int oldh = FRAME_PIXEL_HEIGHT (emacsframe);
6207 int neww, newh; 6241 int neww, newh;
6208 6242
6209 NSTRACE ("updateFrameSize"); 6243 NSTRACE ("[EmacsView updateFrameSize:]");
6210 NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh)); 6244 NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
6211 NSTRACE_RECT ("Original frame", wr); 6245 NSTRACE_RECT ("Original frame", wr);
6212 NSTRACE_MSG ("Original columns: %d", cols); 6246 NSTRACE_MSG ("Original columns: %d", cols);
@@ -6249,8 +6283,8 @@ not_in_argv (NSString *arg)
6249 if (rows < MINHEIGHT) 6283 if (rows < MINHEIGHT)
6250 rows = MINHEIGHT; 6284 rows = MINHEIGHT;
6251 6285
6252 NSTRACE_MSG ("New columns: %d", cols); 6286 NSTRACE_MSG ("New columns: %d", cols);
6253 NSTRACE_MSG ("New rows: %d", rows); 6287 NSTRACE_MSG ("New rows: %d", rows);
6254 6288
6255 if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) 6289 if (oldr != rows || oldc != cols || neww != oldw || newh != oldh)
6256 { 6290 {
@@ -6265,8 +6299,9 @@ not_in_argv (NSString *arg)
6265 cancel_mouse_face (emacsframe); 6299 cancel_mouse_face (emacsframe);
6266 6300
6267 wr = NSMakeRect (0, 0, neww, newh); 6301 wr = NSMakeRect (0, 0, neww, newh);
6268 NSTRACE_RECT ("setFrame", wr); 6302
6269 [view setFrame: wr]; 6303 [view setFrame: wr];
6304
6270 // to do: consider using [NSNotificationCenter postNotificationName:]. 6305 // to do: consider using [NSNotificationCenter postNotificationName:].
6271 [self windowDidMove: // Update top/left. 6306 [self windowDidMove: // Update top/left.
6272 [NSNotification notificationWithName:NSWindowDidMoveNotification 6307 [NSNotification notificationWithName:NSWindowDidMoveNotification
@@ -6283,7 +6318,7 @@ not_in_argv (NSString *arg)
6283{ 6318{
6284 int extra = 0; 6319 int extra = 0;
6285 6320
6286 NSTRACE ("windowWillResize: toSize: " NSTRACE_FMT_SIZE, 6321 NSTRACE ("[EmacsView windowWillResize:toSize: " NSTRACE_FMT_SIZE "]",
6287 NSTRACE_ARG_SIZE (frameSize)); 6322 NSTRACE_ARG_SIZE (frameSize));
6288 NSTRACE_RECT ("[sender frame]", [sender frame]); 6323 NSTRACE_RECT ("[sender frame]", [sender frame]);
6289 NSTRACE_FSTYPE ("fs_state", fs_state); 6324 NSTRACE_FSTYPE ("fs_state", fs_state);
@@ -6382,7 +6417,7 @@ not_in_argv (NSString *arg)
6382 6417
6383- (void)windowDidResize: (NSNotification *)notification 6418- (void)windowDidResize: (NSNotification *)notification
6384{ 6419{
6385 NSTRACE ("windowDidResize"); 6420 NSTRACE ("[EmacsView windowDidResize:]");
6386 if (!FRAME_LIVE_P (emacsframe)) 6421 if (!FRAME_LIVE_P (emacsframe))
6387 { 6422 {
6388 NSTRACE_MSG ("Ignored (frame dead)"); 6423 NSTRACE_MSG ("Ignored (frame dead)");
@@ -6425,6 +6460,8 @@ not_in_argv (NSString *arg)
6425#ifdef NS_IMPL_COCOA 6460#ifdef NS_IMPL_COCOA
6426- (void)viewDidEndLiveResize 6461- (void)viewDidEndLiveResize
6427{ 6462{
6463 NSTRACE ("[EmacsView viewDidEndLiveResize]");
6464
6428 [super viewDidEndLiveResize]; 6465 [super viewDidEndLiveResize];
6429 if (old_title != 0) 6466 if (old_title != 0)
6430 { 6467 {
@@ -6449,7 +6486,7 @@ not_in_argv (NSString *arg)
6449 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); 6486 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
6450 struct frame *old_focus = dpyinfo->x_focus_frame; 6487 struct frame *old_focus = dpyinfo->x_focus_frame;
6451 6488
6452 NSTRACE ("windowDidBecomeKey"); 6489 NSTRACE ("[EmacsView windowDidBecomeKey]");
6453 6490
6454 if (emacsframe != old_focus) 6491 if (emacsframe != old_focus)
6455 dpyinfo->x_focus_frame = emacsframe; 6492 dpyinfo->x_focus_frame = emacsframe;
@@ -6469,7 +6506,7 @@ not_in_argv (NSString *arg)
6469{ 6506{
6470 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); 6507 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
6471 BOOL is_focus_frame = dpyinfo->x_focus_frame == emacsframe; 6508 BOOL is_focus_frame = dpyinfo->x_focus_frame == emacsframe;
6472 NSTRACE ("windowDidResignKey"); 6509 NSTRACE ("[EmacsView windowDidResignKey:]");
6473 6510
6474 if (is_focus_frame) 6511 if (is_focus_frame)
6475 dpyinfo->x_focus_frame = 0; 6512 dpyinfo->x_focus_frame = 0;
@@ -6504,7 +6541,16 @@ not_in_argv (NSString *arg)
6504 6541
6505- (void)windowWillMiniaturize: sender 6542- (void)windowWillMiniaturize: sender
6506{ 6543{
6507 NSTRACE ("windowWillMiniaturize"); 6544 NSTRACE ("[EmacsView windowWillMiniaturize:]");
6545}
6546
6547
6548- (void)setFrame:(NSRect)frameRect;
6549{
6550 NSTRACE ("[EmacsView setFrame:" NSTRACE_FMT_RECT "]",
6551 NSTRACE_ARG_RECT (frameRect));
6552
6553 [super setFrame:(NSRect)frameRect];
6508} 6554}
6509 6555
6510 6556
@@ -6528,7 +6574,8 @@ not_in_argv (NSString *arg)
6528 NSColor *col; 6574 NSColor *col;
6529 NSString *name; 6575 NSString *name;
6530 6576
6531 NSTRACE ("initFrameFromEmacs"); 6577 NSTRACE ("[EmacsView initFrameFromEmacs:]");
6578 NSTRACE_MSG ("cols:%d lines:%d\n", f->text_cols, f->text_lines);
6532 6579
6533 windowClosing = NO; 6580 windowClosing = NO;
6534 processingCompose = NO; 6581 processingCompose = NO;
@@ -6543,8 +6590,6 @@ not_in_argv (NSString *arg)
6543 maximized_width = maximized_height = -1; 6590 maximized_width = maximized_height = -1;
6544 nonfs_window = nil; 6591 nonfs_window = nil;
6545 6592
6546/*fprintf (stderr,"init with %d, %d\n",f->text_cols, f->text_lines); */
6547
6548 ns_userRect = NSMakeRect (0, 0, 0, 0); 6593 ns_userRect = NSMakeRect (0, 0, 0, 0);
6549 r = NSMakeRect (0, 0, FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, f->text_cols), 6594 r = NSMakeRect (0, 0, FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, f->text_cols),
6550 FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, f->text_lines)); 6595 FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, f->text_lines));
@@ -6632,8 +6677,6 @@ not_in_argv (NSString *arg)
6632 IN_BOUND (-SCREENMAX, 6677 IN_BOUND (-SCREENMAX,
6633 [screen frame].size.height - NS_TOP_POS (f), SCREENMAX)); 6678 [screen frame].size.height - NS_TOP_POS (f), SCREENMAX));
6634 6679
6635 NSTRACE_POINT ("setFrameTopLeftPoint", pt);
6636
6637 [win setFrameTopLeftPoint: pt]; 6680 [win setFrameTopLeftPoint: pt];
6638 6681
6639 NSTRACE_RECT ("new frame", [win frame]); 6682 NSTRACE_RECT ("new frame", [win frame]);
@@ -6667,7 +6710,7 @@ not_in_argv (NSString *arg)
6667 NSArray *screens = [NSScreen screens]; 6710 NSArray *screens = [NSScreen screens];
6668 NSScreen *screen = [screens objectAtIndex: 0]; 6711 NSScreen *screen = [screens objectAtIndex: 0];
6669 6712
6670 NSTRACE ("windowDidMove"); 6713 NSTRACE ("[EmacsView windowDidMove:]");
6671 6714
6672 if (!emacsframe->output_data.ns) 6715 if (!emacsframe->output_data.ns)
6673 return; 6716 return;
@@ -6685,7 +6728,7 @@ not_in_argv (NSString *arg)
6685 location so set_window_size moves the frame. */ 6728 location so set_window_size moves the frame. */
6686- (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame 6729- (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame
6687{ 6730{
6688 NSTRACE (("[windowShouldZoom:win toFrame:" NSTRACE_FMT_RECT "]" 6731 NSTRACE (("[EmacsView windowShouldZoom:toFrame:" NSTRACE_FMT_RECT "]"
6689 NSTRACE_FMT_RETURN "YES"), 6732 NSTRACE_FMT_RETURN "YES"),
6690 NSTRACE_ARG_RECT (newFrame)); 6733 NSTRACE_ARG_RECT (newFrame));
6691 6734
@@ -6704,7 +6747,7 @@ not_in_argv (NSString *arg)
6704 // all paths. 6747 // all paths.
6705 NSRect result = [sender frame]; 6748 NSRect result = [sender frame];
6706 6749
6707 NSTRACE (("[windowWillUseStandardFrame: defaultFrame:" 6750 NSTRACE (("[EmacsView windowWillUseStandardFrame:defaultFrame:"
6708 NSTRACE_FMT_RECT "]"), 6751 NSTRACE_FMT_RECT "]"),
6709 NSTRACE_ARG_RECT (defaultFrame)); 6752 NSTRACE_ARG_RECT (defaultFrame));
6710 NSTRACE_FSTYPE ("fs_state", fs_state); 6753 NSTRACE_FSTYPE ("fs_state", fs_state);
@@ -6817,7 +6860,7 @@ not_in_argv (NSString *arg)
6817 6860
6818- (void)windowDidDeminiaturize: sender 6861- (void)windowDidDeminiaturize: sender
6819{ 6862{
6820 NSTRACE ("windowDidDeminiaturize"); 6863 NSTRACE ("[EmacsView windowDidDeminiaturize:]");
6821 if (!emacsframe->output_data.ns) 6864 if (!emacsframe->output_data.ns)
6822 return; 6865 return;
6823 6866
@@ -6835,7 +6878,7 @@ not_in_argv (NSString *arg)
6835 6878
6836- (void)windowDidExpose: sender 6879- (void)windowDidExpose: sender
6837{ 6880{
6838 NSTRACE ("windowDidExpose"); 6881 NSTRACE ("[EmacsView windowDidExpose:]");
6839 if (!emacsframe->output_data.ns) 6882 if (!emacsframe->output_data.ns)
6840 return; 6883 return;
6841 6884
@@ -6849,7 +6892,7 @@ not_in_argv (NSString *arg)
6849 6892
6850- (void)windowDidMiniaturize: sender 6893- (void)windowDidMiniaturize: sender
6851{ 6894{
6852 NSTRACE ("windowDidMiniaturize"); 6895 NSTRACE ("[EmacsView windowDidMiniaturize:]");
6853 if (!emacsframe->output_data.ns) 6896 if (!emacsframe->output_data.ns)
6854 return; 6897 return;
6855 6898
@@ -6874,22 +6917,24 @@ not_in_argv (NSString *arg)
6874 6917
6875- (void)windowWillEnterFullScreen:(NSNotification *)notification 6918- (void)windowWillEnterFullScreen:(NSNotification *)notification
6876{ 6919{
6920 NSTRACE ("[EmacsView windowWillEnterFullScreen:]");
6877 [self windowWillEnterFullScreen]; 6921 [self windowWillEnterFullScreen];
6878} 6922}
6879- (void)windowWillEnterFullScreen /* provided for direct calls */ 6923- (void)windowWillEnterFullScreen /* provided for direct calls */
6880{ 6924{
6881 NSTRACE ("windowWillEnterFullScreen"); 6925 NSTRACE ("[EmacsView windowWillEnterFullScreen]");
6882 fs_before_fs = fs_state; 6926 fs_before_fs = fs_state;
6883} 6927}
6884 6928
6885- (void)windowDidEnterFullScreen:(NSNotification *)notification 6929- (void)windowDidEnterFullScreen:(NSNotification *)notification
6886{ 6930{
6931 NSTRACE ("[EmacsView windowDidEnterFullScreen:]");
6887 [self windowDidEnterFullScreen]; 6932 [self windowDidEnterFullScreen];
6888} 6933}
6889 6934
6890- (void)windowDidEnterFullScreen /* provided for direct calls */ 6935- (void)windowDidEnterFullScreen /* provided for direct calls */
6891{ 6936{
6892 NSTRACE ("windowDidEnterFullScreen"); 6937 NSTRACE ("[EmacsView windowDidEnterFullScreen]");
6893 [self setFSValue: FULLSCREEN_BOTH]; 6938 [self setFSValue: FULLSCREEN_BOTH];
6894 if (! [self fsIsNative]) 6939 if (! [self fsIsNative])
6895 { 6940 {
@@ -6923,12 +6968,13 @@ not_in_argv (NSString *arg)
6923 6968
6924- (void)windowWillExitFullScreen:(NSNotification *)notification 6969- (void)windowWillExitFullScreen:(NSNotification *)notification
6925{ 6970{
6971 NSTRACE ("[EmacsView windowWillExitFullScreen:]");
6926 [self windowWillExitFullScreen]; 6972 [self windowWillExitFullScreen];
6927} 6973}
6928 6974
6929- (void)windowWillExitFullScreen /* provided for direct calls */ 6975- (void)windowWillExitFullScreen /* provided for direct calls */
6930{ 6976{
6931 NSTRACE ("windowWillExitFullScreen"); 6977 NSTRACE ("[EmacsView windowWillExitFullScreen]");
6932 if (!FRAME_LIVE_P (emacsframe)) 6978 if (!FRAME_LIVE_P (emacsframe))
6933 { 6979 {
6934 NSTRACE_MSG ("Ignored (frame dead)"); 6980 NSTRACE_MSG ("Ignored (frame dead)");
@@ -6940,12 +6986,13 @@ not_in_argv (NSString *arg)
6940 6986
6941- (void)windowDidExitFullScreen:(NSNotification *)notification 6987- (void)windowDidExitFullScreen:(NSNotification *)notification
6942{ 6988{
6989 NSTRACE ("[EmacsView windowDidExitFullScreen:]");
6943 [self windowDidExitFullScreen]; 6990 [self windowDidExitFullScreen];
6944} 6991}
6945 6992
6946- (void)windowDidExitFullScreen /* provided for direct calls */ 6993- (void)windowDidExitFullScreen /* provided for direct calls */
6947{ 6994{
6948 NSTRACE ("windowDidExitFullScreen"); 6995 NSTRACE ("[EamcsView windowDidExitFullScreen]");
6949 if (!FRAME_LIVE_P (emacsframe)) 6996 if (!FRAME_LIVE_P (emacsframe))
6950 { 6997 {
6951 NSTRACE_MSG ("Ignored (frame dead)"); 6998 NSTRACE_MSG ("Ignored (frame dead)");
@@ -6977,6 +7024,8 @@ not_in_argv (NSString *arg)
6977 7024
6978- (BOOL)isFullscreen 7025- (BOOL)isFullscreen
6979{ 7026{
7027 NSTRACE ("[EmacsView isFullscreen]");
7028
6980 if (! fs_is_native) return nonfs_window != nil; 7029 if (! fs_is_native) return nonfs_window != nil;
6981#ifdef HAVE_NATIVE_FS 7030#ifdef HAVE_NATIVE_FS
6982 return ([[self window] styleMask] & NSFullScreenWindowMask) != 0; 7031 return ([[self window] styleMask] & NSFullScreenWindowMask) != 0;
@@ -6988,6 +7037,8 @@ not_in_argv (NSString *arg)
6988#ifdef HAVE_NATIVE_FS 7037#ifdef HAVE_NATIVE_FS
6989- (void)updateCollectionBehavior 7038- (void)updateCollectionBehavior
6990{ 7039{
7040 NSTRACE ("[EmacsView updateCollectionBehavior]");
7041
6991 if (! [self isFullscreen]) 7042 if (! [self isFullscreen])
6992 { 7043 {
6993 NSWindow *win = [self window]; 7044 NSWindow *win = [self window];
@@ -7011,7 +7062,7 @@ not_in_argv (NSString *arg)
7011 NSRect r, wr; 7062 NSRect r, wr;
7012 NSColor *col; 7063 NSColor *col;
7013 7064
7014 NSTRACE ("toggleFullScreen"); 7065 NSTRACE ("[EmacsView toggleFullScreen:]");
7015 7066
7016 if (fs_is_native) 7067 if (fs_is_native)
7017 { 7068 {
@@ -7126,7 +7177,7 @@ not_in_argv (NSString *arg)
7126 7177
7127- (void)handleFS 7178- (void)handleFS
7128{ 7179{
7129 NSTRACE ("handleFS"); 7180 NSTRACE ("[EmacsView handleFS]");
7130 7181
7131 if (fs_state != emacsframe->want_fullscreen) 7182 if (fs_state != emacsframe->want_fullscreen)
7132 { 7183 {
@@ -7177,8 +7228,8 @@ not_in_argv (NSString *arg)
7177 7228
7178- (void) setFSValue: (int)value 7229- (void) setFSValue: (int)value
7179{ 7230{
7180 NSTRACE ("setFSValue"); 7231 NSTRACE ("[EmacsView setFSValue:" NSTRACE_FMT_FSTYPE "]",
7181 NSTRACE_FSTYPE ("value", value); 7232 NSTRACE_ARG_FSTYPE(value));
7182 7233
7183 Lisp_Object lval = Qnil; 7234 Lisp_Object lval = Qnil;
7184 switch (value) 7235 switch (value)
@@ -7202,7 +7253,7 @@ not_in_argv (NSString *arg)
7202 7253
7203- (void)mouseEntered: (NSEvent *)theEvent 7254- (void)mouseEntered: (NSEvent *)theEvent
7204{ 7255{
7205 NSTRACE ("mouseEntered"); 7256 NSTRACE ("[EmacsView mouseEntered:]");
7206 if (emacsframe) 7257 if (emacsframe)
7207 FRAME_DISPLAY_INFO (emacsframe)->last_mouse_movement_time 7258 FRAME_DISPLAY_INFO (emacsframe)->last_mouse_movement_time
7208 = EV_TIMESTAMP (theEvent); 7259 = EV_TIMESTAMP (theEvent);
@@ -7213,7 +7264,7 @@ not_in_argv (NSString *arg)
7213{ 7264{
7214 Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL; 7265 Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
7215 7266
7216 NSTRACE ("mouseExited"); 7267 NSTRACE ("[EmacsView mouseExited:]");
7217 7268
7218 if (!hlinfo) 7269 if (!hlinfo)
7219 return; 7270 return;
@@ -7231,7 +7282,7 @@ not_in_argv (NSString *arg)
7231 7282
7232- menuDown: sender 7283- menuDown: sender
7233{ 7284{
7234 NSTRACE ("menuDown"); 7285 NSTRACE ("[EmacsView menuDown:]");
7235 if (context_menu_value == -1) 7286 if (context_menu_value == -1)
7236 context_menu_value = [sender tag]; 7287 context_menu_value = [sender tag];
7237 else 7288 else
@@ -7259,7 +7310,7 @@ not_in_argv (NSString *arg)
7259 NSEvent *theEvent; 7310 NSEvent *theEvent;
7260 int idx = [item tag] * TOOL_BAR_ITEM_NSLOTS; 7311 int idx = [item tag] * TOOL_BAR_ITEM_NSLOTS;
7261 7312
7262 NSTRACE ("toolbarClicked"); 7313 NSTRACE ("[EmacsView toolbarClicked:]");
7263 7314
7264 if (!emacs_event) 7315 if (!emacs_event)
7265 return self; 7316 return self;
@@ -7282,6 +7333,8 @@ not_in_argv (NSString *arg)
7282 7333
7283- toggleToolbar: (id)sender 7334- toggleToolbar: (id)sender
7284{ 7335{
7336 NSTRACE ("[EmacsView toggleToolbar:]");
7337
7285 if (!emacs_event) 7338 if (!emacs_event)
7286 return self; 7339 return self;
7287 7340
@@ -7297,8 +7350,8 @@ not_in_argv (NSString *arg)
7297 int x = NSMinX (rect), y = NSMinY (rect); 7350 int x = NSMinX (rect), y = NSMinY (rect);
7298 int width = NSWidth (rect), height = NSHeight (rect); 7351 int width = NSWidth (rect), height = NSHeight (rect);
7299 7352
7300 NSTRACE ("drawRect"); 7353 NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]",
7301 NSTRACE_RECT ("input", rect); 7354 NSTRACE_ARG_RECT(rect));
7302 7355
7303 if (!emacsframe || !emacsframe->output_data.ns) 7356 if (!emacsframe || !emacsframe->output_data.ns)
7304 return; 7357 return;
@@ -7324,7 +7377,7 @@ not_in_argv (NSString *arg)
7324 7377
7325-(NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender 7378-(NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
7326{ 7379{
7327 NSTRACE ("draggingEntered"); 7380 NSTRACE ("[EmacsView draggingEntered:]");
7328 return NSDragOperationGeneric; 7381 return NSDragOperationGeneric;
7329} 7382}
7330 7383
@@ -7345,7 +7398,7 @@ not_in_argv (NSString *arg)
7345 NSDragOperation op = [sender draggingSourceOperationMask]; 7398 NSDragOperation op = [sender draggingSourceOperationMask];
7346 int modifiers = 0; 7399 int modifiers = 0;
7347 7400
7348 NSTRACE ("performDragOperation"); 7401 NSTRACE ("[EmacsView performDragOperation:]");
7349 7402
7350 if (!emacs_event) 7403 if (!emacs_event)
7351 return NO; 7404 return NO;
@@ -7445,7 +7498,7 @@ not_in_argv (NSString *arg)
7445- (id) validRequestorForSendType: (NSString *)typeSent 7498- (id) validRequestorForSendType: (NSString *)typeSent
7446 returnType: (NSString *)typeReturned 7499 returnType: (NSString *)typeReturned
7447{ 7500{
7448 NSTRACE ("validRequestorForSendType"); 7501 NSTRACE ("[EmacsView validRequestorForSendType:returnType:]");
7449 if (typeSent != nil && [ns_send_types indexOfObject: typeSent] != NSNotFound 7502 if (typeSent != nil && [ns_send_types indexOfObject: typeSent] != NSNotFound
7450 && typeReturned == nil) 7503 && typeReturned == nil)
7451 { 7504 {
@@ -7478,6 +7531,8 @@ not_in_argv (NSString *arg)
7478 NSArray *typesDeclared; 7531 NSArray *typesDeclared;
7479 Lisp_Object val; 7532 Lisp_Object val;
7480 7533
7534 NSTRACE ("[EmacsView writeSelectionToPasteboard:types:]");
7535
7481 /* We only support NSStringPboardType */ 7536 /* We only support NSStringPboardType */
7482 if ([types containsObject:NSStringPboardType] == NO) { 7537 if ([types containsObject:NSStringPboardType] == NO) {
7483 return NO; 7538 return NO;
@@ -7507,7 +7562,7 @@ not_in_argv (NSString *arg)
7507- setMiniwindowImage: (BOOL) setMini 7562- setMiniwindowImage: (BOOL) setMini
7508{ 7563{
7509 id image = [[self window] miniwindowImage]; 7564 id image = [[self window] miniwindowImage];
7510 NSTRACE ("setMiniwindowImage"); 7565 NSTRACE ("[EmacsView setMiniwindowImage:%d]", setMini);
7511 7566
7512 /* NOTE: under Cocoa miniwindowImage always returns nil, documentation 7567 /* NOTE: under Cocoa miniwindowImage always returns nil, documentation
7513 about "AppleDockIconEnabled" notwithstanding, however the set message 7568 about "AppleDockIconEnabled" notwithstanding, however the set message
@@ -7555,6 +7610,8 @@ not_in_argv (NSString *arg)
7555 struct frame *f = SELECTED_FRAME (); 7610 struct frame *f = SELECTED_FRAME ();
7556 struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->contents); 7611 struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->contents);
7557 7612
7613 NSTRACE ("[EmacsWindow accessibilityAttributeValue:]");
7614
7558 if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) 7615 if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
7559 return NSAccessibilityTextFieldRole; 7616 return NSAccessibilityTextFieldRole;
7560 7617
@@ -7623,7 +7680,7 @@ not_in_argv (NSString *arg)
7623 large screen). */ 7680 large screen). */
7624- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen 7681- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
7625{ 7682{
7626 NSTRACE ("constrainFrameRect:" NSTRACE_FMT_RECT " toScreen:", 7683 NSTRACE ("[EmacsWindow constrainFrameRect:" NSTRACE_FMT_RECT " toScreen:]",
7627 NSTRACE_ARG_RECT (frameRect)); 7684 NSTRACE_ARG_RECT (frameRect));
7628 7685
7629#ifdef NS_IMPL_COCOA 7686#ifdef NS_IMPL_COCOA
@@ -7646,7 +7703,7 @@ not_in_argv (NSString *arg)
7646 7703
7647- (void)performZoom:(id)sender 7704- (void)performZoom:(id)sender
7648{ 7705{
7649 NSTRACE ("performZoom"); 7706 NSTRACE ("[EmacsWindow performZoom:]");
7650 7707
7651 return [super performZoom:sender]; 7708 return [super performZoom:sender];
7652} 7709}
@@ -7655,7 +7712,7 @@ not_in_argv (NSString *arg)
7655{ 7712{
7656 struct frame * f = SELECTED_FRAME (); 7713 struct frame * f = SELECTED_FRAME ();
7657 7714
7658 NSTRACE ("zoom"); 7715 NSTRACE ("[EmacsWindow zoom:]");
7659 7716
7660 ns_update_auto_hide_menu_bar(); 7717 ns_update_auto_hide_menu_bar();
7661 7718
@@ -7714,7 +7771,7 @@ not_in_argv (NSString *arg)
7714 || newWr.origin.x != wr.origin.x 7771 || newWr.origin.x != wr.origin.x
7715 || newWr.origin.y != wr.origin.y) 7772 || newWr.origin.y != wr.origin.y)
7716 { 7773 {
7717 NSTRACE_RECT ("Corrected rect", newWr); 7774 NSTRACE_MSG ("New frame different");
7718 [self setFrame: newWr display: NO]; 7775 [self setFrame: newWr display: NO];
7719 } 7776 }
7720 } 7777 }
@@ -7734,6 +7791,33 @@ not_in_argv (NSString *arg)
7734#endif 7791#endif
7735} 7792}
7736 7793
7794- (void)setFrame:(NSRect)windowFrame
7795 display:(BOOL)displayViews
7796{
7797 NSTRACE ("[EmacsWindow setFrame:" NSTRACE_FMT_RECT " display:%d]",
7798 NSTRACE_ARG_RECT (windowFrame), displayViews);
7799
7800 [super setFrame:windowFrame display:displayViews];
7801}
7802
7803- (void)setFrame:(NSRect)windowFrame
7804 display:(BOOL)displayViews
7805 animate:(BOOL)performAnimation
7806{
7807 NSTRACE ("[EmacsWindow setFrame:" NSTRACE_FMT_RECT
7808 " display:%d performAnimation:%d]",
7809 NSTRACE_ARG_RECT (windowFrame), displayViews, performAnimation);
7810
7811 [super setFrame:windowFrame display:displayViews animate:performAnimation];
7812}
7813
7814- (void)setFrameTopLeftPoint:(NSPoint)point
7815{
7816 NSTRACE ("[EmacsWindow setFrameTopLeftPoint:" NSTRACE_FMT_POINT "]",
7817 NSTRACE_ARG_POINT (point));
7818
7819 [super setFrameTopLeftPoint:point];
7820}
7737@end /* EmacsWindow */ 7821@end /* EmacsWindow */
7738 7822
7739 7823
@@ -7782,7 +7866,7 @@ not_in_argv (NSString *arg)
7782 7866
7783- initFrame: (NSRect )r window: (Lisp_Object)nwin 7867- initFrame: (NSRect )r window: (Lisp_Object)nwin
7784{ 7868{
7785 NSTRACE ("EmacsScroller_initFrame"); 7869 NSTRACE ("[EmacsScroller initFrame: window:]");
7786 7870
7787 r.size.width = [EmacsScroller scrollerWidth]; 7871 r.size.width = [EmacsScroller scrollerWidth];
7788 [super initWithFrame: r/*NSMakeRect (0, 0, 0, 0)*/]; 7872 [super initWithFrame: r/*NSMakeRect (0, 0, 0, 0)*/];
@@ -7828,7 +7912,8 @@ not_in_argv (NSString *arg)
7828 7912
7829- (void)setFrame: (NSRect)newRect 7913- (void)setFrame: (NSRect)newRect
7830{ 7914{
7831 NSTRACE ("EmacsScroller_setFrame"); 7915 NSTRACE ("[EmacsScroller setFrame:]");
7916
7832/* block_input (); */ 7917/* block_input (); */
7833 pixel_height = NSHeight (newRect); 7918 pixel_height = NSHeight (newRect);
7834 if (pixel_height == 0) pixel_height = 1; 7919 if (pixel_height == 0) pixel_height = 1;
@@ -7840,7 +7925,7 @@ not_in_argv (NSString *arg)
7840 7925
7841- (void)dealloc 7926- (void)dealloc
7842{ 7927{
7843 NSTRACE ("EmacsScroller_dealloc"); 7928 NSTRACE ("[EmacsScroller dealloc]");
7844 if (window) 7929 if (window)
7845 wset_vertical_scroll_bar (window, Qnil); 7930 wset_vertical_scroll_bar (window, Qnil);
7846 window = 0; 7931 window = 0;
@@ -7850,7 +7935,7 @@ not_in_argv (NSString *arg)
7850 7935
7851- condemn 7936- condemn
7852{ 7937{
7853 NSTRACE ("condemn"); 7938 NSTRACE ("[EmacsScroller condemn]");
7854 condemned =YES; 7939 condemned =YES;
7855 return self; 7940 return self;
7856} 7941}
@@ -7858,7 +7943,7 @@ not_in_argv (NSString *arg)
7858 7943
7859- reprieve 7944- reprieve
7860{ 7945{
7861 NSTRACE ("reprieve"); 7946 NSTRACE ("[EmacsScroller reprieve]");
7862 condemned =NO; 7947 condemned =NO;
7863 return self; 7948 return self;
7864} 7949}
@@ -7866,7 +7951,7 @@ not_in_argv (NSString *arg)
7866 7951
7867-(bool)judge 7952-(bool)judge
7868{ 7953{
7869 NSTRACE ("judge"); 7954 NSTRACE ("[EmacsScroller judge]");
7870 bool ret = condemned; 7955 bool ret = condemned;
7871 if (condemned) 7956 if (condemned)
7872 { 7957 {
@@ -7890,7 +7975,7 @@ not_in_argv (NSString *arg)
7890- (void)resetCursorRects 7975- (void)resetCursorRects
7891{ 7976{
7892 NSRect visible = [self visibleRect]; 7977 NSRect visible = [self visibleRect];
7893 NSTRACE ("resetCursorRects"); 7978 NSTRACE ("[EmacsScroller resetCursorRects]");
7894 7979
7895 if (!NSIsEmptyRect (visible)) 7980 if (!NSIsEmptyRect (visible))
7896 [self addCursorRect: visible cursor: [NSCursor arrowCursor]]; 7981 [self addCursorRect: visible cursor: [NSCursor arrowCursor]];
@@ -7908,7 +7993,7 @@ not_in_argv (NSString *arg)
7908 7993
7909- setPosition: (int)position portion: (int)portion whole: (int)whole 7994- setPosition: (int)position portion: (int)portion whole: (int)whole
7910{ 7995{
7911 NSTRACE ("setPosition"); 7996 NSTRACE ("[EmacsScroller setPosition:portion:whole:]");
7912 7997
7913 em_position = position; 7998 em_position = position;
7914 em_portion = portion; 7999 em_portion = portion;
@@ -7945,6 +8030,9 @@ not_in_argv (NSString *arg)
7945- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e 8030- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e
7946{ 8031{
7947 Lisp_Object win; 8032 Lisp_Object win;
8033
8034 NSTRACE ("[EmacsScroller sendScrollEventAtLoc:fromEvent:]");
8035
7948 if (!emacs_event) 8036 if (!emacs_event)
7949 return; 8037 return;
7950 8038
@@ -7978,6 +8066,8 @@ not_in_argv (NSString *arg)
7978 NSPoint p = [[self window] mouseLocationOutsideOfEventStream]; 8066 NSPoint p = [[self window] mouseLocationOutsideOfEventStream];
7979 BOOL inKnob = [self testPart: p] == NSScrollerKnob; 8067 BOOL inKnob = [self testPart: p] == NSScrollerKnob;
7980 8068
8069 NSTRACE ("[EmacsScroller repeatScroll:]");
8070
7981 /* clear timer if need be */ 8071 /* clear timer if need be */
7982 if (inKnob || [scroll_repeat_entry timeInterval] == SCROLL_BAR_FIRST_DELAY) 8072 if (inKnob || [scroll_repeat_entry timeInterval] == SCROLL_BAR_FIRST_DELAY)
7983 { 8073 {
@@ -8013,7 +8103,7 @@ not_in_argv (NSString *arg)
8013 CGFloat inc = 0.0, loc, kloc, pos; 8103 CGFloat inc = 0.0, loc, kloc, pos;
8014 int edge = 0; 8104 int edge = 0;
8015 8105
8016 NSTRACE ("EmacsScroller_mouseDown"); 8106 NSTRACE ("[EmacsScroller mouseDown:]");
8017 8107
8018 switch (part) 8108 switch (part)
8019 { 8109 {
@@ -8110,7 +8200,7 @@ not_in_argv (NSString *arg)
8110 NSRect sr; 8200 NSRect sr;
8111 double loc, pos; 8201 double loc, pos;
8112 8202
8113 NSTRACE ("EmacsScroller_mouseDragged"); 8203 NSTRACE ("[EmacsScroller mouseDragged:]");
8114 8204
8115 sr = [self convertRect: [self rectForPart: NSScrollerKnobSlot] 8205 sr = [self convertRect: [self rectForPart: NSScrollerKnobSlot]
8116 toView: nil]; 8206 toView: nil];
@@ -8132,6 +8222,8 @@ not_in_argv (NSString *arg)
8132 8222
8133- (void)mouseUp: (NSEvent *)e 8223- (void)mouseUp: (NSEvent *)e
8134{ 8224{
8225 NSTRACE ("[EmacsScroller mouseUp:]");
8226
8135 if (scroll_repeat_entry) 8227 if (scroll_repeat_entry)
8136 { 8228 {
8137 [scroll_repeat_entry invalidate]; 8229 [scroll_repeat_entry invalidate];
@@ -8145,6 +8237,8 @@ not_in_argv (NSString *arg)
8145/* treat scrollwheel events in the bar as though they were in the main window */ 8237/* treat scrollwheel events in the bar as though they were in the main window */
8146- (void) scrollWheel: (NSEvent *)theEvent 8238- (void) scrollWheel: (NSEvent *)theEvent
8147{ 8239{
8240 NSTRACE ("[EmacsScroller scrollWheel:]");
8241
8148 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (frame); 8242 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (frame);
8149 [view mouseDown: theEvent]; 8243 [view mouseDown: theEvent];
8150} 8244}