aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorAnders Lindgren2015-10-23 07:58:02 +0200
committerAnders Lindgren2015-10-23 07:58:02 +0200
commitba24d35a3e82cdeba4be5bd794f7f48bbfa5498e (patch)
treeafd99e3b51d9773d178bdc1b972ddd6a367385e3 /src/nsfns.m
parent3768304c6a501fb5bc90ed9e21a63aebd314a44e (diff)
downloademacs-ba24d35a3e82cdeba4be5bd794f7f48bbfa5498e.tar.gz
emacs-ba24d35a3e82cdeba4be5bd794f7f48bbfa5498e.zip
NextSten maximization and NSTRACE rewrite.
Full-height, full-width, and maximized windows now cover the entire screen (except the menu bar), including the part where the system dock is placed. The system zoom animation is no longer used. Made NonMaximized->FullWidth->FullHeight->NonMaximized restore the original size. * nsterm.m (ns_menu_bar_height): New function, return height of the menu bar, or 0 when it's hidden. * nsterm.m (constrain_frame_rect): New function for constraining a frame. * nsterm.m (ns_constrain_all_frames): Set frame size explicitly rather than relying on the system doing it for us by writing back the current frame size. * nsterm.m (windowWillUseStandardFrame): Register non-maximized width or height as new user size. When entering full width or height, the other size component is taken from the user size. * nsterm.m (fullscreenState): New method for accessing the fullscreen state. * nsterm.m (constrainFrameRect): Restrict frame to be placed under the menu bar, if present. The old version, sometimes, restricted the height of a frame to the screen, this version never does this. * nsterm.m (zoom): Perform zoom by setting the frame to the full size of the screen (minus the menu bar). The default system function, with the zoom animation, is no longer used, as the final frame size doesn't cover the entire screen. Rework how to constrain resizing to the character grid. The old system used "resizeIncrements" in NSWindows. However, once a frame was resized so that it was not aligned to the text grid, it remained unaligned even after a resize. In addition, it conflicted when resizing a fullheight window. * nsterm.m (windowWillResize): Restrict frame size to text grid, unless when pixelwise frame resizing is enabled. * nsterm.m (updateFrameSize, initFrameFromEmacs) (toggleFullScreen, handleFS): Don't set resizeIncrements. Redesign the NS trace system. The call structure is represented using indentations and vertical lines. The NSTRACE macro accepts printf-style arguments. New macros for printing various information. * nsterm.h (NSTRACE_ENABLED): Macro to enable trace system. * nsterm.h (NSTRACE, NSTRACE_WHEN, NSTRACE_UNLESS): Macros to start a new block (typically a function), accept printf-style arguments. * nsterm.h (NSTRACE_MSG): Macro for extra information, accepts printf-style arguments. * nsterm.h (NSTRACE_what): Macros for printing various types. * nsterm.h (NSTRACE_FMT_what): Macro with printf format string snippets. * nsterm.h (NSTRACE_ARG_what): Macros for passing printf-style arguments, corresponds to NSTRACE_FMT_what. * nsterm.h (NSTRACE_RETURN): Macro to print return value, accept printf-style arguments. * nsterm.h (NSTRACE_RETURN_what): Macros to print return value for various types. * nsterm.m: Remove old NSTRACE macro. * nsterm.m (nstrace_num): Trace counter. * nsterm.m (nstrace_depth): Current call depth. * nsterm.m (nstrace_leave): NSTRACE support function, called when the local variable "nstrace_enabled" goes out of scope using the "cleanup" extension. * nsterm.m (ns_print_fullscreen_type_name): NSTRACE_FSTYPE support function. * nsterm.m (constrain_frame_rect, ns_constrain_all_frames) (ns_update_auto_hide_menu_bar, ns_update_begin) (ns_update_window_begin, update_window_end, ns_update_end) (ns_focus, ns_unfocus, ns_ring_bell, ns_frame_raise_lower) (ns_frame_rehighlight, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_free_frame_resources) (x_destroy_window, x_set_offset, x_set_window_size) (ns_fullscreen_hook, ns_lisp_to_color, ns_color_to_lisp) (ns_defined_color, frame_set_mouse_pixel_position) (note_mouse_movement, ns_mouse_position, ns_frame_up_to_date) (ns_define_frame_cursor, x_get_keysym_name, ns_redraw_scroll_bars) (ns_clear_frame, ns_clear_frame_area, ns_scroll_run) (ns_after_update_window_line, ns_shift_glyphs_for_insert) (dumpcursor, ns_draw_vertical_window_border) (ns_draw_window_divider, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) (ns_dumpglyphs_image, ns_draw_glyph_string, ns_send_appdefined) (ns_read_socket, ns_select, ns_set_vertical_scroll_bar) (ns_set_horizontal_scroll_bar, ns_condemn_scroll_bars) (ns_redeem_scroll_bar, ns_judge_scroll_bars, ns_delete_terminal) (ns_create_terminal, ns_term_init, sendEvent) (applicationDidFinishLaunching, applicationDidBecomeActive) (timeout_handler, fd_handler, EmacsView_dealloc, changeFont) (acceptsFirstResponder, resetCursorRects, keyDown, mouseDown) (deltaIsZero, rightMouseDown, otherMouseDown, mouseUp) (rightMouseUp, otherMouseUp, scrollWheel, mouseMoved) (mouse_autoselect_window, in_window, mouseDragged) (rightMouseDragged, otherMouseDragged, windowShouldClose) (updateFrameSize, windowWillResize, windowDidResize) (windowDidBecomeKey, windowDidResignKey, windowWillMiniaturize) (initFrameFromEmacs, windowDidMove, windowDidDeminiaturize) (windowDidExpose, windowDidMiniaturize, windowWillEnterFullScreen) (windowDidEnterFullScreen, windowWillExitFullScreen) (windowDidExitFullScreen, toggleFullScreen, handleFS, setFSValue) (mouseEntered, mouseExited, menuDown, toolbarClicked, drawRect) (draggingEntered, performDragOperation, validRequestorForSendType) (setMiniwindowImage, constrainFrameRect, performZoom, zoom) (EmacsScroller_initFrame, EmacsScroller_setFrame) (EmacsScroller_dealloc, condemn, reprieve, judge) (resetCursorRects, setPosition, EmacsScroller_mouseDown) (EmacsScroller_mouseDragged, syms_of_nsterm): Use new trace system. * nsfns.m: Remove old NSTRACE macro. * nsfns.m (x_set_icon_name, ns_set_name, x_explicitly_set_name) (x_implicitly_set_name, x_set_title, ns_set_name_as_filename) (ns_implicitly_set_icon_type, x_set_icon_type): Use new trace system. * nsimage.m: Remove old NSTRACE macro. * nsimage.m (ns_image_from_XBM, ns_image_for_XPM) (ns_image_from_bitmap_file, ns_load_image): Use new trace system. * nsmenu.m: Remove old NSTRACE macro. * nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog): Use new trace system.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 43002ca6fef..1ed3e23cba5 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -49,13 +49,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
49#include "macfont.h" 49#include "macfont.h"
50#endif 50#endif
51 51
52#if 0
53int fns_trace_num = 1;
54#define NSTRACE(x) fprintf (stderr, "%s:%d: [%d] " #x "\n", \
55 __FILE__, __LINE__, ++fns_trace_num)
56#else
57#define NSTRACE(x)
58#endif
59 52
60#ifdef HAVE_NS 53#ifdef HAVE_NS
61 54
@@ -364,7 +357,7 @@ static void
364x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 357x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
365{ 358{
366 NSView *view = FRAME_NS_VIEW (f); 359 NSView *view = FRAME_NS_VIEW (f);
367 NSTRACE (x_set_icon_name); 360 NSTRACE ("x_set_icon_name");
368 361
369 /* see if it's changed */ 362 /* see if it's changed */
370 if (STRINGP (arg)) 363 if (STRINGP (arg))
@@ -436,7 +429,7 @@ ns_set_name_internal (struct frame *f, Lisp_Object name)
436static void 429static void
437ns_set_name (struct frame *f, Lisp_Object name, int explicit) 430ns_set_name (struct frame *f, Lisp_Object name, int explicit)
438{ 431{
439 NSTRACE (ns_set_name); 432 NSTRACE ("ns_set_name");
440 433
441 /* Make sure that requests from lisp code override requests from 434 /* Make sure that requests from lisp code override requests from
442 Emacs redisplay code. */ 435 Emacs redisplay code. */
@@ -477,7 +470,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit)
477static void 470static void
478x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 471x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
479{ 472{
480 NSTRACE (x_explicitly_set_name); 473 NSTRACE ("x_explicitly_set_name");
481 ns_set_name (f, arg, 1); 474 ns_set_name (f, arg, 1);
482} 475}
483 476
@@ -488,7 +481,7 @@ x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
488void 481void
489x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 482x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
490{ 483{
491 NSTRACE (x_implicitly_set_name); 484 NSTRACE ("x_implicitly_set_name");
492 485
493 /* Deal with NS specific format t. */ 486 /* Deal with NS specific format t. */
494 if (FRAME_NS_P (f) && ((FRAME_ICONIFIED_P (f) && EQ (Vicon_title_format, Qt)) 487 if (FRAME_NS_P (f) && ((FRAME_ICONIFIED_P (f) && EQ (Vicon_title_format, Qt))
@@ -505,7 +498,7 @@ x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
505static void 498static void
506x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) 499x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
507{ 500{
508 NSTRACE (x_set_title); 501 NSTRACE ("x_set_title");
509 /* Don't change the title if it's already NAME. */ 502 /* Don't change the title if it's already NAME. */
510 if (EQ (name, f->title)) 503 if (EQ (name, f->title))
511 return; 504 return;
@@ -533,7 +526,7 @@ ns_set_name_as_filename (struct frame *f)
533 NSAutoreleasePool *pool; 526 NSAutoreleasePool *pool;
534 Lisp_Object encoded_name, encoded_filename; 527 Lisp_Object encoded_name, encoded_filename;
535 NSString *str; 528 NSString *str;
536 NSTRACE (ns_set_name_as_filename); 529 NSTRACE ("ns_set_name_as_filename");
537 530
538 if (f->explicit_name || ! NILP (f->title)) 531 if (f->explicit_name || ! NILP (f->title))
539 return; 532 return;
@@ -729,7 +722,7 @@ ns_implicitly_set_icon_type (struct frame *f)
729 NSAutoreleasePool *pool; 722 NSAutoreleasePool *pool;
730 BOOL setMini = YES; 723 BOOL setMini = YES;
731 724
732 NSTRACE (ns_implicitly_set_icon_type); 725 NSTRACE ("ns_implicitly_set_icon_type");
733 726
734 block_input (); 727 block_input ();
735 pool = [[NSAutoreleasePool alloc] init]; 728 pool = [[NSAutoreleasePool alloc] init];
@@ -797,7 +790,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
797 id image = nil; 790 id image = nil;
798 BOOL setMini = YES; 791 BOOL setMini = YES;
799 792
800 NSTRACE (x_set_icon_type); 793 NSTRACE ("x_set_icon_type");
801 794
802 if (!NILP (arg) && SYMBOLP (arg)) 795 if (!NILP (arg) && SYMBOLP (arg))
803 { 796 {