Commit graph

46324 commits

Author SHA1 Message Date
Po Lu
3939a72fcb Fix detection of wheel movement during drag-and-drop
* src/xterm.c (x_dnd_send_position): Don't treat Button8 as the
mouse wheel.
2022-05-16 21:47:39 +08:00
Lars Ingebrigtsen
f5ee56c5ea Don't expose Vprint_variable_mapping to Lisp
* src/print.c: Don't expose Vprint_variable_mapping to the Lisp
world, because it really should be immutable.
(print_create_variable_mapping): Initialization moved here from
syms_of_print.
(print_bind_overrides): Call it.
(syms_of_print): Protect the mapping variable.
2022-05-16 15:01:08 +02:00
Po Lu
b8cfe8fa75 Improve error checking in `haiku-roster-launch'
* src/haikuselect.c (Fhaiku_roster_launch): Signal error if
FILE-OR-TYPE doesn't exist or ARGS does not apply.
2022-05-16 07:17:16 +00:00
Stefan Kangas
1fc1d8b889 Merge from origin/emacs-28
f928330fa8 Update to Org 9.5.3-6-gef41f3
007bf9a34c Hide temporary FUSE files in Tramp
5dbaddc729 ; Fix some typos
2022-05-16 06:30:38 +02:00
Po Lu
44e5339e82 Improve safety of handling unsupported drop events on X
* src/keyboard.c (kbd_buffer_get_event):
* src/xterm.c (handle_one_xevent): Check that the event frame is
still live after calling arbitrary Lisp code.
2022-05-16 11:05:32 +08:00
Po Lu
a57687dc0e Clean up Haiku code after file panel changes
* src/haiku_support.cc:
* src/haiku_support.h: Stop including pthread.h and specpdl_ref.

* src/haikumenu.c (run_menu_bar_help_event): Ignore invalid help
events instead of aborting.
2022-05-16 01:37:27 +00:00
Po Lu
af4a0d7ad6 ; Remove extraneous debugging code
* src/xterm.c (handle_one_xevent): Remove extra debugging code.
2022-05-16 09:22:50 +08:00
Po Lu
dd05eb4048 Handle pointer axes changing along with scroll valuators
* xterm.c (x_get_scroll_valuator_delta): Set valuator_return to
NULL if no valuator was found.
(handle_one_xevent): Assume pointer axes might've changed if no
scroll valuator was found but valuators were set when handling
motion events.
2022-05-16 09:18:33 +08:00
Eli Zaretskii
d4ae418691 ; Improve documentation of the OVERRIDES argument to prin1
* src/print.c (Fprin1, syms_of_print):
* etc/NEWS:
* doc/lispref/streams.texi (Output Functions, Output Overrides):
Fix typos and cross-references, and improve wording.
2022-05-15 19:02:46 +03:00
Lars Ingebrigtsen
a517f3d759 Adjust more prin1-to-string callers
* src/w32.c (check_windows_init_file):
* src/comp.c (Lisp_Object):
(emit_lisp_obj_reloc_lval):
(emit_lisp_obj_rval):
(emit_mvar_rval):
(emit_limple_insn):
(emit_static_object): Adjust prin1-to-string callers.
2022-05-15 15:37:12 +02:00
Lars Ingebrigtsen
aa95b2a47d Add OVERRIDES argument to prin1/prin1-to-string
* doc/lispref/streams.texi (Output Functions): Document it.
(Output Overrides): New node.

* src/process.c (Faccept_process_output):
* src/print.c (debug_print, print_error_message):
* src/pdumper.c (print_paths_to_root_1, decode_emacs_reloc):
* src/lread.c (readevalloop):
* src/eval.c (internal_lisp_condition_case):
* src/editfns.c (styled_format): Adjust prin1/prin1-to-string
callers.

* src/print.c (Fprin1): Take an OVERRIDES parameter.
(print_bind_overrides, print_bind_all_defaults): New functions.
(Fprin1_to_string): Take an OVERRIDES parameter.
2022-05-15 15:29:38 +02:00
Po Lu
22873b5415 Make Haiku stipple display slightly faster
* src/haikuterm.c (haiku_draw_stipple_background): Draw tiled
bitmap to end of stipple instead of the end of the frame.
2022-05-15 12:44:59 +00:00
Po Lu
ade35760a5 Fix use of more invalid keys in PGTK GSettings code
* src/xsettings.c (apply_gsettings_font_hinting):
(apply_gsettings_font_rgba_order): Test for key existence before
using it.
2022-05-15 17:38:56 +08:00
Stefan Kangas
09674074b5 ; Fix typos 2022-05-15 11:15:06 +02:00
Stefan Kangas
5dbaddc729 ; Fix some typos 2022-05-15 11:05:36 +02:00
Po Lu
aaa2d0db18 Improve return value of `haiku-roster-launch'
* src/haikuselect.c (Fhaiku_roster_launch): Return
`already-running' if no PID is available since the target
application is already running.
(syms_of_haikuselect): New defsym.
2022-05-15 08:33:34 +00:00
Po Lu
99df11a393 Simplify Haiku cursor management code
* src/haiku_support.cc (BCursor_create_default)
(BCursor_create_modeline, BCursor_from_id, BCursor_create_i_beam)
(BCursor_create_progress_cursor, BCursor_create_grab)
(BCursor_delete): Delete specialized cursor creation functions.
(be_delete_cursor, be_create_cursor_from_id): New functions.
(BView_set_view_cursor): Fix coding style.
* src/haiku_support.h (enum haiku_cursor): Add all cursor IDs.
* src/haikufns.c (haiku_free_custom_cursors):
(haiku_set_mouse_color):
* src/haikuterm.c (haiku_term_init): Adjust accordingly.
2022-05-15 06:23:45 +00:00
Eli Zaretskii
fef8a3a3cd Fix database related to some scripts
* lisp/international/fontset.el (script-representative-chars): Add
tai-le and tai-lue scripts.
(otf-script-alist): Fix the name of tai-le.

* src/w32font.c (syms_of_w32font): Fix typos in some script symbol
names.
2022-05-15 09:08:50 +03:00
Po Lu
2a5e1d8c44 Allocate some buffers used during event handling safely
* src/xterm.c (handle_one_xevent): Allocate string lookup and
device disable data safely since they can potentially become
very large.
2022-05-15 09:38:56 +08:00
Po Lu
8e59297378 Prevent crashes trying to access nonexistent key
* src/xsettings.c (xg_settings_key_valid_p): New function.
(apply_gsettings_font_antialias): Test that `font-aliasing' is
actually available.  (bug#55416)
2022-05-15 09:30:07 +08:00
Po Lu
003dc93f93 Fix scroll event translation for legacy button events
* src/xterm.c (handle_one_xevent): Don't treat emulated Button8
as a wheel event.
2022-05-15 09:05:59 +08:00
Stefan Monnier
b65a905edf src/lisp.h (FOR_EACH_TAIL_SAFE): Typo 2022-05-14 12:46:21 -04:00
Po Lu
2c4e998592 Minor fixes for popup dialogs on macOS
* nsmenu.m (pop_down_menu): Restore old hack for macOS.
([EmacsDialogPanel initWithTitle:isQuestion:]): Set command
title correctly.
2022-05-14 21:35:05 +08:00
Po Lu
5aef501d9c Fix processing of dialog box items on NS
* 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.
2022-05-14 21:18:35 +08:00
Po Lu
e0044dfeb0 Avoid unsafe alloca when looking up toplevels
* src/xterm.c (x_dnd_compute_toplevels): Use SAFE_ALLOCA, since
alloca isn't safe when there are lots of toplevels or the window
manager is broken.
2022-05-14 20:07:56 +08:00
Po Lu
df8efda552 Try to restore valuator values when a device is enabled
* src/xterm.c (struct xi_known_valuator): New struct.
(xi_populate_device_from_info): Figure out all the values of the
valuators and set the scroll valuators's current_value to it.
2022-05-14 14:12:39 +08:00
Po Lu
004c2ced6e Better fix for disappearing menu items on NS
* 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.
2022-05-14 13:50:52 +08:00
Po Lu
320eaa0017 Add more cursor bitmaps on Haiku
* src/haikufns.c (cursor_bitmaps): Register new cursor bitmaps.
* src/haikugui.h (hand_ptr_bits, hand_ptrmask_bits)
(horizd_ptr_bits, horizd_ptrmask_bits, vertd_ptr_bits)
(vertd_ptrmask_bits, hourglass_bits, hourglass_mask_bits): New
cursor bitmaps.
2022-05-14 05:30:16 +00:00
Po Lu
c33b048a86 Work around deleting tooltip frames clearing menubars on NS
* src/frame.c (delete_frame): Update menu bars if a tooltip
frame was deleted on NS.
2022-05-14 12:16:34 +08:00
Po Lu
09e86785ce Implement non-system tooltips on NS
* src/nsfns.m (unwind_create_frame): Return Lisp_Object like on
X.
(do_unwind_create_frame): New function.
(Fx_create_frame): Adjust accordingly.
(compute_tip_xy): Fix coding style.
(unwind_create_tip_frame, ns_create_tip_frame): New functions.
(x_hide_tip, Fx_show_tip, Fx_hide_tip): Create and hide actual
tooltip frames.
(syms_of_nsfns): New defvar `x-max-tooltip-size' and staticpros.

* src/nsterm.m (ns_set_window_size): Clean up coding style.
([EmacsWindow initWithEmacsFrame:]):
([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Handle
tooltip frames.
2022-05-14 11:30:29 +08:00
Po Lu
96f60d1033 Fix display class of tooltip frames on Haiku
* haikufns.c (haiku_create_tip_frame): Set up frame display
class.
(syms_of_haikufns): New symbols `mono', `grayscale' and `color'.
2022-05-14 02:39:18 +00:00
Po Lu
0bedf074a6 Reenable frame sync for child frames after they're unparented
* src/xfns.c (x_set_parent_frame, Fx_create_frame): Use correct
boolean constants.
* src/xterm.c (handle_one_xevent): Enable frame synchronization
upon receiving a sync request event.
2022-05-14 10:12:21 +08:00
Lars Ingebrigtsen
dea41d4c24 Add new minor mode `header-line-indent-mode'
This is mostly factored out from tabulated-list.el (with bugs fixed).

* doc/lispref/modes.texi (Header Lines): Document it.
* lisp/display-line-numbers.el (header-line-indent): New variable.
(header-line-indent--line-number-width)
(header-line-indent--watch-line-number-width)
(header-line-indent--window-scroll-function): New helper functions.
(header-line-indent-mode): New minor mode.

* lisp/display-line-numbers.el (header-line-indent-width): New
variable.

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-line-number-width)
(tabulated-list-watch-line-number-width)
(tabulated-list-window-scroll-function): Make into obsolete aliases.
(tabulated-list-mode): Use 'header-line-indent-mode'.

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-init-header):
Adjust the header line format and computation.

