emacs/src/nsterm.h

1387 lines
45 KiB
C
Raw Normal View History

2021-09-30 10:56:26 +02:00
/* -*- objc -*- */
2008-07-15 18:15:18 +00:00
/* Definitions and headers for communication with NeXT/Open/GNUstep API.
2022-01-01 02:45:51 -05:00
Copyright (C) 1989, 1993, 2005, 2008-2022 Free Software Foundation,
2013-01-01 09:11:05 +00:00
Inc.
2008-07-15 18:15:18 +00:00
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
2008-07-15 18:15:18 +00:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
2008-07-15 18:15:18 +00:00
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
2008-07-15 18:15:18 +00:00
#include "dispextern.h"
#include "frame.h"
#include "character.h"
#include "font.h"
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
#include "sysselect.h"
Use fewer locks when accessing stdio * src/alloc.c, src/bidi.c, src/emacs-module.c, src/pdumper.c: * src/regex-emacs.c, src/unexhp9k800.c, src/unexmacosx.c: * src/widget.c, src/xdisp.c, src/xselect.c, src/xterm.c: Include sysstdio.h instead of stdio.h, to avoid locking stdio streams in many cases. * src/alloc.c (test_setjmp): * src/bidi.c (bidi_dump_cached_states): * src/cm.c (calccost): * src/dispnew.c (init_display_interactive): * src/emacs.c (main): * src/image.c (convert_mono_to_color_image): * src/minibuf.c (read_minibuf_noninteractive): * src/nsfont.m (ns_descriptor_to_entity) (ns_dump_glyphstring): * src/nsterm.h (NSTRACE_MSG_NO_DASHES): * src/nsterm.m (ns_mouse_position) (sendEvent:, keyDown:, performDragOperation:): * src/pdumper.c (dump_fingerprint, print_paths_to_root_1): * src/print.c (debug_print): * src/regex-emacs.c (debug_putchar, print_fastmap) (print_partial_compiled_pattern, print_compiled_pattern) (print_double_string, regex_compile): * src/term.c (vfatal): * src/unexhp9k800.c (read_header): * src/unexmacosx.c (unexec_error): * src/widget.c (EmacsFrameInitialize): * src/xdisp.c (message_to_stderr, vmessage, dump_glyph_row) (Fdump_glyph_matrix, Fdump_frame_glyph_matrix, dump_glyph_string): * src/xfaces.c (Fdump_colors, Fdump_face): * src/xselect.c (x_clipboard_manager_error_2): * src/xterm.c (x_initialize): * src/xwidget.c (WEBKIT_FN_INIT): Prefer unlocked calls like fputs to locked calls like fprintf. * src/charset.c (read_hex): * src/cm.c (cmputc, cmcheckmagic): * src/dispnew.c (update_frame, update_frame_with_menu) (update_frame_1, Fsend_string_to_terminal, Fding) (bitch_at_user): * src/emacs.c (main, Fdump_emacs): * src/emacs-module.c (module_abort): * src/fileio.c (Fdo_auto_save): * src/image.c (slurp_file) (png_read_from_file, png_load_body, our_stdio_fill_input_buffer): * src/keyboard.c (record_char, kbd_buffer_get_event) (handle_interrupt): * src/lread.c (readbyte_from_stdio, read1): * src/minibuf.c (read_minibuf_noninteractive): * src/print.c (printchar_to_stream, strout) (Fredirect_debugging_output): * src/sysdep.c (reset_sys_modes, close_output_streams) (procfs_ttyname, procfs_get_total_memory): * src/term.c (tty_ring_bell, tty_send_additional_strings) (tty_set_terminal_modes, tty_reset_terminal_modes) (tty_update_end, tty_clear_end_of_line, tty_write_glyphs) (tty_write_glyphs_with_face, tty_insert_glyphs) (tty_menu_activate): * src/xfaces.c (Fx_load_color_file): Simplify by using ordinary calls like putc to explicitly-unlocked calls like putc_unlocked, since the ordinary calls are now unlocked anyway. * src/emacs.c (main, Fdump_emacs): * src/pdumper.c (Fdump_emacs_portable): Coalesce adjacent printfs. * src/nsterm.h: Include sysstdio.h as this file’s macros rely on it. * src/regex-emacs.c (print_compiled_pattern): Omit redundant fflush. * src/sysstdio.h: Include unlocked-io.h. (clearerr_unlocked, feof_unlocked, ferror_unlocked) (fflush_unlocked, fgets_unlocked, fputc_unlocked) (fputs_unlocked, fread_unlocked, fwrite_unlocked) (getc_unlocked, getchar_unlocked, putc_unlocked) (putchar_unlocked): Remove these macros; now done by unlocked-io.h. * src/xwidget.c: Include sysstdio.h.
2019-07-08 17:50:39 -07:00
#include "sysstdio.h"
2008-07-15 18:15:18 +00:00
#ifdef HAVE_NS
#ifdef __OBJC__
2014-01-20 14:44:56 -05:00
/* CGFloat on GNUstep may be 4 or 8 byte, but functions expect float* for some
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
versions.
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
On Cocoa >= 10.5, functions expect CGFloat *. Make compatible type. */
#ifdef NS_IMPL_COCOA
typedef CGFloat EmacsCGFloat;
#elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
typedef CGFloat EmacsCGFloat;
#else
typedef float EmacsCGFloat;
#endif
/* NSFilenamesPboardType is deprecated in macOS 10.14, but
NSPasteboardTypeFileURL is only available in 10.13 (and GNUstep
probably lacks it too). */
#if defined NS_IMPL_COCOA && MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
#define NS_USE_NSPasteboardTypeFileURL 1
#else
#define NS_USE_NSPasteboardTypeFileURL 0
#endif
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.
2015-10-23 07:58:02 +02:00
/* ==========================================================================
Trace support
========================================================================== */
/* Uncomment the following line to enable trace.
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.
2015-10-23 07:58:02 +02:00
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.
2015-11-15 20:19:34 +01:00
Uncomment suitable NSTRACE_GROUP_xxx lines to trace more.
Hint: keep the trailing whitespace -- the version control system
will reject accidental commits. */
/* #define NSTRACE_ENABLED 1 */
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.
2015-10-23 07:58:02 +02:00
2015-11-29 21:50:59 -08:00
/* When non-zero, trace output is enabled for all parts, except those
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.
2015-11-15 20:19:34 +01:00
explicitly disabled. */
/* #define NSTRACE_ALL_GROUPS 1 */
/* When non-zero, trace output is enabled in the corresponding part. */
/* #define NSTRACE_GROUP_EVENTS 1 */
/* #define NSTRACE_GROUP_UPDATES 1 */
/* #define NSTRACE_GROUP_FRINGE 1 */
/* #define NSTRACE_GROUP_COLOR 1 */
/* #define NSTRACE_GROUP_GLYPHS 1 */
/* #define NSTRACE_GROUP_FOCUS 1 */
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.
2015-10-23 07:58:02 +02:00
/* Print a call tree containing all annotated functions.
The call structure of the functions is represented using
indentation and vertical lines. Extra information is printed using
horizontal lines that connect to the vertical line.
The return value is represented using the arrow "->>". For simple
functions, the arrow can be printed on the same line as the
function name. If more output is printed, it is connected to the
vertical line of the function.
The first column contains the file name, the second the line
number, and the third a number increasing for each trace line.
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.
2015-11-15 20:19:34 +01:00
Note, when trace output from several threads are mixed, the output
can become misaligned, as all threads (currently) share one state.
This is post prominent when the EVENTS part is enabled.
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
Note that the trace system, when enabled, uses the GCC/Clang
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.
2015-11-15 20:19:34 +01:00
"cleanup" extension. */
/* For example, the following is the output of `M-x
toggle-frame-maximized RET'.
(Long lines manually split to reduced width):
nsterm.m : 1608: [ 354] ns_fullscreen_hook
nsterm.m : 7180: [ 355] | [EmacsView handleFS]
nsterm.m : 7209: [ 356] | +--- FULLSCREEN_MAXIMIZED
nsterm.m : 7706: [ 357] | | [EmacsWindow performZoom:]
nsterm.m : 7715: [ 358] | | | [EmacsWindow zoom:]
nsterm.m : 882: [ 359] | | | | ns_update_auto_hide_menu_bar
nsterm.m : 6752: [ 360] | | | |
[EmacsView windowWillUseStandardFrame:defaultFrame:(X:0 Y:0)/(W:1600 H:1177)]
nsterm.m : 6753: [ 361] | | | | +--- fs_state: FULLSCREEN_NONE
nsterm.m : 6754: [ 362] | | | | +--- fs_before_fs: -1
nsterm.m : 6755: [ 363] | | | | +--- next_maximized: FULLSCREEN_MAXIMIZED
nsterm.m : 6756: [ 364] | | | | +--- ns_userRect: (X:0 Y:0)/(W:0 H:0)
nsterm.m : 6757: [ 365] | | | | +---
[sender frame]: (X:0 Y:626)/(W:595 H:551)
nsterm.m : 6781: [ 366] | | | | +---
ns_userRect (2): (X:0 Y:626)/(W:595 H:551)
nsterm.m : 6821: [ 367] | | | | +--- FULLSCREEN_MAXIMIZED
nsterm.m : 7232: [ 368] | | | | |
[EmacsView setFSValue:FULLSCREEN_MAXIMIZED]
nsterm.m : 6848: [ 369] | | | | +---
Final ns_userRect: (X:0 Y:626)/(W:595 H:551)
nsterm.m : 6849: [ 370] | | | | +--- Final maximized_width: 1600
nsterm.m : 6850: [ 371] | | | | +--- Final maximized_height: 1177
nsterm.m : 6851: [ 372] | | | | +--- Final next_maximized: -1
nsterm.m : 6322: [ 373] | | | | |
[EmacsView windowWillResize:toSize: (W:1600 H:1177)]
nsterm.m : 6323: [ 374] | | | | | +---
[sender frame]: (X:0 Y:626)/(W:595 H:551)
nsterm.m : 6324: [ 375] | | | | | +--- fs_state: FULLSCREEN_MAXIMIZED
nsterm.m : 7027: [ 376] | | | | | | [EmacsView isFullscreen]
nsterm.m : 6387: [ 377] | | | | | +--- cols: 223 rows: 79
nsterm.m : 6412: [ 378] | | | | | +->> (W:1596 H:1167)
nsterm.m : 6855: [ 379] | | | | +->> (X:0 Y:0)/(W:1600 H:1177)
*/
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.
2015-10-23 07:58:02 +02:00
#ifndef NSTRACE_ENABLED
#define NSTRACE_ENABLED 0
#endif
#if NSTRACE_ENABLED
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.
2015-11-15 20:19:34 +01:00
#ifndef NSTRACE_ALL_GROUPS
#define NSTRACE_ALL_GROUPS 0
#endif
#ifndef NSTRACE_GROUP_EVENTS
#define NSTRACE_GROUP_EVENTS NSTRACE_ALL_GROUPS
#endif
#ifndef NSTRACE_GROUP_UPDATES
#define NSTRACE_GROUP_UPDATES NSTRACE_ALL_GROUPS
#endif
#ifndef NSTRACE_GROUP_FRINGE
#define NSTRACE_GROUP_FRINGE NSTRACE_ALL_GROUPS
#endif
#ifndef NSTRACE_GROUP_COLOR
#define NSTRACE_GROUP_COLOR NSTRACE_ALL_GROUPS
#endif
#ifndef NSTRACE_GROUP_GLYPHS
#define NSTRACE_GROUP_GLYPHS NSTRACE_ALL_GROUPS
#endif
#ifndef NSTRACE_GROUP_FOCUS
#define NSTRACE_GROUP_FOCUS NSTRACE_ALL_GROUPS
#endif
extern volatile int nstrace_num;
extern volatile int nstrace_depth;
extern volatile int nstrace_enabled_global;
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.
2015-10-23 07:58:02 +02:00
void nstrace_leave(int *);
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.
2015-11-15 20:19:34 +01:00
void nstrace_restore_global_trace_state(int *);
char const * nstrace_fullscreen_type_name (int);
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.
2015-10-23 07:58:02 +02:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* printf-style trace output. Output is aligned with contained heading. */
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.
2015-10-23 07:58:02 +02:00
#define NSTRACE_MSG_NO_DASHES(...) \
do \
{ \
if (nstrace_enabled) \
{ \
fprintf (stderr, "%-10s:%5d: [%5d]%.*s", \
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.
2015-11-15 20:19:34 +01:00
__FILE__, __LINE__, nstrace_num++, \
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.
2015-10-23 07:58:02 +02:00
2*nstrace_depth, " | | | | | | | | | | | | | | | .."); \
fprintf (stderr, __VA_ARGS__); \
Use fewer locks when accessing stdio * src/alloc.c, src/bidi.c, src/emacs-module.c, src/pdumper.c: * src/regex-emacs.c, src/unexhp9k800.c, src/unexmacosx.c: * src/widget.c, src/xdisp.c, src/xselect.c, src/xterm.c: Include sysstdio.h instead of stdio.h, to avoid locking stdio streams in many cases. * src/alloc.c (test_setjmp): * src/bidi.c (bidi_dump_cached_states): * src/cm.c (calccost): * src/dispnew.c (init_display_interactive): * src/emacs.c (main): * src/image.c (convert_mono_to_color_image): * src/minibuf.c (read_minibuf_noninteractive): * src/nsfont.m (ns_descriptor_to_entity) (ns_dump_glyphstring): * src/nsterm.h (NSTRACE_MSG_NO_DASHES): * src/nsterm.m (ns_mouse_position) (sendEvent:, keyDown:, performDragOperation:): * src/pdumper.c (dump_fingerprint, print_paths_to_root_1): * src/print.c (debug_print): * src/regex-emacs.c (debug_putchar, print_fastmap) (print_partial_compiled_pattern, print_compiled_pattern) (print_double_string, regex_compile): * src/term.c (vfatal): * src/unexhp9k800.c (read_header): * src/unexmacosx.c (unexec_error): * src/widget.c (EmacsFrameInitialize): * src/xdisp.c (message_to_stderr, vmessage, dump_glyph_row) (Fdump_glyph_matrix, Fdump_frame_glyph_matrix, dump_glyph_string): * src/xfaces.c (Fdump_colors, Fdump_face): * src/xselect.c (x_clipboard_manager_error_2): * src/xterm.c (x_initialize): * src/xwidget.c (WEBKIT_FN_INIT): Prefer unlocked calls like fputs to locked calls like fprintf. * src/charset.c (read_hex): * src/cm.c (cmputc, cmcheckmagic): * src/dispnew.c (update_frame, update_frame_with_menu) (update_frame_1, Fsend_string_to_terminal, Fding) (bitch_at_user): * src/emacs.c (main, Fdump_emacs): * src/emacs-module.c (module_abort): * src/fileio.c (Fdo_auto_save): * src/image.c (slurp_file) (png_read_from_file, png_load_body, our_stdio_fill_input_buffer): * src/keyboard.c (record_char, kbd_buffer_get_event) (handle_interrupt): * src/lread.c (readbyte_from_stdio, read1): * src/minibuf.c (read_minibuf_noninteractive): * src/print.c (printchar_to_stream, strout) (Fredirect_debugging_output): * src/sysdep.c (reset_sys_modes, close_output_streams) (procfs_ttyname, procfs_get_total_memory): * src/term.c (tty_ring_bell, tty_send_additional_strings) (tty_set_terminal_modes, tty_reset_terminal_modes) (tty_update_end, tty_clear_end_of_line, tty_write_glyphs) (tty_write_glyphs_with_face, tty_insert_glyphs) (tty_menu_activate): * src/xfaces.c (Fx_load_color_file): Simplify by using ordinary calls like putc to explicitly-unlocked calls like putc_unlocked, since the ordinary calls are now unlocked anyway. * src/emacs.c (main, Fdump_emacs): * src/pdumper.c (Fdump_emacs_portable): Coalesce adjacent printfs. * src/nsterm.h: Include sysstdio.h as this file’s macros rely on it. * src/regex-emacs.c (print_compiled_pattern): Omit redundant fflush. * src/sysstdio.h: Include unlocked-io.h. (clearerr_unlocked, feof_unlocked, ferror_unlocked) (fflush_unlocked, fgets_unlocked, fputc_unlocked) (fputs_unlocked, fread_unlocked, fwrite_unlocked) (getc_unlocked, getchar_unlocked, putc_unlocked) (putchar_unlocked): Remove these macros; now done by unlocked-io.h. * src/xwidget.c: Include sysstdio.h.
2019-07-08 17:50:39 -07:00
putc ('\n', stderr); \
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.
2015-10-23 07:58:02 +02:00
} \
} \
while(0)
#define NSTRACE_MSG(...) NSTRACE_MSG_NO_DASHES("+--- " __VA_ARGS__)
/* Macros for printing complex types.
NSTRACE_FMT_what -- Printf format string for "what".
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
NSTRACE_ARG_what(x) -- Printf argument for "what". */
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.
2015-10-23 07:58:02 +02:00
#define NSTRACE_FMT_SIZE "(W:%.0f H:%.0f)"
#define NSTRACE_ARG_SIZE(elt) (elt).width, (elt).height
#define NSTRACE_FMT_POINT "(X:%.0f Y:%.0f)"
#define NSTRACE_ARG_POINT(elt) (elt).x, (elt).y
#define NSTRACE_FMT_RECT NSTRACE_FMT_POINT "/" NSTRACE_FMT_SIZE
#define NSTRACE_ARG_RECT(elt) \
NSTRACE_ARG_POINT((elt).origin), NSTRACE_ARG_SIZE((elt).size)
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.
2015-11-15 20:19:34 +01:00
#define NSTRACE_FMT_FSTYPE "%s"
#define NSTRACE_ARG_FSTYPE(elt) nstrace_fullscreen_type_name(elt)
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.
2015-10-23 07:58:02 +02:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Macros for printing complex types as extra information. */
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.
2015-10-23 07:58:02 +02:00
#define NSTRACE_SIZE(str,size) \
NSTRACE_MSG (str ": " NSTRACE_FMT_SIZE, \
NSTRACE_ARG_SIZE (size));
#define NSTRACE_POINT(str,point) \
NSTRACE_MSG (str ": " NSTRACE_FMT_POINT, \
NSTRACE_ARG_POINT (point));
#define NSTRACE_RECT(str,rect) \
NSTRACE_MSG (str ": " NSTRACE_FMT_RECT, \
NSTRACE_ARG_RECT (rect));
#define NSTRACE_FSTYPE(str,fs_type) \
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.
2015-11-15 20:19:34 +01:00
NSTRACE_MSG (str ": " NSTRACE_FMT_FSTYPE, \
NSTRACE_ARG_FSTYPE (fs_type));
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.
2015-10-23 07:58:02 +02:00
/* Return value macros.
NSTRACE_RETURN(fmt, ...) - Print a return value, support printf-style
format string and arguments.
NSTRACE_RETURN_what(obj) - Print a return value of kind WHAT.
NSTRACE_FMT_RETURN - A string literal representing a returned
value. Useful when creating a format string
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
to printf-like constructs like NSTRACE(). */
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.
2015-10-23 07:58:02 +02:00
#define NSTRACE_FMT_RETURN "->>"
#define NSTRACE_RETURN(...) \
NSTRACE_MSG_NO_DASHES ("+" NSTRACE_FMT_RETURN " " __VA_ARGS__)
#define NSTRACE_RETURN_SIZE(size) \
NSTRACE_RETURN(NSTRACE_FMT_SIZE, NSTRACE_ARG_SIZE(size))
#define NSTRACE_RETURN_POINT(point) \
NSTRACE_RETURN(NSTRACE_FMT_POINT, NSTRACE_ARG_POINT(point))
#define NSTRACE_RETURN_RECT(rect) \
NSTRACE_RETURN(NSTRACE_FMT_RECT, NSTRACE_ARG_RECT(rect))
/* Function enter macros.
NSTRACE (fmt, ...) -- Enable trace output in current block
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.
2015-10-23 07:58:02 +02:00
(typically a function). Accepts printf-style
arguments.
NSTRACE_WHEN (cond, fmt, ...) -- Enable trace output when COND is true.
NSTRACE_UNLESS (cond, fmt, ...) -- Enable trace output unless COND is
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
true. */
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.
2015-10-23 07:58:02 +02:00
#define NSTRACE_WHEN(cond, ...) \
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.
2015-11-15 20:19:34 +01:00
__attribute__((cleanup(nstrace_restore_global_trace_state))) \
int nstrace_saved_enabled_global = nstrace_enabled_global; \
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.
2015-10-23 07:58:02 +02:00
__attribute__((cleanup(nstrace_leave))) \
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.
2015-11-15 20:19:34 +01:00
int nstrace_enabled = nstrace_enabled_global && (cond); \
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.
2015-10-23 07:58:02 +02:00
if (nstrace_enabled) { ++nstrace_depth; } \
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.
2015-11-15 20:19:34 +01:00
else { nstrace_enabled_global = 0; } \
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.
2015-10-23 07:58:02 +02:00
NSTRACE_MSG_NO_DASHES(__VA_ARGS__);
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.
2015-11-15 20:19:34 +01:00
/* Unsilence called functions.
Concretely, this us used to allow "event" functions to be silenced
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
while trace output can be printed for functions they call. */
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.
2015-11-15 20:19:34 +01:00
#define NSTRACE_UNSILENCE() do { nstrace_enabled_global = 1; } while(0)
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.
2015-10-23 07:58:02 +02:00
#endif /* NSTRACE_ENABLED */
#define NSTRACE(...) NSTRACE_WHEN(1, __VA_ARGS__)
#define NSTRACE_UNLESS(cond, ...) NSTRACE_WHEN(!(cond), __VA_ARGS__)
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Non-trace replacement versions. */
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.
2015-10-23 07:58:02 +02:00
#ifndef NSTRACE_WHEN
#define NSTRACE_WHEN(...)
#endif
#ifndef NSTRACE_MSG
#define NSTRACE_MSG(...)
#endif
#ifndef NSTRACE_SIZE
#define NSTRACE_SIZE(str,size)
#endif
#ifndef NSTRACE_POINT
#define NSTRACE_POINT(str,point)
#endif
#ifndef NSTRACE_RECT
#define NSTRACE_RECT(str,rect)
#endif
#ifndef NSTRACE_FSTYPE
#define NSTRACE_FSTYPE(str,fs_type)
#endif
#ifndef NSTRACE_RETURN_SIZE
#define NSTRACE_RETURN_SIZE(size)
#endif
#ifndef NSTRACE_RETURN_POINT
#define NSTRACE_RETURN_POINT(point)
#endif
#ifndef NSTRACE_RETURN_RECT
#define NSTRACE_RETURN_RECT(rect)
#endif
#ifndef NSTRACE_RETURN_FSTYPE
#define NSTRACE_RETURN_FSTYPE(fs_type)
#endif
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.
2015-11-15 20:19:34 +01:00
#ifndef NSTRACE_UNSILENCE
#define NSTRACE_UNSILENCE()
#endif
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.
2015-10-23 07:58:02 +02:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* If the compiler doesn't support instancetype, map it to id. */
#ifndef NATIVE_OBJC_INSTANCETYPE
typedef id instancetype;
#endif
/* ==========================================================================
NSColor, EmacsColor category.
========================================================================== */
@interface NSColor (EmacsColor)
+ (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green
blue:(CGFloat)blue alpha:(CGFloat)alpha;
+ (NSColor *)colorWithUnsignedLong:(unsigned long)c;
- (NSColor *)colorUsingDefaultColorSpace;
- (unsigned long)unsignedLong;
@end
@interface NSString (EmacsString)
+ (NSString *)stringWithLispString:(Lisp_Object)string;
- (Lisp_Object)lispString;
@end
2008-07-15 18:15:18 +00:00
/* ==========================================================================
The Emacs application
========================================================================== */
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* We override sendEvent: as a means to stop/start the event loop. */
2008-07-15 18:15:18 +00:00
@interface EmacsApp : NSApplication
{
#ifdef NS_IMPL_COCOA
BOOL shouldKeepRunning;
BOOL isFirst;
#endif
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
#ifdef NS_IMPL_GNUSTEP
BOOL applicationDidFinishLaunchingCalled;
#endif
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
@public
int nextappdefined;
2008-07-15 18:15:18 +00:00
}
2008-08-01 14:01:08 +00:00
- (void)logNotification: (NSNotification *)notification;
- (void)antialiasThresholdDidChange:(NSNotification *)notification;
2008-07-15 18:15:18 +00:00
- (void)sendEvent: (NSEvent *)theEvent;
- (void)showPreferencesWindow: (id)sender;
2008-08-01 14:01:08 +00:00
- (BOOL) openFile: (NSString *)fileName;
- (void)fd_handler: (id)unused;
2008-08-01 14:01:08 +00:00
- (void)timeout_handler: (NSTimer *)timedEntry;
- (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg;
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
#ifdef NS_IMPL_GNUSTEP
- (void)sendFromMainThread:(id)unused;
#endif
2008-07-15 18:15:18 +00:00
@end
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
#ifdef NS_IMPL_GNUSTEP
/* Dummy class to get rid of startup warnings. */
@interface EmacsDocument : NSDocument
{
}
@end
#endif
2008-07-15 18:15:18 +00:00
enum ns_return_frame_mode
{
RETURN_FRAME_NEVER,
RETURN_FRAME_EVENTUALLY,
RETURN_FRAME_NOW,
};
/* EmacsWindow */
@interface EmacsWindow : NSWindow
{
NSPoint grabOffset;
NSEvent *last_drag_event;
NSDragOperation drag_op;
NSDragOperation selected_op;
struct frame *dnd_return_frame;
enum ns_return_frame_mode dnd_mode;
BOOL dnd_allow_same_frame;
BOOL dnd_move_tooltip_with_frame;
}
#ifdef NS_IMPL_GNUSTEP
- (NSInteger) orderedIndex;
#endif
- (instancetype) initWithEmacsFrame: (struct frame *) f;
- (instancetype) initWithEmacsFrame: (struct frame *) f
fullscreen: (BOOL) fullscreen
screen: (NSScreen *) screen;
- (void) createToolbar: (struct frame *) f;
- (void) setParentChildRelationships;
- (NSInteger) borderWidth;
- (BOOL) restackWindow: (NSWindow *) win above: (BOOL) above;
- (void) setAppearance;
- (void) setLastDragEvent: (NSEvent *) event;
- (NSDragOperation) beginDrag: (NSDragOperation) op
forPasteboard: (NSPasteboard *) pasteboard
withMode: (enum ns_return_frame_mode) mode
returnFrameTo: (struct frame **) frame_return
prohibitSame: (BOOL) prohibit_same_frame
followTooltip: (BOOL) follow_tooltip;
- (BOOL) mustNotDropOn: (NSView *) receiver;
@end
2008-07-15 18:15:18 +00:00
/* ==========================================================================
The main Emacs view
========================================================================== */
@class EmacsToolbar;
Simplify macOS drawing code Convert EmacsSurface into a CALayer subclass so we can use the built-in relationships. Also simplify the macOS versioning code. This will result in more warnings on older versions of macOS but makes reading the code easier. * configure.ac: Add QuartzCore framework. * src/nsterm.h (NS_DRAW_TO_BUFFER): Remove define and all references. (EmacsSurface, EmacsLayer): Rename EmacsSurface to EmacsLayer and modify the definition to fit the new function. * src/nsterm.m (ns_update_begin): (ns_update_end): (ns_focus): (ns_unfocus): Use the new overridden lockFocus and unlockFocus and simplify the frame management. ([EmacsView dealloc]): ([EmacsView viewDidResize:]):Don't explicitly release surfaces. ([EmacsView initFrameFromEmacs:]): Move the layer code to after the NSWindow has been created as creating the layer now relies on some of it's properties. ([EmacsView makeBackingLayer]): New function. ([EmacsView lockFocus]): ([EmacsView focusOnDrawingBuffer]): Rename to lockFocus. ([EmacsView unlockFocus]): ([EmacsView unfocusDrawingBuffer]): Rename to unlockFocus. ([EmacsView windowDidChangeBackingProperties]): Don't explicitly release surfaces but reset EmacsLayer properties. ([EmacsView layout]): ([EmacsView viewWillDraw]): Rename to layout. ([EmacsView wantsUpdateLayer]): Remove function and change all callers to [EmacsView wantsLayer]. (EmacsSurface, EmacsLayer): Rename to EmacsLayer. ([EmacsSurface getSize]): ([EmacsSurface initWithSize:ColorSpace:Scale:]): Remove methods. ([EmacsSurface initWithColorSpace:]): ([EmacsLayer checkDimensions]): ([EmacsLayer releaseSurfaces]): ([EmacsLayer display]): New functions. * src/nsterm.m ([EmacsLayer dealloc]): Use releaseSurfaces. ([EmacsSurface getContext]): Automatically detect frame property changes and clear the cache if required. Use built-in CALayer properties where available. ([EmacsLayer copyContentsTo:]): Use [CALayer contents] as source.
2021-05-29 09:48:51 +01:00
@class EmacsLayer;
2008-07-15 18:15:18 +00:00
Require OSX >= 10.6. Remove PowerPC unexec code. * configure.ac: Require OSX 10.6. Remove NSInteger test, use nsfont for Gnustep, macfont for OSX. * etc/NEWS: OSX required is 10.6 or newer. * src/Makefile.in: Replace nsfont.o macfont.o with ns_fontfile in comment. * src/macfont.h (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_FORMAT_BITMAP) (mac_font_copy_non_synthetic_table): Remove versions for OSX < 10.6 * src/nsfns.m: Always include src/macfont.h on COCOA. (ns_filename_from_panel, ns_directory_from_panel) (Fx_create_frame, Fns_popup_font_panel, ns_run_file_dialog) (Fns_read_file_name, Fns_list_services): Remove code for OSX < 10.6 * src/nsterm.m: Always include src/macfont.h on COCOA. (ns_update_auto_hide_menu_bar, ns_draw_fringe_bitmap) (ns_dumpglyphs_image, ns_check_menu_open) (applicationDidFinishLaunching) (antialiasThresholdDidChange:) (keyDown:, toggleFullScreen:, setPosition:portion:whole:): Remove checks for OSX <= 10.5/10.6. (changeFont:): Use macfont on COCOA, nsfont on GNUSTEP. (syms_of_nsterm): Call syms_of_macfont on COCOA, syms_of_nsfont on GNUSTEP. * src/macfont.m: Remove >= 1050 check. (macfont_create_family_with_symbol) (macfont_get_glyph_for_character) (mac_font_get_glyphs_for_variants) (mac_ctfont_create_available_families, syms_of_macfont): Remove code for OSX < 10.6. (mac_font_family_group, mac_font_family_compare): Remove, only used for OSX < 10.6. * src/nsimage.m (allocInitFromFile:): Remove code for OSX < 10.6. * src/nsmenu.m (NSMenuDidBeginTrackingNotification): Remove. (x_activate_menubar, trackingNotification:): Remove check for OSX >= 10.5. (menuNeedsUpdate:): Remove check for OSX < 10.5. * src/nsterm.h (MAC_OS_X_VERSION_10_4, MAC_OS_X_VERSION_10_5): Remove. (NS_HAVE_NSINTEGER): Remove block. Remove >= OSX 10.6 tests. * src/unexmacosx.c: Remove include ppc/reloc.h. (unrelocate, copy_dysymtab): Remove PPC code. (rebase_reloc_address): Remove, only used for PPC:
2014-10-12 10:35:50 +02:00
#ifdef NS_IMPL_COCOA
@interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
#else
@interface EmacsView : NSView <NSTextInput>
#endif
{
#ifdef NS_IMPL_COCOA
char *old_title;
BOOL maximizing_resize;
#endif
BOOL font_panel_active;
NSFont *font_panel_result;
BOOL windowClosing;
NSString *workingText;
BOOL processingCompose;
int fs_state, fs_before_fs, next_maximized;
int maximized_width, maximized_height;
EmacsWindow *nonfs_window;
BOOL fs_is_native;
2008-07-15 18:15:18 +00:00
@public
struct frame *emacsframe;
int scrollbarsNeedingUpdate;
NSRect ns_userRect;
}
2008-07-15 18:15:18 +00:00
/* AppKit-side interface */
- (instancetype)menuDown: (id)sender;
- (instancetype)toolbarClicked: (id)item;
- (instancetype)toggleToolbar: (id)sender;
2008-07-15 18:15:18 +00:00
- (void)keyDown: (NSEvent *)theEvent;
- (void)mouseDown: (NSEvent *)theEvent;
- (void)mouseUp: (NSEvent *)theEvent;
- (instancetype)setMiniwindowImage: (BOOL)setMini;
2008-07-15 18:15:18 +00:00
/* Emacs-side interface */
- (instancetype) initFrameFromEmacs: (struct frame *) f;
2008-07-15 18:15:18 +00:00
- (void) setWindowClosing: (BOOL)closing;
- (void) deleteWorkingText;
- (void) handleFS;
- (void) setFSValue: (int)value;
- (void) toggleFullScreen: (id) sender;
* lisp/cus-start.el (all): Add ns-use-native-fullscreen. * src/nsmenu.m (update_frame_tool_bar): Check for negative tool bar height. * src/nsterm.h (HAVE_NATIVE_FS): Define if OSX => 10.7. (EmacsView): Add fs_is_native, fsIsNative, isFullscreen and updateCollectionBehaviour. * src/nsterm.m (NEW_STYLE_FS): Remove. (ns_last_use_native_fullscreen): New variable. (x_make_frame_visible): Replace NEW_STYLE_FS with isFullscreen. (x_set_window_size): Do not take title bar and tool bar into account if isFullscreen returns YES. (ns_fullscreen_hook): Replace NEW_STYLE_FS with isFullscreen. (check_native_fs): New function. (ns_select, ns_read_socket): Call check_native_fs if HAVE_NATIVE_FS. (ns_term_init): Remove NEW_STYLE_FS. (updateFrameSize:, windowWillResize:toSize:): Only adjust for title bar and tool bar if isFullscreen returns NO. (windowDidResize:): Replace NEW_STYLE_FS with fsIsNative. (initFrameFromEmacs:): Initialize fs_is_native. Replace NEW_STYLE_FS with HAVE_NATIVE_FS. (window:willUseFullScreenPresentationOptions:): New method. (windowDidEnterFullScreen:): Replace NEW_STYLE_FS with fsIsNative. Hide toolbar if not enabled. (windowDidExitFullScreen:): Call updateCollectionBehaviour. Restore tool bar if enabled, hide it otherwise (Bug#13444). (fsIsNative, isFullscreen, updateCollectionBehaviour): New methods. (toggleFullScreen:): If fs_is_native, call toggleFullScreen on window. Do no set FRAME_EXTERNAL_TOOL_BAR (f) to 0. Check FRAME_EXTERNAL_TOOL_BAR (f) before restoring FRAME_TOOLBAR_HEIGHT (f). Call updateFrameSize when going non-fs. (syms_of_nsterm): Add ns-use-native-fullscreen.
2013-02-05 13:16:35 +01:00
- (BOOL) fsIsNative;
- (BOOL) isFullscreen;
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- (void) updateCollectionBehavior;
* lisp/cus-start.el (all): Add ns-use-native-fullscreen. * src/nsmenu.m (update_frame_tool_bar): Check for negative tool bar height. * src/nsterm.h (HAVE_NATIVE_FS): Define if OSX => 10.7. (EmacsView): Add fs_is_native, fsIsNative, isFullscreen and updateCollectionBehaviour. * src/nsterm.m (NEW_STYLE_FS): Remove. (ns_last_use_native_fullscreen): New variable. (x_make_frame_visible): Replace NEW_STYLE_FS with isFullscreen. (x_set_window_size): Do not take title bar and tool bar into account if isFullscreen returns YES. (ns_fullscreen_hook): Replace NEW_STYLE_FS with isFullscreen. (check_native_fs): New function. (ns_select, ns_read_socket): Call check_native_fs if HAVE_NATIVE_FS. (ns_term_init): Remove NEW_STYLE_FS. (updateFrameSize:, windowWillResize:toSize:): Only adjust for title bar and tool bar if isFullscreen returns NO. (windowDidResize:): Replace NEW_STYLE_FS with fsIsNative. (initFrameFromEmacs:): Initialize fs_is_native. Replace NEW_STYLE_FS with HAVE_NATIVE_FS. (window:willUseFullScreenPresentationOptions:): New method. (windowDidEnterFullScreen:): Replace NEW_STYLE_FS with fsIsNative. Hide toolbar if not enabled. (windowDidExitFullScreen:): Call updateCollectionBehaviour. Restore tool bar if enabled, hide it otherwise (Bug#13444). (fsIsNative, isFullscreen, updateCollectionBehaviour): New methods. (toggleFullScreen:): If fs_is_native, call toggleFullScreen on window. Do no set FRAME_EXTERNAL_TOOL_BAR (f) to 0. Check FRAME_EXTERNAL_TOOL_BAR (f) before restoring FRAME_TOOLBAR_HEIGHT (f). Call updateFrameSize when going non-fs. (syms_of_nsterm): Add ns-use-native-fullscreen.
2013-02-05 13:16:35 +01:00
#endif
#ifdef NS_IMPL_GNUSTEP
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
- (void)windowDidMove: (id)sender;
#endif
- (Lisp_Object) showFontPanel;
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.
2015-10-23 07:58:02 +02:00
- (int)fullscreenState;
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
Simplify macOS drawing code Convert EmacsSurface into a CALayer subclass so we can use the built-in relationships. Also simplify the macOS versioning code. This will result in more warnings on older versions of macOS but makes reading the code easier. * configure.ac: Add QuartzCore framework. * src/nsterm.h (NS_DRAW_TO_BUFFER): Remove define and all references. (EmacsSurface, EmacsLayer): Rename EmacsSurface to EmacsLayer and modify the definition to fit the new function. * src/nsterm.m (ns_update_begin): (ns_update_end): (ns_focus): (ns_unfocus): Use the new overridden lockFocus and unlockFocus and simplify the frame management. ([EmacsView dealloc]): ([EmacsView viewDidResize:]):Don't explicitly release surfaces. ([EmacsView initFrameFromEmacs:]): Move the layer code to after the NSWindow has been created as creating the layer now relies on some of it's properties. ([EmacsView makeBackingLayer]): New function. ([EmacsView lockFocus]): ([EmacsView focusOnDrawingBuffer]): Rename to lockFocus. ([EmacsView unlockFocus]): ([EmacsView unfocusDrawingBuffer]): Rename to unlockFocus. ([EmacsView windowDidChangeBackingProperties]): Don't explicitly release surfaces but reset EmacsLayer properties. ([EmacsView layout]): ([EmacsView viewWillDraw]): Rename to layout. ([EmacsView wantsUpdateLayer]): Remove function and change all callers to [EmacsView wantsLayer]. (EmacsSurface, EmacsLayer): Rename to EmacsLayer. ([EmacsSurface getSize]): ([EmacsSurface initWithSize:ColorSpace:Scale:]): Remove methods. ([EmacsSurface initWithColorSpace:]): ([EmacsLayer checkDimensions]): ([EmacsLayer releaseSurfaces]): ([EmacsLayer display]): New functions. * src/nsterm.m ([EmacsLayer dealloc]): Use releaseSurfaces. ([EmacsSurface getContext]): Automatically detect frame property changes and clear the cache if required. Use built-in CALayer properties where available. ([EmacsLayer copyContentsTo:]): Use [CALayer contents] as source.
2021-05-29 09:48:51 +01:00
- (void)lockFocus;
- (void)unlockFocus;
#endif
- (void)copyRect:(NSRect)srcRect to:(NSPoint)dest;
/* Non-notification versions of NSView methods. Used for direct calls. */
- (void)windowWillEnterFullScreen;
- (void)windowDidEnterFullScreen;
- (void)windowWillExitFullScreen;
- (void)windowDidExitFullScreen;
- (void)windowDidBecomeKey;
2008-07-15 18:15:18 +00:00
@end
/* ==========================================================================
The main menu implementation
========================================================================== */
@interface EmacsMenu : NSMenu <NSMenuDelegate>
2008-07-15 18:15:18 +00:00
{
BOOL needsUpdate;
2008-07-15 18:15:18 +00:00
}
- (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
attributes: (NSDictionary *)attributes;
2008-07-15 18:15:18 +00:00
- (void)fillWithWidgetValue: (void *)wvptr;
- (EmacsMenu *)addSubmenuWithTitle: (const char *)title;
- (void) removeAllItems;
2008-07-15 18:15:18 +00:00
- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
keymaps: (bool)keymaps;
2008-07-15 18:15:18 +00:00
@end
/* ==========================================================================
Toolbar
========================================================================== */
@class EmacsImage;
Require OSX >= 10.6. Remove PowerPC unexec code. * configure.ac: Require OSX 10.6. Remove NSInteger test, use nsfont for Gnustep, macfont for OSX. * etc/NEWS: OSX required is 10.6 or newer. * src/Makefile.in: Replace nsfont.o macfont.o with ns_fontfile in comment. * src/macfont.h (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_FORMAT_BITMAP) (mac_font_copy_non_synthetic_table): Remove versions for OSX < 10.6 * src/nsfns.m: Always include src/macfont.h on COCOA. (ns_filename_from_panel, ns_directory_from_panel) (Fx_create_frame, Fns_popup_font_panel, ns_run_file_dialog) (Fns_read_file_name, Fns_list_services): Remove code for OSX < 10.6 * src/nsterm.m: Always include src/macfont.h on COCOA. (ns_update_auto_hide_menu_bar, ns_draw_fringe_bitmap) (ns_dumpglyphs_image, ns_check_menu_open) (applicationDidFinishLaunching) (antialiasThresholdDidChange:) (keyDown:, toggleFullScreen:, setPosition:portion:whole:): Remove checks for OSX <= 10.5/10.6. (changeFont:): Use macfont on COCOA, nsfont on GNUSTEP. (syms_of_nsterm): Call syms_of_macfont on COCOA, syms_of_nsfont on GNUSTEP. * src/macfont.m: Remove >= 1050 check. (macfont_create_family_with_symbol) (macfont_get_glyph_for_character) (mac_font_get_glyphs_for_variants) (mac_ctfont_create_available_families, syms_of_macfont): Remove code for OSX < 10.6. (mac_font_family_group, mac_font_family_compare): Remove, only used for OSX < 10.6. * src/nsimage.m (allocInitFromFile:): Remove code for OSX < 10.6. * src/nsmenu.m (NSMenuDidBeginTrackingNotification): Remove. (x_activate_menubar, trackingNotification:): Remove check for OSX >= 10.5. (menuNeedsUpdate:): Remove check for OSX < 10.5. * src/nsterm.h (MAC_OS_X_VERSION_10_4, MAC_OS_X_VERSION_10_5): Remove. (NS_HAVE_NSINTEGER): Remove block. Remove >= OSX 10.6 tests. * src/unexmacosx.c: Remove include ppc/reloc.h. (unrelocate, copy_dysymtab): Remove PPC code. (rebase_reloc_address): Remove, only used for PPC:
2014-10-12 10:35:50 +02:00
#ifdef NS_IMPL_COCOA
@interface EmacsToolbar : NSToolbar <NSToolbarDelegate>
#else
@interface EmacsToolbar : NSToolbar
#endif
2008-07-15 18:15:18 +00:00
{
EmacsView *emacsView;
NSMutableDictionary *identifierToItem;
NSMutableArray *activeIdentifiers;
NSArray *prevIdentifiers;
unsigned long enablement, prevEnablement;
}
- (instancetype) initForView: (EmacsView *)view withIdentifier: (NSString *)identifier;
2008-07-15 18:15:18 +00:00
- (void) clearActive;
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
- (void) clearAll;
2008-07-15 18:15:18 +00:00
- (BOOL) changed;
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
- (void) addDisplayItemWithImage: (EmacsImage *)img
idx: (int)idx
tag: (int)tag
labelText: (NSString *)label
helpText: (NSString *)help
2008-07-15 18:15:18 +00:00
enabled: (BOOL)enabled;
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
2008-07-15 18:15:18 +00:00
/* delegate methods */
- (NSToolbarItem *)toolbar: (NSToolbar *)toolbar
itemForItemIdentifier: (NSString *)itemIdentifier
willBeInsertedIntoToolbar: (BOOL)flag;
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar;
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar;
@end
/* ==========================================================================
Message / question windows
========================================================================== */
@interface EmacsDialogPanel : NSPanel
{
NSTextField *command;
NSTextField *title;
NSMatrix *matrix;
int rows, cols;
BOOL timer_fired, window_closed;
Lisp_Object dialog_return;
}
- (instancetype) initWithTitle: (char *) title_str
isQuestion: (BOOL) is_question;
- (void) processMenuItems: (Lisp_Object) menu_items
used: (ptrdiff_t) menu_items_used
withErrorOutput: (const char **) error_name;
- (void) addButton: (char *) str
value: (NSInteger) tag
row: (int) row
enable: (BOOL) enable;
- (void) addString: (char *) str
row: (int) row;
- (void) addSplit;
- (void) resizeBoundsPriorToDisplay;
- (Lisp_Object) runDialogAt: (NSPoint) p;
- (void) timeout_handler: (NSTimer *) timedEntry;
2008-07-15 18:15:18 +00:00
@end
Require OSX >= 10.6. Remove PowerPC unexec code. * configure.ac: Require OSX 10.6. Remove NSInteger test, use nsfont for Gnustep, macfont for OSX. * etc/NEWS: OSX required is 10.6 or newer. * src/Makefile.in: Replace nsfont.o macfont.o with ns_fontfile in comment. * src/macfont.h (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_FORMAT_BITMAP) (mac_font_copy_non_synthetic_table): Remove versions for OSX < 10.6 * src/nsfns.m: Always include src/macfont.h on COCOA. (ns_filename_from_panel, ns_directory_from_panel) (Fx_create_frame, Fns_popup_font_panel, ns_run_file_dialog) (Fns_read_file_name, Fns_list_services): Remove code for OSX < 10.6 * src/nsterm.m: Always include src/macfont.h on COCOA. (ns_update_auto_hide_menu_bar, ns_draw_fringe_bitmap) (ns_dumpglyphs_image, ns_check_menu_open) (applicationDidFinishLaunching) (antialiasThresholdDidChange:) (keyDown:, toggleFullScreen:, setPosition:portion:whole:): Remove checks for OSX <= 10.5/10.6. (changeFont:): Use macfont on COCOA, nsfont on GNUSTEP. (syms_of_nsterm): Call syms_of_macfont on COCOA, syms_of_nsfont on GNUSTEP. * src/macfont.m: Remove >= 1050 check. (macfont_create_family_with_symbol) (macfont_get_glyph_for_character) (mac_font_get_glyphs_for_variants) (mac_ctfont_create_available_families, syms_of_macfont): Remove code for OSX < 10.6. (mac_font_family_group, mac_font_family_compare): Remove, only used for OSX < 10.6. * src/nsimage.m (allocInitFromFile:): Remove code for OSX < 10.6. * src/nsmenu.m (NSMenuDidBeginTrackingNotification): Remove. (x_activate_menubar, trackingNotification:): Remove check for OSX >= 10.5. (menuNeedsUpdate:): Remove check for OSX < 10.5. * src/nsterm.h (MAC_OS_X_VERSION_10_4, MAC_OS_X_VERSION_10_5): Remove. (NS_HAVE_NSINTEGER): Remove block. Remove >= OSX 10.6 tests. * src/unexmacosx.c: Remove include ppc/reloc.h. (unrelocate, copy_dysymtab): Remove PPC code. (rebase_reloc_address): Remove, only used for PPC:
2014-10-12 10:35:50 +02:00
#ifdef NS_IMPL_COCOA
@interface EmacsTooltip : NSObject <NSWindowDelegate>
#else
@interface EmacsTooltip : NSObject
#endif
{
NSWindow *win;
NSTextField *textField;
NSTimer *timer;
}
- (instancetype) init;
- (void) setText: (char *) text;
- (void) setBackgroundColor: (NSColor *) col;
- (void) setForegroundColor: (NSColor *) col;
- (void) showAtX: (int) x Y: (int) y for: (int) seconds;
2008-07-15 18:15:18 +00:00
- (void) hide;
- (BOOL) isActive;
- (NSRect) frame;
- (void) moveTo: (NSPoint) screen_point;
2008-07-15 18:15:18 +00:00
@end
@interface EmacsFileDelegate : NSObject
{
}
- (BOOL)panel: (id)sender isValidFilename: (NSString *)filename;
- (BOOL)panel: (id)sender shouldShowFilename: (NSString *)filename;
- (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename
confirmed: (BOOL)okFlag;
@end
/* ==========================================================================
Images and stippling
========================================================================== */
@interface EmacsImage : NSImage
{
NSBitmapImageRep *bmRep; /* used for accessing pixel data */
unsigned char *pixmapData[5]; /* shortcut to access pixel data */
NSColor *stippleMask;
@public
NSAffineTransform *transform;
BOOL smoothing;
2008-07-15 18:15:18 +00:00
}
+ (instancetype)allocInitFromFile: (Lisp_Object)file;
2008-07-15 18:15:18 +00:00
- (void)dealloc;
- (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
fg: (unsigned long)fg bg: (unsigned long)bg
reverseBytes: (BOOL)reverse;
- (instancetype)initForXPMWithDepth: (int)depth width: (int)width height: (int)height;
2008-07-15 18:15:18 +00:00
- (void)setPixmapData;
- (unsigned long)getPixelAtX: (int)x Y: (int)y;
- (void)setPixelAtX: (int)x Y: (int)y toRed: (unsigned char)r
green: (unsigned char)g blue: (unsigned char)b
alpha:(unsigned char)a;
- (void)setAlphaAtX: (int)x Y: (int)y to: (unsigned char)a;
- (NSColor *)stippleMask;
- (Lisp_Object)getMetadata;
- (BOOL)setFrame: (unsigned int) index;
- (void)setTransform: (double[3][3]) m;
- (void)setSmoothing: (BOOL)s;
- (size_t)sizeInBytes;
2008-07-15 18:15:18 +00:00
@end
/* ==========================================================================
Scrollbars
========================================================================== */
@interface EmacsScroller : NSScroller
{
struct window *window;
2008-07-15 18:15:18 +00:00
struct frame *frame;
NSResponder *prevResponder;
/* offset to the bottom of knob of last mouse down */
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
CGFloat last_mouse_offset;
2008-07-15 18:15:18 +00:00
float min_portion;
int pixel_length;
enum scroll_bar_part last_hit_part;
2008-07-15 18:15:18 +00:00
BOOL condemned;
BOOL horizontal;
2008-07-15 18:15:18 +00:00
/* optimize against excessive positioning calls generated by emacs */
int em_position;
int em_portion;
int em_whole;
}
- (void) mark;
- (instancetype) initFrame: (NSRect )r window: (Lisp_Object)win;
2008-07-15 18:15:18 +00:00
- (void)setFrame: (NSRect)r;
- (instancetype) setPosition: (int) position portion: (int) portion whole: (int) whole;
2008-07-15 18:15:18 +00:00
- (int) checkSamePosition: (int)position portion: (int)portion
whole: (int)whole;
- (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e;
- (instancetype)repeatScroll: (NSTimer *)sender;
- (instancetype)condemn;
- (instancetype)reprieve;
- (bool)judge;
+ (CGFloat)scrollerWidth;
2008-07-15 18:15:18 +00:00
@end
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
Simplify macOS drawing code Convert EmacsSurface into a CALayer subclass so we can use the built-in relationships. Also simplify the macOS versioning code. This will result in more warnings on older versions of macOS but makes reading the code easier. * configure.ac: Add QuartzCore framework. * src/nsterm.h (NS_DRAW_TO_BUFFER): Remove define and all references. (EmacsSurface, EmacsLayer): Rename EmacsSurface to EmacsLayer and modify the definition to fit the new function. * src/nsterm.m (ns_update_begin): (ns_update_end): (ns_focus): (ns_unfocus): Use the new overridden lockFocus and unlockFocus and simplify the frame management. ([EmacsView dealloc]): ([EmacsView viewDidResize:]):Don't explicitly release surfaces. ([EmacsView initFrameFromEmacs:]): Move the layer code to after the NSWindow has been created as creating the layer now relies on some of it's properties. ([EmacsView makeBackingLayer]): New function. ([EmacsView lockFocus]): ([EmacsView focusOnDrawingBuffer]): Rename to lockFocus. ([EmacsView unlockFocus]): ([EmacsView unfocusDrawingBuffer]): Rename to unlockFocus. ([EmacsView windowDidChangeBackingProperties]): Don't explicitly release surfaces but reset EmacsLayer properties. ([EmacsView layout]): ([EmacsView viewWillDraw]): Rename to layout. ([EmacsView wantsUpdateLayer]): Remove function and change all callers to [EmacsView wantsLayer]. (EmacsSurface, EmacsLayer): Rename to EmacsLayer. ([EmacsSurface getSize]): ([EmacsSurface initWithSize:ColorSpace:Scale:]): Remove methods. ([EmacsSurface initWithColorSpace:]): ([EmacsLayer checkDimensions]): ([EmacsLayer releaseSurfaces]): ([EmacsLayer display]): New functions. * src/nsterm.m ([EmacsLayer dealloc]): Use releaseSurfaces. ([EmacsSurface getContext]): Automatically detect frame property changes and clear the cache if required. Use built-in CALayer properties where available. ([EmacsLayer copyContentsTo:]): Use [CALayer contents] as source.
2021-05-29 09:48:51 +01:00
@interface EmacsLayer : CALayer
{
NSMutableArray *cache;
CGColorSpaceRef colorSpace;
IOSurfaceRef currentSurface;
CGContextRef context;
}
Simplify macOS drawing code Convert EmacsSurface into a CALayer subclass so we can use the built-in relationships. Also simplify the macOS versioning code. This will result in more warnings on older versions of macOS but makes reading the code easier. * configure.ac: Add QuartzCore framework. * src/nsterm.h (NS_DRAW_TO_BUFFER): Remove define and all references. (EmacsSurface, EmacsLayer): Rename EmacsSurface to EmacsLayer and modify the definition to fit the new function. * src/nsterm.m (ns_update_begin): (ns_update_end): (ns_focus): (ns_unfocus): Use the new overridden lockFocus and unlockFocus and simplify the frame management. ([EmacsView dealloc]): ([EmacsView viewDidResize:]):Don't explicitly release surfaces. ([EmacsView initFrameFromEmacs:]): Move the layer code to after the NSWindow has been created as creating the layer now relies on some of it's properties. ([EmacsView makeBackingLayer]): New function. ([EmacsView lockFocus]): ([EmacsView focusOnDrawingBuffer]): Rename to lockFocus. ([EmacsView unlockFocus]): ([EmacsView unfocusDrawingBuffer]): Rename to unlockFocus. ([EmacsView windowDidChangeBackingProperties]): Don't explicitly release surfaces but reset EmacsLayer properties. ([EmacsView layout]): ([EmacsView viewWillDraw]): Rename to layout. ([EmacsView wantsUpdateLayer]): Remove function and change all callers to [EmacsView wantsLayer]. (EmacsSurface, EmacsLayer): Rename to EmacsLayer. ([EmacsSurface getSize]): ([EmacsSurface initWithSize:ColorSpace:Scale:]): Remove methods. ([EmacsSurface initWithColorSpace:]): ([EmacsLayer checkDimensions]): ([EmacsLayer releaseSurfaces]): ([EmacsLayer display]): New functions. * src/nsterm.m ([EmacsLayer dealloc]): Use releaseSurfaces. ([EmacsSurface getContext]): Automatically detect frame property changes and clear the cache if required. Use built-in CALayer properties where available. ([EmacsLayer copyContentsTo:]): Use [CALayer contents] as source.
2021-05-29 09:48:51 +01:00
- (id) initWithColorSpace: (CGColorSpaceRef)cs;
- (void) setColorSpace: (CGColorSpaceRef)cs;
- (CGContextRef) getContext;
@end
#endif
2008-07-15 18:15:18 +00:00
/* ==========================================================================
Rendering
2008-07-15 18:15:18 +00:00
========================================================================== */
extern NSArray *ns_send_types, *ns_return_types;
2009-09-27 15:48:30 +00:00
extern NSString *ns_app_name;
Fix problems found by static checking --with-ns This is for Fedora 24 when configured with --enable-gcc-warnings. Although it does not fix all the problems, it fixes many of them. * src/frame.c (XParseGeometry): * src/nsterm.m (mouseDown:): Mark locals with UNINIT to pacify --enable-gcc-warnings. * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen): Remove unused macros. (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image) (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_load_image, xpm_load) (pbm_next_char, pbm_scan_number, pbm_load, svg_load) (svg_load_image): * src/nsfns.m (x_get_string_resource): * src/nsimage.m (ns_image_from_XBM): Fix pointer signedness problems. * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load) (imagemagick_load_image): Omit unused locals. * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types) (Fx_open_connection): * src/nsfont.m (ns_antialias_threshold): Move extern decl to nsterm.h so it can be checked. * src/nsmenu.m (svcsMenu, dockMenu): Move to the only file that uses them, so they can be static. * src/nsterm.h (find_and_call_menu_selection): * src/nsterm.m (x_set_frame_alpha): Omit duplicate decls. * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE. * src/nsfns.m (ns_tooltip, ns_display_info_for_name) (ns_set_name_as_filename, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): * src/nsterm.m (ns_drag_types, ns_draw_text_decoration): Now static. * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp): Remove; unused. * src/nsfont.m (ns_dump_glyphstring): * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp) (ns_clear_frame, keyDown:): Fix signedness problem with printf arg. * src/nsterm.h (ns_input_events, ns_finish_events): * src/nsterm.m (ns_finish_events, hide_bell): Prototype the decls. * src/nsterm.m (NSMenuDidBeginTrackingNotification): Omit unnecessary decl. (dockMenu): (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file. (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:) (toggleFullScreen:): Use FACE_FROM_ID instead of FACE_FROM_ID_OR_NULL in contexts where the caller expects the result to be non-null. (applicationShouldTerminate:): Fix misleading indentation.
2016-09-29 20:09:37 -07:00
extern EmacsMenu *svcsMenu;
2008-07-15 18:15:18 +00:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Apple removed the declaration, but kept the implementation. */
#if defined (NS_IMPL_COCOA)
2008-07-15 18:15:18 +00:00
@interface NSApplication (EmacsApp)
- (void)setAppleMenu: (NSMenu *)menu;
@end
#endif
#endif /* __OBJC__ */
/* ==========================================================================
Non-OO stuff
========================================================================== */
/* Special keycodes that we pass down the event chain */
#define KEY_NS_POWER_OFF ((1<<28)|(0<<16)|1)
#define KEY_NS_OPEN_FILE ((1<<28)|(0<<16)|2)
#define KEY_NS_OPEN_TEMP_FILE ((1<<28)|(0<<16)|3)
#define KEY_NS_CHANGE_FONT ((1<<28)|(0<<16)|7)
#define KEY_NS_OPEN_FILE_LINE ((1<<28)|(0<<16)|8)
#define KEY_NS_PUT_WORKING_TEXT ((1<<28)|(0<<16)|9)
#define KEY_NS_UNPUT_WORKING_TEXT ((1<<28)|(0<<16)|10)
#define KEY_NS_SPI_SERVICE_CALL ((1<<28)|(0<<16)|11)
#define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
#define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13)
#define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14)
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Could use list to store these, but rest of emacs has a big infrastructure
for managing a table of bitmap "records". */
2008-07-15 18:15:18 +00:00
struct ns_bitmap_record
{
#ifdef __OBJC__
EmacsImage *img;
#else
void *img;
#endif
char *file;
int refcount;
int height, width, depth;
};
#ifdef NS_IMPL_GNUSTEP
2008-07-15 18:15:18 +00:00
/* this extends font backend font */
struct nsfont_info
{
struct font font;
2011-11-16 18:47:25 +01:00
char *name; /* PostScript name, uniquely identifies on NS systems */
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* The following metrics are stored as float rather than int. */
float width; /* Maximum advance for the font. */
2008-07-15 18:15:18 +00:00
float height;
float underpos;
float underwidth;
float size;
#ifdef __OBJC__
NSFont *nsfont;
#else /* ! OBJC */
void *nsfont;
#endif
char bold, ital; /* convenience flags */
char synthItal;
XCharStruct max_bounds;
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* We compute glyph codes and metrics on-demand in blocks of 256 indexed
by hibyte, lobyte. */
Improve font display on NS port * src/nsfns.m (Fx_create_frame): Use "fixed" for the default font on GNUstep. * src/nsfont.m (LCD_SMOOTHING_MARGIN, ns_escape_name) (ns_unescape_name, ns_attribute_fvalue) (STYLE_REF): Remove unused defines and functions. (struct ns_glyph_layout, enum lgstring_direction). (enum gs_font_slant, enum gs_font_weight, enum gs_font_width) (enum gs_specified, struct gs_font_data): New enumerators and structures. (ns_font_descs_match_p) (ns_done_font_data, ns_get_font_data): New functions. (ns_glyph_metrics): Stop escaping names. (ns_spec_to_descriptor): Fix font descriptor creation for symbolic font spec entires. (ns_descriptor_to_entity): Create entries with the correct symbolic styles. (ns_fallback_entity): Fix fallback entity selection. (ns_findfonts): Use our own font matcher instead of the broken GNUstep matcher. (ns_list_family): Remove obsolete comment. (nsfont_open): Remove obsolete code, comments, and synthItal logic which doesn't work on GNUstep. (nsfont_encode_char): Use a type that can fit NSGlyph (nsfont_draw): Chose correct font, remove obsolete mouse face logic, obsolete comments, and switch to using glyph-based drawing instead of character-based drawing. (ns_font_shape, nsfont_shape): New functions. (ns_uni_to_glyphs_1): New function. (ns_uni_to_glyphs): Return glyphs instead of unicode codepoints. (ns_glyph_metrics): Use NSGlyphs instead of unicode codepoints and fix left bearing, right bearing, ascent and descent computation. (struct nsfont_driver): Add shaping capability. * src/nsterm.h (struct nsfont_info): Use unsigned int for glyph cache. * src/nsterm.c (ns_focus): Set DPS clipping on GNUstep. (ns_compute_glyph_string_overhangs): Fix overhang computation by using xterm code. (ns_draw_window_cursor): Simplify cursor drawing. (ns_maybe_dumpglyphs_background): Test for cursor HL and remove obsolete mouse face logic. (ns_dumpglyphs_image) (ns_dumpglyphs_box_or_relief): Rectify for new cursor logic. (ns_dumpglyphs_stretch): Rectify for new cursor logic and rely on ns_draw_glyph_string to set focus. (ns_draw_glyph_string_foreground): Remove mouse face logic. (ns_draw_glyph_strings): Implement overhangs, remove obsolete comment, and always focus before dumping glyphs. (ns_draw_text_decoration): Add condition for DRAW_CURSOR and simplify color selection. (ns_define_frame_cursor): Remove nonsensical code (define_frame_cursor has nothing to do with the text cursor, aka caret). * src/xdisp.c (draw_glyphs): Enable code for NS port to fix mouse face cursor display. * src/macfont.m (get_cgcolor_from_nscolor): New function. (macfont_draw): Remove obsolete mouse-face code and enable cursor display.
2021-10-23 19:44:03 +08:00
unsigned int **glyphs; /* map Unicode index to glyph */
2008-07-15 18:15:18 +00:00
struct font_metrics **metrics;
};
#endif
2008-07-15 18:15:18 +00:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Initialized in ns_initialize_display_info (). */
2008-07-15 18:15:18 +00:00
struct ns_display_info
{
/* Chain of all ns_display_info structures. */
struct ns_display_info *next;
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* The generic display parameters corresponding to this NS display. */
2008-07-15 18:15:18 +00:00
struct terminal *terminal;
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */
2008-07-15 18:15:18 +00:00
Lisp_Object name_list_element;
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* The number of fonts loaded. */
2008-07-15 18:15:18 +00:00
int n_fonts;
/* Minimum width over all characters in all fonts in font_table. */
int smallest_char_width;
/* Minimum font height over all fonts in font_table. */
int smallest_font_height;
struct ns_bitmap_record *bitmaps;
ptrdiff_t bitmaps_size;
ptrdiff_t bitmaps_last;
2008-07-15 18:15:18 +00:00
/* DPI resolution of this screen */
2008-07-15 18:15:18 +00:00
double resx, resy;
/* Mask of things that cause the mouse to be grabbed */
2008-07-15 18:15:18 +00:00
int grabbed;
int n_planes;
int color_p;
Window root_window;
/* Xism */
Lisp_Object rdb;
2008-07-15 18:15:18 +00:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* The cursor to use for vertical scroll bars. */
Emacs_Cursor vertical_scroll_bar_cursor;
2008-07-15 18:15:18 +00:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* The cursor to use for horizontal scroll bars. */
Emacs_Cursor horizontal_scroll_bar_cursor;
Complete pixelwise frame/window resizing, add horizontal scrollbar support. * frame.el (frame-notice-user-settings): Rewrite using frame-initial-frame-tool-bar-height. * menu-bar.el (menu-bar-horizontal-scroll-bar) (menu-bar-no-horizontal-scroll-bar): New functions. (menu-bar-showhide-scroll-bar-menu): Add bindings for horizontal scroll bars. * scroll-bar.el (scroll-bar-lines) (set-horizontal-scroll-bar-mode) (get-horizontal-scroll-bar-mode, horizontal-scroll-bar-mode) (scroll-bar-horizontal-drag-1, scroll-bar-horizontal-drag) (scroll-bar-toolkit-horizontal-scroll): New functions. (horizontal-scroll-bar-mode) (previous-horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode-explicit): New variables. (horizontal-scroll-bar-mode): New option. (toggle-horizontal-scroll-bar): Do something. (top-level): Bind horizontal-scroll-bar mouse-1. * startup.el (tool-bar-originally-present): Remove variable. (command-line): Don't set tool-bar-originally-present. * window.el (window-min-height): Update doc-string. (window--dump-frame): Dump horizontal scroll bar values. (window--min-size-1): Handle minibuffer window separately. Count in margins and horizontal scroll bar. Return safe value iff IGNORE equals 'safe. (frame-windows-min-size): New function (used by frame resizing routines). (fit-frame-to-buffer, fit-window-to-buffer): Count in horizontal scroll bars. (window--sanitize-window-sizes): New function. (window-split-min-size): Remove. (split-window): Count divider-width. Don't use `window-split-min-size' any more. Reword error messages. Sanitize windows sizes after splitting. * buffer.h (struct buffer): New fields scroll_bar_height and horizontal_scroll_bar_type. * buffer.c (bset_scroll_bar_height) (bset_horizontal_scroll_bar_type): New functions. (Fbuffer_swap_text): Handle old_pointm field. (init_buffer_once): Set defaults for scroll_bar_height and horizontal_scroll_bar_type. (syms_of_buffer): New variables scroll_bar_height and horizontal_scroll_bar_type. * dispextern.h (window_part): Rename ON_SCROLL_BAR to ON_VERTICAL_SCROLL_BAR. Add ON_HORIZONTAL_SCROLL_BAR. (set_vertical_scroll_bar): Remove prototype. (x_change_tool_bar_height): Add prototype. * dispnew.c (adjust_frame_glyphs_for_frame_redisplay) (window_to_frame_vpos, update_frame_1, scrolling, init_display): Use FRAME_TOTAL_COLS and FRAME_TOTAL_LINES instead of FRAME_COLS and FRAME_LINES. (adjust_frame_glyphs_for_window_redisplay): Rearrange lines. (update_window): Start mode_line_row->y after horizontal scroll bar. (change_frame_size_1): Call adjust_frame_size. (init_display): When changing the size of a tty frame do not pass height of menu bar. (Qframe_windows_min_size): New symbol. * frame.h (struct frame): List tool bar fields after menu bar fields. Add official, total_lines, horizontal_scroll_bars, config_scroll_bar_height and config_scroll_bar_lines fields. (FRAME_HAS_HORIZONTAL_SCROLL_BARS) (FRAME_CONFIG_SCROLL_BAR_HEIGHT, FRAME_CONFIG_SCROLL_BAR_LINES) (FRAME_SCROLL_BAR_AREA_HEIGHT, FRAME_SCROLL_BAR_COLS) (FRAME_SCROLL_BAR_LINES, FRAME_TOTAL_LINES, SET_FRAME_LINES) (FRAME_WINDOWS_HEIGHT): New macros. (SET_FRAME_HEIGHT, FRAME_TEXT_LINES_TO_PIXEL_HEIGHT) (FRAME_PIXEL_Y_TO_LINE, FRAME_PIXEL_HEIGHT_TO_TEXT_LINES) (FRAME_TEXT_TO_PIXEL_HEIGHT): Separately count top margin and horizontal scroll bar. (frame_inhibit_resize, adjust_frame_size) (frame_windows_min_size): Add declarations. (Qscroll_bar_height, Qhorizontal_scroll_bars) (x_set_scroll_bar_default_height, x_set_left_fringe) (x_set_right_fringe, x_set_vertical_scroll_bars) (x_set_horizontal_scroll_bars, x_set_scroll_bar_width) (x_set_scroll_bar_height): Add external declarations. * frame.c: (frame_inhibit_resize, frame_windows_min_size) (adjust_frame_size): New functions. (make_frame): Initial horizontal_scroll_bars field. Use SET_FRAME_LINES. Don't allow horizontal scroll bar in minibuffer window. (make_initial_frame, make_terminal_frame): No horizontal scroll bar in initial and terminal frames. Use adjust_frame_size. (Fframe_total_cols): Fix doc-string. (Fframe_total_lines, Fscroll_bar_height): New Lisp functions. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Rewrite using adjust_frame_size. (Qscroll_bar_height, Qhorizontal_scroll_bars) (Qframe_windows_min_size): New symbols. (x_set_frame_parameters): Remove call of check_frame_size. (x_report_frame_params): Return scroll_bar_height value. (x_set_left_fringe, x_set_right_fringe): New functions. (adjust_frame_height, x_set_internal_border_width) (x_set_fringe_width): Remove. (x_set_internal_border_width, x_set_vertical_scroll_bars) (x_set_scroll_bar_width, x_set_right_divider_width) (x_set_bottom_divider_width): Rewrite using adjust_frame_size. (x_set_horizontal_scroll_bars, x_set_scroll_bar_height): New functions. (x_figure_window_size): Rewrite to make frame display the expected number of lines. (Vdefault_frame_scroll_bars): Rewrite doc-string. (Vdefault_frame_horizontal_scroll_bars) (Vframe_initial_frame_tool_bar_height) (frame_inhibit_implied_resize): New variables. * fringe.c (compute_fringe_widths): Remove. * gtkutil.h (YG_SB_MIN, YG_SB_MAX, YG_SB_RANGE): Define. (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb) (xg_get_default_scrollbar_height) (xg_clear_under_internal_border): Extern. * gtkutil.c (xg_frame_resized): Don't call do_pending_window_change. (xg_frame_set_char_size): Use adjust_frame_size. (style_changed_cb): Call update_theme_scrollbar_height and x_set_scroll_bar_default_height. (x_wm_set_size_hint): Don't call check_frame_size. (update_theme_scrollbar_height) (xg_get_default_scrollbar_height) (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb): New functions. (xg_create_scroll_bar): Set horizontal slot of bar. (xg_initialize): Call update_theme_scrollbar_height. (xg_clear_under_internal_border): No more static. * insdel.c (adjust_suspend_auto_hscroll): New function. (adjust_markers_for_delete, adjust_markers_for_insert) (adjust_markers_for_replace): Call adjust_suspend_auto_hscroll. * keyboard.c (readable_events, discard_mouse_events) (make_lispy_event): Handle horizontal scroll bar click events. (Fsuspend_emacs): When changing the size of a tty frame do not pass height of menu bar. (Qbefore_handle, Qhorizontal_handle, Qafter_handle, Qleft) (Qright, Qleftmost, Qrightmost): New symbols. * menu.c (Fx_popup_dialog): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * minibuf.c (read_minibuf): Initialize suspend_auto_hscroll. * nsfns.m (x_set_internal_border_width): New function. * nsterm.m (ns_draw_fringe_bitmap, ns_set_vertical_scroll_bar): Remove extended fringe code. (x_set_window_size, x_new_font): Don't call compute_fringe_widths. * term.c (Fresume_tty): When changing the size of a tty frame do not pass height of menu bar. (clear_tty_hooks, set_tty_hooks): Clear horizontal_scroll_bar_hook. (init_tty): Frame has no horizontal scroll bars. * termhooks.h (enum scroll_bar_part): Add scroll_bar_move_ratio, scroll_bar_before_handle, scroll_bar_horizontal_handle, scroll_bar_after_handle, scroll_bar_left_arrow, scroll_bar_right_arrow, scroll_bar_to_leftmost and scroll_bar_to_rightmost entries. (enum event_kind): Add HORIZONTAL_SCROLL_BAR_CLICK_EVENT (struct terminal): Add set_horizontal_scroll_bar_hook. * w32console.c (initialize_w32_display): Clear horizontal_scroll_bar_hook. * w32fns.c (x_set_mouse_color): Use FRAME_W32_DISPLAY instead of FRAME_X_DISPLAY. (x_clear_under_internal_border, x_set_internal_border_width): New functions. (x_set_menu_bar_lines): Rewrite using frame_inhibit_resize. Set windows_or_buffers_changed when adding the menu bar. (x_set_tool_bar_lines): Rewrite using adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (w32_createhscrollbar): New functions. (w32_createscrollbar): Rename to w32_createvscrollbar. (w32_createwindow): Init WND_HSCROLLBAR_INDEX. (w32_name_of_message): Replace WM_EMACS_CREATESCROLLBAR by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR. Add WM_EMACS_SHOWCURSOR. (w32_wnd_proc): Handle WM_HSCROLL case. In WM_WINDOWPOSCHANGING case do not artificially impose WM size hints. Handle WM_EMACS_SHOWCURSOR case. Replace WM_EMACS_CREATESCROLLBAR case by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR cases. (my_create_tip_window): Replace WND_SCROLLBAR_INDEX by WND_VSCROLLBAR_INDEX and WND_HSCROLLBAR_INDEX. (unwind_create_frame_1): Remove. (Fx_create_frame): Make both scrollbars the system standard width and height. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (w32_frame_parm_handlers): Remove x_set_fringe_width entries. Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe and x_set_right_fringe. * w32inevt.c (resize_event, maybe_generate_resize_event): Do not pass height of menu bar to change_frame_size. * w32menu.c (set_frame_menubar): Rewrite using frame_inhibit_resize. * w32term.h (struct w32_display_info): Add horizontal_scroll_bar_cursor and cursor_display_counter. (struct scroll_bar): Add horizontal. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH) (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): New macros. (WM_EMACS_CREATEVSCROLLBAR, WM_EMACS_CREATEHSCROLLBAR): Define instead of WM_EMACS_CREATESCROLLBAR. (WND_VSCROLLBAR_INDEX, WND_HSCROLLBAR_INDEX): Define instead of WND_SCROLLBAR_INDEX. * w32term.c (horizontal_scroll_bar_min_handle) (horizontal_scroll_bar_left_border) (horizontal_scroll_bar_right_border): New integers. (x_set_frame_alpha): Replace x_highlight_frame by w32_focus_frame. (x_window_to_scroll_bar): New argument "type". Update callers accordingly. (w32_set_horizontal_scroll_bar_thumb) (x_horizontal_scroll_bar_report_motion) (w32_set_horizontal_scroll_bar) (w32_horizontal_scroll_bar_handle_click) (x_horizontal_scroll_bar_report_motion): New functions. (w32_mouse_position): Discriminate horizontal and vertical scrollbar cases. (my_create_scrollbar): Replace with two new functions my_create_vscrollbar and my_create_hscrollbar. (x_scroll_bar_create): New argument "horizontal". Update callers accordingly. (x_scroll_bar_remove, w32_condemn_scroll_bars) (w32_redeem_scroll_bar, x_scroll_bar_clear): Handle horizontal scroll bar case. (w32_read_socket): Handle WM_HSCROLL cae. (x_new_font): Don't recompute fringe widths. Use frame_inhibit_resize. Calculate new menu bar height iff we build without toolkit. Always clear under internal border. (x_set_window_size): Don't check frame size or recompute fringes. Reset fullscreen status before applying sizes. Always resize as requested by pixelwise argument. Don't call do_pending_window_change. (x_wm_set_size_hint): Add call for FRAME_SCROLL_BAR_AREA_HEIGHT. (w32_initialize_display_info): Initialize dpyinfo's horizontal_scroll_bar_cursor entry. (w32_create_terminal): Add set_horizontal_scroll_bar_hook. (w32_initialize): Init horizontal_scroll_bar_min_handle and horizontal_scroll_bar_left_border. (w32fullscreen_hook): Intermittently resize window to normal when switching from fullscreen to maximized state. (run_window_configuration_change_hook): Don't run it if frame is not official yet. (unwind_change_frame): Remove. (Fset_window_configuration): Rewrite using frame's official field. * widget.c (set_frame_size): Don't call compute_fringe_widths. (EmacsFrameSetCharSize): Obey frame_inhibit_resize. * window.h (struct window): New fields old_pointm, horizontal_scroll_bar, horizontal_scroll_bar_type, hscroll_whole, scroll_bar_height and suspend_auto_hscroll. (wset_horizontal_scroll_bar, wset_horizontal_scroll_bar_type): New functions. (sanitize_window_sizes): Extern. (MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P, WINDOW_PSEUDO_P) (WINDOW_TOPMOST_P, WINDOW_HAS_HORIZONTAL_SCROLL_BAR) (WINDOW_CONFIG_SCROLL_BAR_HEIGHT) (WINDOW_CONFIG_SCROLL_BAR_LINES) (WINDOW_SCROLL_BAR_LINES, WINDOW_SCROLL_BAR_AREA_HEIGHT): New macros. (WINDOW_LEFT_FRINGE_COLS, WINDOW_RIGHT_FRINGE_COLS) (WINDOW_FRINGE_COLS, WINDOW_FRINGE_EXTENDED_P): Remove macros. (WINDOW_VERTICAL_SCROLL_BAR_TYPE) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT) (WINDOW_HAS_VERTICAL_SCROLL_BAR): Minor rewrite. (WINDOW_BOX_HEIGHT_NO_MODE_LINE, WINDOW_BOX_TEXT_HEIGHT) (WINDOW_SCROLL_BAR_AREA_Y): Count in scroll bar height. * window.c (wset_old_pointm, Fwindow_scroll_bar_height) (Fwindow_old_point, sanitize_window_sizes): New functions. (Qwindow_sanitize_window_sizes): New symbol. (window_body_height): Count in horizontal scroll bar. (set_window_hscroll, Fscroll_left, Fscroll_right): Set suspend_auto_hscroll slot. (Fwindow_inside_edges): Count fringes pixelwise. (coordinates_in_window, Fcoordinates_in_window_p): Consider horizontal scroll bar. (check_frame_size, adjust_window_margins): Remove functions and corresponding calls. (set_window_buffer): Initialize old_pointm and horizontal scroll bars. (temp_output_buffer_show): Reset hscroll related fields. Initialize old_pointm. (make_parent_window): Initialize old_pointm. (make_window): Initialize old_pointm, horizontal scroll bar type, and scroll bar height. (resize_frame_windows): Don't count top margin in new sizes. Don't use safe sizes when shrinking a frame; let the window manager do the clipping. (Fsplit_window_internal): Inherit horizontal scroll bar type and height. (Fdelete_window_internal): Unchain old_pointm marker. (window_scroll_pixel_based, Fscroll_other_window): Adjust old_pointm. (Fwindow_text_width, Fwindow_text_height): New argument "pixelwise". (struct saved_window): New fields, old_pointm, hscroll_whole, suspend_auto_hscroll, scroll_bar_height and horizontal_scroll_bar_type. (Fset_window_configuration, save_window_save): Set new fields of saved_window. (apply_window_adjustment): Don't call adjust_window_margins. (set_window_margins): Don't change margins if new sizes don't fit into window. (set_window_scroll_bars): New argument "horizontal_type". Handle horizontal scroll bars. Don't change scroll bars if they don't fit into window. (Fset_window_scroll_bars): New argument "horizontal_type". (Fwindow_scroll_bars): Return values for horizontal scroll bars. (compare_window_configurations): Compare horizontal scroll bar settings. * xdisp.c (window_text_bottom_y, window_box_height): Count in horizontal scroll bar height. (pixel_to_glyph_coords, init_xdisp): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (remember_mouse_glyph): Case ON_SCROLL_BAR changed to ON_VERTICAL_SCROLL_BAR. (with_echo_area_buffer): Initialize old_pointm. (with_echo_area_buffer_unwind_data): Store old_pointm values in vector. (unwind_with_echo_area_buffer): Handle old_pointm. (update_tool_bar): Set do_update when the tool bar window has at least one line (since this is what the user sets). (MAX_FRAME_TOOL_BAR_HEIGHT): Remove macro. (redisplay_tool_bar): Return early when toolbar has zero lines. Call x_change_tool_bar_height. Don't use max_tool_bar_height. (hscroll_window_tree): Handle suspension of auto_hscroll and old_pointm. (set_horizontal_scroll_bar): New function. (redisplay_window): Set ignore_mouse_drag_p when tool bar has more than one line. Handle horizontal scroll bars. (note_mouse_highlight): Handle horizontal scrol bars. (expose_frame): Set dimensions of XRectangle from frame's text sizes. (Vvoid_text_area_pointer): Update doc-string. * xfns.c (x_set_menu_bar_lines): Use adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (x_set_internal_border_width): New functions. (x_set_tool_bar_lines): Call x_change_tool_bar_height. (unwind_create_frame_1): Remove. (Fx_create_frame): Handle horizontal scroll bars. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (x_frame_parm_handlers): Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe, x_set_right_fringe. * xmenu.c (update_frame_menubar, free_frame_menubar): Use adjust_frame_size. * xterm.h (struct x_display_info): Add horizontal_scroll_bar_cursor and Xatom_Horizontal_Scrollbar slots. (struct scroll_bar): Add horizontal slot. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH): New macros. (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): Define. (x_clear_under_internal_border): Remove. * xterm.c (XTmouse_position): Handle horizontal scroll bars. (x_window_to_scroll_bar): New argument TYPE. Update callers. (x_send_scroll_bar_event, x_scroll_bar_create): New arguments HORIZONTAL. Update callers. (horizontal_action_hook_id): New action hook id. (x_horizontal_scroll_bar_to_input_event) (x_create_horizontal_toolkit_scroll_bar) (xt_horizontal_action_hook) (x_set_toolkit_horizontal_scroll_bar_thumb) (XTset_horizontal_scroll_bar, x_net_wm_state) (x_horizontal_scroll_bar_report_motion): New functions. (xg_scroll_callback, x_scroll_bar_handle_click): Handle horizontal scroll bars. (SCROLL_BAR_HORIZONTAL_NAME): Define. (XTset_vertical_scroll_bar): Attempt to clear areas not covered by scroll bar. (XTcondemn_scroll_bars, XTredeem_scroll_bar): Rewrite. Handle horizontal scroll bars. (handle_one_xevent): Handle horizontal scroll bar events. Call x_net_wm_state. (x_set_window_size_1, x_wm_set_size_hint): Don't call check_frame_size. (x_set_window_size): Don't call check_frame_size and do_pending_window_change. (x_term_init): Init horizontal_scroll_bar_cursor display info. (x_create_terminal): Add set_horizontal_scroll_bar_hook. (x_scroll_bar_set_handle): Add some checks when calling x_clear_area.
2014-07-27 15:21:30 +02:00
/* Information about the range of text currently shown in
mouse-face. */
Mouse_HLInfo mouse_highlight;
2008-07-15 18:15:18 +00:00
struct frame *highlight_frame;
struct frame *ns_focus_frame;
/* The frame where the mouse was last time we reported a mouse event. */
struct frame *last_mouse_frame;
/* The frame where the mouse was last time we reported a mouse motion. */
struct frame *last_mouse_motion_frame;
/* Position where the mouse was last time we reported a motion.
This is a position on last_mouse_motion_frame. */
int last_mouse_motion_x;
int last_mouse_motion_y;
/* Where the mouse was last time we reported a mouse position. */
NSRect last_mouse_glyph;
/* Time of last mouse movement. */
Time last_mouse_movement_time;
/* The scroll bar in which the last motion event occurred. */
#ifdef __OBJC__
EmacsScroller *last_mouse_scroll_bar;
#else
void *last_mouse_scroll_bar;
#endif
2008-07-15 18:15:18 +00:00
};
/* This is a chain of structures for all the NS displays currently in use. */
extern struct ns_display_info *x_display_list;
2008-07-15 18:15:18 +00:00
struct ns_output
{
#ifdef __OBJC__
EmacsView *view;
id miniimage;
NSColor *cursor_color;
2008-07-15 18:15:18 +00:00
NSColor *foreground_color;
NSColor *background_color;
NSColor *relief_background_color;
NSColor *light_relief_color;
NSColor *dark_relief_color;
2008-07-15 18:15:18 +00:00
EmacsToolbar *toolbar;
#else
void *view;
void *miniimage;
void *cursor_color;
2008-07-15 18:15:18 +00:00
void *foreground_color;
void *background_color;
void *relief_background_color;
void *light_relief_color;
void *dark_relief_color;
2008-07-15 18:15:18 +00:00
void *toolbar;
#endif
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* NSCursors are initialized in initFrameFromEmacs. */
Emacs_Cursor text_cursor;
Emacs_Cursor nontext_cursor;
Emacs_Cursor modeline_cursor;
Emacs_Cursor hand_cursor;
Emacs_Cursor hourglass_cursor;
Emacs_Cursor horizontal_drag_cursor;
Emacs_Cursor vertical_drag_cursor;
Emacs_Cursor left_edge_cursor;
Emacs_Cursor top_left_corner_cursor;
Emacs_Cursor top_edge_cursor;
Emacs_Cursor top_right_corner_cursor;
Emacs_Cursor right_edge_cursor;
Emacs_Cursor bottom_right_corner_cursor;
Emacs_Cursor bottom_edge_cursor;
Emacs_Cursor bottom_left_corner_cursor;
2008-07-15 18:15:18 +00:00
/* NS-specific */
Emacs_Cursor current_pointer;
2008-07-15 18:15:18 +00:00
/* lord knows why Emacs needs to know about our Window ids.. */
2008-07-15 18:15:18 +00:00
Window window_desc, parent_desc;
char explicit_parent;
struct font *font;
int baseline_offset;
/* If a fontset is specified for this frame instead of font, this
value contains an ID of the fontset, else -1. */
int fontset; /* only used with font_backend */
int icon_top;
int icon_left;
2008-07-15 18:15:18 +00:00
/* The size of the extra width currently allotted for vertical
scroll bars, in pixels. */
int vertical_scroll_bar_extra;
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* The height of the titlebar decoration (included in NSWindow's frame). */
2008-07-15 18:15:18 +00:00
int titlebar_height;
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* The height of the toolbar if displayed, else 0. */
2008-07-15 18:15:18 +00:00
int toolbar_height;
/* This is the Emacs structure for the NS display this frame is on. */
struct ns_display_info *display_info;
/* Non-zero if we are zooming (maximizing) the frame. */
int zooming;
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Non-zero if we are doing an animation, e.g. toggling the tool bar. */
int in_animation;
#ifdef NS_IMPL_GNUSTEP
/* Zero if this is the first time a toolbar has been updated on this
frame. */
int tool_bar_adjusted;
#endif
2008-07-15 18:15:18 +00:00
};
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* This dummy declaration needed to support TTYs. */
2008-07-15 18:15:18 +00:00
struct x_output
{
int unused;
2008-07-15 18:15:18 +00:00
};
/* This gives the ns_display_info structure for the display F is on. */
#define FRAME_DISPLAY_INFO(f) ((f)->output_data.ns->display_info)
#define FRAME_OUTPUT_DATA(f) ((f)->output_data.ns)
2008-07-15 18:15:18 +00:00
#define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc)
#define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f)
2008-07-15 18:15:18 +00:00
#define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color)
#define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color)
#define NS_FACE_FOREGROUND(f) ((f)->foreground)
#define NS_FACE_BACKGROUND(f) ((f)->background)
#define FRAME_DEFAULT_FACE(f) FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID)
2008-07-15 18:15:18 +00:00
#define FRAME_NS_VIEW(f) ((f)->output_data.ns->view)
#define FRAME_CURSOR_COLOR(f) ((f)->output_data.ns->cursor_color)
2008-07-15 18:15:18 +00:00
#define FRAME_POINTER_TYPE(f) ((f)->output_data.ns->current_pointer)
#define FRAME_FONT(f) ((f)->output_data.ns->font)
#ifdef __OBJC__
#define XNS_SCROLL_BAR(vec) ((id) xmint_pointer (vec))
2008-07-15 18:15:18 +00:00
#else
#define XNS_SCROLL_BAR(vec) xmint_pointer (vec)
2008-07-15 18:15:18 +00:00
#endif
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Compute pixel height of the frame's titlebar. */
Add new frame functionality to NS port * lisp/frame.el (frame-restack): Call ns-frame-restack. * src/keyboard.c (kbd_buffer_get_event) [HAVE_NS]: Enable MOVE_FRAME_EVENT handling. * src/frame.h: * src/frame.c: Enable 'z-group', 'undecorated' and 'parent' frame definitions. * src/nsfns.m: Add x_set_z_group, x_set_parent_frame and x_set_undecorated (Cocoa only) to handler struct. (Fx_create_frame): Handle 'z-group', 'parent-frame' and 'undecorated' frame parameter. (Fns_frame_restack): New function. * src/nsmenu.m (free_frame_tool_bar, update_frame_tool_bar): FRAME_TOOLBAR_HEIGHT is no longer a variable. * src/nsterm.h (NS_PARENT_WINDOW_LEFT_POS, NS_PARENT_WINDOW_TOP_POS): Add #defines to find the screen position of the parent frame. (NS_TOP_POS): Remove defun. (EmacsView): Remove redundant toolbar variables and add createToolbar method. (FRAME_NS_TITLEBAR_HEIGHT, FRAME_TOOLBAR_HEIGHT): Always calculate the values instead of storing them in a variable. * src/nsterm.m (x_set_offset, windowDidMove): Take parent frame position into account when positioning frames. (initFrameFromEmacs): Remove toolbar creation code and handle new frame parameters. (x_set_window_size): Remove toolbar height calculation. (x_set_z_group): (x_set_parent_frame): (x_set_undecorated) [NS_IMPL_COCOA]: New function. (x_destroy_window): Detach parent if child closes. (updateFrameSize): Change NSTRACE message to reflect new reality and no longer reset frame size. (windowWillResize): Don’t change NS window name when the titlebar is invisible. (createToolbar): Move toolbar creation code into it’s own method. (toggleFullScreen): FRAME_TOOLBAR_HEIGHT and FRAME_NS_TITLEBAR_HEIGHT are no longer variables. (windowDidMove): Fire MOVE_FRAME_EVENT Emacs event.
2017-04-14 10:02:38 +01:00
#define FRAME_NS_TITLEBAR_HEIGHT(f) \
(NSHeight([FRAME_NS_VIEW (f) frame]) == 0 ? \
0 \
: (int)(NSHeight([FRAME_NS_VIEW (f) window].frame) \
- NSHeight([NSWindow contentRectForFrameRect: \
[[FRAME_NS_VIEW (f) window] frame] \
styleMask:[[FRAME_NS_VIEW (f) window] styleMask]])))
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Compute pixel height of the toolbar. */
Add new frame functionality to NS port * lisp/frame.el (frame-restack): Call ns-frame-restack. * src/keyboard.c (kbd_buffer_get_event) [HAVE_NS]: Enable MOVE_FRAME_EVENT handling. * src/frame.h: * src/frame.c: Enable 'z-group', 'undecorated' and 'parent' frame definitions. * src/nsfns.m: Add x_set_z_group, x_set_parent_frame and x_set_undecorated (Cocoa only) to handler struct. (Fx_create_frame): Handle 'z-group', 'parent-frame' and 'undecorated' frame parameter. (Fns_frame_restack): New function. * src/nsmenu.m (free_frame_tool_bar, update_frame_tool_bar): FRAME_TOOLBAR_HEIGHT is no longer a variable. * src/nsterm.h (NS_PARENT_WINDOW_LEFT_POS, NS_PARENT_WINDOW_TOP_POS): Add #defines to find the screen position of the parent frame. (NS_TOP_POS): Remove defun. (EmacsView): Remove redundant toolbar variables and add createToolbar method. (FRAME_NS_TITLEBAR_HEIGHT, FRAME_TOOLBAR_HEIGHT): Always calculate the values instead of storing them in a variable. * src/nsterm.m (x_set_offset, windowDidMove): Take parent frame position into account when positioning frames. (initFrameFromEmacs): Remove toolbar creation code and handle new frame parameters. (x_set_window_size): Remove toolbar height calculation. (x_set_z_group): (x_set_parent_frame): (x_set_undecorated) [NS_IMPL_COCOA]: New function. (x_destroy_window): Detach parent if child closes. (updateFrameSize): Change NSTRACE message to reflect new reality and no longer reset frame size. (windowWillResize): Don’t change NS window name when the titlebar is invisible. (createToolbar): Move toolbar creation code into it’s own method. (toggleFullScreen): FRAME_TOOLBAR_HEIGHT and FRAME_NS_TITLEBAR_HEIGHT are no longer variables. (windowDidMove): Fire MOVE_FRAME_EVENT Emacs event.
2017-04-14 10:02:38 +01:00
#define FRAME_TOOLBAR_HEIGHT(f) \
(([[FRAME_NS_VIEW (f) window] toolbar] == nil \
|| ! [[FRAME_NS_VIEW (f) window] toolbar].isVisible) ? \
0 \
: (int)(NSHeight([NSWindow contentRectForFrameRect: \
[[FRAME_NS_VIEW (f) window] frame] \
styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]) \
- NSHeight([[[FRAME_NS_VIEW (f) window] contentView] frame])))
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Compute pixel size for vertical scroll bars. */
Complete pixelwise frame/window resizing, add horizontal scrollbar support. * frame.el (frame-notice-user-settings): Rewrite using frame-initial-frame-tool-bar-height. * menu-bar.el (menu-bar-horizontal-scroll-bar) (menu-bar-no-horizontal-scroll-bar): New functions. (menu-bar-showhide-scroll-bar-menu): Add bindings for horizontal scroll bars. * scroll-bar.el (scroll-bar-lines) (set-horizontal-scroll-bar-mode) (get-horizontal-scroll-bar-mode, horizontal-scroll-bar-mode) (scroll-bar-horizontal-drag-1, scroll-bar-horizontal-drag) (scroll-bar-toolkit-horizontal-scroll): New functions. (horizontal-scroll-bar-mode) (previous-horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode-explicit): New variables. (horizontal-scroll-bar-mode): New option. (toggle-horizontal-scroll-bar): Do something. (top-level): Bind horizontal-scroll-bar mouse-1. * startup.el (tool-bar-originally-present): Remove variable. (command-line): Don't set tool-bar-originally-present. * window.el (window-min-height): Update doc-string. (window--dump-frame): Dump horizontal scroll bar values. (window--min-size-1): Handle minibuffer window separately. Count in margins and horizontal scroll bar. Return safe value iff IGNORE equals 'safe. (frame-windows-min-size): New function (used by frame resizing routines). (fit-frame-to-buffer, fit-window-to-buffer): Count in horizontal scroll bars. (window--sanitize-window-sizes): New function. (window-split-min-size): Remove. (split-window): Count divider-width. Don't use `window-split-min-size' any more. Reword error messages. Sanitize windows sizes after splitting. * buffer.h (struct buffer): New fields scroll_bar_height and horizontal_scroll_bar_type. * buffer.c (bset_scroll_bar_height) (bset_horizontal_scroll_bar_type): New functions. (Fbuffer_swap_text): Handle old_pointm field. (init_buffer_once): Set defaults for scroll_bar_height and horizontal_scroll_bar_type. (syms_of_buffer): New variables scroll_bar_height and horizontal_scroll_bar_type. * dispextern.h (window_part): Rename ON_SCROLL_BAR to ON_VERTICAL_SCROLL_BAR. Add ON_HORIZONTAL_SCROLL_BAR. (set_vertical_scroll_bar): Remove prototype. (x_change_tool_bar_height): Add prototype. * dispnew.c (adjust_frame_glyphs_for_frame_redisplay) (window_to_frame_vpos, update_frame_1, scrolling, init_display): Use FRAME_TOTAL_COLS and FRAME_TOTAL_LINES instead of FRAME_COLS and FRAME_LINES. (adjust_frame_glyphs_for_window_redisplay): Rearrange lines. (update_window): Start mode_line_row->y after horizontal scroll bar. (change_frame_size_1): Call adjust_frame_size. (init_display): When changing the size of a tty frame do not pass height of menu bar. (Qframe_windows_min_size): New symbol. * frame.h (struct frame): List tool bar fields after menu bar fields. Add official, total_lines, horizontal_scroll_bars, config_scroll_bar_height and config_scroll_bar_lines fields. (FRAME_HAS_HORIZONTAL_SCROLL_BARS) (FRAME_CONFIG_SCROLL_BAR_HEIGHT, FRAME_CONFIG_SCROLL_BAR_LINES) (FRAME_SCROLL_BAR_AREA_HEIGHT, FRAME_SCROLL_BAR_COLS) (FRAME_SCROLL_BAR_LINES, FRAME_TOTAL_LINES, SET_FRAME_LINES) (FRAME_WINDOWS_HEIGHT): New macros. (SET_FRAME_HEIGHT, FRAME_TEXT_LINES_TO_PIXEL_HEIGHT) (FRAME_PIXEL_Y_TO_LINE, FRAME_PIXEL_HEIGHT_TO_TEXT_LINES) (FRAME_TEXT_TO_PIXEL_HEIGHT): Separately count top margin and horizontal scroll bar. (frame_inhibit_resize, adjust_frame_size) (frame_windows_min_size): Add declarations. (Qscroll_bar_height, Qhorizontal_scroll_bars) (x_set_scroll_bar_default_height, x_set_left_fringe) (x_set_right_fringe, x_set_vertical_scroll_bars) (x_set_horizontal_scroll_bars, x_set_scroll_bar_width) (x_set_scroll_bar_height): Add external declarations. * frame.c: (frame_inhibit_resize, frame_windows_min_size) (adjust_frame_size): New functions. (make_frame): Initial horizontal_scroll_bars field. Use SET_FRAME_LINES. Don't allow horizontal scroll bar in minibuffer window. (make_initial_frame, make_terminal_frame): No horizontal scroll bar in initial and terminal frames. Use adjust_frame_size. (Fframe_total_cols): Fix doc-string. (Fframe_total_lines, Fscroll_bar_height): New Lisp functions. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Rewrite using adjust_frame_size. (Qscroll_bar_height, Qhorizontal_scroll_bars) (Qframe_windows_min_size): New symbols. (x_set_frame_parameters): Remove call of check_frame_size. (x_report_frame_params): Return scroll_bar_height value. (x_set_left_fringe, x_set_right_fringe): New functions. (adjust_frame_height, x_set_internal_border_width) (x_set_fringe_width): Remove. (x_set_internal_border_width, x_set_vertical_scroll_bars) (x_set_scroll_bar_width, x_set_right_divider_width) (x_set_bottom_divider_width): Rewrite using adjust_frame_size. (x_set_horizontal_scroll_bars, x_set_scroll_bar_height): New functions. (x_figure_window_size): Rewrite to make frame display the expected number of lines. (Vdefault_frame_scroll_bars): Rewrite doc-string. (Vdefault_frame_horizontal_scroll_bars) (Vframe_initial_frame_tool_bar_height) (frame_inhibit_implied_resize): New variables. * fringe.c (compute_fringe_widths): Remove. * gtkutil.h (YG_SB_MIN, YG_SB_MAX, YG_SB_RANGE): Define. (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb) (xg_get_default_scrollbar_height) (xg_clear_under_internal_border): Extern. * gtkutil.c (xg_frame_resized): Don't call do_pending_window_change. (xg_frame_set_char_size): Use adjust_frame_size. (style_changed_cb): Call update_theme_scrollbar_height and x_set_scroll_bar_default_height. (x_wm_set_size_hint): Don't call check_frame_size. (update_theme_scrollbar_height) (xg_get_default_scrollbar_height) (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb): New functions. (xg_create_scroll_bar): Set horizontal slot of bar. (xg_initialize): Call update_theme_scrollbar_height. (xg_clear_under_internal_border): No more static. * insdel.c (adjust_suspend_auto_hscroll): New function. (adjust_markers_for_delete, adjust_markers_for_insert) (adjust_markers_for_replace): Call adjust_suspend_auto_hscroll. * keyboard.c (readable_events, discard_mouse_events) (make_lispy_event): Handle horizontal scroll bar click events. (Fsuspend_emacs): When changing the size of a tty frame do not pass height of menu bar. (Qbefore_handle, Qhorizontal_handle, Qafter_handle, Qleft) (Qright, Qleftmost, Qrightmost): New symbols. * menu.c (Fx_popup_dialog): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * minibuf.c (read_minibuf): Initialize suspend_auto_hscroll. * nsfns.m (x_set_internal_border_width): New function. * nsterm.m (ns_draw_fringe_bitmap, ns_set_vertical_scroll_bar): Remove extended fringe code. (x_set_window_size, x_new_font): Don't call compute_fringe_widths. * term.c (Fresume_tty): When changing the size of a tty frame do not pass height of menu bar. (clear_tty_hooks, set_tty_hooks): Clear horizontal_scroll_bar_hook. (init_tty): Frame has no horizontal scroll bars. * termhooks.h (enum scroll_bar_part): Add scroll_bar_move_ratio, scroll_bar_before_handle, scroll_bar_horizontal_handle, scroll_bar_after_handle, scroll_bar_left_arrow, scroll_bar_right_arrow, scroll_bar_to_leftmost and scroll_bar_to_rightmost entries. (enum event_kind): Add HORIZONTAL_SCROLL_BAR_CLICK_EVENT (struct terminal): Add set_horizontal_scroll_bar_hook. * w32console.c (initialize_w32_display): Clear horizontal_scroll_bar_hook. * w32fns.c (x_set_mouse_color): Use FRAME_W32_DISPLAY instead of FRAME_X_DISPLAY. (x_clear_under_internal_border, x_set_internal_border_width): New functions. (x_set_menu_bar_lines): Rewrite using frame_inhibit_resize. Set windows_or_buffers_changed when adding the menu bar. (x_set_tool_bar_lines): Rewrite using adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (w32_createhscrollbar): New functions. (w32_createscrollbar): Rename to w32_createvscrollbar. (w32_createwindow): Init WND_HSCROLLBAR_INDEX. (w32_name_of_message): Replace WM_EMACS_CREATESCROLLBAR by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR. Add WM_EMACS_SHOWCURSOR. (w32_wnd_proc): Handle WM_HSCROLL case. In WM_WINDOWPOSCHANGING case do not artificially impose WM size hints. Handle WM_EMACS_SHOWCURSOR case. Replace WM_EMACS_CREATESCROLLBAR case by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR cases. (my_create_tip_window): Replace WND_SCROLLBAR_INDEX by WND_VSCROLLBAR_INDEX and WND_HSCROLLBAR_INDEX. (unwind_create_frame_1): Remove. (Fx_create_frame): Make both scrollbars the system standard width and height. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (w32_frame_parm_handlers): Remove x_set_fringe_width entries. Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe and x_set_right_fringe. * w32inevt.c (resize_event, maybe_generate_resize_event): Do not pass height of menu bar to change_frame_size. * w32menu.c (set_frame_menubar): Rewrite using frame_inhibit_resize. * w32term.h (struct w32_display_info): Add horizontal_scroll_bar_cursor and cursor_display_counter. (struct scroll_bar): Add horizontal. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH) (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): New macros. (WM_EMACS_CREATEVSCROLLBAR, WM_EMACS_CREATEHSCROLLBAR): Define instead of WM_EMACS_CREATESCROLLBAR. (WND_VSCROLLBAR_INDEX, WND_HSCROLLBAR_INDEX): Define instead of WND_SCROLLBAR_INDEX. * w32term.c (horizontal_scroll_bar_min_handle) (horizontal_scroll_bar_left_border) (horizontal_scroll_bar_right_border): New integers. (x_set_frame_alpha): Replace x_highlight_frame by w32_focus_frame. (x_window_to_scroll_bar): New argument "type". Update callers accordingly. (w32_set_horizontal_scroll_bar_thumb) (x_horizontal_scroll_bar_report_motion) (w32_set_horizontal_scroll_bar) (w32_horizontal_scroll_bar_handle_click) (x_horizontal_scroll_bar_report_motion): New functions. (w32_mouse_position): Discriminate horizontal and vertical scrollbar cases. (my_create_scrollbar): Replace with two new functions my_create_vscrollbar and my_create_hscrollbar. (x_scroll_bar_create): New argument "horizontal". Update callers accordingly. (x_scroll_bar_remove, w32_condemn_scroll_bars) (w32_redeem_scroll_bar, x_scroll_bar_clear): Handle horizontal scroll bar case. (w32_read_socket): Handle WM_HSCROLL cae. (x_new_font): Don't recompute fringe widths. Use frame_inhibit_resize. Calculate new menu bar height iff we build without toolkit. Always clear under internal border. (x_set_window_size): Don't check frame size or recompute fringes. Reset fullscreen status before applying sizes. Always resize as requested by pixelwise argument. Don't call do_pending_window_change. (x_wm_set_size_hint): Add call for FRAME_SCROLL_BAR_AREA_HEIGHT. (w32_initialize_display_info): Initialize dpyinfo's horizontal_scroll_bar_cursor entry. (w32_create_terminal): Add set_horizontal_scroll_bar_hook. (w32_initialize): Init horizontal_scroll_bar_min_handle and horizontal_scroll_bar_left_border. (w32fullscreen_hook): Intermittently resize window to normal when switching from fullscreen to maximized state. (run_window_configuration_change_hook): Don't run it if frame is not official yet. (unwind_change_frame): Remove. (Fset_window_configuration): Rewrite using frame's official field. * widget.c (set_frame_size): Don't call compute_fringe_widths. (EmacsFrameSetCharSize): Obey frame_inhibit_resize. * window.h (struct window): New fields old_pointm, horizontal_scroll_bar, horizontal_scroll_bar_type, hscroll_whole, scroll_bar_height and suspend_auto_hscroll. (wset_horizontal_scroll_bar, wset_horizontal_scroll_bar_type): New functions. (sanitize_window_sizes): Extern. (MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P, WINDOW_PSEUDO_P) (WINDOW_TOPMOST_P, WINDOW_HAS_HORIZONTAL_SCROLL_BAR) (WINDOW_CONFIG_SCROLL_BAR_HEIGHT) (WINDOW_CONFIG_SCROLL_BAR_LINES) (WINDOW_SCROLL_BAR_LINES, WINDOW_SCROLL_BAR_AREA_HEIGHT): New macros. (WINDOW_LEFT_FRINGE_COLS, WINDOW_RIGHT_FRINGE_COLS) (WINDOW_FRINGE_COLS, WINDOW_FRINGE_EXTENDED_P): Remove macros. (WINDOW_VERTICAL_SCROLL_BAR_TYPE) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT) (WINDOW_HAS_VERTICAL_SCROLL_BAR): Minor rewrite. (WINDOW_BOX_HEIGHT_NO_MODE_LINE, WINDOW_BOX_TEXT_HEIGHT) (WINDOW_SCROLL_BAR_AREA_Y): Count in scroll bar height. * window.c (wset_old_pointm, Fwindow_scroll_bar_height) (Fwindow_old_point, sanitize_window_sizes): New functions. (Qwindow_sanitize_window_sizes): New symbol. (window_body_height): Count in horizontal scroll bar. (set_window_hscroll, Fscroll_left, Fscroll_right): Set suspend_auto_hscroll slot. (Fwindow_inside_edges): Count fringes pixelwise. (coordinates_in_window, Fcoordinates_in_window_p): Consider horizontal scroll bar. (check_frame_size, adjust_window_margins): Remove functions and corresponding calls. (set_window_buffer): Initialize old_pointm and horizontal scroll bars. (temp_output_buffer_show): Reset hscroll related fields. Initialize old_pointm. (make_parent_window): Initialize old_pointm. (make_window): Initialize old_pointm, horizontal scroll bar type, and scroll bar height. (resize_frame_windows): Don't count top margin in new sizes. Don't use safe sizes when shrinking a frame; let the window manager do the clipping. (Fsplit_window_internal): Inherit horizontal scroll bar type and height. (Fdelete_window_internal): Unchain old_pointm marker. (window_scroll_pixel_based, Fscroll_other_window): Adjust old_pointm. (Fwindow_text_width, Fwindow_text_height): New argument "pixelwise". (struct saved_window): New fields, old_pointm, hscroll_whole, suspend_auto_hscroll, scroll_bar_height and horizontal_scroll_bar_type. (Fset_window_configuration, save_window_save): Set new fields of saved_window. (apply_window_adjustment): Don't call adjust_window_margins. (set_window_margins): Don't change margins if new sizes don't fit into window. (set_window_scroll_bars): New argument "horizontal_type". Handle horizontal scroll bars. Don't change scroll bars if they don't fit into window. (Fset_window_scroll_bars): New argument "horizontal_type". (Fwindow_scroll_bars): Return values for horizontal scroll bars. (compare_window_configurations): Compare horizontal scroll bar settings. * xdisp.c (window_text_bottom_y, window_box_height): Count in horizontal scroll bar height. (pixel_to_glyph_coords, init_xdisp): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (remember_mouse_glyph): Case ON_SCROLL_BAR changed to ON_VERTICAL_SCROLL_BAR. (with_echo_area_buffer): Initialize old_pointm. (with_echo_area_buffer_unwind_data): Store old_pointm values in vector. (unwind_with_echo_area_buffer): Handle old_pointm. (update_tool_bar): Set do_update when the tool bar window has at least one line (since this is what the user sets). (MAX_FRAME_TOOL_BAR_HEIGHT): Remove macro. (redisplay_tool_bar): Return early when toolbar has zero lines. Call x_change_tool_bar_height. Don't use max_tool_bar_height. (hscroll_window_tree): Handle suspension of auto_hscroll and old_pointm. (set_horizontal_scroll_bar): New function. (redisplay_window): Set ignore_mouse_drag_p when tool bar has more than one line. Handle horizontal scroll bars. (note_mouse_highlight): Handle horizontal scrol bars. (expose_frame): Set dimensions of XRectangle from frame's text sizes. (Vvoid_text_area_pointer): Update doc-string. * xfns.c (x_set_menu_bar_lines): Use adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (x_set_internal_border_width): New functions. (x_set_tool_bar_lines): Call x_change_tool_bar_height. (unwind_create_frame_1): Remove. (Fx_create_frame): Handle horizontal scroll bars. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (x_frame_parm_handlers): Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe, x_set_right_fringe. * xmenu.c (update_frame_menubar, free_frame_menubar): Use adjust_frame_size. * xterm.h (struct x_display_info): Add horizontal_scroll_bar_cursor and Xatom_Horizontal_Scrollbar slots. (struct scroll_bar): Add horizontal slot. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH): New macros. (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): Define. (x_clear_under_internal_border): Remove. * xterm.c (XTmouse_position): Handle horizontal scroll bars. (x_window_to_scroll_bar): New argument TYPE. Update callers. (x_send_scroll_bar_event, x_scroll_bar_create): New arguments HORIZONTAL. Update callers. (horizontal_action_hook_id): New action hook id. (x_horizontal_scroll_bar_to_input_event) (x_create_horizontal_toolkit_scroll_bar) (xt_horizontal_action_hook) (x_set_toolkit_horizontal_scroll_bar_thumb) (XTset_horizontal_scroll_bar, x_net_wm_state) (x_horizontal_scroll_bar_report_motion): New functions. (xg_scroll_callback, x_scroll_bar_handle_click): Handle horizontal scroll bars. (SCROLL_BAR_HORIZONTAL_NAME): Define. (XTset_vertical_scroll_bar): Attempt to clear areas not covered by scroll bar. (XTcondemn_scroll_bars, XTredeem_scroll_bar): Rewrite. Handle horizontal scroll bars. (handle_one_xevent): Handle horizontal scroll bar events. Call x_net_wm_state. (x_set_window_size_1, x_wm_set_size_hint): Don't call check_frame_size. (x_set_window_size): Don't call check_frame_size and do_pending_window_change. (x_term_init): Init horizontal_scroll_bar_cursor display info. (x_create_terminal): Add set_horizontal_scroll_bar_hook. (x_scroll_bar_set_handle): Add some checks when calling x_clear_area.
2014-07-27 15:21:30 +02:00
#define NS_SCROLL_BAR_WIDTH(f) \
(FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \
? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
: (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \
: 0)
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Compute pixel size for horizontal scroll bars. */
Complete pixelwise frame/window resizing, add horizontal scrollbar support. * frame.el (frame-notice-user-settings): Rewrite using frame-initial-frame-tool-bar-height. * menu-bar.el (menu-bar-horizontal-scroll-bar) (menu-bar-no-horizontal-scroll-bar): New functions. (menu-bar-showhide-scroll-bar-menu): Add bindings for horizontal scroll bars. * scroll-bar.el (scroll-bar-lines) (set-horizontal-scroll-bar-mode) (get-horizontal-scroll-bar-mode, horizontal-scroll-bar-mode) (scroll-bar-horizontal-drag-1, scroll-bar-horizontal-drag) (scroll-bar-toolkit-horizontal-scroll): New functions. (horizontal-scroll-bar-mode) (previous-horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode-explicit): New variables. (horizontal-scroll-bar-mode): New option. (toggle-horizontal-scroll-bar): Do something. (top-level): Bind horizontal-scroll-bar mouse-1. * startup.el (tool-bar-originally-present): Remove variable. (command-line): Don't set tool-bar-originally-present. * window.el (window-min-height): Update doc-string. (window--dump-frame): Dump horizontal scroll bar values. (window--min-size-1): Handle minibuffer window separately. Count in margins and horizontal scroll bar. Return safe value iff IGNORE equals 'safe. (frame-windows-min-size): New function (used by frame resizing routines). (fit-frame-to-buffer, fit-window-to-buffer): Count in horizontal scroll bars. (window--sanitize-window-sizes): New function. (window-split-min-size): Remove. (split-window): Count divider-width. Don't use `window-split-min-size' any more. Reword error messages. Sanitize windows sizes after splitting. * buffer.h (struct buffer): New fields scroll_bar_height and horizontal_scroll_bar_type. * buffer.c (bset_scroll_bar_height) (bset_horizontal_scroll_bar_type): New functions. (Fbuffer_swap_text): Handle old_pointm field. (init_buffer_once): Set defaults for scroll_bar_height and horizontal_scroll_bar_type. (syms_of_buffer): New variables scroll_bar_height and horizontal_scroll_bar_type. * dispextern.h (window_part): Rename ON_SCROLL_BAR to ON_VERTICAL_SCROLL_BAR. Add ON_HORIZONTAL_SCROLL_BAR. (set_vertical_scroll_bar): Remove prototype. (x_change_tool_bar_height): Add prototype. * dispnew.c (adjust_frame_glyphs_for_frame_redisplay) (window_to_frame_vpos, update_frame_1, scrolling, init_display): Use FRAME_TOTAL_COLS and FRAME_TOTAL_LINES instead of FRAME_COLS and FRAME_LINES. (adjust_frame_glyphs_for_window_redisplay): Rearrange lines. (update_window): Start mode_line_row->y after horizontal scroll bar. (change_frame_size_1): Call adjust_frame_size. (init_display): When changing the size of a tty frame do not pass height of menu bar. (Qframe_windows_min_size): New symbol. * frame.h (struct frame): List tool bar fields after menu bar fields. Add official, total_lines, horizontal_scroll_bars, config_scroll_bar_height and config_scroll_bar_lines fields. (FRAME_HAS_HORIZONTAL_SCROLL_BARS) (FRAME_CONFIG_SCROLL_BAR_HEIGHT, FRAME_CONFIG_SCROLL_BAR_LINES) (FRAME_SCROLL_BAR_AREA_HEIGHT, FRAME_SCROLL_BAR_COLS) (FRAME_SCROLL_BAR_LINES, FRAME_TOTAL_LINES, SET_FRAME_LINES) (FRAME_WINDOWS_HEIGHT): New macros. (SET_FRAME_HEIGHT, FRAME_TEXT_LINES_TO_PIXEL_HEIGHT) (FRAME_PIXEL_Y_TO_LINE, FRAME_PIXEL_HEIGHT_TO_TEXT_LINES) (FRAME_TEXT_TO_PIXEL_HEIGHT): Separately count top margin and horizontal scroll bar. (frame_inhibit_resize, adjust_frame_size) (frame_windows_min_size): Add declarations. (Qscroll_bar_height, Qhorizontal_scroll_bars) (x_set_scroll_bar_default_height, x_set_left_fringe) (x_set_right_fringe, x_set_vertical_scroll_bars) (x_set_horizontal_scroll_bars, x_set_scroll_bar_width) (x_set_scroll_bar_height): Add external declarations. * frame.c: (frame_inhibit_resize, frame_windows_min_size) (adjust_frame_size): New functions. (make_frame): Initial horizontal_scroll_bars field. Use SET_FRAME_LINES. Don't allow horizontal scroll bar in minibuffer window. (make_initial_frame, make_terminal_frame): No horizontal scroll bar in initial and terminal frames. Use adjust_frame_size. (Fframe_total_cols): Fix doc-string. (Fframe_total_lines, Fscroll_bar_height): New Lisp functions. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Rewrite using adjust_frame_size. (Qscroll_bar_height, Qhorizontal_scroll_bars) (Qframe_windows_min_size): New symbols. (x_set_frame_parameters): Remove call of check_frame_size. (x_report_frame_params): Return scroll_bar_height value. (x_set_left_fringe, x_set_right_fringe): New functions. (adjust_frame_height, x_set_internal_border_width) (x_set_fringe_width): Remove. (x_set_internal_border_width, x_set_vertical_scroll_bars) (x_set_scroll_bar_width, x_set_right_divider_width) (x_set_bottom_divider_width): Rewrite using adjust_frame_size. (x_set_horizontal_scroll_bars, x_set_scroll_bar_height): New functions. (x_figure_window_size): Rewrite to make frame display the expected number of lines. (Vdefault_frame_scroll_bars): Rewrite doc-string. (Vdefault_frame_horizontal_scroll_bars) (Vframe_initial_frame_tool_bar_height) (frame_inhibit_implied_resize): New variables. * fringe.c (compute_fringe_widths): Remove. * gtkutil.h (YG_SB_MIN, YG_SB_MAX, YG_SB_RANGE): Define. (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb) (xg_get_default_scrollbar_height) (xg_clear_under_internal_border): Extern. * gtkutil.c (xg_frame_resized): Don't call do_pending_window_change. (xg_frame_set_char_size): Use adjust_frame_size. (style_changed_cb): Call update_theme_scrollbar_height and x_set_scroll_bar_default_height. (x_wm_set_size_hint): Don't call check_frame_size. (update_theme_scrollbar_height) (xg_get_default_scrollbar_height) (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb): New functions. (xg_create_scroll_bar): Set horizontal slot of bar. (xg_initialize): Call update_theme_scrollbar_height. (xg_clear_under_internal_border): No more static. * insdel.c (adjust_suspend_auto_hscroll): New function. (adjust_markers_for_delete, adjust_markers_for_insert) (adjust_markers_for_replace): Call adjust_suspend_auto_hscroll. * keyboard.c (readable_events, discard_mouse_events) (make_lispy_event): Handle horizontal scroll bar click events. (Fsuspend_emacs): When changing the size of a tty frame do not pass height of menu bar. (Qbefore_handle, Qhorizontal_handle, Qafter_handle, Qleft) (Qright, Qleftmost, Qrightmost): New symbols. * menu.c (Fx_popup_dialog): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * minibuf.c (read_minibuf): Initialize suspend_auto_hscroll. * nsfns.m (x_set_internal_border_width): New function. * nsterm.m (ns_draw_fringe_bitmap, ns_set_vertical_scroll_bar): Remove extended fringe code. (x_set_window_size, x_new_font): Don't call compute_fringe_widths. * term.c (Fresume_tty): When changing the size of a tty frame do not pass height of menu bar. (clear_tty_hooks, set_tty_hooks): Clear horizontal_scroll_bar_hook. (init_tty): Frame has no horizontal scroll bars. * termhooks.h (enum scroll_bar_part): Add scroll_bar_move_ratio, scroll_bar_before_handle, scroll_bar_horizontal_handle, scroll_bar_after_handle, scroll_bar_left_arrow, scroll_bar_right_arrow, scroll_bar_to_leftmost and scroll_bar_to_rightmost entries. (enum event_kind): Add HORIZONTAL_SCROLL_BAR_CLICK_EVENT (struct terminal): Add set_horizontal_scroll_bar_hook. * w32console.c (initialize_w32_display): Clear horizontal_scroll_bar_hook. * w32fns.c (x_set_mouse_color): Use FRAME_W32_DISPLAY instead of FRAME_X_DISPLAY. (x_clear_under_internal_border, x_set_internal_border_width): New functions. (x_set_menu_bar_lines): Rewrite using frame_inhibit_resize. Set windows_or_buffers_changed when adding the menu bar. (x_set_tool_bar_lines): Rewrite using adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (w32_createhscrollbar): New functions. (w32_createscrollbar): Rename to w32_createvscrollbar. (w32_createwindow): Init WND_HSCROLLBAR_INDEX. (w32_name_of_message): Replace WM_EMACS_CREATESCROLLBAR by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR. Add WM_EMACS_SHOWCURSOR. (w32_wnd_proc): Handle WM_HSCROLL case. In WM_WINDOWPOSCHANGING case do not artificially impose WM size hints. Handle WM_EMACS_SHOWCURSOR case. Replace WM_EMACS_CREATESCROLLBAR case by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR cases. (my_create_tip_window): Replace WND_SCROLLBAR_INDEX by WND_VSCROLLBAR_INDEX and WND_HSCROLLBAR_INDEX. (unwind_create_frame_1): Remove. (Fx_create_frame): Make both scrollbars the system standard width and height. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (w32_frame_parm_handlers): Remove x_set_fringe_width entries. Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe and x_set_right_fringe. * w32inevt.c (resize_event, maybe_generate_resize_event): Do not pass height of menu bar to change_frame_size. * w32menu.c (set_frame_menubar): Rewrite using frame_inhibit_resize. * w32term.h (struct w32_display_info): Add horizontal_scroll_bar_cursor and cursor_display_counter. (struct scroll_bar): Add horizontal. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH) (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): New macros. (WM_EMACS_CREATEVSCROLLBAR, WM_EMACS_CREATEHSCROLLBAR): Define instead of WM_EMACS_CREATESCROLLBAR. (WND_VSCROLLBAR_INDEX, WND_HSCROLLBAR_INDEX): Define instead of WND_SCROLLBAR_INDEX. * w32term.c (horizontal_scroll_bar_min_handle) (horizontal_scroll_bar_left_border) (horizontal_scroll_bar_right_border): New integers. (x_set_frame_alpha): Replace x_highlight_frame by w32_focus_frame. (x_window_to_scroll_bar): New argument "type". Update callers accordingly. (w32_set_horizontal_scroll_bar_thumb) (x_horizontal_scroll_bar_report_motion) (w32_set_horizontal_scroll_bar) (w32_horizontal_scroll_bar_handle_click) (x_horizontal_scroll_bar_report_motion): New functions. (w32_mouse_position): Discriminate horizontal and vertical scrollbar cases. (my_create_scrollbar): Replace with two new functions my_create_vscrollbar and my_create_hscrollbar. (x_scroll_bar_create): New argument "horizontal". Update callers accordingly. (x_scroll_bar_remove, w32_condemn_scroll_bars) (w32_redeem_scroll_bar, x_scroll_bar_clear): Handle horizontal scroll bar case. (w32_read_socket): Handle WM_HSCROLL cae. (x_new_font): Don't recompute fringe widths. Use frame_inhibit_resize. Calculate new menu bar height iff we build without toolkit. Always clear under internal border. (x_set_window_size): Don't check frame size or recompute fringes. Reset fullscreen status before applying sizes. Always resize as requested by pixelwise argument. Don't call do_pending_window_change. (x_wm_set_size_hint): Add call for FRAME_SCROLL_BAR_AREA_HEIGHT. (w32_initialize_display_info): Initialize dpyinfo's horizontal_scroll_bar_cursor entry. (w32_create_terminal): Add set_horizontal_scroll_bar_hook. (w32_initialize): Init horizontal_scroll_bar_min_handle and horizontal_scroll_bar_left_border. (w32fullscreen_hook): Intermittently resize window to normal when switching from fullscreen to maximized state. (run_window_configuration_change_hook): Don't run it if frame is not official yet. (unwind_change_frame): Remove. (Fset_window_configuration): Rewrite using frame's official field. * widget.c (set_frame_size): Don't call compute_fringe_widths. (EmacsFrameSetCharSize): Obey frame_inhibit_resize. * window.h (struct window): New fields old_pointm, horizontal_scroll_bar, horizontal_scroll_bar_type, hscroll_whole, scroll_bar_height and suspend_auto_hscroll. (wset_horizontal_scroll_bar, wset_horizontal_scroll_bar_type): New functions. (sanitize_window_sizes): Extern. (MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P, WINDOW_PSEUDO_P) (WINDOW_TOPMOST_P, WINDOW_HAS_HORIZONTAL_SCROLL_BAR) (WINDOW_CONFIG_SCROLL_BAR_HEIGHT) (WINDOW_CONFIG_SCROLL_BAR_LINES) (WINDOW_SCROLL_BAR_LINES, WINDOW_SCROLL_BAR_AREA_HEIGHT): New macros. (WINDOW_LEFT_FRINGE_COLS, WINDOW_RIGHT_FRINGE_COLS) (WINDOW_FRINGE_COLS, WINDOW_FRINGE_EXTENDED_P): Remove macros. (WINDOW_VERTICAL_SCROLL_BAR_TYPE) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT) (WINDOW_HAS_VERTICAL_SCROLL_BAR): Minor rewrite. (WINDOW_BOX_HEIGHT_NO_MODE_LINE, WINDOW_BOX_TEXT_HEIGHT) (WINDOW_SCROLL_BAR_AREA_Y): Count in scroll bar height. * window.c (wset_old_pointm, Fwindow_scroll_bar_height) (Fwindow_old_point, sanitize_window_sizes): New functions. (Qwindow_sanitize_window_sizes): New symbol. (window_body_height): Count in horizontal scroll bar. (set_window_hscroll, Fscroll_left, Fscroll_right): Set suspend_auto_hscroll slot. (Fwindow_inside_edges): Count fringes pixelwise. (coordinates_in_window, Fcoordinates_in_window_p): Consider horizontal scroll bar. (check_frame_size, adjust_window_margins): Remove functions and corresponding calls. (set_window_buffer): Initialize old_pointm and horizontal scroll bars. (temp_output_buffer_show): Reset hscroll related fields. Initialize old_pointm. (make_parent_window): Initialize old_pointm. (make_window): Initialize old_pointm, horizontal scroll bar type, and scroll bar height. (resize_frame_windows): Don't count top margin in new sizes. Don't use safe sizes when shrinking a frame; let the window manager do the clipping. (Fsplit_window_internal): Inherit horizontal scroll bar type and height. (Fdelete_window_internal): Unchain old_pointm marker. (window_scroll_pixel_based, Fscroll_other_window): Adjust old_pointm. (Fwindow_text_width, Fwindow_text_height): New argument "pixelwise". (struct saved_window): New fields, old_pointm, hscroll_whole, suspend_auto_hscroll, scroll_bar_height and horizontal_scroll_bar_type. (Fset_window_configuration, save_window_save): Set new fields of saved_window. (apply_window_adjustment): Don't call adjust_window_margins. (set_window_margins): Don't change margins if new sizes don't fit into window. (set_window_scroll_bars): New argument "horizontal_type". Handle horizontal scroll bars. Don't change scroll bars if they don't fit into window. (Fset_window_scroll_bars): New argument "horizontal_type". (Fwindow_scroll_bars): Return values for horizontal scroll bars. (compare_window_configurations): Compare horizontal scroll bar settings. * xdisp.c (window_text_bottom_y, window_box_height): Count in horizontal scroll bar height. (pixel_to_glyph_coords, init_xdisp): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (remember_mouse_glyph): Case ON_SCROLL_BAR changed to ON_VERTICAL_SCROLL_BAR. (with_echo_area_buffer): Initialize old_pointm. (with_echo_area_buffer_unwind_data): Store old_pointm values in vector. (unwind_with_echo_area_buffer): Handle old_pointm. (update_tool_bar): Set do_update when the tool bar window has at least one line (since this is what the user sets). (MAX_FRAME_TOOL_BAR_HEIGHT): Remove macro. (redisplay_tool_bar): Return early when toolbar has zero lines. Call x_change_tool_bar_height. Don't use max_tool_bar_height. (hscroll_window_tree): Handle suspension of auto_hscroll and old_pointm. (set_horizontal_scroll_bar): New function. (redisplay_window): Set ignore_mouse_drag_p when tool bar has more than one line. Handle horizontal scroll bars. (note_mouse_highlight): Handle horizontal scrol bars. (expose_frame): Set dimensions of XRectangle from frame's text sizes. (Vvoid_text_area_pointer): Update doc-string. * xfns.c (x_set_menu_bar_lines): Use adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (x_set_internal_border_width): New functions. (x_set_tool_bar_lines): Call x_change_tool_bar_height. (unwind_create_frame_1): Remove. (Fx_create_frame): Handle horizontal scroll bars. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (x_frame_parm_handlers): Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe, x_set_right_fringe. * xmenu.c (update_frame_menubar, free_frame_menubar): Use adjust_frame_size. * xterm.h (struct x_display_info): Add horizontal_scroll_bar_cursor and Xatom_Horizontal_Scrollbar slots. (struct scroll_bar): Add horizontal slot. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH): New macros. (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): Define. (x_clear_under_internal_border): Remove. * xterm.c (XTmouse_position): Handle horizontal scroll bars. (x_window_to_scroll_bar): New argument TYPE. Update callers. (x_send_scroll_bar_event, x_scroll_bar_create): New arguments HORIZONTAL. Update callers. (horizontal_action_hook_id): New action hook id. (x_horizontal_scroll_bar_to_input_event) (x_create_horizontal_toolkit_scroll_bar) (xt_horizontal_action_hook) (x_set_toolkit_horizontal_scroll_bar_thumb) (XTset_horizontal_scroll_bar, x_net_wm_state) (x_horizontal_scroll_bar_report_motion): New functions. (xg_scroll_callback, x_scroll_bar_handle_click): Handle horizontal scroll bars. (SCROLL_BAR_HORIZONTAL_NAME): Define. (XTset_vertical_scroll_bar): Attempt to clear areas not covered by scroll bar. (XTcondemn_scroll_bars, XTredeem_scroll_bar): Rewrite. Handle horizontal scroll bars. (handle_one_xevent): Handle horizontal scroll bar events. Call x_net_wm_state. (x_set_window_size_1, x_wm_set_size_hint): Don't call check_frame_size. (x_set_window_size): Don't call check_frame_size and do_pending_window_change. (x_term_init): Init horizontal_scroll_bar_cursor display info. (x_create_terminal): Add set_horizontal_scroll_bar_hook. (x_scroll_bar_set_handle): Add some checks when calling x_clear_area.
2014-07-27 15:21:30 +02:00
#define NS_SCROLL_BAR_HEIGHT(f) \
(FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \
? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 \
? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) \
: (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))) \
: 0)
2008-07-15 18:15:18 +00:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Difference between char-column-calculated and actual SB widths.
This is only a concern for rendering when SB on left. */
#define NS_SCROLL_BAR_ADJUST(w, f) \
(WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) ? \
(FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) \
- NS_SCROLL_BAR_WIDTH (f)) : 0)
2008-07-15 18:15:18 +00:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Difference between char-line-calculated and actual SB heights.
This is only a concern for rendering when SB on top. */
Complete pixelwise frame/window resizing, add horizontal scrollbar support. * frame.el (frame-notice-user-settings): Rewrite using frame-initial-frame-tool-bar-height. * menu-bar.el (menu-bar-horizontal-scroll-bar) (menu-bar-no-horizontal-scroll-bar): New functions. (menu-bar-showhide-scroll-bar-menu): Add bindings for horizontal scroll bars. * scroll-bar.el (scroll-bar-lines) (set-horizontal-scroll-bar-mode) (get-horizontal-scroll-bar-mode, horizontal-scroll-bar-mode) (scroll-bar-horizontal-drag-1, scroll-bar-horizontal-drag) (scroll-bar-toolkit-horizontal-scroll): New functions. (horizontal-scroll-bar-mode) (previous-horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode-explicit): New variables. (horizontal-scroll-bar-mode): New option. (toggle-horizontal-scroll-bar): Do something. (top-level): Bind horizontal-scroll-bar mouse-1. * startup.el (tool-bar-originally-present): Remove variable. (command-line): Don't set tool-bar-originally-present. * window.el (window-min-height): Update doc-string. (window--dump-frame): Dump horizontal scroll bar values. (window--min-size-1): Handle minibuffer window separately. Count in margins and horizontal scroll bar. Return safe value iff IGNORE equals 'safe. (frame-windows-min-size): New function (used by frame resizing routines). (fit-frame-to-buffer, fit-window-to-buffer): Count in horizontal scroll bars. (window--sanitize-window-sizes): New function. (window-split-min-size): Remove. (split-window): Count divider-width. Don't use `window-split-min-size' any more. Reword error messages. Sanitize windows sizes after splitting. * buffer.h (struct buffer): New fields scroll_bar_height and horizontal_scroll_bar_type. * buffer.c (bset_scroll_bar_height) (bset_horizontal_scroll_bar_type): New functions. (Fbuffer_swap_text): Handle old_pointm field. (init_buffer_once): Set defaults for scroll_bar_height and horizontal_scroll_bar_type. (syms_of_buffer): New variables scroll_bar_height and horizontal_scroll_bar_type. * dispextern.h (window_part): Rename ON_SCROLL_BAR to ON_VERTICAL_SCROLL_BAR. Add ON_HORIZONTAL_SCROLL_BAR. (set_vertical_scroll_bar): Remove prototype. (x_change_tool_bar_height): Add prototype. * dispnew.c (adjust_frame_glyphs_for_frame_redisplay) (window_to_frame_vpos, update_frame_1, scrolling, init_display): Use FRAME_TOTAL_COLS and FRAME_TOTAL_LINES instead of FRAME_COLS and FRAME_LINES. (adjust_frame_glyphs_for_window_redisplay): Rearrange lines. (update_window): Start mode_line_row->y after horizontal scroll bar. (change_frame_size_1): Call adjust_frame_size. (init_display): When changing the size of a tty frame do not pass height of menu bar. (Qframe_windows_min_size): New symbol. * frame.h (struct frame): List tool bar fields after menu bar fields. Add official, total_lines, horizontal_scroll_bars, config_scroll_bar_height and config_scroll_bar_lines fields. (FRAME_HAS_HORIZONTAL_SCROLL_BARS) (FRAME_CONFIG_SCROLL_BAR_HEIGHT, FRAME_CONFIG_SCROLL_BAR_LINES) (FRAME_SCROLL_BAR_AREA_HEIGHT, FRAME_SCROLL_BAR_COLS) (FRAME_SCROLL_BAR_LINES, FRAME_TOTAL_LINES, SET_FRAME_LINES) (FRAME_WINDOWS_HEIGHT): New macros. (SET_FRAME_HEIGHT, FRAME_TEXT_LINES_TO_PIXEL_HEIGHT) (FRAME_PIXEL_Y_TO_LINE, FRAME_PIXEL_HEIGHT_TO_TEXT_LINES) (FRAME_TEXT_TO_PIXEL_HEIGHT): Separately count top margin and horizontal scroll bar. (frame_inhibit_resize, adjust_frame_size) (frame_windows_min_size): Add declarations. (Qscroll_bar_height, Qhorizontal_scroll_bars) (x_set_scroll_bar_default_height, x_set_left_fringe) (x_set_right_fringe, x_set_vertical_scroll_bars) (x_set_horizontal_scroll_bars, x_set_scroll_bar_width) (x_set_scroll_bar_height): Add external declarations. * frame.c: (frame_inhibit_resize, frame_windows_min_size) (adjust_frame_size): New functions. (make_frame): Initial horizontal_scroll_bars field. Use SET_FRAME_LINES. Don't allow horizontal scroll bar in minibuffer window. (make_initial_frame, make_terminal_frame): No horizontal scroll bar in initial and terminal frames. Use adjust_frame_size. (Fframe_total_cols): Fix doc-string. (Fframe_total_lines, Fscroll_bar_height): New Lisp functions. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Rewrite using adjust_frame_size. (Qscroll_bar_height, Qhorizontal_scroll_bars) (Qframe_windows_min_size): New symbols. (x_set_frame_parameters): Remove call of check_frame_size. (x_report_frame_params): Return scroll_bar_height value. (x_set_left_fringe, x_set_right_fringe): New functions. (adjust_frame_height, x_set_internal_border_width) (x_set_fringe_width): Remove. (x_set_internal_border_width, x_set_vertical_scroll_bars) (x_set_scroll_bar_width, x_set_right_divider_width) (x_set_bottom_divider_width): Rewrite using adjust_frame_size. (x_set_horizontal_scroll_bars, x_set_scroll_bar_height): New functions. (x_figure_window_size): Rewrite to make frame display the expected number of lines. (Vdefault_frame_scroll_bars): Rewrite doc-string. (Vdefault_frame_horizontal_scroll_bars) (Vframe_initial_frame_tool_bar_height) (frame_inhibit_implied_resize): New variables. * fringe.c (compute_fringe_widths): Remove. * gtkutil.h (YG_SB_MIN, YG_SB_MAX, YG_SB_RANGE): Define. (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb) (xg_get_default_scrollbar_height) (xg_clear_under_internal_border): Extern. * gtkutil.c (xg_frame_resized): Don't call do_pending_window_change. (xg_frame_set_char_size): Use adjust_frame_size. (style_changed_cb): Call update_theme_scrollbar_height and x_set_scroll_bar_default_height. (x_wm_set_size_hint): Don't call check_frame_size. (update_theme_scrollbar_height) (xg_get_default_scrollbar_height) (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb): New functions. (xg_create_scroll_bar): Set horizontal slot of bar. (xg_initialize): Call update_theme_scrollbar_height. (xg_clear_under_internal_border): No more static. * insdel.c (adjust_suspend_auto_hscroll): New function. (adjust_markers_for_delete, adjust_markers_for_insert) (adjust_markers_for_replace): Call adjust_suspend_auto_hscroll. * keyboard.c (readable_events, discard_mouse_events) (make_lispy_event): Handle horizontal scroll bar click events. (Fsuspend_emacs): When changing the size of a tty frame do not pass height of menu bar. (Qbefore_handle, Qhorizontal_handle, Qafter_handle, Qleft) (Qright, Qleftmost, Qrightmost): New symbols. * menu.c (Fx_popup_dialog): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * minibuf.c (read_minibuf): Initialize suspend_auto_hscroll. * nsfns.m (x_set_internal_border_width): New function. * nsterm.m (ns_draw_fringe_bitmap, ns_set_vertical_scroll_bar): Remove extended fringe code. (x_set_window_size, x_new_font): Don't call compute_fringe_widths. * term.c (Fresume_tty): When changing the size of a tty frame do not pass height of menu bar. (clear_tty_hooks, set_tty_hooks): Clear horizontal_scroll_bar_hook. (init_tty): Frame has no horizontal scroll bars. * termhooks.h (enum scroll_bar_part): Add scroll_bar_move_ratio, scroll_bar_before_handle, scroll_bar_horizontal_handle, scroll_bar_after_handle, scroll_bar_left_arrow, scroll_bar_right_arrow, scroll_bar_to_leftmost and scroll_bar_to_rightmost entries. (enum event_kind): Add HORIZONTAL_SCROLL_BAR_CLICK_EVENT (struct terminal): Add set_horizontal_scroll_bar_hook. * w32console.c (initialize_w32_display): Clear horizontal_scroll_bar_hook. * w32fns.c (x_set_mouse_color): Use FRAME_W32_DISPLAY instead of FRAME_X_DISPLAY. (x_clear_under_internal_border, x_set_internal_border_width): New functions. (x_set_menu_bar_lines): Rewrite using frame_inhibit_resize. Set windows_or_buffers_changed when adding the menu bar. (x_set_tool_bar_lines): Rewrite using adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (w32_createhscrollbar): New functions. (w32_createscrollbar): Rename to w32_createvscrollbar. (w32_createwindow): Init WND_HSCROLLBAR_INDEX. (w32_name_of_message): Replace WM_EMACS_CREATESCROLLBAR by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR. Add WM_EMACS_SHOWCURSOR. (w32_wnd_proc): Handle WM_HSCROLL case. In WM_WINDOWPOSCHANGING case do not artificially impose WM size hints. Handle WM_EMACS_SHOWCURSOR case. Replace WM_EMACS_CREATESCROLLBAR case by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR cases. (my_create_tip_window): Replace WND_SCROLLBAR_INDEX by WND_VSCROLLBAR_INDEX and WND_HSCROLLBAR_INDEX. (unwind_create_frame_1): Remove. (Fx_create_frame): Make both scrollbars the system standard width and height. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (w32_frame_parm_handlers): Remove x_set_fringe_width entries. Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe and x_set_right_fringe. * w32inevt.c (resize_event, maybe_generate_resize_event): Do not pass height of menu bar to change_frame_size. * w32menu.c (set_frame_menubar): Rewrite using frame_inhibit_resize. * w32term.h (struct w32_display_info): Add horizontal_scroll_bar_cursor and cursor_display_counter. (struct scroll_bar): Add horizontal. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH) (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): New macros. (WM_EMACS_CREATEVSCROLLBAR, WM_EMACS_CREATEHSCROLLBAR): Define instead of WM_EMACS_CREATESCROLLBAR. (WND_VSCROLLBAR_INDEX, WND_HSCROLLBAR_INDEX): Define instead of WND_SCROLLBAR_INDEX. * w32term.c (horizontal_scroll_bar_min_handle) (horizontal_scroll_bar_left_border) (horizontal_scroll_bar_right_border): New integers. (x_set_frame_alpha): Replace x_highlight_frame by w32_focus_frame. (x_window_to_scroll_bar): New argument "type". Update callers accordingly. (w32_set_horizontal_scroll_bar_thumb) (x_horizontal_scroll_bar_report_motion) (w32_set_horizontal_scroll_bar) (w32_horizontal_scroll_bar_handle_click) (x_horizontal_scroll_bar_report_motion): New functions. (w32_mouse_position): Discriminate horizontal and vertical scrollbar cases. (my_create_scrollbar): Replace with two new functions my_create_vscrollbar and my_create_hscrollbar. (x_scroll_bar_create): New argument "horizontal". Update callers accordingly. (x_scroll_bar_remove, w32_condemn_scroll_bars) (w32_redeem_scroll_bar, x_scroll_bar_clear): Handle horizontal scroll bar case. (w32_read_socket): Handle WM_HSCROLL cae. (x_new_font): Don't recompute fringe widths. Use frame_inhibit_resize. Calculate new menu bar height iff we build without toolkit. Always clear under internal border. (x_set_window_size): Don't check frame size or recompute fringes. Reset fullscreen status before applying sizes. Always resize as requested by pixelwise argument. Don't call do_pending_window_change. (x_wm_set_size_hint): Add call for FRAME_SCROLL_BAR_AREA_HEIGHT. (w32_initialize_display_info): Initialize dpyinfo's horizontal_scroll_bar_cursor entry. (w32_create_terminal): Add set_horizontal_scroll_bar_hook. (w32_initialize): Init horizontal_scroll_bar_min_handle and horizontal_scroll_bar_left_border. (w32fullscreen_hook): Intermittently resize window to normal when switching from fullscreen to maximized state. (run_window_configuration_change_hook): Don't run it if frame is not official yet. (unwind_change_frame): Remove. (Fset_window_configuration): Rewrite using frame's official field. * widget.c (set_frame_size): Don't call compute_fringe_widths. (EmacsFrameSetCharSize): Obey frame_inhibit_resize. * window.h (struct window): New fields old_pointm, horizontal_scroll_bar, horizontal_scroll_bar_type, hscroll_whole, scroll_bar_height and suspend_auto_hscroll. (wset_horizontal_scroll_bar, wset_horizontal_scroll_bar_type): New functions. (sanitize_window_sizes): Extern. (MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P, WINDOW_PSEUDO_P) (WINDOW_TOPMOST_P, WINDOW_HAS_HORIZONTAL_SCROLL_BAR) (WINDOW_CONFIG_SCROLL_BAR_HEIGHT) (WINDOW_CONFIG_SCROLL_BAR_LINES) (WINDOW_SCROLL_BAR_LINES, WINDOW_SCROLL_BAR_AREA_HEIGHT): New macros. (WINDOW_LEFT_FRINGE_COLS, WINDOW_RIGHT_FRINGE_COLS) (WINDOW_FRINGE_COLS, WINDOW_FRINGE_EXTENDED_P): Remove macros. (WINDOW_VERTICAL_SCROLL_BAR_TYPE) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT) (WINDOW_HAS_VERTICAL_SCROLL_BAR): Minor rewrite. (WINDOW_BOX_HEIGHT_NO_MODE_LINE, WINDOW_BOX_TEXT_HEIGHT) (WINDOW_SCROLL_BAR_AREA_Y): Count in scroll bar height. * window.c (wset_old_pointm, Fwindow_scroll_bar_height) (Fwindow_old_point, sanitize_window_sizes): New functions. (Qwindow_sanitize_window_sizes): New symbol. (window_body_height): Count in horizontal scroll bar. (set_window_hscroll, Fscroll_left, Fscroll_right): Set suspend_auto_hscroll slot. (Fwindow_inside_edges): Count fringes pixelwise. (coordinates_in_window, Fcoordinates_in_window_p): Consider horizontal scroll bar. (check_frame_size, adjust_window_margins): Remove functions and corresponding calls. (set_window_buffer): Initialize old_pointm and horizontal scroll bars. (temp_output_buffer_show): Reset hscroll related fields. Initialize old_pointm. (make_parent_window): Initialize old_pointm. (make_window): Initialize old_pointm, horizontal scroll bar type, and scroll bar height. (resize_frame_windows): Don't count top margin in new sizes. Don't use safe sizes when shrinking a frame; let the window manager do the clipping. (Fsplit_window_internal): Inherit horizontal scroll bar type and height. (Fdelete_window_internal): Unchain old_pointm marker. (window_scroll_pixel_based, Fscroll_other_window): Adjust old_pointm. (Fwindow_text_width, Fwindow_text_height): New argument "pixelwise". (struct saved_window): New fields, old_pointm, hscroll_whole, suspend_auto_hscroll, scroll_bar_height and horizontal_scroll_bar_type. (Fset_window_configuration, save_window_save): Set new fields of saved_window. (apply_window_adjustment): Don't call adjust_window_margins. (set_window_margins): Don't change margins if new sizes don't fit into window. (set_window_scroll_bars): New argument "horizontal_type". Handle horizontal scroll bars. Don't change scroll bars if they don't fit into window. (Fset_window_scroll_bars): New argument "horizontal_type". (Fwindow_scroll_bars): Return values for horizontal scroll bars. (compare_window_configurations): Compare horizontal scroll bar settings. * xdisp.c (window_text_bottom_y, window_box_height): Count in horizontal scroll bar height. (pixel_to_glyph_coords, init_xdisp): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (remember_mouse_glyph): Case ON_SCROLL_BAR changed to ON_VERTICAL_SCROLL_BAR. (with_echo_area_buffer): Initialize old_pointm. (with_echo_area_buffer_unwind_data): Store old_pointm values in vector. (unwind_with_echo_area_buffer): Handle old_pointm. (update_tool_bar): Set do_update when the tool bar window has at least one line (since this is what the user sets). (MAX_FRAME_TOOL_BAR_HEIGHT): Remove macro. (redisplay_tool_bar): Return early when toolbar has zero lines. Call x_change_tool_bar_height. Don't use max_tool_bar_height. (hscroll_window_tree): Handle suspension of auto_hscroll and old_pointm. (set_horizontal_scroll_bar): New function. (redisplay_window): Set ignore_mouse_drag_p when tool bar has more than one line. Handle horizontal scroll bars. (note_mouse_highlight): Handle horizontal scrol bars. (expose_frame): Set dimensions of XRectangle from frame's text sizes. (Vvoid_text_area_pointer): Update doc-string. * xfns.c (x_set_menu_bar_lines): Use adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (x_set_internal_border_width): New functions. (x_set_tool_bar_lines): Call x_change_tool_bar_height. (unwind_create_frame_1): Remove. (Fx_create_frame): Handle horizontal scroll bars. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (x_frame_parm_handlers): Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe, x_set_right_fringe. * xmenu.c (update_frame_menubar, free_frame_menubar): Use adjust_frame_size. * xterm.h (struct x_display_info): Add horizontal_scroll_bar_cursor and Xatom_Horizontal_Scrollbar slots. (struct scroll_bar): Add horizontal slot. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH): New macros. (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): Define. (x_clear_under_internal_border): Remove. * xterm.c (XTmouse_position): Handle horizontal scroll bars. (x_window_to_scroll_bar): New argument TYPE. Update callers. (x_send_scroll_bar_event, x_scroll_bar_create): New arguments HORIZONTAL. Update callers. (horizontal_action_hook_id): New action hook id. (x_horizontal_scroll_bar_to_input_event) (x_create_horizontal_toolkit_scroll_bar) (xt_horizontal_action_hook) (x_set_toolkit_horizontal_scroll_bar_thumb) (XTset_horizontal_scroll_bar, x_net_wm_state) (x_horizontal_scroll_bar_report_motion): New functions. (xg_scroll_callback, x_scroll_bar_handle_click): Handle horizontal scroll bars. (SCROLL_BAR_HORIZONTAL_NAME): Define. (XTset_vertical_scroll_bar): Attempt to clear areas not covered by scroll bar. (XTcondemn_scroll_bars, XTredeem_scroll_bar): Rewrite. Handle horizontal scroll bars. (handle_one_xevent): Handle horizontal scroll bar events. Call x_net_wm_state. (x_set_window_size_1, x_wm_set_size_hint): Don't call check_frame_size. (x_set_window_size): Don't call check_frame_size and do_pending_window_change. (x_term_init): Init horizontal_scroll_bar_cursor display info. (x_create_terminal): Add set_horizontal_scroll_bar_hook. (x_scroll_bar_set_handle): Add some checks when calling x_clear_area.
2014-07-27 15:21:30 +02:00
#define NS_SCROLL_BAR_ADJUST_HORIZONTALLY(w, f) \
(WINDOW_HAS_HORIZONTAL_SCROLL_BARS (w) ? \
(FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f) \
- NS_SCROLL_BAR_HEIGHT (f)) : 0)
#define FRAME_NS_FONT_TABLE(f) (FRAME_DISPLAY_INFO (f)->font_table)
2008-07-15 18:15:18 +00:00
#define FRAME_FONTSET(f) ((f)->output_data.ns->fontset)
#define FRAME_BASELINE_OFFSET(f) ((f)->output_data.ns->baseline_offset)
#define BLACK_PIX_DEFAULT(f) 0x000000
#define WHITE_PIX_DEFAULT(f) 0xFFFFFF
/* First position where characters can be shown (instead of scrollbar, if
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
it is on left. */
Complete pixelwise frame/window resizing, add horizontal scrollbar support. * frame.el (frame-notice-user-settings): Rewrite using frame-initial-frame-tool-bar-height. * menu-bar.el (menu-bar-horizontal-scroll-bar) (menu-bar-no-horizontal-scroll-bar): New functions. (menu-bar-showhide-scroll-bar-menu): Add bindings for horizontal scroll bars. * scroll-bar.el (scroll-bar-lines) (set-horizontal-scroll-bar-mode) (get-horizontal-scroll-bar-mode, horizontal-scroll-bar-mode) (scroll-bar-horizontal-drag-1, scroll-bar-horizontal-drag) (scroll-bar-toolkit-horizontal-scroll): New functions. (horizontal-scroll-bar-mode) (previous-horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode-explicit): New variables. (horizontal-scroll-bar-mode): New option. (toggle-horizontal-scroll-bar): Do something. (top-level): Bind horizontal-scroll-bar mouse-1. * startup.el (tool-bar-originally-present): Remove variable. (command-line): Don't set tool-bar-originally-present. * window.el (window-min-height): Update doc-string. (window--dump-frame): Dump horizontal scroll bar values. (window--min-size-1): Handle minibuffer window separately. Count in margins and horizontal scroll bar. Return safe value iff IGNORE equals 'safe. (frame-windows-min-size): New function (used by frame resizing routines). (fit-frame-to-buffer, fit-window-to-buffer): Count in horizontal scroll bars. (window--sanitize-window-sizes): New function. (window-split-min-size): Remove. (split-window): Count divider-width. Don't use `window-split-min-size' any more. Reword error messages. Sanitize windows sizes after splitting. * buffer.h (struct buffer): New fields scroll_bar_height and horizontal_scroll_bar_type. * buffer.c (bset_scroll_bar_height) (bset_horizontal_scroll_bar_type): New functions. (Fbuffer_swap_text): Handle old_pointm field. (init_buffer_once): Set defaults for scroll_bar_height and horizontal_scroll_bar_type. (syms_of_buffer): New variables scroll_bar_height and horizontal_scroll_bar_type. * dispextern.h (window_part): Rename ON_SCROLL_BAR to ON_VERTICAL_SCROLL_BAR. Add ON_HORIZONTAL_SCROLL_BAR. (set_vertical_scroll_bar): Remove prototype. (x_change_tool_bar_height): Add prototype. * dispnew.c (adjust_frame_glyphs_for_frame_redisplay) (window_to_frame_vpos, update_frame_1, scrolling, init_display): Use FRAME_TOTAL_COLS and FRAME_TOTAL_LINES instead of FRAME_COLS and FRAME_LINES. (adjust_frame_glyphs_for_window_redisplay): Rearrange lines. (update_window): Start mode_line_row->y after horizontal scroll bar. (change_frame_size_1): Call adjust_frame_size. (init_display): When changing the size of a tty frame do not pass height of menu bar. (Qframe_windows_min_size): New symbol. * frame.h (struct frame): List tool bar fields after menu bar fields. Add official, total_lines, horizontal_scroll_bars, config_scroll_bar_height and config_scroll_bar_lines fields. (FRAME_HAS_HORIZONTAL_SCROLL_BARS) (FRAME_CONFIG_SCROLL_BAR_HEIGHT, FRAME_CONFIG_SCROLL_BAR_LINES) (FRAME_SCROLL_BAR_AREA_HEIGHT, FRAME_SCROLL_BAR_COLS) (FRAME_SCROLL_BAR_LINES, FRAME_TOTAL_LINES, SET_FRAME_LINES) (FRAME_WINDOWS_HEIGHT): New macros. (SET_FRAME_HEIGHT, FRAME_TEXT_LINES_TO_PIXEL_HEIGHT) (FRAME_PIXEL_Y_TO_LINE, FRAME_PIXEL_HEIGHT_TO_TEXT_LINES) (FRAME_TEXT_TO_PIXEL_HEIGHT): Separately count top margin and horizontal scroll bar. (frame_inhibit_resize, adjust_frame_size) (frame_windows_min_size): Add declarations. (Qscroll_bar_height, Qhorizontal_scroll_bars) (x_set_scroll_bar_default_height, x_set_left_fringe) (x_set_right_fringe, x_set_vertical_scroll_bars) (x_set_horizontal_scroll_bars, x_set_scroll_bar_width) (x_set_scroll_bar_height): Add external declarations. * frame.c: (frame_inhibit_resize, frame_windows_min_size) (adjust_frame_size): New functions. (make_frame): Initial horizontal_scroll_bars field. Use SET_FRAME_LINES. Don't allow horizontal scroll bar in minibuffer window. (make_initial_frame, make_terminal_frame): No horizontal scroll bar in initial and terminal frames. Use adjust_frame_size. (Fframe_total_cols): Fix doc-string. (Fframe_total_lines, Fscroll_bar_height): New Lisp functions. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Rewrite using adjust_frame_size. (Qscroll_bar_height, Qhorizontal_scroll_bars) (Qframe_windows_min_size): New symbols. (x_set_frame_parameters): Remove call of check_frame_size. (x_report_frame_params): Return scroll_bar_height value. (x_set_left_fringe, x_set_right_fringe): New functions. (adjust_frame_height, x_set_internal_border_width) (x_set_fringe_width): Remove. (x_set_internal_border_width, x_set_vertical_scroll_bars) (x_set_scroll_bar_width, x_set_right_divider_width) (x_set_bottom_divider_width): Rewrite using adjust_frame_size. (x_set_horizontal_scroll_bars, x_set_scroll_bar_height): New functions. (x_figure_window_size): Rewrite to make frame display the expected number of lines. (Vdefault_frame_scroll_bars): Rewrite doc-string. (Vdefault_frame_horizontal_scroll_bars) (Vframe_initial_frame_tool_bar_height) (frame_inhibit_implied_resize): New variables. * fringe.c (compute_fringe_widths): Remove. * gtkutil.h (YG_SB_MIN, YG_SB_MAX, YG_SB_RANGE): Define. (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb) (xg_get_default_scrollbar_height) (xg_clear_under_internal_border): Extern. * gtkutil.c (xg_frame_resized): Don't call do_pending_window_change. (xg_frame_set_char_size): Use adjust_frame_size. (style_changed_cb): Call update_theme_scrollbar_height and x_set_scroll_bar_default_height. (x_wm_set_size_hint): Don't call check_frame_size. (update_theme_scrollbar_height) (xg_get_default_scrollbar_height) (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb): New functions. (xg_create_scroll_bar): Set horizontal slot of bar. (xg_initialize): Call update_theme_scrollbar_height. (xg_clear_under_internal_border): No more static. * insdel.c (adjust_suspend_auto_hscroll): New function. (adjust_markers_for_delete, adjust_markers_for_insert) (adjust_markers_for_replace): Call adjust_suspend_auto_hscroll. * keyboard.c (readable_events, discard_mouse_events) (make_lispy_event): Handle horizontal scroll bar click events. (Fsuspend_emacs): When changing the size of a tty frame do not pass height of menu bar. (Qbefore_handle, Qhorizontal_handle, Qafter_handle, Qleft) (Qright, Qleftmost, Qrightmost): New symbols. * menu.c (Fx_popup_dialog): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * minibuf.c (read_minibuf): Initialize suspend_auto_hscroll. * nsfns.m (x_set_internal_border_width): New function. * nsterm.m (ns_draw_fringe_bitmap, ns_set_vertical_scroll_bar): Remove extended fringe code. (x_set_window_size, x_new_font): Don't call compute_fringe_widths. * term.c (Fresume_tty): When changing the size of a tty frame do not pass height of menu bar. (clear_tty_hooks, set_tty_hooks): Clear horizontal_scroll_bar_hook. (init_tty): Frame has no horizontal scroll bars. * termhooks.h (enum scroll_bar_part): Add scroll_bar_move_ratio, scroll_bar_before_handle, scroll_bar_horizontal_handle, scroll_bar_after_handle, scroll_bar_left_arrow, scroll_bar_right_arrow, scroll_bar_to_leftmost and scroll_bar_to_rightmost entries. (enum event_kind): Add HORIZONTAL_SCROLL_BAR_CLICK_EVENT (struct terminal): Add set_horizontal_scroll_bar_hook. * w32console.c (initialize_w32_display): Clear horizontal_scroll_bar_hook. * w32fns.c (x_set_mouse_color): Use FRAME_W32_DISPLAY instead of FRAME_X_DISPLAY. (x_clear_under_internal_border, x_set_internal_border_width): New functions. (x_set_menu_bar_lines): Rewrite using frame_inhibit_resize. Set windows_or_buffers_changed when adding the menu bar. (x_set_tool_bar_lines): Rewrite using adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (w32_createhscrollbar): New functions. (w32_createscrollbar): Rename to w32_createvscrollbar. (w32_createwindow): Init WND_HSCROLLBAR_INDEX. (w32_name_of_message): Replace WM_EMACS_CREATESCROLLBAR by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR. Add WM_EMACS_SHOWCURSOR. (w32_wnd_proc): Handle WM_HSCROLL case. In WM_WINDOWPOSCHANGING case do not artificially impose WM size hints. Handle WM_EMACS_SHOWCURSOR case. Replace WM_EMACS_CREATESCROLLBAR case by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR cases. (my_create_tip_window): Replace WND_SCROLLBAR_INDEX by WND_VSCROLLBAR_INDEX and WND_HSCROLLBAR_INDEX. (unwind_create_frame_1): Remove. (Fx_create_frame): Make both scrollbars the system standard width and height. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (w32_frame_parm_handlers): Remove x_set_fringe_width entries. Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe and x_set_right_fringe. * w32inevt.c (resize_event, maybe_generate_resize_event): Do not pass height of menu bar to change_frame_size. * w32menu.c (set_frame_menubar): Rewrite using frame_inhibit_resize. * w32term.h (struct w32_display_info): Add horizontal_scroll_bar_cursor and cursor_display_counter. (struct scroll_bar): Add horizontal. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH) (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): New macros. (WM_EMACS_CREATEVSCROLLBAR, WM_EMACS_CREATEHSCROLLBAR): Define instead of WM_EMACS_CREATESCROLLBAR. (WND_VSCROLLBAR_INDEX, WND_HSCROLLBAR_INDEX): Define instead of WND_SCROLLBAR_INDEX. * w32term.c (horizontal_scroll_bar_min_handle) (horizontal_scroll_bar_left_border) (horizontal_scroll_bar_right_border): New integers. (x_set_frame_alpha): Replace x_highlight_frame by w32_focus_frame. (x_window_to_scroll_bar): New argument "type". Update callers accordingly. (w32_set_horizontal_scroll_bar_thumb) (x_horizontal_scroll_bar_report_motion) (w32_set_horizontal_scroll_bar) (w32_horizontal_scroll_bar_handle_click) (x_horizontal_scroll_bar_report_motion): New functions. (w32_mouse_position): Discriminate horizontal and vertical scrollbar cases. (my_create_scrollbar): Replace with two new functions my_create_vscrollbar and my_create_hscrollbar. (x_scroll_bar_create): New argument "horizontal". Update callers accordingly. (x_scroll_bar_remove, w32_condemn_scroll_bars) (w32_redeem_scroll_bar, x_scroll_bar_clear): Handle horizontal scroll bar case. (w32_read_socket): Handle WM_HSCROLL cae. (x_new_font): Don't recompute fringe widths. Use frame_inhibit_resize. Calculate new menu bar height iff we build without toolkit. Always clear under internal border. (x_set_window_size): Don't check frame size or recompute fringes. Reset fullscreen status before applying sizes. Always resize as requested by pixelwise argument. Don't call do_pending_window_change. (x_wm_set_size_hint): Add call for FRAME_SCROLL_BAR_AREA_HEIGHT. (w32_initialize_display_info): Initialize dpyinfo's horizontal_scroll_bar_cursor entry. (w32_create_terminal): Add set_horizontal_scroll_bar_hook. (w32_initialize): Init horizontal_scroll_bar_min_handle and horizontal_scroll_bar_left_border. (w32fullscreen_hook): Intermittently resize window to normal when switching from fullscreen to maximized state. (run_window_configuration_change_hook): Don't run it if frame is not official yet. (unwind_change_frame): Remove. (Fset_window_configuration): Rewrite using frame's official field. * widget.c (set_frame_size): Don't call compute_fringe_widths. (EmacsFrameSetCharSize): Obey frame_inhibit_resize. * window.h (struct window): New fields old_pointm, horizontal_scroll_bar, horizontal_scroll_bar_type, hscroll_whole, scroll_bar_height and suspend_auto_hscroll. (wset_horizontal_scroll_bar, wset_horizontal_scroll_bar_type): New functions. (sanitize_window_sizes): Extern. (MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P, WINDOW_PSEUDO_P) (WINDOW_TOPMOST_P, WINDOW_HAS_HORIZONTAL_SCROLL_BAR) (WINDOW_CONFIG_SCROLL_BAR_HEIGHT) (WINDOW_CONFIG_SCROLL_BAR_LINES) (WINDOW_SCROLL_BAR_LINES, WINDOW_SCROLL_BAR_AREA_HEIGHT): New macros. (WINDOW_LEFT_FRINGE_COLS, WINDOW_RIGHT_FRINGE_COLS) (WINDOW_FRINGE_COLS, WINDOW_FRINGE_EXTENDED_P): Remove macros. (WINDOW_VERTICAL_SCROLL_BAR_TYPE) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT) (WINDOW_HAS_VERTICAL_SCROLL_BAR): Minor rewrite. (WINDOW_BOX_HEIGHT_NO_MODE_LINE, WINDOW_BOX_TEXT_HEIGHT) (WINDOW_SCROLL_BAR_AREA_Y): Count in scroll bar height. * window.c (wset_old_pointm, Fwindow_scroll_bar_height) (Fwindow_old_point, sanitize_window_sizes): New functions. (Qwindow_sanitize_window_sizes): New symbol. (window_body_height): Count in horizontal scroll bar. (set_window_hscroll, Fscroll_left, Fscroll_right): Set suspend_auto_hscroll slot. (Fwindow_inside_edges): Count fringes pixelwise. (coordinates_in_window, Fcoordinates_in_window_p): Consider horizontal scroll bar. (check_frame_size, adjust_window_margins): Remove functions and corresponding calls. (set_window_buffer): Initialize old_pointm and horizontal scroll bars. (temp_output_buffer_show): Reset hscroll related fields. Initialize old_pointm. (make_parent_window): Initialize old_pointm. (make_window): Initialize old_pointm, horizontal scroll bar type, and scroll bar height. (resize_frame_windows): Don't count top margin in new sizes. Don't use safe sizes when shrinking a frame; let the window manager do the clipping. (Fsplit_window_internal): Inherit horizontal scroll bar type and height. (Fdelete_window_internal): Unchain old_pointm marker. (window_scroll_pixel_based, Fscroll_other_window): Adjust old_pointm. (Fwindow_text_width, Fwindow_text_height): New argument "pixelwise". (struct saved_window): New fields, old_pointm, hscroll_whole, suspend_auto_hscroll, scroll_bar_height and horizontal_scroll_bar_type. (Fset_window_configuration, save_window_save): Set new fields of saved_window. (apply_window_adjustment): Don't call adjust_window_margins. (set_window_margins): Don't change margins if new sizes don't fit into window. (set_window_scroll_bars): New argument "horizontal_type". Handle horizontal scroll bars. Don't change scroll bars if they don't fit into window. (Fset_window_scroll_bars): New argument "horizontal_type". (Fwindow_scroll_bars): Return values for horizontal scroll bars. (compare_window_configurations): Compare horizontal scroll bar settings. * xdisp.c (window_text_bottom_y, window_box_height): Count in horizontal scroll bar height. (pixel_to_glyph_coords, init_xdisp): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (remember_mouse_glyph): Case ON_SCROLL_BAR changed to ON_VERTICAL_SCROLL_BAR. (with_echo_area_buffer): Initialize old_pointm. (with_echo_area_buffer_unwind_data): Store old_pointm values in vector. (unwind_with_echo_area_buffer): Handle old_pointm. (update_tool_bar): Set do_update when the tool bar window has at least one line (since this is what the user sets). (MAX_FRAME_TOOL_BAR_HEIGHT): Remove macro. (redisplay_tool_bar): Return early when toolbar has zero lines. Call x_change_tool_bar_height. Don't use max_tool_bar_height. (hscroll_window_tree): Handle suspension of auto_hscroll and old_pointm. (set_horizontal_scroll_bar): New function. (redisplay_window): Set ignore_mouse_drag_p when tool bar has more than one line. Handle horizontal scroll bars. (note_mouse_highlight): Handle horizontal scrol bars. (expose_frame): Set dimensions of XRectangle from frame's text sizes. (Vvoid_text_area_pointer): Update doc-string. * xfns.c (x_set_menu_bar_lines): Use adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (x_set_internal_border_width): New functions. (x_set_tool_bar_lines): Call x_change_tool_bar_height. (unwind_create_frame_1): Remove. (Fx_create_frame): Handle horizontal scroll bars. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (x_frame_parm_handlers): Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe, x_set_right_fringe. * xmenu.c (update_frame_menubar, free_frame_menubar): Use adjust_frame_size. * xterm.h (struct x_display_info): Add horizontal_scroll_bar_cursor and Xatom_Horizontal_Scrollbar slots. (struct scroll_bar): Add horizontal slot. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH): New macros. (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): Define. (x_clear_under_internal_border): Remove. * xterm.c (XTmouse_position): Handle horizontal scroll bars. (x_window_to_scroll_bar): New argument TYPE. Update callers. (x_send_scroll_bar_event, x_scroll_bar_create): New arguments HORIZONTAL. Update callers. (horizontal_action_hook_id): New action hook id. (x_horizontal_scroll_bar_to_input_event) (x_create_horizontal_toolkit_scroll_bar) (xt_horizontal_action_hook) (x_set_toolkit_horizontal_scroll_bar_thumb) (XTset_horizontal_scroll_bar, x_net_wm_state) (x_horizontal_scroll_bar_report_motion): New functions. (xg_scroll_callback, x_scroll_bar_handle_click): Handle horizontal scroll bars. (SCROLL_BAR_HORIZONTAL_NAME): Define. (XTset_vertical_scroll_bar): Attempt to clear areas not covered by scroll bar. (XTcondemn_scroll_bars, XTredeem_scroll_bar): Rewrite. Handle horizontal scroll bars. (handle_one_xevent): Handle horizontal scroll bar events. Call x_net_wm_state. (x_set_window_size_1, x_wm_set_size_hint): Don't call check_frame_size. (x_set_window_size): Don't call check_frame_size and do_pending_window_change. (x_term_init): Init horizontal_scroll_bar_cursor display info. (x_create_terminal): Add set_horizontal_scroll_bar_hook. (x_scroll_bar_set_handle): Add some checks when calling x_clear_area.
2014-07-27 15:21:30 +02:00
#define FIRST_CHAR_POSITION(f) \
(! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \
2008-07-15 18:15:18 +00:00
: FRAME_SCROLL_BAR_COLS (f))
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern struct ns_display_info *ns_term_init (Lisp_Object display_name);
2008-07-15 18:15:18 +00:00
extern void ns_term_shutdown (int sig);
/* constants for text rendering */
#define NS_DUMPGLYPH_NORMAL 0
#define NS_DUMPGLYPH_CURSOR 1
#define NS_DUMPGLYPH_FOREGROUND 2
#define NS_DUMPGLYPH_MOUSEFACE 3
#ifdef NS_IMPL_GNUSTEP
2008-07-15 18:15:18 +00:00
/* In nsfont, called from fontset.c */
extern void nsfont_make_fontset_for_font (Lisp_Object name,
Lisp_Object font_object);
/* In nsfont, for debugging */
struct glyph_string;
Fix problems found by static checking --with-ns This is for Fedora 24 when configured with --enable-gcc-warnings. Although it does not fix all the problems, it fixes many of them. * src/frame.c (XParseGeometry): * src/nsterm.m (mouseDown:): Mark locals with UNINIT to pacify --enable-gcc-warnings. * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen): Remove unused macros. (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image) (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_load_image, xpm_load) (pbm_next_char, pbm_scan_number, pbm_load, svg_load) (svg_load_image): * src/nsfns.m (x_get_string_resource): * src/nsimage.m (ns_image_from_XBM): Fix pointer signedness problems. * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load) (imagemagick_load_image): Omit unused locals. * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types) (Fx_open_connection): * src/nsfont.m (ns_antialias_threshold): Move extern decl to nsterm.h so it can be checked. * src/nsmenu.m (svcsMenu, dockMenu): Move to the only file that uses them, so they can be static. * src/nsterm.h (find_and_call_menu_selection): * src/nsterm.m (x_set_frame_alpha): Omit duplicate decls. * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE. * src/nsfns.m (ns_tooltip, ns_display_info_for_name) (ns_set_name_as_filename, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): * src/nsterm.m (ns_drag_types, ns_draw_text_decoration): Now static. * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp): Remove; unused. * src/nsfont.m (ns_dump_glyphstring): * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp) (ns_clear_frame, keyDown:): Fix signedness problem with printf arg. * src/nsterm.h (ns_input_events, ns_finish_events): * src/nsterm.m (ns_finish_events, hide_bell): Prototype the decls. * src/nsterm.m (NSMenuDidBeginTrackingNotification): Omit unnecessary decl. (dockMenu): (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file. (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:) (toggleFullScreen:): Use FACE_FROM_ID instead of FACE_FROM_ID_OR_NULL in contexts where the caller expects the result to be non-null. (applicationShouldTerminate:): Fix misleading indentation.
2016-09-29 20:09:37 -07:00
void ns_dump_glyphstring (struct glyph_string *s) EXTERNALLY_VISIBLE;
#endif
2008-07-15 18:15:18 +00:00
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Implemented in nsterm, published in or needed from nsfns. */
extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern,
2008-07-15 18:15:18 +00:00
int size, int maxnames);
extern void ns_clear_frame (struct frame *f);
extern void ns_set_offset (struct frame *f, int xoff, int yoff,
int change_grav);
2008-07-15 18:15:18 +00:00
extern const char *ns_xlfd_to_fontname (const char *xlfd);
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern Lisp_Object ns_map_event_to_object (void);
#ifdef __OBJC__
extern Lisp_Object ns_string_from_pasteboard (id pb);
extern void ns_string_to_pasteboard (id pb, Lisp_Object str);
#endif
extern Lisp_Object ns_get_local_selection (Lisp_Object selection_name,
Lisp_Object target_type);
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern void nxatoms_of_nsselect (void);
extern void ns_set_doc_edited (void);
2008-07-15 18:15:18 +00:00
image.c, indent.c: Use bool for booleans. * dispextern.h (struct image_type): Members valid_p, load, init now return bool, not int. All uses changed. * image.c: Omit unnecessary static decls. (x_create_bitmap_mask, x_build_heuristic_mask): Return void, not int, since callers don't care about the return value. (x_create_bitmap_mask, define_image_type, valid_image_p) (struct image_keyword, parse_image_spec, image_spec_value) (check_image_size, image_background) (image_background_transparent, x_clear_image_1) (postprocess_image, lookup_image, x_check_image_size) (x_create_x_image_and_pixmap, xbm_image_p) (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, init_png_functions, png_load_body, png_load) (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) (init_gif_functions, gif_load, imagemagick_image_p) (imagemagick_load_image, imagemagick_load, svg_image_p) (init_svg_functions, svg_load, svg_load_image, gs_image_p) (gs_load): * nsimage.m (ns_load_image): * nsterm.m (ns_defined_color): * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): * xfns.c (x_defined_color): * xterm.c (x_alloc_lighter_color_for_widget) (x_alloc_nearest_color_1, x_alloc_nearest_color) (x_alloc_lighter_color): * indent.c (disptab_matches_widthtab, current_column) (scan_for_column, string_display_width, indented_beyond_p) (compute_motion, vmotion, Fvertical_motion): Use bool for booleans.
2012-09-24 14:38:23 -07:00
extern bool
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
ns_defined_color (struct frame *f,
const char *name,
Emacs_Color *color_def, bool alloc,
image.c, indent.c: Use bool for booleans. * dispextern.h (struct image_type): Members valid_p, load, init now return bool, not int. All uses changed. * image.c: Omit unnecessary static decls. (x_create_bitmap_mask, x_build_heuristic_mask): Return void, not int, since callers don't care about the return value. (x_create_bitmap_mask, define_image_type, valid_image_p) (struct image_keyword, parse_image_spec, image_spec_value) (check_image_size, image_background) (image_background_transparent, x_clear_image_1) (postprocess_image, lookup_image, x_check_image_size) (x_create_x_image_and_pixmap, xbm_image_p) (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, init_png_functions, png_load_body, png_load) (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) (init_gif_functions, gif_load, imagemagick_image_p) (imagemagick_load_image, imagemagick_load, svg_image_p) (init_svg_functions, svg_load, svg_load_image, gs_image_p) (gs_load): * nsimage.m (ns_load_image): * nsterm.m (ns_defined_color): * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): * xfns.c (x_defined_color): * xterm.c (x_alloc_lighter_color_for_widget) (x_alloc_nearest_color_1, x_alloc_nearest_color) (x_alloc_lighter_color): * indent.c (disptab_matches_widthtab, current_column) (scan_for_column, string_display_width, indented_beyond_p) (compute_motion, vmotion, Fvertical_motion): Use bool for booleans.
2012-09-24 14:38:23 -07:00
bool makeIndex);
2008-07-15 18:15:18 +00:00
#ifdef __OBJC__
extern int ns_lisp_to_color (Lisp_Object color, NSColor **col);
Update the GNUStep port so it works OK. Redraw and sizing bugs remain. * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use EmacsCGFloat. (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove unused variables. (Fns_read_file_name): Keep track if panel is for save. Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for Cocoa. (getDirectory, getFilename): Removed from EmacsOpenPanel and EmacsSavePanel. (EmacsOpenPanel:ok:): Use ns_filename_from_panel and ns_directory_from_panel. * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) (ns_charset_covers, ns_get_covering_families, nsfont_open): Use F suffix on floats. (ns_char_width): Returns CGFloat. (ns_ascii_average_width): w is CGFloat instead of float. (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to DPSxshow. (ns_glyph_metrics): CGFloat instead of float. * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. * src/nsmenu.m (ns_update_menubar): Make static. (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA (fillWithWidgetValue:): Add cast to SEL for setAction. (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. (update_frame_tool_bar): Update code for GNUStep. (clearAll): New method. (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move identifierToItem setObject and activeIdentifiers addObject before call to insertItemWithItemIdentifier. (validateVisibleItems): Fix indentation. (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and UtilityWindow to aStyle, remove call to setStyleMask. * src/nsselect.m (ns_get_local_selection): Remove unused variable type. * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size of CGFloat differs. (EmacsApp): New variable nextappdefined. Declare sendFromMainThread when NS_IMPL_GNUSTEP. (EmacsDocument): Declare when NS_IMPL_GNUSTEP. (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. (EmacsToolbar): Add clearAll. Add tag argument to addDisplayItemWithImage. (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP. (ns_menu_bar_is_hidden, menu_will_open_state): Define only if NS_IMPL_COCOA. (x_set_cursor_type): Remove declaration. (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. (ns_get_color): Use F suffix on float. (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. (ns_get_rgb_color): Remove. (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. (note_mouse_movement): x and y are CGFloat. (ns_draw_fringe_bitmap): Remove unused rowY. Change #if to COCOA && >= 10_6. (ns_draw_window_cursor): Remove unused overspill. (ns_draw_underwave): width and x are EamcsCGFloat. (ns_draw_box): thickness is CGFloat. (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread if not in main thread. (ns_get_pending_menu_title, ns_check_menu_open) (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. (sendFromMainThread:): New method. (changeFont:): size is CGFloat. (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. Disable warning about permanent text. (characterIndexForPoint:): Adjust return type depending on GNUStep version. (mouseDown:): delta is CGFloat. (updateFrameSize): Remove unised variable f. (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (windowWillUseStandardFrame:defaultFrame:): Set maximized_height also to -1 when restoring. (windowDidExitFullScreen:): Put call to updateCollectionBehaviour inside NS_IMPL_COCOA. (toggleFullScreen:): Put call to toggleFullScreen inside NS_IMPL_COCOA. Cast float to EmacsCGFloat. (setPosition:portion:whole:): por is CGFloat. (getMouseMotionPart:window:x:y:): Add F suffix to float. (mouseDown:): Use CGFloat. (mouseDragged:): Remove unised variable edge. (EmacsDocument): Implement for NS_IMPL_GNUSTEP. * src/process.c (catch_child_signal): New function. (init_process_emacs): Call it. * src/process.h (catch_child_signal): Declare.
2013-06-02 21:14:25 +02:00
extern const char *ns_get_pending_menu_title (void);
2008-07-15 18:15:18 +00:00
#endif
/* Implemented in nsfns, published in nsterm. */
#ifdef __OBJC__
extern void ns_move_tooltip_to_mouse_location (NSPoint);
#endif
extern void ns_implicitly_set_name (struct frame *f, Lisp_Object arg,
Lisp_Object oldval);
extern void ns_set_scroll_bar_default_width (struct frame *f);
extern void ns_set_scroll_bar_default_height (struct frame *f);
extern void ns_change_tab_bar_height (struct frame *f, int height);
extern const char *ns_get_string_resource (void *_rdb,
const char *name,
const char *class);
2008-07-15 18:15:18 +00:00
/* C access to ObjC functionality */
extern void ns_release_object (void *obj);
extern void ns_retain_object (void *obj);
Remove compiler warnings in objective-C files. * nsfns.m (x_set_icon_name, ns_set_name_internal) (ns_set_name_as_filename, ns_implicitly_set_icon_type) (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name) (Fns_get_resource, Fns_set_resource, Fx_open_connection) (Fns_font_name, Fns_perform_service) (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript) (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate. (ns_set_name): Remove unused variable view. (x_set_menu_bar_lines): Remove unused variable olines. (x_set_tool_bar_lines): Remove unused variable root_window. (Fns_list_colors): Put () around assignment in while statement. (Fns_perform_service): Remove unused variable len. (Fns_display_usable_bounds): Remove unused variable top. (syms_of_nsfns): Remove unused variable i. * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script) (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA where appropriate. (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put () around assignment in loop statement. (nsfont_open): Remove unused variable i. (nsfont_open): Remove unused variable len. (nsfont_draw): Remove unused variable cs. * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where appropriate. (setXBMColor): Remove unused variable len. (setPixmapData): Put () around assignment in loop statement. * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog) (initFromContents): Use SSDATA where appropriate. (ns_update_menubar): Add braces to ambigous if-else. (initWithTitle): Put () around assignment in if statement. (ns_menu_show): Remove unused variables window and keymap. (update_frame_tool_bar): Remove unused variable selected_p. (initWithContentRect): Remove unused variable this_cmd_name. * nsterm.h (menuDown): Add id as type to argument sender. (ns_display_info_for_name): Add Lisp_Object argument. (ns_term_init): Add Lisp_Object argument. (ns_map_event_to_object): Add void argument. (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct prototype with arguments and only declare if __OBJC__. (nxatoms_of_nsselect): Add void argument. (ns_lisp_to_cursor_type): Add Lisp_Object argument. (ns_alloc_autorelease_pool): Add void argument. (ns_release_autorelease_pool): Add void* argument. (ns_get_defaults_value): Add const char* argument. * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP. (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE. (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init) (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA where appropriate. (ns_exec_path, ns_load_path, changeFont): Put () around assignment used as boolean expression. (x_set_window_size): Remove unused variable toolbar. (ns_get_color_default, ns_mod_to_lisp): Remove. (ns_mouse_position): Remove unused variables xchar and ychar. (ns_compute_glyph_string_overhangs): Remove unused variable face. (ns_set_vertical_scroll_bar): Remove unused variable count. (ns_delete_terminal): Remove unused variable i. (ns_term_init): Remove unused variables r, g and b. (mouseDown): Remove unused variable window. (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP. (initFrameFromEmacs): Remove unused variable vbextra. (mouseEntered): Remove unused variables p and dpyinfo. (mouseExited): Remove unused variables p and r. (ns_define_frame_cursor, ns_clear_frame_area) (ns_draw_window_cursor, ns_initialize_display_info): Make static. (menuDown): Assign [sender tag] to variable and cast the variable.
2012-07-13 20:03:10 +02:00
extern void *ns_alloc_autorelease_pool (void);
extern void ns_release_autorelease_pool (void *);
extern const char *ns_get_defaults_value (const char *key);
extern void ns_init_locale (void);
2008-07-15 18:15:18 +00:00
/* in nsmenu */
extern void update_frame_tool_bar (struct frame *f);
#ifdef __OBJC__
extern void update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar);
#endif
extern void free_frame_tool_bar (struct frame *f);
extern Lisp_Object find_and_return_menu_selection (struct frame *f,
bool keymaps,
2008-07-15 18:15:18 +00:00
void *client_data);
extern Lisp_Object ns_popup_dialog (struct frame *, Lisp_Object header,
2013-09-29 21:38:56 +03:00
Lisp_Object contents);
2008-07-15 18:15:18 +00:00
extern void ns_free_frame_resources (struct frame *);
#define NSAPP_DATA2_RUNASSCRIPT 10
extern void ns_run_ascript (void);
#define NSAPP_DATA2_RUNFILEDIALOG 11
extern void ns_run_file_dialog (void);
extern const char *ns_relocate (const char *epath);
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
extern void syms_of_nsterm (void);
extern void syms_of_nsfns (void);
extern void syms_of_nsmenu (void);
extern void syms_of_nsselect (void);
2008-07-15 18:15:18 +00:00
/* From nsimage.m, needed in image.c */
struct image;
extern bool ns_can_use_native_image_api (Lisp_Object type);
Fix problems found by static checking --with-ns This is for Fedora 24 when configured with --enable-gcc-warnings. Although it does not fix all the problems, it fixes many of them. * src/frame.c (XParseGeometry): * src/nsterm.m (mouseDown:): Mark locals with UNINIT to pacify --enable-gcc-warnings. * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen): Remove unused macros. (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image) (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_load_image, xpm_load) (pbm_next_char, pbm_scan_number, pbm_load, svg_load) (svg_load_image): * src/nsfns.m (x_get_string_resource): * src/nsimage.m (ns_image_from_XBM): Fix pointer signedness problems. * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load) (imagemagick_load_image): Omit unused locals. * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types) (Fx_open_connection): * src/nsfont.m (ns_antialias_threshold): Move extern decl to nsterm.h so it can be checked. * src/nsmenu.m (svcsMenu, dockMenu): Move to the only file that uses them, so they can be static. * src/nsterm.h (find_and_call_menu_selection): * src/nsterm.m (x_set_frame_alpha): Omit duplicate decls. * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE. * src/nsfns.m (ns_tooltip, ns_display_info_for_name) (ns_set_name_as_filename, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): * src/nsterm.m (ns_drag_types, ns_draw_text_decoration): Now static. * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp): Remove; unused. * src/nsfont.m (ns_dump_glyphstring): * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp) (ns_clear_frame, keyDown:): Fix signedness problem with printf arg. * src/nsterm.h (ns_input_events, ns_finish_events): * src/nsterm.m (ns_finish_events, hide_bell): Prototype the decls. * src/nsterm.m (NSMenuDidBeginTrackingNotification): Omit unnecessary decl. (dockMenu): (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file. (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:) (toggleFullScreen:): Use FACE_FROM_ID instead of FACE_FROM_ID_OR_NULL in contexts where the caller expects the result to be non-null. (applicationShouldTerminate:): Fix misleading indentation.
2016-09-29 20:09:37 -07:00
extern void *ns_image_from_XBM (char *bits, int width, int height,
unsigned long fg, unsigned long bg);
2008-07-15 18:15:18 +00:00
extern void *ns_image_for_XPM (int width, int height, int depth);
extern void *ns_image_from_file (Lisp_Object file);
image.c, indent.c: Use bool for booleans. * dispextern.h (struct image_type): Members valid_p, load, init now return bool, not int. All uses changed. * image.c: Omit unnecessary static decls. (x_create_bitmap_mask, x_build_heuristic_mask): Return void, not int, since callers don't care about the return value. (x_create_bitmap_mask, define_image_type, valid_image_p) (struct image_keyword, parse_image_spec, image_spec_value) (check_image_size, image_background) (image_background_transparent, x_clear_image_1) (postprocess_image, lookup_image, x_check_image_size) (x_create_x_image_and_pixmap, xbm_image_p) (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, init_png_functions, png_load_body, png_load) (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) (init_gif_functions, gif_load, imagemagick_image_p) (imagemagick_load_image, imagemagick_load, svg_image_p) (init_svg_functions, svg_load, svg_load_image, gs_image_p) (gs_load): * nsimage.m (ns_load_image): * nsterm.m (ns_defined_color): * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): * xfns.c (x_defined_color): * xterm.c (x_alloc_lighter_color_for_widget) (x_alloc_nearest_color_1, x_alloc_nearest_color) (x_alloc_lighter_color): * indent.c (disptab_matches_widthtab, current_column) (scan_for_column, string_display_width, indented_beyond_p) (compute_motion, vmotion, Fvertical_motion): Use bool for booleans.
2012-09-24 14:38:23 -07:00
extern bool ns_load_image (struct frame *f, struct image *img,
Lisp_Object spec_file, Lisp_Object spec_data);
2008-07-15 18:15:18 +00:00
extern int ns_image_width (void *img);
extern int ns_image_height (void *img);
extern void ns_image_set_size (void *img, int width, int height);
extern void ns_image_set_transform (void *img, double m[3][3]);
extern void ns_image_set_smoothing (void *img, bool smooth);
2008-07-15 18:15:18 +00:00
extern unsigned long ns_get_pixel (void *img, int x, int y);
extern void ns_put_pixel (void *img, int x, int y, unsigned long argb);
extern void ns_set_alpha (void *img, int x, int y, unsigned char a);
extern int ns_display_pixel_height (struct ns_display_info *);
extern int ns_display_pixel_width (struct ns_display_info *);
extern size_t ns_image_size_in_bytes (void *img);
2008-07-15 18:15:18 +00:00
/* This in nsterm.m */
Fix problems found by static checking --with-ns This is for Fedora 24 when configured with --enable-gcc-warnings. Although it does not fix all the problems, it fixes many of them. * src/frame.c (XParseGeometry): * src/nsterm.m (mouseDown:): Mark locals with UNINIT to pacify --enable-gcc-warnings. * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen): Remove unused macros. (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image) (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_load_image, xpm_load) (pbm_next_char, pbm_scan_number, pbm_load, svg_load) (svg_load_image): * src/nsfns.m (x_get_string_resource): * src/nsimage.m (ns_image_from_XBM): Fix pointer signedness problems. * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load) (imagemagick_load_image): Omit unused locals. * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types) (Fx_open_connection): * src/nsfont.m (ns_antialias_threshold): Move extern decl to nsterm.h so it can be checked. * src/nsmenu.m (svcsMenu, dockMenu): Move to the only file that uses them, so they can be static. * src/nsterm.h (find_and_call_menu_selection): * src/nsterm.m (x_set_frame_alpha): Omit duplicate decls. * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE. * src/nsfns.m (ns_tooltip, ns_display_info_for_name) (ns_set_name_as_filename, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): * src/nsterm.m (ns_drag_types, ns_draw_text_decoration): Now static. * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp): Remove; unused. * src/nsfont.m (ns_dump_glyphstring): * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp) (ns_clear_frame, keyDown:): Fix signedness problem with printf arg. * src/nsterm.h (ns_input_events, ns_finish_events): * src/nsterm.m (ns_finish_events, hide_bell): Prototype the decls. * src/nsterm.m (NSMenuDidBeginTrackingNotification): Omit unnecessary decl. (dockMenu): (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file. (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:) (toggleFullScreen:): Use FACE_FROM_ID instead of FACE_FROM_ID_OR_NULL in contexts where the caller expects the result to be non-null. (applicationShouldTerminate:): Fix misleading indentation.
2016-09-29 20:09:37 -07:00
extern float ns_antialias_threshold;
extern void ns_make_frame_visible (struct frame *f);
extern void ns_make_frame_invisible (struct frame *f);
extern void ns_iconify_frame (struct frame *f);
extern void ns_set_undecorated (struct frame *f, Lisp_Object new_value,
Add new frame functionality to NS port * lisp/frame.el (frame-restack): Call ns-frame-restack. * src/keyboard.c (kbd_buffer_get_event) [HAVE_NS]: Enable MOVE_FRAME_EVENT handling. * src/frame.h: * src/frame.c: Enable 'z-group', 'undecorated' and 'parent' frame definitions. * src/nsfns.m: Add x_set_z_group, x_set_parent_frame and x_set_undecorated (Cocoa only) to handler struct. (Fx_create_frame): Handle 'z-group', 'parent-frame' and 'undecorated' frame parameter. (Fns_frame_restack): New function. * src/nsmenu.m (free_frame_tool_bar, update_frame_tool_bar): FRAME_TOOLBAR_HEIGHT is no longer a variable. * src/nsterm.h (NS_PARENT_WINDOW_LEFT_POS, NS_PARENT_WINDOW_TOP_POS): Add #defines to find the screen position of the parent frame. (NS_TOP_POS): Remove defun. (EmacsView): Remove redundant toolbar variables and add createToolbar method. (FRAME_NS_TITLEBAR_HEIGHT, FRAME_TOOLBAR_HEIGHT): Always calculate the values instead of storing them in a variable. * src/nsterm.m (x_set_offset, windowDidMove): Take parent frame position into account when positioning frames. (initFrameFromEmacs): Remove toolbar creation code and handle new frame parameters. (x_set_window_size): Remove toolbar height calculation. (x_set_z_group): (x_set_parent_frame): (x_set_undecorated) [NS_IMPL_COCOA]: New function. (x_destroy_window): Detach parent if child closes. (updateFrameSize): Change NSTRACE message to reflect new reality and no longer reset frame size. (windowWillResize): Don’t change NS window name when the titlebar is invisible. (createToolbar): Move toolbar creation code into it’s own method. (toggleFullScreen): FRAME_TOOLBAR_HEIGHT and FRAME_NS_TITLEBAR_HEIGHT are no longer variables. (windowDidMove): Fire MOVE_FRAME_EVENT Emacs event.
2017-04-14 10:02:38 +01:00
Lisp_Object old_value);
extern void ns_set_parent_frame (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value);
extern void ns_set_no_focus_on_map (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value);
extern void ns_set_no_accept_focus (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value);
extern void ns_set_z_group (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value);
#ifdef NS_IMPL_COCOA
extern void ns_set_appearance (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value);
extern void ns_set_transparent_titlebar (struct frame *f,
Lisp_Object new_value,
Lisp_Object old_value);
#endif
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings. * configure.in: Check for util.h. * src/bidi.c (bidi_dump_cached_states): Fix fprintf warning. * src/emacs.c: Include src/nsterm.h if HAVE_NS. * src/image.c (xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image) (xpm_load): Convert to ANSI C prototypes. * src/lisp.h (fmod_float): Declare. * src/menu.h (x_set_menu_bar_line): Declare. (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions. * src/window.c: Include menu.h. * src/nsfns.m (have_menus_p, ns_display_info_for_name) (x_set_cursor_type, ns_appkit_version_str) (ns_appkit_version_int, ns_do_applescript) (x_set_scroll_bar_default_width, x_sync, compute_tip_xy) (syms_of_nsfns): Convert to ANSI C prototypes. * src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C prototypes. * src/nsimage.m (ns_load_image): Move NSTRACE after declarations. * src/nsmenu.m (popup_activated, name_is_separator) (syms_of_nsmenu): Convert to ANSI C prototypes. (runMenuAt): Prototypes and move declarations before code. * src/nsterm.h : Include sysselect.h. (x_sync, x_get_focus_frame, x_set_mouse_position) (x_set_mouse_pixel_position, x_make_frame_visible) (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height) (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines) (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select) (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect): Declare * src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS. * src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool) (ns_ring_bell, ns_defined_color, hide_hourglass) (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm): Convert to ANSI C prototypes. (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations before code. * src/sysdep.c: Check HAVE_TERM_H * src/term.c: Check HAVE_SYS_IOCTL_H. * src/unexmacosx.c (print_region_list, print_regions) (build_region_list, find_emacs_zone_regions) (unexec_regions_merge, read_load_commands, dump_it) (unexec_init_emacs_zone): Convert to ANSI C prototypes. * src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timespec *timeout,
sigset_t *sigmask);
#ifdef HAVE_PTHREAD
extern void ns_run_loop_break (void);
#endif
2008-07-15 18:15:18 +00:00
extern unsigned long ns_get_rgb_color (struct frame *f,
float r, float g, float b, float a);
Fix problems found by static checking --with-ns This is for Fedora 24 when configured with --enable-gcc-warnings. Although it does not fix all the problems, it fixes many of them. * src/frame.c (XParseGeometry): * src/nsterm.m (mouseDown:): Mark locals with UNINIT to pacify --enable-gcc-warnings. * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen): Remove unused macros. (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image) (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v) (xpm_make_color_table_h, xpm_put_color_table_h) (xpm_get_color_table_h, xpm_load_image, xpm_load) (pbm_next_char, pbm_scan_number, pbm_load, svg_load) (svg_load_image): * src/nsfns.m (x_get_string_resource): * src/nsimage.m (ns_image_from_XBM): Fix pointer signedness problems. * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load) (imagemagick_load_image): Omit unused locals. * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types) (Fx_open_connection): * src/nsfont.m (ns_antialias_threshold): Move extern decl to nsterm.h so it can be checked. * src/nsmenu.m (svcsMenu, dockMenu): Move to the only file that uses them, so they can be static. * src/nsterm.h (find_and_call_menu_selection): * src/nsterm.m (x_set_frame_alpha): Omit duplicate decls. * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE. * src/nsfns.m (ns_tooltip, ns_display_info_for_name) (ns_set_name_as_filename, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): * src/nsterm.m (ns_drag_types, ns_draw_text_decoration): Now static. * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp): * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp): Remove; unused. * src/nsfont.m (ns_dump_glyphstring): * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp) (ns_clear_frame, keyDown:): Fix signedness problem with printf arg. * src/nsterm.h (ns_input_events, ns_finish_events): * src/nsterm.m (ns_finish_events, hide_bell): Prototype the decls. * src/nsterm.m (NSMenuDidBeginTrackingNotification): Omit unnecessary decl. (dockMenu): (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file. (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:) (toggleFullScreen:): Use FACE_FROM_ID instead of FACE_FROM_ID_OR_NULL in contexts where the caller expects the result to be non-null. (applicationShouldTerminate:): Fix misleading indentation.
2016-09-29 20:09:37 -07:00
struct input_event;
extern void ns_init_events (struct input_event *);
extern void ns_finish_events (void);
extern double ns_frame_scale_factor (struct frame *);
2008-07-15 18:15:18 +00:00
#ifdef NS_IMPL_GNUSTEP
extern char gnustep_base_version[]; /* version tracking */
#endif
#define MINWIDTH 10
#define MINHEIGHT 10
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Screen max coordinate -- using larger coordinates causes
movewindow/placewindow to abort. */
2008-07-15 18:15:18 +00:00
#define SCREENMAX 16000
#define NS_SCROLL_BAR_WIDTH_DEFAULT [EmacsScroller scrollerWidth]
Complete pixelwise frame/window resizing, add horizontal scrollbar support. * frame.el (frame-notice-user-settings): Rewrite using frame-initial-frame-tool-bar-height. * menu-bar.el (menu-bar-horizontal-scroll-bar) (menu-bar-no-horizontal-scroll-bar): New functions. (menu-bar-showhide-scroll-bar-menu): Add bindings for horizontal scroll bars. * scroll-bar.el (scroll-bar-lines) (set-horizontal-scroll-bar-mode) (get-horizontal-scroll-bar-mode, horizontal-scroll-bar-mode) (scroll-bar-horizontal-drag-1, scroll-bar-horizontal-drag) (scroll-bar-toolkit-horizontal-scroll): New functions. (horizontal-scroll-bar-mode) (previous-horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode-explicit): New variables. (horizontal-scroll-bar-mode): New option. (toggle-horizontal-scroll-bar): Do something. (top-level): Bind horizontal-scroll-bar mouse-1. * startup.el (tool-bar-originally-present): Remove variable. (command-line): Don't set tool-bar-originally-present. * window.el (window-min-height): Update doc-string. (window--dump-frame): Dump horizontal scroll bar values. (window--min-size-1): Handle minibuffer window separately. Count in margins and horizontal scroll bar. Return safe value iff IGNORE equals 'safe. (frame-windows-min-size): New function (used by frame resizing routines). (fit-frame-to-buffer, fit-window-to-buffer): Count in horizontal scroll bars. (window--sanitize-window-sizes): New function. (window-split-min-size): Remove. (split-window): Count divider-width. Don't use `window-split-min-size' any more. Reword error messages. Sanitize windows sizes after splitting. * buffer.h (struct buffer): New fields scroll_bar_height and horizontal_scroll_bar_type. * buffer.c (bset_scroll_bar_height) (bset_horizontal_scroll_bar_type): New functions. (Fbuffer_swap_text): Handle old_pointm field. (init_buffer_once): Set defaults for scroll_bar_height and horizontal_scroll_bar_type. (syms_of_buffer): New variables scroll_bar_height and horizontal_scroll_bar_type. * dispextern.h (window_part): Rename ON_SCROLL_BAR to ON_VERTICAL_SCROLL_BAR. Add ON_HORIZONTAL_SCROLL_BAR. (set_vertical_scroll_bar): Remove prototype. (x_change_tool_bar_height): Add prototype. * dispnew.c (adjust_frame_glyphs_for_frame_redisplay) (window_to_frame_vpos, update_frame_1, scrolling, init_display): Use FRAME_TOTAL_COLS and FRAME_TOTAL_LINES instead of FRAME_COLS and FRAME_LINES. (adjust_frame_glyphs_for_window_redisplay): Rearrange lines. (update_window): Start mode_line_row->y after horizontal scroll bar. (change_frame_size_1): Call adjust_frame_size. (init_display): When changing the size of a tty frame do not pass height of menu bar. (Qframe_windows_min_size): New symbol. * frame.h (struct frame): List tool bar fields after menu bar fields. Add official, total_lines, horizontal_scroll_bars, config_scroll_bar_height and config_scroll_bar_lines fields. (FRAME_HAS_HORIZONTAL_SCROLL_BARS) (FRAME_CONFIG_SCROLL_BAR_HEIGHT, FRAME_CONFIG_SCROLL_BAR_LINES) (FRAME_SCROLL_BAR_AREA_HEIGHT, FRAME_SCROLL_BAR_COLS) (FRAME_SCROLL_BAR_LINES, FRAME_TOTAL_LINES, SET_FRAME_LINES) (FRAME_WINDOWS_HEIGHT): New macros. (SET_FRAME_HEIGHT, FRAME_TEXT_LINES_TO_PIXEL_HEIGHT) (FRAME_PIXEL_Y_TO_LINE, FRAME_PIXEL_HEIGHT_TO_TEXT_LINES) (FRAME_TEXT_TO_PIXEL_HEIGHT): Separately count top margin and horizontal scroll bar. (frame_inhibit_resize, adjust_frame_size) (frame_windows_min_size): Add declarations. (Qscroll_bar_height, Qhorizontal_scroll_bars) (x_set_scroll_bar_default_height, x_set_left_fringe) (x_set_right_fringe, x_set_vertical_scroll_bars) (x_set_horizontal_scroll_bars, x_set_scroll_bar_width) (x_set_scroll_bar_height): Add external declarations. * frame.c: (frame_inhibit_resize, frame_windows_min_size) (adjust_frame_size): New functions. (make_frame): Initial horizontal_scroll_bars field. Use SET_FRAME_LINES. Don't allow horizontal scroll bar in minibuffer window. (make_initial_frame, make_terminal_frame): No horizontal scroll bar in initial and terminal frames. Use adjust_frame_size. (Fframe_total_cols): Fix doc-string. (Fframe_total_lines, Fscroll_bar_height): New Lisp functions. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Rewrite using adjust_frame_size. (Qscroll_bar_height, Qhorizontal_scroll_bars) (Qframe_windows_min_size): New symbols. (x_set_frame_parameters): Remove call of check_frame_size. (x_report_frame_params): Return scroll_bar_height value. (x_set_left_fringe, x_set_right_fringe): New functions. (adjust_frame_height, x_set_internal_border_width) (x_set_fringe_width): Remove. (x_set_internal_border_width, x_set_vertical_scroll_bars) (x_set_scroll_bar_width, x_set_right_divider_width) (x_set_bottom_divider_width): Rewrite using adjust_frame_size. (x_set_horizontal_scroll_bars, x_set_scroll_bar_height): New functions. (x_figure_window_size): Rewrite to make frame display the expected number of lines. (Vdefault_frame_scroll_bars): Rewrite doc-string. (Vdefault_frame_horizontal_scroll_bars) (Vframe_initial_frame_tool_bar_height) (frame_inhibit_implied_resize): New variables. * fringe.c (compute_fringe_widths): Remove. * gtkutil.h (YG_SB_MIN, YG_SB_MAX, YG_SB_RANGE): Define. (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb) (xg_get_default_scrollbar_height) (xg_clear_under_internal_border): Extern. * gtkutil.c (xg_frame_resized): Don't call do_pending_window_change. (xg_frame_set_char_size): Use adjust_frame_size. (style_changed_cb): Call update_theme_scrollbar_height and x_set_scroll_bar_default_height. (x_wm_set_size_hint): Don't call check_frame_size. (update_theme_scrollbar_height) (xg_get_default_scrollbar_height) (xg_create_horizontal_scroll_bar) (xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_horizontal_scroll_bar_thumb): New functions. (xg_create_scroll_bar): Set horizontal slot of bar. (xg_initialize): Call update_theme_scrollbar_height. (xg_clear_under_internal_border): No more static. * insdel.c (adjust_suspend_auto_hscroll): New function. (adjust_markers_for_delete, adjust_markers_for_insert) (adjust_markers_for_replace): Call adjust_suspend_auto_hscroll. * keyboard.c (readable_events, discard_mouse_events) (make_lispy_event): Handle horizontal scroll bar click events. (Fsuspend_emacs): When changing the size of a tty frame do not pass height of menu bar. (Qbefore_handle, Qhorizontal_handle, Qafter_handle, Qleft) (Qright, Qleftmost, Qrightmost): New symbols. * menu.c (Fx_popup_dialog): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * minibuf.c (read_minibuf): Initialize suspend_auto_hscroll. * nsfns.m (x_set_internal_border_width): New function. * nsterm.m (ns_draw_fringe_bitmap, ns_set_vertical_scroll_bar): Remove extended fringe code. (x_set_window_size, x_new_font): Don't call compute_fringe_widths. * term.c (Fresume_tty): When changing the size of a tty frame do not pass height of menu bar. (clear_tty_hooks, set_tty_hooks): Clear horizontal_scroll_bar_hook. (init_tty): Frame has no horizontal scroll bars. * termhooks.h (enum scroll_bar_part): Add scroll_bar_move_ratio, scroll_bar_before_handle, scroll_bar_horizontal_handle, scroll_bar_after_handle, scroll_bar_left_arrow, scroll_bar_right_arrow, scroll_bar_to_leftmost and scroll_bar_to_rightmost entries. (enum event_kind): Add HORIZONTAL_SCROLL_BAR_CLICK_EVENT (struct terminal): Add set_horizontal_scroll_bar_hook. * w32console.c (initialize_w32_display): Clear horizontal_scroll_bar_hook. * w32fns.c (x_set_mouse_color): Use FRAME_W32_DISPLAY instead of FRAME_X_DISPLAY. (x_clear_under_internal_border, x_set_internal_border_width): New functions. (x_set_menu_bar_lines): Rewrite using frame_inhibit_resize. Set windows_or_buffers_changed when adding the menu bar. (x_set_tool_bar_lines): Rewrite using adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (w32_createhscrollbar): New functions. (w32_createscrollbar): Rename to w32_createvscrollbar. (w32_createwindow): Init WND_HSCROLLBAR_INDEX. (w32_name_of_message): Replace WM_EMACS_CREATESCROLLBAR by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR. Add WM_EMACS_SHOWCURSOR. (w32_wnd_proc): Handle WM_HSCROLL case. In WM_WINDOWPOSCHANGING case do not artificially impose WM size hints. Handle WM_EMACS_SHOWCURSOR case. Replace WM_EMACS_CREATESCROLLBAR case by WM_EMACS_CREATEVSCROLLBAR and WM_EMACS_CREATEHSCROLLBAR cases. (my_create_tip_window): Replace WND_SCROLLBAR_INDEX by WND_VSCROLLBAR_INDEX and WND_HSCROLLBAR_INDEX. (unwind_create_frame_1): Remove. (Fx_create_frame): Make both scrollbars the system standard width and height. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (w32_frame_parm_handlers): Remove x_set_fringe_width entries. Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe and x_set_right_fringe. * w32inevt.c (resize_event, maybe_generate_resize_event): Do not pass height of menu bar to change_frame_size. * w32menu.c (set_frame_menubar): Rewrite using frame_inhibit_resize. * w32term.h (struct w32_display_info): Add horizontal_scroll_bar_cursor and cursor_display_counter. (struct scroll_bar): Add horizontal. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH) (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): New macros. (WM_EMACS_CREATEVSCROLLBAR, WM_EMACS_CREATEHSCROLLBAR): Define instead of WM_EMACS_CREATESCROLLBAR. (WND_VSCROLLBAR_INDEX, WND_HSCROLLBAR_INDEX): Define instead of WND_SCROLLBAR_INDEX. * w32term.c (horizontal_scroll_bar_min_handle) (horizontal_scroll_bar_left_border) (horizontal_scroll_bar_right_border): New integers. (x_set_frame_alpha): Replace x_highlight_frame by w32_focus_frame. (x_window_to_scroll_bar): New argument "type". Update callers accordingly. (w32_set_horizontal_scroll_bar_thumb) (x_horizontal_scroll_bar_report_motion) (w32_set_horizontal_scroll_bar) (w32_horizontal_scroll_bar_handle_click) (x_horizontal_scroll_bar_report_motion): New functions. (w32_mouse_position): Discriminate horizontal and vertical scrollbar cases. (my_create_scrollbar): Replace with two new functions my_create_vscrollbar and my_create_hscrollbar. (x_scroll_bar_create): New argument "horizontal". Update callers accordingly. (x_scroll_bar_remove, w32_condemn_scroll_bars) (w32_redeem_scroll_bar, x_scroll_bar_clear): Handle horizontal scroll bar case. (w32_read_socket): Handle WM_HSCROLL cae. (x_new_font): Don't recompute fringe widths. Use frame_inhibit_resize. Calculate new menu bar height iff we build without toolkit. Always clear under internal border. (x_set_window_size): Don't check frame size or recompute fringes. Reset fullscreen status before applying sizes. Always resize as requested by pixelwise argument. Don't call do_pending_window_change. (x_wm_set_size_hint): Add call for FRAME_SCROLL_BAR_AREA_HEIGHT. (w32_initialize_display_info): Initialize dpyinfo's horizontal_scroll_bar_cursor entry. (w32_create_terminal): Add set_horizontal_scroll_bar_hook. (w32_initialize): Init horizontal_scroll_bar_min_handle and horizontal_scroll_bar_left_border. (w32fullscreen_hook): Intermittently resize window to normal when switching from fullscreen to maximized state. (run_window_configuration_change_hook): Don't run it if frame is not official yet. (unwind_change_frame): Remove. (Fset_window_configuration): Rewrite using frame's official field. * widget.c (set_frame_size): Don't call compute_fringe_widths. (EmacsFrameSetCharSize): Obey frame_inhibit_resize. * window.h (struct window): New fields old_pointm, horizontal_scroll_bar, horizontal_scroll_bar_type, hscroll_whole, scroll_bar_height and suspend_auto_hscroll. (wset_horizontal_scroll_bar, wset_horizontal_scroll_bar_type): New functions. (sanitize_window_sizes): Extern. (MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P, WINDOW_PSEUDO_P) (WINDOW_TOPMOST_P, WINDOW_HAS_HORIZONTAL_SCROLL_BAR) (WINDOW_CONFIG_SCROLL_BAR_HEIGHT) (WINDOW_CONFIG_SCROLL_BAR_LINES) (WINDOW_SCROLL_BAR_LINES, WINDOW_SCROLL_BAR_AREA_HEIGHT): New macros. (WINDOW_LEFT_FRINGE_COLS, WINDOW_RIGHT_FRINGE_COLS) (WINDOW_FRINGE_COLS, WINDOW_FRINGE_EXTENDED_P): Remove macros. (WINDOW_VERTICAL_SCROLL_BAR_TYPE) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT) (WINDOW_HAS_VERTICAL_SCROLL_BAR): Minor rewrite. (WINDOW_BOX_HEIGHT_NO_MODE_LINE, WINDOW_BOX_TEXT_HEIGHT) (WINDOW_SCROLL_BAR_AREA_Y): Count in scroll bar height. * window.c (wset_old_pointm, Fwindow_scroll_bar_height) (Fwindow_old_point, sanitize_window_sizes): New functions. (Qwindow_sanitize_window_sizes): New symbol. (window_body_height): Count in horizontal scroll bar. (set_window_hscroll, Fscroll_left, Fscroll_right): Set suspend_auto_hscroll slot. (Fwindow_inside_edges): Count fringes pixelwise. (coordinates_in_window, Fcoordinates_in_window_p): Consider horizontal scroll bar. (check_frame_size, adjust_window_margins): Remove functions and corresponding calls. (set_window_buffer): Initialize old_pointm and horizontal scroll bars. (temp_output_buffer_show): Reset hscroll related fields. Initialize old_pointm. (make_parent_window): Initialize old_pointm. (make_window): Initialize old_pointm, horizontal scroll bar type, and scroll bar height. (resize_frame_windows): Don't count top margin in new sizes. Don't use safe sizes when shrinking a frame; let the window manager do the clipping. (Fsplit_window_internal): Inherit horizontal scroll bar type and height. (Fdelete_window_internal): Unchain old_pointm marker. (window_scroll_pixel_based, Fscroll_other_window): Adjust old_pointm. (Fwindow_text_width, Fwindow_text_height): New argument "pixelwise". (struct saved_window): New fields, old_pointm, hscroll_whole, suspend_auto_hscroll, scroll_bar_height and horizontal_scroll_bar_type. (Fset_window_configuration, save_window_save): Set new fields of saved_window. (apply_window_adjustment): Don't call adjust_window_margins. (set_window_margins): Don't change margins if new sizes don't fit into window. (set_window_scroll_bars): New argument "horizontal_type". Handle horizontal scroll bars. Don't change scroll bars if they don't fit into window. (Fset_window_scroll_bars): New argument "horizontal_type". (Fwindow_scroll_bars): Return values for horizontal scroll bars. (compare_window_configurations): Compare horizontal scroll bar settings. * xdisp.c (window_text_bottom_y, window_box_height): Count in horizontal scroll bar height. (pixel_to_glyph_coords, init_xdisp): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (remember_mouse_glyph): Case ON_SCROLL_BAR changed to ON_VERTICAL_SCROLL_BAR. (with_echo_area_buffer): Initialize old_pointm. (with_echo_area_buffer_unwind_data): Store old_pointm values in vector. (unwind_with_echo_area_buffer): Handle old_pointm. (update_tool_bar): Set do_update when the tool bar window has at least one line (since this is what the user sets). (MAX_FRAME_TOOL_BAR_HEIGHT): Remove macro. (redisplay_tool_bar): Return early when toolbar has zero lines. Call x_change_tool_bar_height. Don't use max_tool_bar_height. (hscroll_window_tree): Handle suspension of auto_hscroll and old_pointm. (set_horizontal_scroll_bar): New function. (redisplay_window): Set ignore_mouse_drag_p when tool bar has more than one line. Handle horizontal scroll bars. (note_mouse_highlight): Handle horizontal scrol bars. (expose_frame): Set dimensions of XRectangle from frame's text sizes. (Vvoid_text_area_pointer): Update doc-string. * xfns.c (x_set_menu_bar_lines): Use adjust_frame_size. (x_change_tool_bar_height, x_set_scroll_bar_default_height) (x_set_internal_border_width): New functions. (x_set_tool_bar_lines): Call x_change_tool_bar_height. (unwind_create_frame_1): Remove. (Fx_create_frame): Handle horizontal scroll bars. Use official field of frame structure to inhibit running window-configuration-change-hook. (x_create_tip_frame): Call SET_FRAME_LINES and change_frame_size pixelwise. Handle frame's official field. (x_frame_parm_handlers): Add x_set_scroll_bar_height, x_set_horizontal_scroll_bars, x_set_left_fringe, x_set_right_fringe. * xmenu.c (update_frame_menubar, free_frame_menubar): Use adjust_frame_size. * xterm.h (struct x_display_info): Add horizontal_scroll_bar_cursor and Xatom_Horizontal_Scrollbar slots. (struct scroll_bar): Add horizontal slot. (HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT) (HORIZONTAL_SCROLL_BAR_LEFT_RANGE) (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH): New macros. (HORIZONTAL_SCROLL_BAR_LEFT_BORDER) (HORIZONTAL_SCROLL_BAR_RIGHT_BORDER) (HORIZONTAL_SCROLL_BAR_TOP_BORDER) (HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER) (HORIZONTAL_SCROLL_BAR_MIN_HANDLE): Define. (x_clear_under_internal_border): Remove. * xterm.c (XTmouse_position): Handle horizontal scroll bars. (x_window_to_scroll_bar): New argument TYPE. Update callers. (x_send_scroll_bar_event, x_scroll_bar_create): New arguments HORIZONTAL. Update callers. (horizontal_action_hook_id): New action hook id. (x_horizontal_scroll_bar_to_input_event) (x_create_horizontal_toolkit_scroll_bar) (xt_horizontal_action_hook) (x_set_toolkit_horizontal_scroll_bar_thumb) (XTset_horizontal_scroll_bar, x_net_wm_state) (x_horizontal_scroll_bar_report_motion): New functions. (xg_scroll_callback, x_scroll_bar_handle_click): Handle horizontal scroll bars. (SCROLL_BAR_HORIZONTAL_NAME): Define. (XTset_vertical_scroll_bar): Attempt to clear areas not covered by scroll bar. (XTcondemn_scroll_bars, XTredeem_scroll_bar): Rewrite. Handle horizontal scroll bars. (handle_one_xevent): Handle horizontal scroll bar events. Call x_net_wm_state. (x_set_window_size_1, x_wm_set_size_hint): Don't call check_frame_size. (x_set_window_size): Don't call check_frame_size and do_pending_window_change. (x_term_init): Init horizontal_scroll_bar_cursor display info. (x_create_terminal): Add set_horizontal_scroll_bar_hook. (x_scroll_bar_set_handle): Add some checks when calling x_clear_area.
2014-07-27 15:21:30 +02:00
#define NS_SCROLL_BAR_HEIGHT_DEFAULT [EmacsScroller scrollerHeight]
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* This is to match emacs on other platforms, ugly though it is. */
#define NS_SELECTION_BG_COLOR_DEFAULT @"LightGoldenrod2";
#define NS_SELECTION_FG_COLOR_DEFAULT @"Black";
2008-07-15 18:15:18 +00:00
#define RESIZE_HANDLE_SIZE 12
/* Little utility macros */
#define IN_BOUND(min, x, max) (((x) < (min)) \
? (min) : (((x)>(max)) ? (max) : (x)))
#define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX))
#ifdef NS_IMPL_COCOA
/* Add some required AppKit version numbers if they're not defined. */
#ifndef NSAppKitVersionNumber10_7
#define NSAppKitVersionNumber10_7 1138
#endif
#ifndef NSAppKitVersionNumber10_10
#define NSAppKitVersionNumber10_10 1343
#endif
#endif /* NS_IMPL_COCOA */
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* macOS 10.7 introduces some new constants. */
#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_7)
#define NSFullScreenWindowMask (1 << 14)
#define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7)
#define NSWindowCollectionBehaviorFullScreenAuxiliary (1 << 8)
#define NSApplicationPresentationFullScreen (1 << 10)
#define NSApplicationPresentationAutoHideToolbar (1 << 11)
#define NSAppKitVersionNumber10_7 1138
#endif /* !defined (MAC_OS_X_VERSION_10_7) */
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* macOS 10.12 deprecates a bunch of constants. */
#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12)
#define NSEventModifierFlagCommand NSCommandKeyMask
#define NSEventModifierFlagControl NSControlKeyMask
#define NSEventModifierFlagHelp NSHelpKeyMask
#define NSEventModifierFlagNumericPad NSNumericPadKeyMask
#define NSEventModifierFlagOption NSAlternateKeyMask
#define NSEventModifierFlagShift NSShiftKeyMask
#define NSCompositingOperationSourceOver NSCompositeSourceOver
#define NSEventMaskApplicationDefined NSApplicationDefinedMask
#define NSEventTypeApplicationDefined NSApplicationDefined
#define NSEventTypeCursorUpdate NSCursorUpdate
#define NSEventTypeMouseMoved NSMouseMoved
#define NSEventTypeLeftMouseDown NSLeftMouseDown
#define NSEventTypeRightMouseDown NSRightMouseDown
#define NSEventTypeOtherMouseDown NSOtherMouseDown
#define NSEventTypeLeftMouseUp NSLeftMouseUp
#define NSEventTypeRightMouseUp NSRightMouseUp
#define NSEventTypeOtherMouseUp NSOtherMouseUp
#define NSEventTypeLeftMouseDragged NSLeftMouseDragged
#define NSEventTypeRightMouseDragged NSRightMouseDragged
#define NSEventTypeOtherMouseDragged NSOtherMouseDragged
#define NSEventTypeScrollWheel NSScrollWheel
#define NSEventTypeKeyDown NSKeyDown
#define NSEventTypeKeyUp NSKeyUp
#define NSEventTypeFlagsChanged NSFlagsChanged
#define NSEventMaskAny NSAnyEventMask
#define NSEventTypeSystemDefined NSSystemDefined
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
#define NSWindowStyleMaskClosable NSClosableWindowMask
#define NSWindowStyleMaskFullScreen NSFullScreenWindowMask
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
#define NSWindowStyleMaskResizable NSResizableWindowMask
#define NSWindowStyleMaskTitled NSTitledWindowMask
#define NSWindowStyleMaskUtilityWindow NSUtilityWindowMask
#define NSAlertStyleCritical NSCriticalAlertStyle
#define NSControlSizeRegular NSRegularControlSize
#define NSCompositingOperationCopy NSCompositeCopy
#define NSTextAlignmentRight NSRightTextAlignment
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* And adds NSWindowStyleMask. */
#ifdef __OBJC__
typedef NSUInteger NSWindowStyleMask;
#endif
Normalize and fix some mistakes in NS-related commentary * lisp/term/ns-win.el (ns-insert-working-text): Normalize commentary. (x-file-dialog): Fix indentation. * src/nsfns.m (ns_get_window, interpret_services_menu) (x_set_background_color, x_set_icon_name, x_set_tool_bar_lines) (x_set_icon_type, x_set_mouse_color, Fx_create_frame) (ns_window_is_ancestor, Fns_popup_font_panel) (Fx_display_visual_class, Fns_font_name, Fns_do_applescript) (ns_screen_name, compute_tip_xy, Fns_mouse_absolute_pixel_position) (handlePanelKeys): Normalize commentary (also in top-level declarations) and remove two outdated comments (one in Fx_create_frame, the other in compute_tip_xy). * src/nsterm.h (NSApplication, NSWindow, ns_bitmap_record): * src/nsselect.m: * src/nsmenu.m (ns_update_menubar, addItemWithWidgetValue:) (runMenuAt:forFrame:keymaps:, ns_menu_show, free_frame_tool_bar) (update_frame_tool_bar, init) (initWithContentRect:styleMask:backing:defer:) (initFromContents:isQuestion:, timeout_handler:) (Fmenu_or_popup_active_p): * src/nsimage.m (initFromXBM, initFromXBMWithDepth): * src/nsgui.h: * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_get_req_script, ns_findfonts) (nsfont_list_family, nsfont_open, nsfont_encode_char) (nsfont_draw, ns_uni_to_glyphs, ns_glyph_metrics) (syms_of_nsfont): Normalize commentary (also in top-level declarations). * src/nsterm.m (ns_init_locale, ns_retain_object) (ns_screen_margins_ignoring_hidden_dock, ns_unfocus, NSImageView) (x_make_frame_visible, x_iconify_frame, x_destroy_window) (x_set_undecorated, x_set_no_focus_on_map, x_set_z_group) (ns_index_color, ns_get_color, ns_lisp_to_color) (note_mouse_movement, scrollbar, ns_scroll_run) (ns_draw_fringe_bitmap, ns_draw_window_cursor) (ns_draw_text_decoration, ns_draw_relief) (ns_dumpglyphs_box_or_relief, ns_dumpglyphs_image) (ns_dumpglyphs_stretch, ns_draw_glyph_string, ns_send_appdefined) (ns_check_menu_open, ns_read_socket, ns_select, ns_run_loop_break) (ns_set_vertical_scroll_bar, ns_set_horizontal_scroll_bar) (ns_string_to_lispmod, ns_default, ns_initialize_display_info) (ns_delete_display, ns_term_init, sendEvent:) (applicationDidFinishLaunching:, applicationDidBecomeActive:) (fd_handler:, setWindowClosing:, keyDown:, insertText:) (mouseDown:, mouseMoved:, updateFrameSize:) (windowWillResize:toSize:, windowDidResize:, windowDidResignKey:) (initFrameFromEmacs:, toggleFullScreen:, toolbarClicked:) (writeSelectionToPasteboard:types:, setMiniwindowImage:) (scrollerWidth, initFrame:window:, setFrame:, repeatScroll:) (ns_xlfd_to_fontname, syms_of_nsterm): Normalize commentary (also in top-level declarations), and in ns_get_color, replace a Gmane link with one from lists.gnu.org, which does not require JS to view the message.
2018-03-19 20:16:19 +01:00
/* Window tabbing mode enums are new too. */
enum NSWindowTabbingMode
{
NSWindowTabbingModeAutomatic,
NSWindowTabbingModePreferred,
NSWindowTabbingModeDisallowed
};
#endif /* !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12) */
#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_13)
/* Deprecated in macOS 10.13. */
#define NSPasteboardNameGeneral NSGeneralPboard
#define NSPasteboardNameDrag NSDragPboard
#endif
#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_14)
/* Deprecated in macOS 10.14. */
/* FIXME: Some of these new names, if not all, are actually available
in some recent version of GNUstep. */
#define NSPasteboardTypeString NSStringPboardType
#define NSPasteboardTypeTabularText NSTabularTextPboardType
#define NSPasteboardTypeURL NSURLPboardType
#define NSPasteboardTypeHTML NSHTMLPboardType
#define NSPasteboardTypePDF NSPDFPboardType
#define NSPasteboardTypeRTF NSRTFPboardType
#define NSPasteboardTypeRTFD NSRTFDPboardType
#define NSPasteboardTypeTIFF NSTIFFPboardType
#define NSControlStateValueOn NSOnState
#define NSControlStateValueOff NSOffState
#define NSBezelStyleRounded NSRoundedBezelStyle
#define NSButtonTypeMomentaryPushIn NSMomentaryPushInButton
#endif
extern void mark_nsterm (void);
2008-07-15 18:15:18 +00:00
#endif /* HAVE_NS */