extern NSString *NSMenuDidBeginTrackingNotification;
+/* ==========================================================================
+
+ NSTRACE, Trace support.
+
+ ========================================================================== */
+
#if NSTRACE_ENABLED
-int nstrace_num = 0;
-int nstrace_depth = 0;
+
+/* The following use "volatile" since they can be accessed from
+ parallel threads. */
+volatile int nstrace_num = 0;
+volatile int nstrace_depth = 0;
+
+/* When 0, no trace is emitted. This is used by NSTRACE_WHEN and
+ NSTRACE_UNLESS to silence functions called.
+
+ TODO: This should really be a thread-local variable, to avoid that
+ a function with disabled trace thread silence trace output in
+ another. However, in practice this seldom is a problem. */
+volatile int nstrace_enabled_global = 1;
/* Called when nstrace_enabled goes out of scope. */
void nstrace_leave(int * pointer_to_nstrace_enabled)
}
-void ns_print_fullscreen_type_name (char const * s, int fs_type)
+/* Called when nstrace_saved_enabled_global goes out of scope. */
+void nstrace_restore_global_trace_state(int * pointer_to_saved_enabled_global)
{
- // This is a support function for the NSTRACE system, don't add a
- // NSTRACE () here. However, a local `nstrace_enabled' variable is
- // needed by the NSTRACE_MSG macros.
- int nstrace_enabled = 1;
+ nstrace_enabled_global = *pointer_to_saved_enabled_global;
+}
+
+char const * nstrace_fullscreen_type_name (int fs_type)
+{
switch (fs_type)
{
- case FULLSCREEN_NONE:
- NSTRACE_MSG ("%s: FULLSCREEN_NONE", s);
- break;
-
- case FULLSCREEN_WIDTH:
- NSTRACE_MSG ("%s: FULLSCREEN_WIDTH", s);
- break;
-
- case FULLSCREEN_HEIGHT:
- NSTRACE_MSG ("%s: FULLSCREEN_HEIGHT", s);
- break;
-
- case FULLSCREEN_BOTH:
- NSTRACE_MSG ("%s: FULLSCREEN_BOTH", s);
- break;
-
- case FULLSCREEN_MAXIMIZED:
- NSTRACE_MSG ("%s: FULLSCREEN_MAXIMIZED", s);
- break;
-
- default:
- NSTRACE_MSG ("%s: %d", s, fs_type);
- break;
+ case -1: return "-1";
+ case FULLSCREEN_NONE: return "FULLSCREEN_NONE";
+ case FULLSCREEN_WIDTH: return "FULLSCREEN_WIDTH";
+ case FULLSCREEN_HEIGHT: return "FULLSCREEN_HEIGHT";
+ case FULLSCREEN_BOTH: return "FULLSCREEN_BOTH";
+ case FULLSCREEN_MAXIMIZED: return "FULLSCREEN_MAXIMIZED";
+ default: return "FULLSCREEN_?????";
}
}
#endif
-------------------------------------------------------------------------- */
{
EmacsView *view = FRAME_NS_VIEW (f);
- NSTRACE ("ns_update_begin");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_begin");
ns_update_auto_hide_menu_bar ();
struct frame *f = XFRAME (WINDOW_FRAME (w));
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
- NSTRACE ("ns_update_window_begin");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_begin");
w->output_cursor = w->cursor;
block_input ();
external (RIF) call; for one window called before update_end
-------------------------------------------------------------------------- */
{
- NSTRACE ("update_window_end");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_end");
/* note: this fn is nearly identical in all terms */
if (!w->pseudo_window_p)
{
EmacsView *view = FRAME_NS_VIEW (f);
- NSTRACE ("ns_update_end");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end");
/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
MOUSE_HL_INFO (f)->mouse_face_defer = 0;
the entire window.
-------------------------------------------------------------------------- */
{
-// NSTRACE ("ns_focus");
-/* static int c =0;
- fprintf (stderr, "focus: %d", c++);
- if (r) fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", r->origin.x, r->origin.y, r->size.width, r->size.height);
- fprintf (stderr, "\n"); */
+ NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_focus");
+ if (r != NULL)
+ {
+ NSTRACE_RECT ("r", *r);
+ }
if (f != ns_updating_frame)
{
Internal: Remove focus on given frame
-------------------------------------------------------------------------- */
{
-// NSTRACE ("ns_unfocus");
+ NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_unfocus");
if (gsaved)
{
-------------------------------------------------------------------------- */
{
NSView *view;
+
check_window_system (f);
view = FRAME_NS_VIEW (f);
block_input ();
-------------------------------------------------------------------------- */
{
NSView *view;
+
check_window_system (f);
view = FRAME_NS_VIEW (f);
block_input ();
return;
NSTRACE_RECT ("current", wr);
-
-/*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));*/
+ NSTRACE_MSG ("Width:%d Height:%d Pixelwise:%d", width, height, pixelwise);
+ NSTRACE_MSG ("Font %d x %d", FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));
block_input ();
make_number (FRAME_NS_TITLEBAR_HEIGHT (f)),
make_number (FRAME_TOOLBAR_HEIGHT (f))));
- NSTRACE_RECT ("setFrame", wr);
[window setFrame: wr display: YES];
/* This is a trick to compensate for Emacs' managing the scrollbar area
? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)
- NS_SCROLL_BAR_WIDTH (f), 0)
: NSMakePoint (0, 0);
- NSTRACE_RECT ("setFrame", wr);
+
[view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)];
[view setBoundsOrigin: origin];
}
float r = -1.0, g, b;
NSString *nsname = [NSString stringWithUTF8String: name];
-/*fprintf (stderr, "ns_get_color: '%s'\n", name); */
+ NSTRACE ("ns_get_color(%s, **)", name);
+
block_input ();
if ([nsname isEqualToString: @"ns_selection_bg_color"])
-------------------------------------------------------------------------- */
{
NSColor *col;
- NSTRACE ("ns_defined_color");
+ NSTRACE_WHEN (NSTRACE_GROUP_COLOR, "ns_defined_color");
block_input ();
if (ns_get_color (name, &col) != 0) /* Color not found */
double alpha = 1.0;
double alpha_min = 1.0;
+ NSTRACE ("x_set_frame_alpha");
+
if (dpyinfo->x_highlight_frame == f)
alpha = f->alpha[0];
else
position = [view convertPoint: position fromView: nil];
remember_mouse_glyph (f, position.x, position.y,
&dpyinfo->last_mouse_glyph);
-/*fprintf (stderr, "ns_mouse_position: %.0f, %.0f\n", position.x, position.y); */
+ NSTRACE_POINT ("position", position);
if (bar_window) *bar_window = Qnil;
if (part) *part = scroll_bar_above_handle;
Can't use FRAME_MOUSE_UPDATE due to ns_frame_begin and ns_frame_end calls.
-------------------------------------------------------------------------- */
{
- NSTRACE ("ns_frame_up_to_date");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_frame_up_to_date");
if (FRAME_NS_P (f))
{
NSView *view = FRAME_NS_VIEW (f);
NSRect r;
- NSTRACE ("ns_clear_frame");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_clear_frame");
/* comes on initial frame because we have
after-make-frame-functions = select-frame */
if (!view || !face)
return;
- NSTRACE ("ns_clear_frame_area");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_clear_frame_area");
r = NSIntersectionRect (r, [view frame]);
ns_focus (f, &r, 1);
struct frame *f;
int width, height;
- NSTRACE ("ns_after_update_window_line");
+ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_after_update_window_line");
/* begin copy from other terms */
eassert (w);
static EmacsImage **bimgs = NULL;
static int nBimgs = 0;
- NSTRACE ("ns_draw_fringe_bitmap");
+ NSTRACE_WHEN (NSTRACE_GROUP_FRINGE, "ns_draw_fringe_bitmap");
NSTRACE_MSG ("which:%d cursor:%d overlay:%d width:%d height:%d period:%d",
p->which, p->cursor_p, p->overlay_p, p->wd, p->h, p->dh);
in mini-buffer windows when switching between echo area glyphs
and mini-buffer. */
- NSTRACE ("dumpcursor");
+ NSTRACE ("ns_draw_window_cursor");
if (!on_p)
return;
struct font *font = s->face->font;
if (! font) font = FRAME_FONT (s->f);
- NSTRACE ("ns_draw_glyph_string");
+ NSTRACE_WHEN (NSTRACE_GROUP_GLYPHS, "ns_draw_glyph_string");
if (s->next && s->right_overhang && !s->for_overlaps/*&&s->hl!=DRAW_CURSOR*/)
{
recognize and take as a command to halt the event loop.
-------------------------------------------------------------------------- */
{
- NSTRACE ("ns_send_appdefined");
+ NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_send_appdefined(%d)", value);
#ifdef NS_IMPL_GNUSTEP
// GNUstep needs postEvent to happen on the main thread.
struct input_event ev;
int nevents;
-/* NSTRACE ("ns_read_socket"); */
+ NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_read_socket");
#ifdef HAVE_NATIVE_FS
check_native_fs ();
struct input_event event;
char c;
-/* NSTRACE ("ns_select"); */
+ NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select");
#ifdef HAVE_NATIVE_FS
check_native_fs ();
- (void)stop: (id)sender
{
- NSTRACE ("[EmacsApp stop]");
+ NSTRACE ("[EmacsApp stop:]");
shouldKeepRunning = NO;
// Stop possible dialog also. Noop if no dialog present.
- (void)logNotification: (NSNotification *)notification
{
- NSTRACE ("[EmacsApp logNotification]");
+ NSTRACE ("[EmacsApp logNotification:]");
const char *name = [[notification name] UTF8String];
if (!strstr (name, "Update") && !strstr (name, "NSMenu")
int type = [theEvent type];
NSWindow *window = [theEvent window];
- NSTRACE ("[EmacsApp sendEvent]");
-/*fprintf (stderr, "received event of type %d\t%d\n", type);*/
+ NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "[EmacsApp sendEvent:]");
+ NSTRACE_MSG ("Type: %d", type);
#ifdef NS_IMPL_GNUSTEP
// Keyboard events aren't propagated to file dialogs for some reason.
}
#endif
+ NSTRACE_UNSILENCE();
+
[super sendEvent: theEvent];
}
- (void)newFrame: (id)sender
{
- NSTRACE ("[EmacsApp newFrame]");
+ NSTRACE ("[EmacsApp newFrame:]");
struct frame *emacsframe = SELECTED_FRAME ();
NSEvent *theEvent = [NSApp currentEvent];
/* Open a file (used by below, after going into queue read by ns_read_socket) */
- (BOOL) openFile: (NSString *)fileName
{
- NSTRACE ("[EmacsApp openFile]");
+ NSTRACE ("[EmacsApp openFile:]");
struct frame *emacsframe = SELECTED_FRAME ();
NSEvent *theEvent = [NSApp currentEvent];
When application is loaded, terminate event loop in ns_term_init
-------------------------------------------------------------------------- */
{
- NSTRACE ("[EmacsApp applicationDidFinishLaunching]");
+ NSTRACE ("[EmacsApp applicationDidFinishLaunching:]");
#ifdef NS_IMPL_GNUSTEP
((EmacsApp *)self)->applicationDidFinishLaunchingCalled = YES;
- (void) terminate: (id)sender
{
- NSTRACE ("[EmacsApp terminate]");
+ NSTRACE ("[EmacsApp terminate:]");
struct frame *emacsframe = SELECTED_FRAME ();
- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
{
- NSTRACE ("[EmacsApp applicationShouldTerminate]");
+ NSTRACE ("[EmacsApp applicationShouldTerminate:]");
bool ret;
/* TODO: these may help w/IO switching btwn terminal and NSApp */
- (void)applicationWillBecomeActive: (NSNotification *)notification
{
- NSTRACE ("[EmacsApp applicationWillBecomeActive]");
+ NSTRACE ("[EmacsApp applicationWillBecomeActive:]");
//ns_app_active=YES;
}
- (void)applicationDidBecomeActive: (NSNotification *)notification
{
- NSTRACE ("[EmacsApp applicationDidBecomeActive]");
+ NSTRACE ("[EmacsApp applicationDidBecomeActive:]");
#ifdef NS_IMPL_GNUSTEP
if (! applicationDidFinishLaunchingCalled)
}
- (void)applicationDidResignActive: (NSNotification *)notification
{
- NSTRACE ("[EmacsApp applicationDidResignActive]");
+ NSTRACE ("[EmacsApp applicationDidResignActive:]");
//ns_app_active=NO;
ns_send_appdefined (-1);
struct frame *emacsframe = SELECTED_FRAME ();
NSEvent *theEvent = [NSApp currentEvent];
+ NSTRACE ("[EmacsApp fulfillService:withArg:]");
+
if (!emacs_event)
return NO;
/* needed to inform when window closed from LISP */
- (void) setWindowClosing: (BOOL)closing
{
+ NSTRACE ("[EmacsView setWindowClosing:%d]", closing);
+
windowClosing = closing;
}
- (void)dealloc
{
- NSTRACE ("EmacsView_dealloc");
+ NSTRACE ("[EmacsView dealloc]");
[toolbar release];
if (fs_state == FULLSCREEN_BOTH)
[nonfs_window release];
CGFloat size;
NSFont *nsfont;
- NSTRACE ("changeFont");
+ NSTRACE ("[EmacsView changeFont:]");
if (!emacs_event)
return;
- (BOOL)acceptsFirstResponder
{
- NSTRACE ("acceptsFirstResponder");
+ NSTRACE ("[EmacsView acceptsFirstResponder]");
return YES;
}
{
NSRect visible = [self visibleRect];
NSCursor *currentCursor = FRAME_POINTER_TYPE (emacsframe);
- NSTRACE ("resetCursorRects");
+ NSTRACE ("[EmacsView resetCursorRects]");
if (currentCursor == nil)
currentCursor = [NSCursor arrowCursor];
int left_is_none;
unsigned int flags = [theEvent modifierFlags];
- NSTRACE ("keyDown");
+ NSTRACE ("[EmacsView keyDown:]");
/* Rhapsody and OS X give up and down events for the arrow keys */
if (ns_fake_keydown == YES)
{
int flags = [theEvent modifierFlags];
int code = [theEvent keyCode];
+
+ NSTRACE ("[EmacsView keyUp:]");
+
if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ &&
code == 0x30 && (flags & NSControlKeyMask) && !(flags & NSCommandKeyMask))
{
int len = [(NSString *)aString length];
int i;
+ NSTRACE ("[EmacsView insertText:]");
+
if (NS_KEYLOG)
NSLog (@"insertText '%@'\tlen = %d", aString, len);
processingCompose = NO;
{
NSString *str = [aString respondsToSelector: @selector (string)] ?
[aString string] : aString;
+
+ NSTRACE ("[EmacsView setMarkedText:selectedRange:]");
+
if (NS_KEYLOG)
NSLog (@"setMarkedText '%@' len =%lu range %lu from %lu",
str, (unsigned long)[str length],
/* delete display of composing characters [not in <NSTextInput>] */
- (void)deleteWorkingText
{
+ NSTRACE ("[EmacsView deleteWorkingText]");
+
if (workingText == nil)
return;
if (NS_KEYLOG)
- (BOOL)hasMarkedText
{
+ NSTRACE ("[EmacsView hasMarkedText]");
+
return workingText != nil;
}
- (NSRange)markedRange
{
+ NSTRACE ("[EmacsView markedRange]");
+
NSRange rng = workingText != nil
? NSMakeRange (0, [workingText length]) : NSMakeRange (NSNotFound, 0);
if (NS_KEYLOG)
- (void)unmarkText
{
+ NSTRACE ("[EmacsView unmarkText]");
+
if (NS_KEYLOG)
NSLog (@"unmark (accept) text");
[self deleteWorkingText];
NSRect rect;
NSPoint pt;
struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
+
+ NSTRACE ("[EmacsView firstRectForCharacterRange:]");
+
if (NS_KEYLOG)
NSLog (@"firstRectForCharRange request");
- (void)doCommandBySelector: (SEL)aSelector
{
+ NSTRACE ("[EmacsView doCommandBySelector:]");
+
if (NS_KEYLOG)
NSLog (@"doCommandBySelector: %@", NSStringFromSelector (aSelector));
struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
- NSTRACE ("mouseDown");
+ NSTRACE ("[EmacsView mouseDown:]");
[self deleteWorkingText];
delta = [theEvent deltaX];
if (delta == 0)
{
- NSTRACE ("deltaIsZero");
+ NSTRACE_MSG ("deltaIsZero");
return;
}
emacs_event->kind = HORIZ_WHEEL_EVENT;
- (void)rightMouseDown: (NSEvent *)theEvent
{
- NSTRACE ("rightMouseDown");
+ NSTRACE ("[EmacsView rightMouseDown:]");
[self mouseDown: theEvent];
}
- (void)otherMouseDown: (NSEvent *)theEvent
{
- NSTRACE ("otherMouseDown");
+ NSTRACE ("[EmacsView otherMouseDown:]");
[self mouseDown: theEvent];
}
- (void)mouseUp: (NSEvent *)theEvent
{
- NSTRACE ("mouseUp");
+ NSTRACE ("[EmacsView mouseUp:]");
[self mouseDown: theEvent];
}
- (void)rightMouseUp: (NSEvent *)theEvent
{
- NSTRACE ("rightMouseUp");
+ NSTRACE ("[EmacsView rightMouseUp:]");
[self mouseDown: theEvent];
}
- (void)otherMouseUp: (NSEvent *)theEvent
{
- NSTRACE ("otherMouseUp");
+ NSTRACE ("[EmacsView otherMouseUp:]");
[self mouseDown: theEvent];
}
- (void) scrollWheel: (NSEvent *)theEvent
{
- NSTRACE ("scrollWheel");
+ NSTRACE ("[EmacsView scrollWheel:]");
[self mouseDown: theEvent];
}
Lisp_Object frame;
NSPoint pt;
-// NSTRACE ("mouseMoved");
+ NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "[EmacsView mouseMoved:]");
dpyinfo->last_mouse_movement_time = EV_TIMESTAMP (e);
pt = [self convertPoint: [e locationInWindow] fromView: nil];
if (!NILP (Vmouse_autoselect_window))
{
- NSTRACE ("mouse_autoselect_window");
+ NSTRACE_MSG ("mouse_autoselect_window");
static Lisp_Object last_mouse_window;
Lisp_Object window
= window_from_coordinates (emacsframe, pt.x, pt.y, 0, 0);
|| (EQ (XWINDOW (window)->frame,
XWINDOW (selected_window)->frame))))
{
- NSTRACE ("in_window");
+ NSTRACE_MSG ("in_window");
emacs_event->kind = SELECT_WINDOW_EVENT;
emacs_event->frame_or_window = window;
EV_TRAILER2 (e);
- (void)mouseDragged: (NSEvent *)e
{
- NSTRACE ("mouseDragged");
+ NSTRACE ("[EmacsView mouseDragged:]");
[self mouseMoved: e];
}
- (void)rightMouseDragged: (NSEvent *)e
{
- NSTRACE ("rightMouseDragged");
+ NSTRACE ("[EmacsView rightMouseDragged:]");
[self mouseMoved: e];
}
- (void)otherMouseDragged: (NSEvent *)e
{
- NSTRACE ("otherMouseDragged");
+ NSTRACE ("[EmacsView otherMouseDragged:]");
[self mouseMoved: e];
}
{
NSEvent *e =[[self window] currentEvent];
- NSTRACE ("windowShouldClose");
+ NSTRACE ("[EmacsView windowShouldClose:]");
windowClosing = YES;
if (!emacs_event)
return NO;
int oldh = FRAME_PIXEL_HEIGHT (emacsframe);
int neww, newh;
- NSTRACE ("updateFrameSize");
+ NSTRACE ("[EmacsView updateFrameSize:]");
NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
NSTRACE_RECT ("Original frame", wr);
NSTRACE_MSG ("Original columns: %d", cols);
if (rows < MINHEIGHT)
rows = MINHEIGHT;
- NSTRACE_MSG ("New columns: %d", cols);
- NSTRACE_MSG ("New rows: %d", rows);
+ NSTRACE_MSG ("New columns: %d", cols);
+ NSTRACE_MSG ("New rows: %d", rows);
if (oldr != rows || oldc != cols || neww != oldw || newh != oldh)
{
cancel_mouse_face (emacsframe);
wr = NSMakeRect (0, 0, neww, newh);
- NSTRACE_RECT ("setFrame", wr);
+
[view setFrame: wr];
+
// to do: consider using [NSNotificationCenter postNotificationName:].
[self windowDidMove: // Update top/left.
[NSNotification notificationWithName:NSWindowDidMoveNotification
{
int extra = 0;
- NSTRACE ("windowWillResize: toSize: " NSTRACE_FMT_SIZE,
+ NSTRACE ("[EmacsView windowWillResize:toSize: " NSTRACE_FMT_SIZE "]",
NSTRACE_ARG_SIZE (frameSize));
NSTRACE_RECT ("[sender frame]", [sender frame]);
NSTRACE_FSTYPE ("fs_state", fs_state);
- (void)windowDidResize: (NSNotification *)notification
{
- NSTRACE ("windowDidResize");
+ NSTRACE ("[EmacsView windowDidResize:]");
if (!FRAME_LIVE_P (emacsframe))
{
NSTRACE_MSG ("Ignored (frame dead)");
#ifdef NS_IMPL_COCOA
- (void)viewDidEndLiveResize
{
+ NSTRACE ("[EmacsView viewDidEndLiveResize]");
+
[super viewDidEndLiveResize];
if (old_title != 0)
{
- (void)windowDidBecomeKey: (NSNotification *)notification
/* cf. x_detect_focus_change(), x_focus_changed(), x_new_focus_frame() */
+{
+ [self windowDidBecomeKey];
+}
+
+
+- (void)windowDidBecomeKey /* for direct calls */
{
struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
struct frame *old_focus = dpyinfo->x_focus_frame;
- NSTRACE ("windowDidBecomeKey");
+ NSTRACE ("[EmacsView windowDidBecomeKey]");
if (emacsframe != old_focus)
dpyinfo->x_focus_frame = emacsframe;
{
struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
BOOL is_focus_frame = dpyinfo->x_focus_frame == emacsframe;
- NSTRACE ("windowDidResignKey");
+ NSTRACE ("[EmacsView windowDidResignKey:]");
if (is_focus_frame)
dpyinfo->x_focus_frame = 0;
- (void)windowWillMiniaturize: sender
{
- NSTRACE ("windowWillMiniaturize");
+ NSTRACE ("[EmacsView windowWillMiniaturize:]");
+}
+
+
+- (void)setFrame:(NSRect)frameRect;
+{
+ NSTRACE ("[EmacsView setFrame:" NSTRACE_FMT_RECT "]",
+ NSTRACE_ARG_RECT (frameRect));
+
+ [super setFrame:(NSRect)frameRect];
}
NSColor *col;
NSString *name;
- NSTRACE ("initFrameFromEmacs");
+ NSTRACE ("[EmacsView initFrameFromEmacs:]");
+ NSTRACE_MSG ("cols:%d lines:%d\n", f->text_cols, f->text_lines);
windowClosing = NO;
processingCompose = NO;
maximized_width = maximized_height = -1;
nonfs_window = nil;
-/*fprintf (stderr,"init with %d, %d\n",f->text_cols, f->text_lines); */
-
ns_userRect = NSMakeRect (0, 0, 0, 0);
r = NSMakeRect (0, 0, FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, f->text_cols),
FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, f->text_lines));
IN_BOUND (-SCREENMAX,
[screen frame].size.height - NS_TOP_POS (f), SCREENMAX));
- NSTRACE_POINT ("setFrameTopLeftPoint", pt);
-
[win setFrameTopLeftPoint: pt];
NSTRACE_RECT ("new frame", [win frame]);
NSArray *screens = [NSScreen screens];
NSScreen *screen = [screens objectAtIndex: 0];
- NSTRACE ("windowDidMove");
+ NSTRACE ("[EmacsView windowDidMove:]");
if (!emacsframe->output_data.ns)
return;
location so set_window_size moves the frame. */
- (BOOL)windowShouldZoom: (NSWindow *)sender toFrame: (NSRect)newFrame
{
- NSTRACE (("[windowShouldZoom:win toFrame:" NSTRACE_FMT_RECT "]"
+ NSTRACE (("[EmacsView windowShouldZoom:toFrame:" NSTRACE_FMT_RECT "]"
NSTRACE_FMT_RETURN "YES"),
NSTRACE_ARG_RECT (newFrame));
// all paths.
NSRect result = [sender frame];
- NSTRACE (("[windowWillUseStandardFrame: defaultFrame:"
+ NSTRACE (("[EmacsView windowWillUseStandardFrame:defaultFrame:"
NSTRACE_FMT_RECT "]"),
NSTRACE_ARG_RECT (defaultFrame));
NSTRACE_FSTYPE ("fs_state", fs_state);
- (void)windowDidDeminiaturize: sender
{
- NSTRACE ("windowDidDeminiaturize");
+ NSTRACE ("[EmacsView windowDidDeminiaturize:]");
if (!emacsframe->output_data.ns)
return;
- (void)windowDidExpose: sender
{
- NSTRACE ("windowDidExpose");
+ NSTRACE ("[EmacsView windowDidExpose:]");
if (!emacsframe->output_data.ns)
return;
- (void)windowDidMiniaturize: sender
{
- NSTRACE ("windowDidMiniaturize");
+ NSTRACE ("[EmacsView windowDidMiniaturize:]");
if (!emacsframe->output_data.ns)
return;
}
#endif
-#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-#define NSWindowDidEnterFullScreenNotification "NSWindowDidEnterFullScreenNotification"
-#endif
-
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
+ NSTRACE ("[EmacsView windowWillEnterFullScreen:]");
[self windowWillEnterFullScreen];
}
- (void)windowWillEnterFullScreen /* provided for direct calls */
{
- NSTRACE ("windowWillEnterFullScreen");
+ NSTRACE ("[EmacsView windowWillEnterFullScreen]");
fs_before_fs = fs_state;
}
-- (void)windowDidEnterFullScreen /* provided for direct calls */
+- (void)windowDidEnterFullScreen:(NSNotification *)notification
{
- [self windowDidEnterFullScreen:
- [NSNotification notificationWithName:NSWindowDidEnterFullScreenNotification
- object:[self window]]];
+ NSTRACE ("[EmacsView windowDidEnterFullScreen:]");
+ [self windowDidEnterFullScreen];
}
-- (void)windowDidEnterFullScreen:(NSNotification *)notification
+
+- (void)windowDidEnterFullScreen /* provided for direct calls */
{
- NSTRACE ("windowDidEnterFullScreen");
+ NSTRACE ("[EmacsView windowDidEnterFullScreen]");
[self setFSValue: FULLSCREEN_BOTH];
if (! [self fsIsNative])
{
- [self windowDidBecomeKey:notification];
+ [self windowDidBecomeKey];
[nonfs_window orderOut:self];
}
else
- (void)windowWillExitFullScreen:(NSNotification *)notification
{
+ NSTRACE ("[EmacsView windowWillExitFullScreen:]");
[self windowWillExitFullScreen];
}
- (void)windowWillExitFullScreen /* provided for direct calls */
{
- NSTRACE ("windowWillExitFullScreen");
+ NSTRACE ("[EmacsView windowWillExitFullScreen]");
if (!FRAME_LIVE_P (emacsframe))
{
NSTRACE_MSG ("Ignored (frame dead)");
- (void)windowDidExitFullScreen:(NSNotification *)notification
{
+ NSTRACE ("[EmacsView windowDidExitFullScreen:]");
[self windowDidExitFullScreen];
}
- (void)windowDidExitFullScreen /* provided for direct calls */
{
- NSTRACE ("windowDidExitFullScreen");
+ NSTRACE ("[EamcsView windowDidExitFullScreen]");
if (!FRAME_LIVE_P (emacsframe))
{
NSTRACE_MSG ("Ignored (frame dead)");
- (BOOL)isFullscreen
{
+ NSTRACE ("[EmacsView isFullscreen]");
+
if (! fs_is_native) return nonfs_window != nil;
#ifdef HAVE_NATIVE_FS
return ([[self window] styleMask] & NSFullScreenWindowMask) != 0;
#ifdef HAVE_NATIVE_FS
- (void)updateCollectionBehavior
{
+ NSTRACE ("[EmacsView updateCollectionBehavior]");
+
if (! [self isFullscreen])
{
NSWindow *win = [self window];
NSRect r, wr;
NSColor *col;
- NSTRACE ("toggleFullScreen");
+ NSTRACE ("[EmacsView toggleFullScreen:]");
if (fs_is_native)
{
- (void)handleFS
{
- NSTRACE ("handleFS");
+ NSTRACE ("[EmacsView handleFS]");
if (fs_state != emacsframe->want_fullscreen)
{
- (void) setFSValue: (int)value
{
- NSTRACE ("setFSValue");
- NSTRACE_FSTYPE ("value", value);
+ NSTRACE ("[EmacsView setFSValue:" NSTRACE_FMT_FSTYPE "]",
+ NSTRACE_ARG_FSTYPE(value));
Lisp_Object lval = Qnil;
switch (value)
- (void)mouseEntered: (NSEvent *)theEvent
{
- NSTRACE ("mouseEntered");
+ NSTRACE ("[EmacsView mouseEntered:]");
if (emacsframe)
FRAME_DISPLAY_INFO (emacsframe)->last_mouse_movement_time
= EV_TIMESTAMP (theEvent);
{
Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
- NSTRACE ("mouseExited");
+ NSTRACE ("[EmacsView mouseExited:]");
if (!hlinfo)
return;
- menuDown: sender
{
- NSTRACE ("menuDown");
+ NSTRACE ("[EmacsView menuDown:]");
if (context_menu_value == -1)
context_menu_value = [sender tag];
else
NSEvent *theEvent;
int idx = [item tag] * TOOL_BAR_ITEM_NSLOTS;
- NSTRACE ("toolbarClicked");
+ NSTRACE ("[EmacsView toolbarClicked:]");
if (!emacs_event)
return self;
- toggleToolbar: (id)sender
{
+ NSTRACE ("[EmacsView toggleToolbar:]");
+
if (!emacs_event)
return self;
int x = NSMinX (rect), y = NSMinY (rect);
int width = NSWidth (rect), height = NSHeight (rect);
- NSTRACE ("drawRect");
- NSTRACE_RECT ("input", rect);
+ NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]",
+ NSTRACE_ARG_RECT(rect));
if (!emacsframe || !emacsframe->output_data.ns)
return;
-(NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
{
- NSTRACE ("draggingEntered");
+ NSTRACE ("[EmacsView draggingEntered:]");
return NSDragOperationGeneric;
}
NSDragOperation op = [sender draggingSourceOperationMask];
int modifiers = 0;
- NSTRACE ("performDragOperation");
+ NSTRACE ("[EmacsView performDragOperation:]");
if (!emacs_event)
return NO;
- (id) validRequestorForSendType: (NSString *)typeSent
returnType: (NSString *)typeReturned
{
- NSTRACE ("validRequestorForSendType");
+ NSTRACE ("[EmacsView validRequestorForSendType:returnType:]");
if (typeSent != nil && [ns_send_types indexOfObject: typeSent] != NSNotFound
&& typeReturned == nil)
{
NSArray *typesDeclared;
Lisp_Object val;
+ NSTRACE ("[EmacsView writeSelectionToPasteboard:types:]");
+
/* We only support NSStringPboardType */
if ([types containsObject:NSStringPboardType] == NO) {
return NO;
- setMiniwindowImage: (BOOL) setMini
{
id image = [[self window] miniwindowImage];
- NSTRACE ("setMiniwindowImage");
+ NSTRACE ("[EmacsView setMiniwindowImage:%d]", setMini);
/* NOTE: under Cocoa miniwindowImage always returns nil, documentation
about "AppleDockIconEnabled" notwithstanding, however the set message
struct frame *f = SELECTED_FRAME ();
struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->contents);
+ NSTRACE ("[EmacsWindow accessibilityAttributeValue:]");
+
if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
return NSAccessibilityTextFieldRole;
large screen). */
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
{
- NSTRACE ("constrainFrameRect:" NSTRACE_FMT_RECT " toScreen:",
+ NSTRACE ("[EmacsWindow constrainFrameRect:" NSTRACE_FMT_RECT " toScreen:]",
NSTRACE_ARG_RECT (frameRect));
#ifdef NS_IMPL_COCOA
- (void)performZoom:(id)sender
{
- NSTRACE ("performZoom");
+ NSTRACE ("[EmacsWindow performZoom:]");
return [super performZoom:sender];
}
{
struct frame * f = SELECTED_FRAME ();
- NSTRACE ("zoom");
+ NSTRACE ("[EmacsWindow zoom:]");
ns_update_auto_hide_menu_bar();
|| newWr.origin.x != wr.origin.x
|| newWr.origin.y != wr.origin.y)
{
- NSTRACE_RECT ("Corrected rect", newWr);
+ NSTRACE_MSG ("New frame different");
[self setFrame: newWr display: NO];
}
}
#endif
}
+- (void)setFrame:(NSRect)windowFrame
+ display:(BOOL)displayViews
+{
+ NSTRACE ("[EmacsWindow setFrame:" NSTRACE_FMT_RECT " display:%d]",
+ NSTRACE_ARG_RECT (windowFrame), displayViews);
+
+ [super setFrame:windowFrame display:displayViews];
+}
+
+- (void)setFrame:(NSRect)windowFrame
+ display:(BOOL)displayViews
+ animate:(BOOL)performAnimation
+{
+ NSTRACE ("[EmacsWindow setFrame:" NSTRACE_FMT_RECT
+ " display:%d performAnimation:%d]",
+ NSTRACE_ARG_RECT (windowFrame), displayViews, performAnimation);
+
+ [super setFrame:windowFrame display:displayViews animate:performAnimation];
+}
+
+- (void)setFrameTopLeftPoint:(NSPoint)point
+{
+ NSTRACE ("[EmacsWindow setFrameTopLeftPoint:" NSTRACE_FMT_POINT "]",
+ NSTRACE_ARG_POINT (point));
+
+ [super setFrameTopLeftPoint:point];
+}
@end /* EmacsWindow */
- initFrame: (NSRect )r window: (Lisp_Object)nwin
{
- NSTRACE ("EmacsScroller_initFrame");
+ NSTRACE ("[EmacsScroller initFrame: window:]");
r.size.width = [EmacsScroller scrollerWidth];
[super initWithFrame: r/*NSMakeRect (0, 0, 0, 0)*/];
- (void)setFrame: (NSRect)newRect
{
- NSTRACE ("EmacsScroller_setFrame");
+ NSTRACE ("[EmacsScroller setFrame:]");
+
/* block_input (); */
pixel_height = NSHeight (newRect);
if (pixel_height == 0) pixel_height = 1;
- (void)dealloc
{
- NSTRACE ("EmacsScroller_dealloc");
+ NSTRACE ("[EmacsScroller dealloc]");
if (window)
wset_vertical_scroll_bar (window, Qnil);
window = 0;
- condemn
{
- NSTRACE ("condemn");
+ NSTRACE ("[EmacsScroller condemn]");
condemned =YES;
return self;
}
- reprieve
{
- NSTRACE ("reprieve");
+ NSTRACE ("[EmacsScroller reprieve]");
condemned =NO;
return self;
}
-(bool)judge
{
- NSTRACE ("judge");
+ NSTRACE ("[EmacsScroller judge]");
bool ret = condemned;
if (condemned)
{
- (void)resetCursorRects
{
NSRect visible = [self visibleRect];
- NSTRACE ("resetCursorRects");
+ NSTRACE ("[EmacsScroller resetCursorRects]");
if (!NSIsEmptyRect (visible))
[self addCursorRect: visible cursor: [NSCursor arrowCursor]];
- setPosition: (int)position portion: (int)portion whole: (int)whole
{
- NSTRACE ("setPosition");
+ NSTRACE ("[EmacsScroller setPosition:portion:whole:]");
em_position = position;
em_portion = portion;
- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e
{
Lisp_Object win;
+
+ NSTRACE ("[EmacsScroller sendScrollEventAtLoc:fromEvent:]");
+
if (!emacs_event)
return;
NSPoint p = [[self window] mouseLocationOutsideOfEventStream];
BOOL inKnob = [self testPart: p] == NSScrollerKnob;
+ NSTRACE ("[EmacsScroller repeatScroll:]");
+
/* clear timer if need be */
if (inKnob || [scroll_repeat_entry timeInterval] == SCROLL_BAR_FIRST_DELAY)
{
CGFloat inc = 0.0, loc, kloc, pos;
int edge = 0;
- NSTRACE ("EmacsScroller_mouseDown");
+ NSTRACE ("[EmacsScroller mouseDown:]");
switch (part)
{
NSRect sr;
double loc, pos;
- NSTRACE ("EmacsScroller_mouseDragged");
+ NSTRACE ("[EmacsScroller mouseDragged:]");
sr = [self convertRect: [self rectForPart: NSScrollerKnobSlot]
toView: nil];
- (void)mouseUp: (NSEvent *)e
{
+ NSTRACE ("[EmacsScroller mouseUp:]");
+
if (scroll_repeat_entry)
{
[scroll_repeat_entry invalidate];
/* treat scrollwheel events in the bar as though they were in the main window */
- (void) scrollWheel: (NSEvent *)theEvent
{
+ NSTRACE ("[EmacsScroller scrollWheel:]");
+
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (frame);
[view mouseDown: theEvent];
}