* src/buffer.c (syms_of_buffer): Mention header-line-indent-mode.
2022-05-13 21:24:12 +02:00
Pieter van Prooijen
526e9758de Use gsettings font rendering entries for pgtk builds
If present, apply the gsettings font hinting and antialiasing
entries when creating a font in cairo.  Do this at
initialization and when the entries change, re-rendering the
frames.

* src/ftcrfont.c (ftcrfont_open): Use the font_options derived
from gsettings when opening a font.
(ftcrfont_cached_font_ok): Report a cached font as invalid if
its font options differ from the current options inside
gsettings.
* src/xsettings.c (apply_gsettings_font_hinting)
(apply_gsettings_font_alias, apply_gsettings_font_rgba_order):
Convert the settings from GSettings to the cairo_font_options_t
object.
(init_gsettings, something_changed_gsettingsCB): Invoke the
apply functions if the relevant settings changed.
(store_font_options_changed): Store an event to re-render the
fonts.
(xsetting_get_font_options)
* src/xsettings.h (xsettings_get_font_options): New function.
2022-05-13 20:52:02 +08:00
Po Lu
77aba69768 Rely solely on device scaling for fonts on PGTK
* src/pgtkterm.c (pgtk_get_text_scaling_factor): Delete
function.
(pgtk_term_init): Stop multiplying dpi by text scale.
(bug#55394)
2022-05-13 19:19:52 +08:00
Po Lu
dae431bf0a Fix display of image reliefs for tab bars on NS
* src/nsterm.m (ns_draw_image_relief): New function.
Synchronize code with X.
(ns_dumpglyphs_image): Use that function instead, as on X.
2022-05-13 17:08:09 +08:00
Po Lu
1a6def02cd Minor cleanups to PGTK code
* src/pgtkterm.c (pgtk_text_scaling_factor): Rename to
`pgtk_get_text_scaling_factor', clean up coding style, and fix
leak of GSettings object.
(pgtk_term_init): Clean up coding style and fix scroll
increments.
2022-05-13 16:32:10 +08:00
Po Lu
7dd4e0b72e Improve test for empty help-echo on NS menu bar items
* src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Also check
if idx is valid.
2022-05-13 16:08:54 +08:00
Po Lu
62d2db341c Display help-echo for popup menus on NS
* src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Display
help echo for ordinary popup menus as well.
2022-05-13 16:06:40 +08:00
Po Lu
85ac627ef4 Fix extraneous quit events processing GTK native input inside popups
* src/gtkutil.c (xg_widget_key_press_event_cb): Return
immediately if a popup is active.
* src/xterm.c (x_filter_event): Clear `xg_pending_quit_event' if
a popup is active.
2022-05-13 15:31:50 +08:00
Po Lu
1bf3afba23 Add more cursor bitmaps on Haiku
* src/haikufns.c (cursor_bitmaps, cursor_bitmaps_for_id):
Register crosshair and xterm cursors.

* src/haikugui.h (cross_ptr_bits, cross_ptrmask_bits)
(ibeam_ptr_bits, ibeam_ptrmask_bits): New cursor bitmaps.
2022-05-13 05:36:02 +00:00
Po Lu
62636ea3c1 Fix disabling frame synchronization on child frames
* src/xfns.c (Fx_create_frame): Disable GTK 3's own frame
synchronization on child frames, since the CM doesn't send
synchronization events to them.
2022-05-13 12:21:32 +08:00
Po Lu
53ed3ad594 Allow setting cursor colors for custom cursors on Haiku
* src/haikufns.c: (struct user_cursor_bitmap_info):
(cursor_bitmaps): Fix hotspot for left arrow pointer.
(cursor_bitmaps_for_id): New array.
(haiku_set_mouse_color): If a color was specified, consult
`cursor_bitmaps_for_id' for user-specified cursors.
2022-05-13 04:03:36 +00:00
Po Lu
119f613cf5 Allow actually setting cursor colors on Haiku
* src/haiku_support.cc (be_create_pixmap_cursor): New function.
* src/haiku_support.h: Update prototypes.

* src/haikufns.c (haiku_create_frame): Change default cursor
color to "font-color".
(haiku_create_tip_frame): Likewise.

(struct user_cursor_bitmap_info): New struct.
(cursor_bitmaps): New list of bitmaps corresponding to cursors.
(haiku_create_colored_cursor): New function.
(haiku_free_custom_cursors): Set current cursor to the default
cursor before freeing the original value.
(haiku_set_mouse_color): Actually recolor cursors based on
built-in bitmaps.

* src/haikuterm.c (haiku_defined_color): Clean up coding style.
2022-05-13 03:14:26 +00:00
Po Lu
6d31ac5961 Fix quitting during drag-and-drop when GTK native input is on
* src/xterm.c (x_dnd_begin_drag_and_drop): Also look in
`xg_pending_quit_event' when GTK native input is on.
2022-05-13 09:15:42 +08:00
Paul Eggert
0f731c49e6 Pacify GCC 12 in default developer build
This lets ‘./configure; make’ work on Fedora 36 x86-64 from a Git
checkout without generating false-alarm warnings.
* lib-src/etags.c (main): There appeared to be false alarm with
GCC 12.  However, the code was wrong anyway, as it mishandled file
names containing "'" so fix that bug.  This pacifies GCC.
(mercury_decl): Omit tests ‘s + pos != NULL’ that were apparently
intended to be ‘s[pos] != '\0'’ but which were miscoded to always
be true and which were mostly not needed anyway.  In one place,
though, a test was needed, so fix that by using strchr instead.
* src/alloc.c (lisp_free) [!GC_MALLOC_CHECK]:
* src/term.c (Fsuspend_tty): Don’t look at a pointer after freeing
it, even just to test it for equality with some other pointer, as
this has undefined behavior in C and GCC 12 diagnoses this.
* src/dbusbind.c (xd_read_message_1): Rework the code a bit
so that it has fewer tests.  This pacifies GCC 12 which was
complaining incorrectly about dereferencing a null pointer.
* src/intervals.c (copy_properties): Remove an eassume that should
no longer be needed even to pacify older GCCs, due to ...
* src/intervals.h (split_interval_left): ... this addition of
ATTRIBUTE_RETURNS_NONNULL to pacify a GCC 12 warning about
dereferencing a null pointer.
* src/regex-emacs.c (EXTEND_BUFFER): Use negative values rather
than auxiliary booleans to indicate null pointers.  This pacifies
GCC 12 false alarms about using uninitialized variables.
* src/xdisp.c (clear_position): New function.
(append_space_for_newline, extend_face_to_end_of_line):
Use it to work around false alarms from GCC 12.
(display_and_set_cursor): Add an UNINIT to pacify GCC 12.
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
Defend against hypothetical bad code elsewhere;
this also pacifies GCC 12.
(x_term_init): Use fixed-size auto array rather than alloca,
as the array is small; this also pacifies GCC 12.
2022-05-12 17:03:55 -07:00
Po Lu
c8d7a27438 Remove unused RIF method
* src/haikuterm.c (haiku_update_window_end): Delete function.
(haiku_redisplay_interface): Remove RIF method.
2022-05-12 13:08:44 +00:00
Po Lu
b6aff96a74 Fix build on Mac OS X 10.11
* src/nsterm.h (NSButtonTypeMomentaryPushIn): New define.
2022-05-12 17:23:45 +08:00
Po Lu
89c6e412dd Fix searching the bitmap file path on Haiku
* src/image.c (image_create_bitmap_from_file): [HAVE_HAIKU]:
Look for the bitmap inside `x-bitmap-file-path' as well.
2022-05-12 07:42:33 +00:00
Stefan Kangas
0e5623b491 ; * src/bytecode.c (exec_byte_code): Fix white space. 2022-05-12 09:32:10 +02:00