aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsmenu.m (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge from savannah/emacs-29Po Lu2024-01-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
| |
* | Don't allow Services entries in pop-up menus on macOS (bug#66420)Mattias Engdegård2023-10-091-0/+4
|/ | | | | | * src/nsmenu.m ([EmacsMenu runMenuAt:forFrame:keymaps:]): Prevent the system from adding context menu plug-ins (Services entries or sub-menu) to all our pop-up menus.
* Avoid crashes on macOS with context menusDaniel Martín2023-09-071-0/+8
| | | | | * src/nsmenu.m ([EmacsMenu menuNeedsUpdate:]): Avoid crashes with context menus. (Bug#63495)
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* Fix nsmenu crash when exiting popup dialogPo Lu2022-10-061-1/+4
| | | | | | * src/nsmenu.m (pop_down_menu): Do not discard menu items here. (ns_popup_dialog): Call discard_menu_items after unuse_menu_items. (bug#58296)
* Expunge unused recompute-lucid-menubar, lucid-menu-bar-dirty-flagAlan Mackenzie2022-07-121-2/+0
| | | | | | | | | | | | | | | | | | This fixes bug #56502. That function and these variables were manipulated by the former file emacs-lisp/lmenu.el that was finally expunged from directory obsolete/ by Stefan Kangas on 2020-05-15. There remain references to them in the *.c, and *.m files. * src/keyboard.c (syms_of_keyboard): Remove declarations of the symbol and variable. * src/haikumenu.c (set_frame_menu_bar) * src/keyboard.c (command_loop_1) * src/nsmenu.m (ns_update_menubar) * src/pgtkmenu.c (set_frame_menubar) * src/xdisp.c (update_menu_bar) * src/xmenu.c (set_frame_menubar): Remove calls to Qrecompute_lucid_menubar contitional on Vlucid_menu_bar_dirty_flag.
* Implement `follow-tooltip' on NS as wellPo Lu2022-06-091-0/+9
| | | | | | | | | | | | | | | | | * lisp/term/ns-win.el (x-begin-drag): Pass `follow-tooltip'. * src/nsfns.m (Fx_show_tip): Record last dx and dy. (syms_of_nsfns): New staticpros. * src/nsmenu.m ([EmacsTooltip moveTo:]): New method. * src/nsselect.m (Fns_begin_drag): New parameter `follow-tooltip'. * src/nsterm.h (@interface EmacsWindow): (EmacsTooltip): Update prototypes. * src/nsterm.m ([EmacsWindow draggedImage:movedTo:]): Move any tooltip to the right location. ([EmacsWindow beginDrag:forPasteboard...]): New parameter `followTooltip'.
* * src/nsmenu.m (ns_menu_show): Use SAFE_ALLOCA.Po Lu2022-05-241-19/+17
|
* Minor fixes for popup dialogs on macOSPo Lu2022-05-141-3/+10
| | | | | | * nsmenu.m (pop_down_menu): Restore old hack for macOS. ([EmacsDialogPanel initWithTitle:isQuestion:]): Set command title correctly.
* Fix processing of dialog box items on NSPo Lu2022-05-141-126/+145
| | | | | | | | | | | | | | | | | | | | * src/nsmenu.m (pop_down_menu): Remove old hack and discard menu items. (ns_popup_dialog): ([EmacsDialogPanel initWithContentRect:styleMask:backing:defer:]): ([EmacsDialogPanel windowShouldClose:]): ([EmacsDialogPanel dealloc]): ([EmacsDialogPanel processdialog:]): ([EmacsDialogPanel addButton:value:row:]): ([EmacsDialogPanel addString:row:]): ([EmacsDialogPanel clicked:]): ([EmacsDialogPanel initFromContents:isQuestion:]): ([EmacsDialogPanel timeouthandler:]): ([EmacsDialogPanel runDialogAt:]): Use the regular menu item machinery to parse dialog items instead of the incorrect ad-hoc code used previously. * src/nsterm.h: Update prototypes.
* Better fix for disappearing menu items on NSPo Lu2022-05-141-4/+14
| | | | | | | | * src/frame.c (delete_frame): Revert last change. * src/nsmenu.m (free_frame_menubar): Only free if that frame's menu bar is actually being displayed. (ns_update_menubar): Note the last frame to have updated the menu bar.
* Improve test for empty help-echo on NS menu bar itemsPo Lu2022-05-131-1/+1
| | | | | * src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Also check if idx is valid.
* Display help-echo for popup menus on NSPo Lu2022-05-131-8/+24
| | | | | * src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Display help echo for ordinary popup menus as well.
* Fix crashes on ordinary menus on macOSPo Lu2022-05-081-9/+13
| | | | | | | * src/nsmenu.m ([EmacsMenu runMenuAt:forFrame:keymaps:]): Fix coding style. ([EmacsMenu menu:willHighlightItem:]): Ignore if this is a context menu.
* Make menu bar help text work on macOS as wellPo Lu2022-05-031-10/+3
| | | | | | | | | * lisp/tooltip.el (tooltip-show-help): Resort to displaying messages in the echo area on NS. * src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Call `show_help_echo' instead of storing an event into the keyboard buffer.
* Fix nsmenu compilation under macOS 10.6Alan Third2022-04-251-4/+6
| | | | | | | | | | | | | | | | | | | * src/nsmenu.m ([EmacsMenu fillWithWidgetValue:]): Replace modern shorthand dictionary and array definitions. * src/nsterm.h (NSTextAlignmentRight): Redefine if necessary. * src/macfont.m (mac_font_create_preferred_family_for_attributes): isOperatingSystemAtLeastVersion is new in macOS 10.10, so it's probably wrong to use it to check whether we're below 10.9. (mac_font_copy_default_descriptors_for_language): (mac_font_copy_default_name_for_charset_and_languages): It seems these functions are only used on macOS 10.8 and below. * src/nsterm.m ([NSColor colorUsingDefaultColorSpace]): Use the generic colorspace. (ns_parent_window_rect): (ns_frame_scale_factor): ([EmacsWindow setParentChildRelationships]): Fix macOS version stuff. Co-authored-by: Po Lu <luangruo@yahoo.com>
* Replace ptrdiff_t with new specpdl_ref type for specpdl referencesMattias Engdegård2022-02-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The specpdl_ref type is just an alias for ptrdiff_t; the compiled code remains the same. All operations on specpdl_ref (arithmetic, comparison etc) now go through inline functions. The bulk of the change is almost completely mechanical. It is done to prepare for a type-safe representation and subsequent performance improvement. * src/lisp.h (specpdl_ref, specpdl_count_to_ref, specpdl_ref_to_count) (specpdl_ref_eq, specpdl_ref_lt, specpdl_ref_valid_p) (make_invalid_specpdl_ref, specpdl_ref_add, specpdl_ref_to_ptr): New. (SPECPDL_INDEX, struct handler, USE_SAFE_ALLOCA, safe_free) (safe_free_unbind_to): * src/alloc.c (run_finalizer_function, inhibit_garbage_collection) (garbage_collect, Fgarbage_collect, which_symbols): * src/bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start): * src/buffer.c (Fkill_buffer, Fset_buffer_major_mode, Fmove_overlay) (Fdelete_overlay): * src/bytecode.c (exec_byte_code): * src/callint.c (Ffuncall_interactively, Fcall_interactively): * src/callproc.c (Fcall_process, call_process, create_temp_file) (Fcall_process_region): * src/charset.c (load_charset_map_from_file): * src/coding.c (decode_coding_gap, decode_coding_object) (encode_coding_object, Fread_coding_system): * src/comp.c (emit_static_object, helper_unbind_n, load_comp_unit): * src/composite.c (update_compositions, autocmp_chars): * src/cygw32.c (conv_filename_to_w32_unicode) (conv_filename_from_w32_unicode): * src/data.c (notify_variable_watchers): * src/decompress.c (Fzlib_decompress_region): * src/dired.c (directory_files_internal, file_name_completion) (file_attributes): * src/dispnew.c (Fredisplay): * src/doc.c (get_doc_string, Fsnarf_documentation): * src/editfns.c (Fsave_excursion, Fsave_current_buffer) (Freplace_buffer_contents, Fsubst_char_in_region, Fsave_restriction) (styled_format): * src/emacs-module.c (Fmodule_load, funcall_module): * src/emacs.c (init_cmdargs, Fdump_emacs): * src/eval.c (call_debugger, do_debug_on_call, FletX, Flet) (Ffuncall_with_delayed_message, Funwind_protect) (internal_lisp_condition_case, signal_or_quit) (load_with_autoload_queue, Feval, grow_specpdl_allocation) (record_in_backtrace, eval_sub, Ffuncall, apply_lambda) (funcall_lambda, clear_unwind_protect, set_unwind_protect) (set_unwind_protect_ptr, unbind_to, Fbacktrace_eval): * src/fileio.c (Fmake_temp_file_internal, Fcopy_file, Frename_file) (Finsert_file_contents, write_region, Fdo_auto_save): * src/fns.c (Fyes_or_no_p, Frequire, hash_table_user_defined_call): * src/fringe.c (update_window_fringes): * src/gtkutil.c (xg_dialog_run): * src/haiku_io.c (c_specpdl_idx_from_cxx): * src/haiku_support.cc (be_popup_file_dialog): * src/haiku_support.h (c_specpdl_idx_from_cxx): * src/haikufns.c (haiku_create_frame, haiku_create_tip_frame) (haiku_hide_tip, Fx_show_tip, Fhaiku_read_file_name): * src/haikumenu.c (haiku_popup_dialog, set_frame_menubar): * src/image.c (slurp_file): * src/indent.c (line_number_display_width, Fvertical_motion): * src/insdel.c (signal_before_change, signal_after_change) (Fcombine_after_change_execute): * src/intervals.c (get_local_map): * src/json.c (lisp_to_json_nonscalar_1, Fjson_serialize, Fjson_insert) (Fjson_parse_string, Fjson_parse_buffer): * src/keyboard.c (recursive_edit_1, Frecursive_edit, cmd_error) (Finternal_track_mouse, command_loop_1, read_menu_command) (safe_run_hooks, read_event_from_main_queue, read_char, timer_check_2) (menu_item_eval_property, read_key_sequence, read_key_sequence_vs) (Fsuspend_emacs): * src/keymap.c (Fcurrent_active_maps, Fdescribe_vector) (Fhelp__describe_vector): * src/lread.c (Fload, save_match_data_load, readevalloop) (Feval_buffer, Feval_region, grow_read_buffer, read_integer, read1): * src/macros.c (Fexecute_kbd_macro): * src/menu.c (x_popup_menu_1): * src/minibuf.c (read_minibuf, set_minibuffer_mode) (read_minibuf_unwind, Fread_string, Fread_buffer): * src/nsfns.m (Fx_create_frame, Fx_show_tip): * src/nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog): * src/pdumper.c (Fdump_emacs_portable): * src/pgtkfns.c (Fx_create_frame, x_create_tip_frame, x_hide_tip) (Fx_show_tip, Fpgtk_print_frames_dialog, Fx_file_dialog, Fx_select_font): * src/pgtkmenu.c (set_frame_menubar, create_and_show_popup_menu) (pgtk_menu_show, create_and_show_dialog, pgtk_dialog_show) (pgtk_popup_dialog): * src/pgtkterm.c (pgtk_cr_export_frames): * src/print.c (PRINTPREPARE, temp_output_buffer_setup) (Fprin1_to_string, print_vectorlike): * src/process.c (Fmake_process, create_process, Fmake_pipe_process) (Fmake_serial_process, connect_network_socket, Fmake_network_process) (network_interface_info, server_accept_connection) (wait_reading_process_output, read_process_output, exec_sentinel): * src/regex-emacs.c (re_match_2_internal): * src/search.c (looking_at_1, fast_looking_at, search_buffer_re): * src/sound.c (Fplay_sound_internal): * src/sysdep.c (system_process_attributes): * src/term.c (tty_menu_show): * src/textprop.c (Fnext_single_char_property_change) (Fprevious_single_char_property_change, add_text_properties_1) (set_text_properties, set_text_properties_1, Fremove_text_properties) (Fremove_list_of_text_properties): * src/thread.c (Fmutex_lock, invoke_thread_function): * src/undo.c (truncate_undo_list): * src/w32fns.c (Fx_create_frame, w32_create_tip_frame, w32_hide_tip) (Fx_show_tip, Fx_file_dialog): * src/w32font.c (Fx_select_font): * src/w32menu.c (set_frame_menubar): * src/window.c (window_list, next_window, window_list_1) (run_window_configuration_change_hook, Frun_window_scroll_functions) (run_window_change_functions, set_window_buffer) (temp_output_buffer_show, window_scroll, scroll_command) (Fscroll_other_window, Fscroll_other_window_down): * src/xdisp.c (safe__call, handle_fontified_prop, handle_face_prop) (handle_single_display_spec, Fbuffer_text_pixel_size) (message_dolog, with_echo_area_buffer, setup_echo_area_for_printing) (display_echo_area, set_message, clear_message, echo_area_display) (gui_consider_frame_title, prepare_menu_bars, update_menu_bar) (update_tab_bar, update_tool_bar, redisplay_internal) (redisplay_preserve_echo_area, run_window_scroll_functions) (redisplay_window, extend_face_to_end_of_line) (display_count_lines_logically, display_count_lines_visually) (display_mode_lines, display_mode_line, Fformat_mode_line) (decode_mode_spec): * src/xfns.c (Fx_create_frame, x_create_tip_frame, x_hide_tip) (Fx_show_tip, Fx_file_dialog, Fx_select_font, Fx_print_frames_dialog): * src/xmenu.c (set_frame_menubar, create_and_show_popup_menu) (x_menu_show, create_and_show_dialog, x_dialog_show) (xw_popup_dialog): * src/xselect.c (x_get_local_selection, x_reply_selection_request) (x_handle_selection_request, wait_for_property_change): * src/xterm.c (x_cr_export_frames, x_connection_closed): Replace ptrdiff_t with specpdl_ref for referencing specpdl and use the corresponding functions instead of direct arithmetic.
* Add some menu bar help code on GNUstepPo Lu2022-01-221-4/+26
| | | | | * src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Implement help event generation for GNUstep.
* Fix GNUstep build warningsPo Lu2022-01-221-0/+19
| | | | | | | * src/nsmenu.m ([EmacsMenu menu:updateItem:atIndex:shouldCancel:]) ([EmacsMenu menuHasKeyEquivalent:forEvent:target:action:]) ([EmacsMenu numberOfItemsInMenu:]): New methods.
* Merge from origin/emacs-28Eli Zaretskii2022-01-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
| |
* | Make NS toolbar item ID more unique (bug#50160)Alan Third2021-12-221-2/+2
| | | | | | | | | | | | | | * src/nsmenu.m ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): Add the label to the identifier to avoid collisions between toolbar items that use the same image.
* | Make NS toolbar use NSString instead of C stringsAlan Third2021-12-221-10/+6
| | | | | | | | | | | | | | | | | | * src/nsfns.m ([NSString stringWithLispString:]): Ensure that the lisp object is actually a string. * src/nsmenu.m (update_frame_tool_bar): Convert to NSString instead of C strings. ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): No need to convert to NSString here anymore.
* | Revert "Support opening the toolkit menu bar on NS"Po Lu2021-11-101-55/+0
| | | | | | | | This reverts commit ff9cf991c1608cd2578a66cba41e654a2b5d9144.
* | Support opening the toolkit menu bar on NSoldosfan2021-11-101-0/+55
| | | | | | | | | | | | * src/nsmenu.m (ns_activate_menubar, Fns_open_menubar): New functions. * src/nsterm.m (ns_create_terminal): Add activate_menubar_hook. * lisp/menu-bar.el (menu-bar-open): Use ns-menu-bar-open on Nextstep.
* | General improvements to NS portPo Lu2021-11-061-14/+62
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/dispextern.h: Remove some !HAVE_NS conditionals around grab related code. * src/frame.c (gui_mouse_grabbed, gui_redo_mouse_highlight): Remove !HAVE_NS conditionals around code. * src/nsmenu.m (ns_update_menubar): Prevent recursive calls and enable shallow updates on GNUstep. (menuNeedsUpdate): Prevent recursive calls. (ns_menu_show): Fix mysterious GC-related bug. (update_frame_tool_bar_1): Work around mysterious toolbar sizing bug on GNUstep. * src/nsterm.h (struct ns_output): New field for tracking toolbar visibility changes. * src/nsterm.m (frame_set_mouse_pixel_position): Implement for GNUstep. (ns_redraw_scroll_bars): Enable for GNUstep. (ns_clear_frame): Redraw scrollbars on GNUstep. (ns_update_window_end): New function. (ns_redisplay_interface): Add ns_update_window_end on GNUstep. (- keyDown): Remove debug code that doesn't work on GNUstep. (- mouseDown): Enable grab tracking on NS port. (- resizeWithOldSuperviewSize): Fix build with NSTRACE. * src/xdisp.c (note_tab_bar_highlight): Enable some code for NS port.
* Fix NS toolbar again (bug#50534)Alan Third2021-09-271-12/+23
| | | | | | | | | | | | | | | | | * src/nsmenu.m (free_frame_tool_bar): Remove toolbar. (update_frame_tool_bar_1): New function. (update_frame_tool_bar): Move most of the functionality to update_frame_tool_bar_1. * src/nsterm.h: Definitions of functions and methods. * src/nsterm.m (ns_update_begin): ([EmacsView windowDidEnterFullScreen]): ([EmacsView windowDidExitFullScreen]): We no longer need to reset the toolbar visibility as that's done when we create the new fullscreen window. ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Move the check for undecorated frames into createToolbar:. ([EmacsWindow createToolbar:]): Check whether a toolbar should be created, and run the toolbar update immediately.
* Fix incorrectly appearing toolbar on NS (bug#50534)Alan Third2021-09-141-1/+1
| | | | | | | | | * src/nsmenu.m (update_frame_tool_bar): Ensure both sides of the test are booleans. * src/nsterm.m ([EmacsWindow createToolbar:]): Make the toolbar non-visible initially, in case things get out of sync. Remove call to update_frame_tool_bar: the window isn't yet associated with the view, so it will return immediately.
* Set label for NSToolbarItem (bug#50159)Masahiro Nakamura2021-08-221-0/+7
| | | | | | | | | * src/nsmenu.m (update_frame_tool_bar): Get label text and pass it to ... ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): ... this that sets label for NSToolbarItem. * src/nsterm.h ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): Add labelText argument.
* Remove default "Select" title from NS popup menus (bug#50067)Mattias Engdegård2021-08-211-1/+1
| | | | | * src/menu.c (x_popup_menu_1): Remove default "Select" title. * src/nsmenu.m (ns_menu_show): Allow title to be absent.
* Fix some macOS problemsAlan Third2021-07-311-2/+2
| | | | | | | * src/nsmenu.m (update_frame_tool_bar): Make sure the toolbar isn't displayed when it's not supposed to be. * src/nsterm.m ([EmacsView layoutSublayersOfLayer:]): Reinstate code intended to prevent a crash when running redisplay.
* Move NS port toolbar handling to the windowAlan Third2021-07-311-12/+4
| | | | | | | | | | | | | | | | | | | * src/nsmenu.m (free_frame_tool_bar): (update_frame_tool_bar): Remove wait_for_tool_bar and get the toolbar from the window. * src/nsterm.h (EmacsView): Remove toolbar and wait_for_tool_bar. * src/nsterm.m (ns_update_begin): ([EmacsView windowDidEnterFullScreen]): ([EmacsView windowDidExitFullScreen]): Get the toolbar from the window, not the view. ([EmacsView dealloc]): Remove toolbar from view. ([EmacsView createToolbar:]): Move method to EmacsWindow. ([EmacsView initFrameFromEmacs:]): Don't create toolbar here any more. ([EmacsView toolbar]): Remove method. ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Create toolbar here. ([EmacsWindow createToolbar:]): Moved from EmacsView. ([EmacsWindow dealloc]): Make sure we clean up the toolbar after closing the window.
* Fix GNUstep menu update crashesAlan Third2021-06-201-1/+29
| | | | | * src/nsmenu.m (ns_update_menubar): close the submenus before modifying them. ([EmacsMenu close]): Make sure to close all submenus.
* Fix GNUstep build warningsAlan Third2021-06-201-8/+31
| | | | | | | | | | | | | | | | | | | * src/nsterm.h ([EmacsWindow orderedIndex]): * src/nsterm.m ([EmacsWindow orderedIndex]): Implement orderedIndex for use under GNUstep. * src/nsmenu.m (free_frame_menubar): (ns_update_menubar): ([EmacsMenu addSubmenuWithTitle:]): ([EmacsMenu addItemWithWidgetValue:attributes:]): Cast return values to correct types. ([EmacsMenu fillWithWidgetValue:]): Move variable definition inside relevant #ifdef block. ([EmacsMenu menuWillOpen:]): ([EmacsMenu menuDidClose:]): ([EmacsMenu confinementRectForMenu:onScreen:]): ([EmacsMenu menu:willHighlightItem:]): New functions to silence build warnings. * src/nsfont.m (nsfont_open): Remove pointless fabs call.
* Fix NS build broken by a recent changeEli Zaretskii2021-01-301-2/+2
| | | | | * src/nsmenu.m (set_frame_menubar, Fns_reset_menu): Adapt to recent changes in set_frame_menubar. (Bug#45759)
* Avoid a few compilation warnings in Objective-C code.Philipp Stephani2021-01-231-1/+0
| | | | | | | | | | | | * src/nsfns.m (Fns_frame_restack): Remove unused variable 'flag'. * src/nsmenu.m (ns_update_menubar): Remove unused variable 'pool'. * src/nsterm.m (focus_view, hide_bell): Define conditionally. (ns_update_end): Define variable 'view' conditionally. (ns_redraw_scroll_bars): Don't define unused function. (copyRect): Don't perform arithmetic on 'void' pointers. (nswindow_orderedIndex_sort): Make static.
* Prevent stack overflow in GNUstep menu codeAlan Third2021-01-051-8/+13
| | | | | | | * src/nsmenu.m (ns_update_menubar): Always do a deep update for GNUstep. ([EmacsMenu menuNeedsUpdate:]): Don't update the menu as it should always have had a deep update.
* Fix GNUstep warningsAlan Third2021-01-011-3/+0
| | | | | | | | * src/nsterm.h: EmacsSurface is only required if NS_DRAW_TO_BUFFER is defined. * src/nsterm.m (ns_judge_scroll_bars): Remove unused variable. * src/nsmenu.m (update_frame_tool_bar): (ns_update_menubar): Remove unused variables.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Fix Help menu on macOSAlan Third2020-12-301-0/+3
| | | | | * src/nsmenu.m (ns_update_menubar): Make sure to reset the help menu when we move it to another submenu.
* Use standard key symbols in NS menu entriesMattias Engdegård2020-12-301-10/+60
| | | | | | * src/nsmenu.m (skipspc): Remove. (key_symbols, prettify_key): New. ([EmacsMenu fillWithWidgetValue:]): Call prettify_key.
* ; * src/nsmenu.m: Undo unintentional changeMattias Engdegård2020-12-301-2/+2
|
* Plug NS memory leaks (bug#45502)Mattias Engdegård2020-12-301-6/+7
| | | | | * src/nsmenu.m ([EmacsMenu addItemWithWidgetValue:attributes:]): Mark allocated and owned objects for autorelease.
* Don't calculate macOS menu data for GNUstep (bug#45502)Alan Third2020-12-291-5/+13
| | | | | * src/nsmenu.m ([EmacsMenu fillWithWidgetValue:]): #ifdef out code that has no effect on GNUstep and autorelease alloc'd objects.
* More readable keys in NS menu entries (bug#45502)Mattias Engdegård2020-12-291-46/+59
| | | | | | | | | | | | | Each menu entry now has the key binding in a right-aligned column, as an attempt to improve readability. Previously the keys were given in brackets immediately following the menu string. * src/nsmenu.m ([EmacsMenu parseKeyEquiv:]): Remove. (skipspc): New helper function. ([EmacsMenu addItemWithWidgetValue:]): Add attributes argument. Use attributed title string. Don't special-case Super bindings. ([EmacsMenu fillWithWidgetValue:]): Compute maximum width. Prepare attributes for title.
* Fix crash in NS menu codeAlan Third2020-12-291-0/+9
| | | | | | * src/nsmenu.m (ns_update_menubar): When the menu generation code was copied from xmenu.c the fix for waiting_for_input was lost. Reinstate it.
* Fix crash in NS menu codeAlan Third2020-12-281-55/+46
| | | | | | | * src/nsmenu.m (ns_update_menubar): Don't assume that the top level menus are correct when populating the submenus. (free_frame_menubar): Clear the menu. ([EmacsMenu removeAllItems]): Actually remove all menu items.
* Remove NS menu synthesized events (bug#44333)Alan Third2020-12-271-302/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the frame tracking stuff as it's not used for anything, and move the update tracking into the EmacsMenu class. * src/nsmenu.m (ns_update_menubar): Copy the parsing code from xmenu.c and rework the NS specific code around to update the existing menus instead of rebuilding them completely. (ns_activate_menubar): ([EmacsMenu trackingNotification:]): ([EmacsMenu menuWillOpen:]): ([EmacsMenu menuDidClose:]): Remove unused functions. ([EmacsMenu menuNeedsUpdate:]): Remove menu tracking code and add code to check whether an update is required. ([EmacsMenu fillWithWidgetValue:]): ([EmacsMenu addSubmenuWithTitle:]): ([EmacsMenu initWithTitle:]): Remove references to frame. ([EmacsMenu setFrame:]): Remove method. ([EmacsMenu clear]): Rename to removeAllItems. ([EmacsMenu removeAllItems]): Use built-in removeAllItems, if available. (syms_of_nsmenu): Remove tracking code. * src/nsterm.m (ns_check_menu_open): (ns_check_pending_open_menu): (ns_create_terminal): Remove unused functions. (ns_term_init): Get rid of menu tracking. * src/nsterm.h (EmacsMenu): Remove frame, add needsUpdate and update method definitions.
* Use new NSString lisp methodsAlan Third2020-12-221-1/+1
| | | | | | | | | | | | | | | | | | * src/nsfont.m (ns_otf_to_script): (ns_registry_to_script): (ns_get_req_script): Use NSString conversion methods. * src/nsimage.m ([EmacsImage allocInitFromFile:]): Use NSString conversion methods. * src/nsmenu.m (ns_menu_show): Use NSString conversion methods. * src/nsselect.m (symbol_to_nsstring): (ns_string_to_pasteboard_internal): Use NSString conversion methods. * src/nsterm.m (ns_term_init): ([EmacsView initFrameFromEmacs:]): Use NSString conversion methods. * src/nsxwidget.m (nsxwidget_webkit_uri): (nsxwidget_webkit_title): (js_to_lisp): Use NSString conversion methods. (build_string_with_nsstr): Functionality replaced by NSString extensions.