diff options
| author | Kenichi Handa <handa@gnu.org> | 2012-10-07 21:58:14 +0900 |
|---|---|---|
| committer | Kenichi Handa <handa@gnu.org> | 2012-10-07 21:58:14 +0900 |
| commit | dade5fca51ce2ed10fdace1cfcf78287599154a1 (patch) | |
| tree | 299c84e1ce2c5a95237b41781113790626d259c5 /src | |
| parent | 6aa75fb62f6cdc4164d935ef14d57feec5ed6e0a (diff) | |
| parent | 78d876b90e52400b7bbb086ca1a471d3d20d0e98 (diff) | |
| download | emacs-dade5fca51ce2ed10fdace1cfcf78287599154a1.tar.gz | |
merge trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 62 | ||||
| -rw-r--r-- | src/nsfns.m | 47 | ||||
| -rw-r--r-- | src/nsimage.m | 8 | ||||
| -rw-r--r-- | src/nsmenu.m | 5 | ||||
| -rw-r--r-- | src/nsselect.m | 4 | ||||
| -rw-r--r-- | src/nsterm.h | 16 | ||||
| -rw-r--r-- | src/nsterm.m | 232 | ||||
| -rw-r--r-- | src/sysdep.c | 18 | ||||
| -rw-r--r-- | src/syssignal.h | 2 |
9 files changed, 182 insertions, 212 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 956e78e6c7e..492b966a256 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,65 @@ +2012-10-07 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (ns_dumpglyphs_image): Only draw slize of image (Bug#12506). + + * nsterm.m (ns_update_auto_hide_menu_bar): Remove defintion of + MAC_OS_X_VERSION_10_6. + (syms_of_nsterm): Remove comment about Panther and above for ns-antialias-text. + * nsterm.h (MAC_OS_X_VERSION_10_3, onTiger): Remove. + (EmacsApp): Remove check for >= MAC_OS_X_VERSION_10_4. + (struct nsfont_info): Remove check for >= MAC_OS_X_VERSION_10_3. + + * nsselect.m (ns_string_from_pasteboard): Remove check for >= + MAC_OS_X_VERSION_10_4. + + * nsmenu.m (fillWithWidgetValue:): Remove code for < MAC_OS_X_VERSION_10_2. + + * nsimage.m (setPixmapData, getPixelAtX, setAlphaAtX): Remove onTiger. + + * nsfns.m (Fns_list_services): Remove comment and check for OSX < 10.4. + (ns_do_applescript): Remove check for >= MAC_OS_X_VERSION_10_4. + + * nsterm.m (ns_in_resize): Remove (Bug#12479). + (ns_resize_handle_rect, mouseDown, mouseUp, mouseDragged): Remove. + (ns_clear_frame, sendEvent, windowDidResize, drawRect:): Remove ns_in_resize + check. + (ns_clear_frame_area): Remove resize handle code. + + * nsfns.m (ns_in_resize): Remove. + (x_set_icon_name, ns_set_name, ns_set_name_as_filename): Remove ns_in_resize + check. + +2012-10-07 Paul Eggert <eggert@cs.ucla.edu> + + Improve sys_siglist detection. + * sysdep.c (sys_siglist, init_signals): Use _sys_siglist if it's + defined as a macro, as is done in Solaris. + (sys_siglist_entries): New macro. + (save_strsignal): Use it. + * syssignal.h (safe_strsignal): Now ATTRIBUTE_CONST, to pacify + GCC 4.7.2 on Fedora 17 with the fixed sys_siglist detection. + +2012-10-06 Jan Djärv <jan.h.d@swipnet.se> + + * nsfns.m (Fx_create_frame): Call x_default_parameter with + fullscreen/Fullscreen. + + * nsterm.h (EmacsView): Rename tbar_height to tibar_height. + tobar_height is new. + + * nsterm.m (x_make_frame_visible): Check for fullscreen. + (ns_fullscreen_hook): Activate old style fullscreen with a timer. + (ns_term_init): Set activateIgnoringOtherApps if old style fullscreen. + (windowDidResize:): Check for correct window if old style fullscreen. + Capitalize word in comment. Remove incorrect comment. + (initFrameFromEmacs:): tbar_height renamed tibar_height. + (windowDidEnterFullScreen:): Toggle toolbar for fullscreen to fix + error in drawing background. + (toggleFullScreen:): Remove comment. Rearrange calls. + Set toolbar values to zero, save old height in tobar_height. + Restore tool bar height when leaving fullscreen. + (canBecomeMainWindow): New function. + 2012-10-06 Paul Eggert <eggert@cs.ucla.edu> * keyboard.c (read_char): Remove unnecessary 'volatile's and label. diff --git a/src/nsfns.m b/src/nsfns.m index 1efadf0cb98..7a22ac547c3 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -93,8 +93,6 @@ EmacsTooltip *ns_tooltip; /* Need forward declaration here to preserve organizational integrity of file */ Lisp_Object Fx_open_connection (Lisp_Object, Lisp_Object, Lisp_Object); -extern BOOL ns_in_resize; - /* Static variables to handle applescript execution. */ static Lisp_Object as_script, *as_result; static int as_status; @@ -433,9 +431,6 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) NSView *view = FRAME_NS_VIEW (f); NSTRACE (x_set_icon_name); - if (ns_in_resize) - return; - /* see if it's changed */ if (STRINGP (arg)) { @@ -511,9 +506,6 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit) { NSTRACE (ns_set_name); - if (ns_in_resize) - return; - /* Make sure that requests from lisp code override requests from Emacs redisplay code. */ if (explicit) @@ -612,7 +604,7 @@ ns_set_name_as_filename (struct frame *f) NSString *str; NSTRACE (ns_set_name_as_filename); - if (f->explicit_name || ! NILP (f->title) || ns_in_resize) + if (f->explicit_name || ! NILP (f->title)) return; block_input (); @@ -1346,6 +1338,8 @@ This function is an internal primitive--use `make-frame' instead. */) RES_TYPE_NUMBER); x_default_parameter (f, parms, Qalpha, Qnil, "alpha", "Alpha", RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qfullscreen, Qnil, + "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); width = FRAME_COLS (f); height = FRAME_LINES (f); @@ -1955,32 +1949,29 @@ DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0, check_ns (); svcs = [[NSMenu alloc] initWithTitle: @"Services"]; - [NSApp setServicesMenu: svcs]; /* this and next rebuild on <10.4 */ + [NSApp setServicesMenu: svcs]; [NSApp registerServicesMenuSendTypes: ns_send_types returnTypes: ns_return_types]; /* On Tiger, services menu updating was made lazier (waits for user to actually click on the menu), so we have to force things along: */ #ifdef NS_IMPL_COCOA - if (NSAppKitVersionNumber >= 744.0) + delegate = [svcs delegate]; + if (delegate != nil) { - delegate = [svcs delegate]; - if (delegate != nil) + if ([delegate respondsToSelector: @selector (menuNeedsUpdate:)]) + [delegate menuNeedsUpdate: svcs]; + if ([delegate respondsToSelector: + @selector (menu:updateItem:atIndex:shouldCancel:)]) { - if ([delegate respondsToSelector: @selector (menuNeedsUpdate:)]) - [delegate menuNeedsUpdate: svcs]; - if ([delegate respondsToSelector: - @selector (menu:updateItem:atIndex:shouldCancel:)]) - { - int i, len = [delegate numberOfItemsInMenu: svcs]; - for (i =0; i<len; i++) - [svcs addItemWithTitle: @"" action: NULL keyEquivalent: @""]; - for (i =0; i<len; i++) - if (![delegate menu: svcs - updateItem: (NSMenuItem *)[svcs itemAtIndex: i] - atIndex: i shouldCancel: NO]) - break; - } + int i, len = [delegate numberOfItemsInMenu: svcs]; + for (i =0; i<len; i++) + [svcs addItemWithTitle: @"" action: NULL keyEquivalent: @""]; + for (i =0; i<len; i++) + if (![delegate menu: svcs + updateItem: (NSMenuItem *)[svcs itemAtIndex: i] + atIndex: i shouldCancel: NO]) + break; } } #endif @@ -2081,7 +2072,7 @@ ns_do_applescript (Lisp_Object script, Lisp_Object *result) *result = Qt; // script returned an AppleScript result if ((typeUnicodeText == [returnDescriptor descriptorType]) || -#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +#if defined (NS_IMPL_COCOA) (typeUTF16ExternalRepresentation == [returnDescriptor descriptorType]) || #endif diff --git a/src/nsimage.m b/src/nsimage.m index 370cf832c7c..884c0763fd4 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -403,7 +403,6 @@ static EmacsImage *ImageList = nil; if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)]) { bmRep = (NSBitmapImageRep *) rep; - onTiger = [bmRep respondsToSelector: @selector (colorAtX:y:)]; if ([bmRep numberOfPlanes] >= 3) [bmRep getBitmapDataPlanes: pixmapData]; @@ -435,7 +434,7 @@ static EmacsImage *ImageList = nil; | (pixmapData[0][loc] << 16) | (pixmapData[1][loc] << 8) | (pixmapData[2][loc]); } - else if (onTiger) + else { NSColor *color = [bmRep colorAtX: x y: y]; CGFloat r, g, b, a; @@ -445,7 +444,6 @@ static EmacsImage *ImageList = nil; | ((int)(b * 255.0)); } - return 0; } - (void) setPixelAtX: (int)x Y: (int)y toRed: (unsigned char)r @@ -463,7 +461,7 @@ static EmacsImage *ImageList = nil; pixmapData[2][loc] = b; pixmapData[3][loc] = a; } - else if (onTiger) + else { [bmRep setColor: [NSColor colorWithCalibratedRed: (r/255.0) green: (g/255.0) @@ -483,7 +481,7 @@ static EmacsImage *ImageList = nil; pixmapData[3][loc] = a; } - else if (onTiger) + else { NSColor *color = [bmRep colorAtX: x y: y]; color = [color colorWithAlphaComponent: (a / 255.0)]; diff --git a/src/nsmenu.m b/src/nsmenu.m index b60cc005c5f..9af732c6c45 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -722,11 +722,6 @@ extern NSString *NSMenuDidBeginTrackingNotification; #ifdef NS_IMPL_GNUSTEP if ([[self window] isVisible]) [self sizeToFit]; -#else -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2 - if ([self supermenu] == nil) - [self sizeToFit]; -#endif #endif } diff --git a/src/nsselect.m b/src/nsselect.m index 95bc1a95957..c0c412c6fb2 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -295,7 +295,7 @@ ns_string_from_pasteboard (id pb) utfStr = [mstr UTF8String]; length = [mstr lengthOfBytesUsingEncoding: NSUTF8StringEncoding]; -#if ! defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 +#if ! defined (NS_IMPL_COCOA) if (!utfStr) { utfStr = [mstr cString]; @@ -306,7 +306,7 @@ ns_string_from_pasteboard (id pb) NS_HANDLER { message1 ("ns_string_from_pasteboard: UTF8String failed\n"); -#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +#if defined (NS_IMPL_COCOA) utfStr = "Conversion failed"; #else utfStr = [str lossyCString]; diff --git a/src/nsterm.h b/src/nsterm.h index f06e0cb0f7f..958d1ce7853 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -26,9 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_NS #ifdef NS_IMPL_COCOA -#ifndef MAC_OS_X_VERSION_10_3 -#define MAC_OS_X_VERSION_10_3 1030 -#endif #ifndef MAC_OS_X_VERSION_10_4 #define MAC_OS_X_VERSION_10_4 1040 #endif @@ -86,7 +83,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ BOOL windowClosing; NSString *workingText; BOOL processingCompose; - int fs_state, fs_before_fs, next_maximized, tbar_height, bwidth; + int fs_state, fs_before_fs, next_maximized; + int tibar_height, tobar_height, bwidth; int maximized_width, maximized_height; NSWindow *nonfs_window; @public @@ -285,7 +283,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ int refCount; NSBitmapImageRep *bmRep; /* used for accessing pixel data */ unsigned char *pixmapData[5]; /* shortcut to access pixel data */ - BOOL onTiger; NSColor *stippleMask; } + allocInitFromFile: (Lisp_Object)file; @@ -354,7 +351,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* ========================================================================== - Rendering on Panther and above + Rendering ========================================================================== */ @@ -379,7 +376,7 @@ extern NSString *ns_app_name; extern EmacsMenu *mainMenu, *svcsMenu, *dockMenu; /* Apple removed the declaration, but kept the implementation */ -#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +#if defined (NS_IMPL_COCOA) @interface NSApplication (EmacsApp) - (void)setAppleMenu: (NSMenu *)menu; @end @@ -482,10 +479,9 @@ struct nsfont_info float size; #ifdef __OBJC__ NSFont *nsfont; - /* cgfont and synthItal are used only on OS X 10.3+ */ -#if defined (NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) +#if defined (NS_IMPL_COCOA) CGFontRef cgfont; -#else /* GNUstep or OS X < 10.3 */ +#else /* GNUstep */ void *cgfont; #endif #else /* ! OBJC */ diff --git a/src/nsterm.m b/src/nsterm.m index 2df0e1a1ad5..6b739befeeb 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -183,7 +183,6 @@ static int ns_window_num = 0; static NSRect uRect; #endif static BOOL gsaved = NO; -BOOL ns_in_resize = NO; static BOOL ns_fake_keydown = NO; int ns_tmp_flags; /* FIXME */ struct nsfont_info *ns_tmp_font; /* FIXME */ @@ -493,17 +492,6 @@ ns_release_autorelease_pool (void *pool) ========================================================================== */ -static NSRect -ns_resize_handle_rect (NSWindow *window) -{ - NSRect r = [window frame]; - r.origin.x = r.size.width - RESIZE_HANDLE_SIZE; - r.origin.y = 0; - r.size.width = r.size.height = RESIZE_HANDLE_SIZE; - return r; -} - - // // Window constraining // ------------------- @@ -581,9 +569,6 @@ ns_menu_bar_should_be_hidden (void) static void ns_update_auto_hide_menu_bar (void) { -#ifndef MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_10_6 1060 -#endif #ifdef NS_IMPL_COCOA #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 block_input (); @@ -1068,8 +1053,23 @@ x_make_frame_visible (struct frame *f) if this ends up the case again, comment this out again. */ if (!FRAME_VISIBLE_P (f)) { + EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); f->async_visible = 1; ns_raise_frame (f); + +#ifdef NEW_STYLE_FS + /* Making a new frame from a fullscreen frame will make the new frame + fullscreen also. So skip handleFS as this will print an error. */ + if (f->want_fullscreen == FULLSCREEN_BOTH + && ([[view window] styleMask] & NSFullScreenWindowMask) != 0) + return; +#endif + if (f->want_fullscreen != FULLSCREEN_NONE) + { + block_input (); + [view handleFS]; + unblock_input (); + } } } @@ -1317,6 +1317,18 @@ ns_fullscreen_hook (FRAME_PTR f) EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); if (! f->async_visible) return; +#ifndef NEW_STYLE_FS + if (f->want_fullscreen == FULLSCREEN_BOTH) + { + /* Old style fs don't initiate correctly if created from + init/default-frame alist, so use a timer (not nice...). + */ + [NSTimer scheduledTimerWithTimeInterval: 0.5 target: view + selector: @selector (handleFS) + userInfo: nil repeats: NO]; + return; + } +#endif block_input (); [view handleFS]; @@ -1956,8 +1968,6 @@ ns_clear_frame (struct frame *f) NSRect r; NSTRACE (ns_clear_frame); - if (ns_in_resize) - return; /* comes on initial frame because we have after-make-frame-functions = select-frame */ @@ -1977,10 +1987,6 @@ ns_clear_frame (struct frame *f) NSRectFill (r); ns_unfocus (f); -#ifdef NS_IMPL_COCOA - [[view window] display]; /* redraw resize handle */ -#endif - /* as of 2006/11 or so this is now needed */ ns_redraw_scroll_bars (f); unblock_input (); @@ -2006,35 +2012,8 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height) ns_focus (f, &r, 1); [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; -#ifdef NS_IMPL_COCOA - { - /* clip out the resize handle */ - NSWindow *window = [FRAME_NS_VIEW (f) window]; - NSRect ir - = [view convertRect: ns_resize_handle_rect (window) fromView: nil]; - - ir = NSIntersectionRect (r, ir); - if (NSIsEmptyRect (ir)) - { -#endif - NSRectFill (r); -#ifdef NS_IMPL_COCOA - } - else - { - NSRect r1 = r, r2 = r; /* upper and lower non-intersecting */ - r1.size.height -= ir.size.height; - r2.origin.y += r1.size.height; - r2.size.width -= ir.size.width; - r2.size.height = ir.size.height; - NSRectFill (r1); - NSRectFill (r2); - } - } -#endif - ns_unfocus (f); return; } @@ -2996,8 +2975,10 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) { #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height); + NSRect ir = NSMakeRect (s->slice.x, s->slice.y, + s->slice.width, s->slice.height); [img drawInRect: dr - fromRect: NSZeroRect + fromRect: ir operation: NSCompositeSourceOver fraction: 1.0 respectFlipped: YES @@ -4210,6 +4191,11 @@ ns_term_init (Lisp_Object display_name) NSColorPboardType, NSFontPboardType, nil] retain]; +#ifndef NEW_STYLE_FS + /* If fullscreen is in init/default-frame-alist, focus isn't set + right for fullscreen windows, so set this. */ + [NSApp activateIgnoringOtherApps:YES]; +#endif [NSApp run]; ns_do_open_file = YES; @@ -4282,34 +4268,6 @@ ns_term_shutdown (int sig) return; } -#ifdef NS_IMPL_COCOA - /* pass mouse down in resize handle and subsequent drags directly to - EmacsWindow so we can generate continuous redisplays */ - if (ns_in_resize) - { - if (type == NSLeftMouseDragged) - { - [window mouseDragged: theEvent]; - return; - } - else if (type == NSLeftMouseUp) - { - [window mouseUp: theEvent]; - return; - } - } - else if (type == NSLeftMouseDown) - { - NSRect r = ns_resize_handle_rect (window); - if (NSPointInRect ([theEvent locationInWindow], r)) - { - ns_in_resize = YES; - [window mouseDown: theEvent]; - return; - } - } -#endif - if (type == NSApplicationDefined) { /* Events posted by ns_send_appdefined interrupt the run loop here. @@ -5505,10 +5463,17 @@ not_in_argv (NSString *arg) - (void)windowDidResize: (NSNotification *)notification { + +#if !defined (NEW_STYLE_FS) && ! defined (NS_IMPL_GNUSTEP) + NSWindow *theWindow = [notification object]; + /* We can get notification on the non-FS window when in fullscreen mode. */ + if ([self window] != theWindow) return; +#endif + #ifdef NS_IMPL_GNUSTEP NSWindow *theWindow = [notification object]; - /* in GNUstep, at least currently, it's possible to get a didResize + /* In GNUstep, at least currently, it's possible to get a didResize without getting a willResize.. therefore we need to act as if we got the willResize now */ NSSize sz = [theWindow frame].size; @@ -5526,20 +5491,10 @@ not_in_argv (NSString *arg) } #endif /* NS_IMPL_COCOA */ - /* Avoid loop under GNUstep due to call at beginning of this function. - (x_set_window_size causes a resize which causes - a "windowDidResize" which calls x_set_window_size). */ -#ifndef NS_IMPL_GNUSTEP if (cols > 0 && rows > 0) { - if (ns_in_resize) - x_set_window_size (emacsframe, 0, cols, rows); - else - { - [self updateFrameSize: YES]; - } + [self updateFrameSize: YES]; } -#endif ns_send_appdefined (-1); } @@ -5661,7 +5616,7 @@ not_in_argv (NSString *arg) wr = [win frame]; bwidth = f->border_width = wr.size.width - r.size.width; - tbar_height = FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height; + tibar_height = FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height; [win setAcceptsMouseMovedEvents: YES]; [win setDelegate: self]; @@ -5870,8 +5825,16 @@ not_in_argv (NSString *arg) - (void)windowDidEnterFullScreen:(NSNotification *)notification { [self setFSValue: FULLSCREEN_BOTH]; -#ifndef NEW_STYLE_FS +#ifdef NEW_STYLE_FS + // Fix bad background. + if ([toolbar isVisible]) + { + [toolbar setVisible:NO]; + [toolbar setVisible:YES]; + } +#else [self windowDidBecomeKey:notification]; + [nonfs_window orderOut:self]; #endif } @@ -5891,11 +5854,6 @@ not_in_argv (NSString *arg) - (void)toggleFullScreen: (id)sender { - /* Bugs remain: - 1) Having fullscreen in initial/default frame alist. - 2) Fullscreen in default frame alist only applied to first frame. - */ - #ifdef NEW_STYLE_FS [[self window] toggleFullScreen:sender]; #else @@ -5904,7 +5862,7 @@ not_in_argv (NSString *arg) isEqual:[[NSScreen screens] objectAtIndex:0]]; struct frame *f = emacsframe; NSSize sz; - NSRect r; + NSRect r, wr = [w frame]; NSColor *col = ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f); @@ -5930,7 +5888,7 @@ not_in_argv (NSString *arg) } fw = [[EmacsFSWindow alloc] - initWithContentRect:[w contentRectForFrameRect:[w frame]] + initWithContentRect:[w contentRectForFrameRect:wr] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES @@ -5938,9 +5896,7 @@ not_in_argv (NSString *arg) [fw setContentView:[w contentView]]; [fw setTitle:[w title]]; - [fw makeKeyAndOrderFront:NSApp]; [fw setDelegate:self]; - [fw makeFirstResponder:self]; [fw setAcceptsMouseMovedEvents: YES]; [fw useOptimizedDrawing: YES]; [fw setResizeIncrements: sz]; @@ -5950,18 +5906,26 @@ not_in_argv (NSString *arg) f->border_width = 0; FRAME_NS_TITLEBAR_HEIGHT (f) = 0; + tobar_height = FRAME_TOOLBAR_HEIGHT (f); + FRAME_TOOLBAR_HEIGHT (f) = 0; + FRAME_EXTERNAL_TOOL_BAR (f) = 0; nonfs_window = w; + [self windowWillEnterFullScreen:nil]; + [fw makeKeyAndOrderFront:NSApp]; + [fw makeFirstResponder:self]; [w orderOut:self]; r = [fw frameRectForContentRect:[[fw screen] frame]]; [fw setFrame: r display:YES animate:YES]; [self windowDidEnterFullScreen:nil]; + [fw display]; } else { fw = w; w = nonfs_window; + nonfs_window = nil; if (onFirstScreen) { @@ -5980,7 +5944,10 @@ not_in_argv (NSString *arg) [w setOpaque: NO]; f->border_width = bwidth; - FRAME_NS_TITLEBAR_HEIGHT (f) = tbar_height; + FRAME_NS_TITLEBAR_HEIGHT (f) = tibar_height; + FRAME_TOOLBAR_HEIGHT (f) = tobar_height; + if (tobar_height) + FRAME_EXTERNAL_TOOL_BAR (f) = 1; [self windowWillExitFullScreen:nil]; [fw setFrame: [w frame] display:YES animate:YES]; @@ -6152,7 +6119,7 @@ not_in_argv (NSString *arg) NSTRACE (drawRect); - if (!emacsframe || !emacsframe->output_data.ns || ns_in_resize) + if (!emacsframe || !emacsframe->output_data.ns) return; ns_clear_frame_area (emacsframe, x, y, width, height); @@ -6489,60 +6456,6 @@ not_in_argv (NSString *arg) return [super constrainFrameRect:frameRect toScreen:screen]; } - -/* called only on resize clicks by special case in EmacsApp-sendEvent */ -- (void)mouseDown: (NSEvent *)theEvent -{ - if (ns_in_resize) - { - NSSize size = [[theEvent window] frame].size; - grabOffset = [theEvent locationInWindow]; - grabOffset.x = size.width - grabOffset.x; - } - else - [super mouseDown: theEvent]; -} - - -/* stop resizing */ -- (void)mouseUp: (NSEvent *)theEvent -{ - if (ns_in_resize) - { - struct frame *f = ((EmacsView *)[self delegate])->emacsframe; - ns_in_resize = NO; - ns_set_name_as_filename (f); - [self display]; - ns_send_appdefined (-1); - } - else - [super mouseUp: theEvent]; -} - - -/* send resize events */ -- (void)mouseDragged: (NSEvent *)theEvent -{ - if (ns_in_resize) - { - NSPoint p = [theEvent locationInWindow]; - NSSize size, vettedSize, origSize = [self frame].size; - - size.width = p.x + grabOffset.x; - size.height = origSize.height - p.y + grabOffset.y; - - if (size.width == origSize.width && size.height == origSize.height) - return; - - vettedSize = [[self delegate] windowWillResize: self toSize: size]; - [[NSNotificationCenter defaultCenter] - postNotificationName: NSWindowDidResizeNotification - object: self]; - } - else - [super mouseDragged: theEvent]; -} - @end /* EmacsWindow */ @@ -6553,6 +6466,11 @@ not_in_argv (NSString *arg) return YES; } +- (BOOL)canBecomeMainWindow +{ + return YES; +} + @end /* ========================================================================== @@ -7168,7 +7086,7 @@ allowing it to be used at a lower level for accented character entry."); ns_function_modifier = Qnone; DEFVAR_LISP ("ns-antialias-text", ns_antialias_text, - "Non-nil (the default) means to render text antialiased. Only has an effect on OS X Panther and above."); + "Non-nil (the default) means to render text antialiased."); ns_antialias_text = Qt; DEFVAR_LISP ("ns-confirm-quit", ns_confirm_quit, diff --git a/src/sysdep.c b/src/sysdep.c index 74617fcaf0f..35beeaa7202 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1545,8 +1545,18 @@ deliver_thread_signal (int sig, signal_handler_t handler) #if !HAVE_DECL_SYS_SIGLIST # undef sys_siglist -# define sys_siglist my_sys_siglist +# ifdef _sys_siglist +# define sys_siglist _sys_siglist +# else +# define sys_siglist my_sys_siglist static char const *sys_siglist[NSIG]; +# endif +#endif + +#ifdef _sys_nsig +# define sys_siglist_entries _sys_nsig +#else +# define sys_siglist_entries NSIG #endif /* Handle bus errors, invalid instruction, etc. */ @@ -1609,7 +1619,7 @@ init_signals (bool dumping) main_thread = pthread_self (); #endif -#if !HAVE_DECL_SYS_SIGLIST +#if !HAVE_DECL_SYS_SIGLIST && !defined _sys_siglist if (! initialized) { sys_siglist[SIGABRT] = "Aborted"; @@ -1757,7 +1767,7 @@ init_signals (bool dumping) sys_siglist[SIGXFSZ] = "File size limit exceeded"; # endif } -#endif /* !HAVE_DECL_SYS_SIGLIST */ +#endif /* !HAVE_DECL_SYS_SIGLIST && !_sys_siglist */ /* Don't alter signal handlers if dumping. On some machines, changing signal handlers sets static data that would make signals @@ -2285,7 +2295,7 @@ safe_strsignal (int code) { char const *signame = 0; - if (0 <= code && code < NSIG) + if (0 <= code && code < sys_siglist_entries) signame = sys_siglist[code]; if (! signame) signame = "Unknown signal"; diff --git a/src/syssignal.h b/src/syssignal.h index 83ab19698dd..2bf2f046aa5 100644 --- a/src/syssignal.h +++ b/src/syssignal.h @@ -43,7 +43,7 @@ extern sigset_t empty_mask; typedef void (*signal_handler_t) (int); extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); -char const *safe_strsignal (int); +char const *safe_strsignal (int) ATTRIBUTE_CONST; #if NSIG < NSIG_MINIMUM # undef NSIG |
