1. 04 Aug, 2020 1 commit
    • Alan Third's avatar
      Don't smooth images when scaling up (bug#38394) · 519a93e0
      Alan Third authored
      * src/image.c (image_set_transform [HAVE_XRENDER]): Use different filter
      when scaling up vs scaling down.
      * src/nsimage.m (ns_image_set_smoothing):
      ([EmacsImage setSmoothing:]): New functions.
      * src/nsterm.h: Add definitions.
      * src/nsterm.m (ns_dumpglyphs_image): Disable smoothing if requested.
  2. 01 Aug, 2020 1 commit
  3. 21 Jun, 2020 1 commit
    • Mattias Engdegård's avatar
      Consolidate #RGB string parsers · 9fe2bdb8
      Mattias Engdegård authored
      Use a single parser of color strings in the #RGB, rgb:R/G/B and
      rgbi:R/G/B formats, replacing four existing ones.  Previously,
      error-checking was spotty, handling of the rgbi: format not always
      present, and normalization of the result was sometimes incorrect.
      * src/dispextern.h: New prototype.
      * src/xfaces.c (parse_hex_color_comp, parse_float_color_comp)
      (parse_color_spec, Finternal-color_values_from_color_spec): New functions.
      * test/src/xfaces-tests.el (xfaces-internal-color-values-from-color-spec):
      New test.
      * lisp/term/tty-colors.el (tty-color-standard-values):
      Use internal-color-values-from-color-spec, replacing old parser.
      * src/nsterm.m (ns_get_color):
      * src/w32fns.c (x_to_w32_color):
      * src/xterm.c (x_parse_color): Use parse_color_spec, replacing old
      (HEX_COLOR_NAME_LENGTH): Remove #define.
  4. 08 Jun, 2020 1 commit
    • Mattias Engdegård's avatar
      More robust NS hex colour string parsing · 64e25cde
      Mattias Engdegård authored
      Invalid arguments to color-values, such as "#abcdefg" or "#1234", or
      valid ones like "#111222333", should not yield nonsense values.
      * src/nsterm.m (ns_get_color):
      Only accept "#RGB" strings with 1-4 digits per components, equal number
      of digits each, and no trailing characters.  Parse 12-bit colours
  5. 03 May, 2020 1 commit
  6. 23 Apr, 2020 1 commit
    • Eli Zaretskii's avatar
      Fix display of composed text with :box face attribute · 5ab80286
      Eli Zaretskii authored
      * src/xdisp.c (get_next_display_element): For a composition on a
      display or overlay string, set the end_of_box_run_p flag if the
      string ends at the last character included in the composition.
      (fill_gstring_glyph_string): Fix the way the width of a gstring
      glyph string is calculated: use the values calculated in
      gui_produce_glyphs, since the latter adjusts the width due to the
      face's ':box' attribute.
      * src/xterm.c (x_draw_glyph_string_box):
      * src/w32term.c (w32_draw_glyph_string_box):
      * src/nsterm.m (ns_dumpglyphs_box_or_relief): Support automatic
      compositions, which have the right_box_line_p flag set on the last
      glyph produced from the composition.  (Bug#40687)
      * src/w32term.c (w32_compute_glyph_string_overhangs): Update to be
      consistent with xterm.c in its support of automatic composition
      glyph strings.
      * src/dispextern.h (enum glyph_type): More accurate commentary.
      * src/.gdbinit (pgx): Display slice.img members only for image
  7. 18 Apr, 2020 1 commit
  8. 16 Apr, 2020 2 commits
    • Alan Third's avatar
      Allow dynamic choice of drawing path on NS (bug#39883) · c019f03e
      Alan Third authored
      * src/nsterm.h (NS_DRAW_TO_BUFFER): Let this be enabled on versions
      older than 10.14.
      * src/nsterm.m (ns_update_begin):
      ([EmacsView viewDidResize:]):
      ([EmacsView createDrawingBuffer]):
      ([EmacsView windowDidChangeBackingProperties:]):
      ([EmacsView copyRect:to:]):
      ([EmacsView wantsUpdateLayer]): Dynamically switch between drawing to a
      buffer and drawing to the screen, depending on the version of AppKit
      in use.
      ([EmacsView dealloc]): We can't release the context unless
      NS_DRAW_TO_BUFFER is defined.
    • Alan Third's avatar
      Fix NS frame resizing issues (bug#40200, bug#28872) · 24cb6908
      Alan Third authored
      * src/nsmenu.m (update_frame_tool_bar): Remove reference to
      * src/nsterm.h: ([EmacsView updateFrameSize]):
      ([EmacsView setRows:andColumns:]): Remove unused
      method definitions.
      (NS_PARENT_WINDOW_TOP_POS): Move to nsterm.m.
      * src/nsterm.m (ns_parent_window_rect): New function.
      (NS_PARENT_WINDOW_TOP_POS): Move to nsterm.m and simplify.
      (ns_set_offset): Fix strange behaviours when using negative values.
      ([EmacsView windowDidResize:]):
      ([EmacsView windowDidExitFullScreen]):
      (ns_judge_scroll_bars): Remove references to updateFrameSize.
      ([EmacsView dealloc]): Unset resize notification and release buffer.
      ([EmacsView updateFrameSize:]): Remove function.
      ([EmacsView windowWillResize:toSize:]): Move some code to
      ([EmacsView viewDidResize]): New function.
      ([EmacsView initFrameFromEmacs:]): Set up resize notification and move
      buffer creation until after the prerequisite objects are created.
      ([EmacsView toggleFullScreen:]): Set frame to the size of the
      contentview, not the whole window, and remove reference to
      ([EmacsView setRows:andColumns:]): Remove unused method.
      ([EmacsView windowDidMove:]): Tidy up.
  9. 15 Apr, 2020 1 commit
    • YAMAMOTO Mitsuharu's avatar
      Limit RLIMIT_NOFILE to FD_SETSIZE on macOS · d87a4d1f
      YAMAMOTO Mitsuharu authored
      * src/nsterm.m ([EmacsApp applicationDidFinishLaunching:]): Call
      CoreFoundation functions that increase RLIMIT_NOFILE behind our back
      during startup, and then set RLIMIT_NOFILE back to FD_SETSIZE to avoid
      crashes in setup_process_coding_system  (Bug#39164).
  10. 01 Apr, 2020 1 commit
    • Alexandre Adolphe's avatar
      Allow negative line width for :box face attribute · 34ae2d0c
      Alexandre Adolphe authored
      Separate values for box line width and height and allow both to be
      negative which makes the visual width and height of the boxed string
      unchanged (Bug#13011).
      * doc/lispref/display.texi (Face Attributes): Modify :box attribute
      description to reflect the new possibilities.
      * lisp/cus-face.el (custom-face-attributes): Set box attribute to get
      two integer to set vertical and horizontal width and modify pre-filter
      to accept dotted list of two int as valid box attribute.
      * src/dispextern.h (face): Use two int for box horizontal and vertical
      line width.
      * src/nsfont.m (nsfont_draw): Use new face attributes.
      * src/nsterm.m (ns_draw_box, ns_draw_relief): Support separated
      horizontal and vertical box line width.
      (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background)
      (ns_dumpglyphs_image, ns_draw_glyph_string_foreground)
      (ns_draw_composite_glyph_string_foreground): Use new face attributes.
      * src/w32term.c (w32_draw_box_rect, w32_draw_relief_rect): Support
      separated horizontal and vertical box line width.
      (x_draw_glyph_string_background, x_draw_glyph_string_foreground)
      (x_draw_glyphless_glyph_string_foreground, x_draw_glyph_string_box)
      (x_draw_image_foreground, x_draw_image_relief)
      (w32_draw_image_foreground_1, x_draw_image_glyph_string): Use new face
      * src/xfaces.c (Sinternal_set_lisp_face_attribute, realize_x_face):
      Accept box attribute as a list of two ints.
      * src/xdisp.c (estimate_mode_line_height, produce_image_glyph)
      (produce_xwidget_glyph, x_produce_glyphs): Use new face attributes.
      * src/xterm.c (x_draw_box_rect, x_draw_relief_rect): Support separated
      horizontal and vertical box line width.
      (x_draw_glyph_string_background, x_draw_glyph_string_foreground)
      (x_draw_glyphless_glyph_string_foreground, x_draw_glyph_string_box)
      (x_draw_image_foreground, x_draw_image_relief, x_draw_image_foreground_1)
      (x_draw_image_glyph_string): Use new face attributes.
  11. 17 Mar, 2020 1 commit
    • Robert Pluim's avatar
      Recalculate default font when switching font backend · 5747a59a
      Robert Pluim authored
      This is an updated version of the patch by Dmitry Antipov
      <dmantipov@yandex.ru> in
      Fixes Bug#23386
      * src/dispextern.h (struct redisplay_interface): New member
      * src/xterm.h: Add prototype for x_default_font_parameter.
      * src/xterm.c (x_redisplay_interface): Initialize
      default_font_parameter member.
      * src/xfns.c (x_default_font_parameter): Make non-static.
      * src/w32term.h: Add prototype for w32_default_font_parameter
      * src/w32fns.c (w32_default_font_parameter): Make non-static.
      * src/w32term.c (w32_redisplay_interface): Initialize
      default_font_parameter member.
      * src/nsterm.m (ns_redisplay_interface): Add dummy
      ns_default_font_parameter (there is currently only one possible font
      backend on macOS).  Initialize default_font_parameter member.
      * src/frame.c (gui_set_font_backend): Recalculate default font using
      RIF default_font_parameter to avoid crash when changing font backend.
  12. 12 Mar, 2020 1 commit
    • Andrii Kolomoiets's avatar
      Fix NS child frame in native fullscreen (bug#36672) · bbc48b26
      Andrii Kolomoiets authored
      * lisp/frame.el (toggle-frame-fullscreen): Don't sleep on cocoa.
      Fullscreen animation waiting is moved to src/nsterm.m.
      * src/nsterm.h (EmacsView): Add in_fullscreen_transition,
      inFullScreenTransition, waitFullScreenTransition.
      (NSWindowCollectionBehaviorFullScreenAuxiliary): New define.
      * src/nsterm.m (ns_make_frame_visible): Wait for fullscreen animation.
      (ns_set_parent_frame): Set frame collection behavior; make child frames
      non-fullscreen; make non-child frames fullscreen if parent was fullscreen.
      ([EmacsView initFrameFromEmacs]): Set in_fullscreen_transition; set frame
      collection behavior according to parent frame.
      ([EmacsView windowDidMove]): Remove code by commenting with "fixme".
      ([EmacsView windowWillEnterFullScreen], [EmacsView windowDidEnterFullScreen])
      ([EmacsView windowWillExitFullScreen], [EmacsView windowDidExitFullScreen]):
      Set in_fullscreen_transition.
      ([EmacsView inFullScreenTransition], [EmacsView waitFullScreenTransition]):
      New methods.
      ([EmacsView updateCollectionBehavior]): Set collection behavior according to
      parent frame.
      ([EmacsView toggleFullScreen]): Wait for fullscreen animation.
  13. 04 Mar, 2020 1 commit
    • Alan Third's avatar
      Fix more NS_DRAW_TO_BUFFER #ifdefs (bug#39883) · d1bbd32d
      Alan Third authored
      * src/nsterm.m (ns_update_end): Make sure the frame is updated after
      (ns_unfocus): Should be checking on NS_DRAW_TO_BUFFER rather than if
      it's Cocoa or GNUstep.
  14. 02 Mar, 2020 2 commits
    • Alan Third's avatar
      Fix macOS/GNUstep compilation warnings · b4911a6f
      Alan Third authored
      * src/nsfns.m (handlePanelKeys): Unused function.
      * src/nsterm.m (ns_set_appearance):
      ([EmacsView initFrameFromEmacs:]): Use EmacsWindow type instead of
      (ns_clip_to_row): Unused function.
      (ns_dumpglyphs_stretch): Remove unused variable.
      ([EmacsWindow setAppearance]): Only compile on macOS.
      (ns_mouse_position): Make sure f is initialised on GNUstep.
      * src/emacs.c (main): Move allocation of autorelease pool to before
      first use.
    • Alan Third's avatar
      Fix #defines controlling when NS port draws to offscreen buffer · 68109c56
      Alan Third authored
      * src/nsterm.h (NS_DRAW_TO_BUFFER): New definition.
      * src/nsterm.m (ns_update_begin):
      ([EmacsView updateFrameSize:]):
      ([EmacsView initFrameFromEmacs:]):
      ([EmacsView copyRect:to:]): Use new #define.
  15. 27 Feb, 2020 2 commits
  16. 19 Feb, 2020 2 commits
    • Masahiro Nakamura's avatar
      Fix working text related issues on NS (Bug#38851) · b3de1302
      Masahiro Nakamura authored
      * src/keyboard.c (read_char): Prevent redsiplay right after
      ns-unput-working-text event.
      * src/nsterm.m ([EmacsView insertText:]): Partially revert commit
      ([EmacsView firstRectForCharacterRange:]): Fix candidate window
      position when cursor is on echoarea.
      ([EmacsView mouseDown:])
      ([EmacsView windowDidResignKey:]): Don't delete working text.
    • Alan Third's avatar
      Fix horizontal bit shifting · 1a75e8b7
      Alan Third authored
      * src/nsterm.m ([EmacsView copyRect:to:]): Calculate the horizontal
      difference instead of just the vertical.
      ([EmacsView updateLayer]): Fix NSTRACE message.
  17. 13 Feb, 2020 1 commit
    • Alan Third's avatar
      Use CGImage instead of NSBitmapImageRep (bug#32932) · 44298ea6
      Alan Third authored
      * src/nsterm.m (ns_update_end):
      (ns_clear_frame): Remove forced draws.
      (ns_dumpglyphs_image): No longer need to invert images as the context
      is already flipped.
      ([EmacsView updateFrameSize:]):
      ([EmacsView initFrameFromEmacs:]): Use new function.
      ([EmacsView createDrawingBuffer]): Replaces createDrawingBufferWithRect:.
      ([EmacsView focusOnDrawingBuffer]): Set CGImage context.
      ([EmacsView windowDidChangeBackingProperties:]): Use new function.
      ([EmacsView copyRect:to:]): Copy using CGImages.
      ([EmacsView wantsUpdateLayer]):
      ([EmacsView updateLayer]): New Functions.
      ([EmacsView drawRect:]): We no longer do anything special here for
      ([EmacsView windowDidChangeBackingProperties:]): Fix indentation and
      add NSTRACE.
  18. 11 Feb, 2020 1 commit
  19. 24 Jan, 2020 4 commits
    • Alan Third's avatar
      Draw to offscreen buffer on macOS · f674c905
      Alan Third authored
      * src/nsfns.m (x_set_background_color): Clear the frame after changing
      the background color, not before.
      * src/nsterm.h (drawingBuffer): New variable.
      ([EmacsView focusOnDrawingBuffer]):
      ([EmacsView copyRect:to:]):
      ([EmacsView createDrawingBufferWithRect:]): New methods.
      * src/nsterm.m (ns_update_begin):
      (ns_unfocus): Handle drawing to offscreen buffer.
      (ns_clip_to_row): Use ns_row_rect.
      (ns_copy_bits): Remove unused function.
      (ns_shift_glyphs_for_insert): Use new scrolling method.
      (ns_dumpglyphs_image): When drawing to the offscreen buffer, flip
      images so they appear the right way up.
      (ns_dumpglyphs_stretch): Remove unnecessary code.
      (ns_draw_window_cursor): Don't disable screen updates.
      ([EmacsView updateFrameSize:]): Update the size of the offscreen
      ([EmacsView initFrameFromEmacs:]): Create offscreen buffer.
      ([EmacsView windowDidChangeBackingProperties:]):
      ([EmacsView createDrawingBufferWithRect:]):
      ([EmacsView focusOnDrawingBuffer]):
      ([EmacsView copyRect]): New methods.
      ([EmacsView viewWillDraw]): Remove method as it no longer does
      anything useful.
      ([EmacsView drawRect:]): Handle drawing from offscreen buffer.
    • Alan Third's avatar
      Revert "Make all NS drawing be done from drawRect" · 3ad78132
      Alan Third authored
      This reverts commit 79464459.
    • Alan Third's avatar
      Revert "Ensure NS frame is redrawn correctly after scroll" · 6b955c26
      Alan Third authored
      This reverts commit a6ab8db3.
    • Alan Third's avatar
      Revert "Fix some NS drawing issues (bug#32932)" · ac6e620a
      Alan Third authored
      This reverts commit 7e8eee60.
  20. 20 Jan, 2020 1 commit
    • Pip Cet's avatar
      Clear output data pointer on NS · 2eb834ea
      Pip Cet authored
      * src/nsterm.m (ns_free_frame_resources): Clear the output data
      pointer to prevent attempting to reuse freed resources (Bug#38748).
  21. 07 Jan, 2020 1 commit
    • Alan Third's avatar
      Fix NS frame parameters (bug#39000) · 72f54f03
      Alan Third authored
      * src/frame.c (make_frame): Use new system default setting.
      * src/frame.h (enum ns_appearance_type): Add new system default
      * src/nsfns.m (Fx_create_frame): Correctly handle Qunbound and support
      system default appearance.
      (syms_of_nsfns): Add Qlight.
      * src/nsterm.h: New method definition.
      * src/nsterm.m (ns_set_appearance): Correctly handle Qlight and use new
      setAppearance method.
      ([EmacsView initFrameFromEmacs:]): Use new setAppearance method.
      ([EmacsWindow setAppearance]): New method.
      * doc/lispref/frames.texi (Management Parameters): Document 'light'.
  22. 01 Jan, 2020 1 commit
  23. 29 Dec, 2019 1 commit
  24. 23 Dec, 2019 1 commit
    • Philipp Stephani's avatar
      Remove some undefined behavior related to left shifts. · 00c99491
      Philipp Stephani authored
      Found by UBSan.
      * src/nsfns.m (ns_set_foreground_color, ns_set_background_color):
      * src/nsimage.m (getPixelAtX:Y:):
      * src/nsterm.m (ns_color_index_to_rgba): Add explicit casts to avoid
      undefined behavior when left-shifting beyond the bounds of the int
      * src/macfont.m (METRICS_VALUE): Add explicit casts to avoid undefined
      behavior when left-shifting a negative value.
  25. 22 Dec, 2019 1 commit
    • Masahiro Nakamura's avatar
      Fix display of working text on NS (Bug#23412, Bug#1453) · ba042176
      Masahiro Nakamura authored
      * lisp/term/ns-win.el (ns-insert-working-text):
      (ns-delete-working-text): Change how working text is deleted to handle
      changed order of operations.
      * src/nsterm.m ([EmacsView insertText:]): Move deletion of working
      text until after insertion of new text.
      Copyright-paperwork-exempt: yes
  26. 11 Dec, 2019 1 commit
  27. 10 Dec, 2019 3 commits
    • Alan Third's avatar
      Fix XBM files on NS (bug#26133) · 9546a2a0
      Alan Third authored
      Reinstate some of the functionality removed in commit
      * src/nsimage.m (ns_image_from_XBM): Use new reverseBytes argument.
      ([EmacsImage initFromXBM:width:height:fg:bg:reverseBytes:]): Add
      ability to reverse the contents of each byte for use with XBMs, while
      still working with fringe bitmaps.
      * src/nsterm.h
      ([EmacsImage initFromXBM:width:height:fg:bg:reverseBytes:]): Modified
      function definition.
      * src/nsterm.m (ns_draw_fringe_bitmap): Use new reverseBytes argument.
    • Alan Third's avatar
      Fix mouse-position on macOS (bug#4892) · fbf9fea4
      Alan Third authored
      * src/nsterm.m (ns_mouse_position): Implement a search for the frame
      under the mouse pointer.
    • Paul Eggert's avatar
      Spelling fixes · d1a791f8
      Paul Eggert authored
  28. 27 Nov, 2019 1 commit
    • Mattias Engdegård's avatar
      Fine-grained NS modifier key settings (bug#38296) · 215f678c
      Mattias Engdegård authored
      For the ns-KEY-modifier and ns-right-KEY-modifier variables, KEY
      being 'control', 'command', 'alternate' and 'function', allow
      values on the form (:ordinary SYMBOL :function :SYMBOL :mouse SYMBOL),
      so that the key can be used for different modifiers (or none) in
      different contexts.  This is particularly useful for using the macOS
      Option key for extended character entry while still using it as an
      Emacs modifier for function keys and mouse clicks.
      * src/nsterm.m (mod_of_kind, right_mod, nil_or_none): Helper functions.
      (EV_MODIFIERS2): Add KIND argument.
      (EV_MODIFIERS): Adapt call to EV_MODIFIERS2.
      (ns_get_shifted_character): Use correct event kind for modifiers.
      (ns-alternate-modifier, ns-right-alternate-modifier)
      (ns-command-modifier, ns-right-command-modifier)
      (ns-control-modifier, ns-right-control-modifier)
      (ns-function-modifier): Rewrite doc strings for new data format.
      (QCordinary, QCfunction, QCmouse): Define symbols.
      * lisp/cus-start.el: Conform to new data types.
      * doc/emacs/macos.texi (Mac / GNUstep Basics)
      (Mac / GNUstep Customization): Improved documentation.
      * etc/NEWS: Mention the change.
  29. 12 Nov, 2019 1 commit
  30. 09 Nov, 2019 1 commit
  31. 31 Oct, 2019 1 commit