1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-10 09:43:26 -08:00
Commit graph

46620 commits

Author SHA1 Message Date
Po Lu
3eb47077d3 Clarify doc of `x-display-set-last-user-time'
* src/xfns.c (Fx_display_last_user_time): Explain in more detail
the meaning of TERMINAL.
2022-06-17 19:04:19 +08:00
Mattias Engdegård
39826148d6 * src/fns.c (Fmapconcat): Better empty-string-or-nil detection. 2022-06-17 11:41:34 +02:00
Po Lu
10d23f4ed4 Fix computation of screen width and height on Haiku
* src/haiku_support.cc (be_get_screen_dimensions): Use correct
macros to extract width and height.
2022-06-17 06:58:20 +00:00
Po Lu
cce197c630 Fix instances of not using a usable Motif drag atom
* src/xterm.c (xm_get_drag_atom_1): If another frame owns an
atom, use it anyway.
2022-06-17 12:58:41 +08:00
Po Lu
a8cf6567dd Improve window manager user time reporting mode switching
* src/xterm.c (x_display_set_last_user_time): Stop periodically
checking for user time window support.
(x_update_frame_user_time_window): New function.
(handle_one_xevent): Call it on toplevel ReparentNotify if the
frame has been visible at least once.

* src/xterm.h (struct x_display_info): Remove
`last_user_check_time'.
2022-06-17 10:57:42 +08:00
Po Lu
61a312ba0c Update last event time during DND operations
* lisp/x-dnd.el (x-dnd-handle-xdnd, x-dnd-handle-motif): Set
last user time to provided timestamp.
* src/xfns.c (Fx_display_last_user_time): New function.
(syms_of_xfns): New defsubr.

* src/xterm.c (x_set_last_user_time_from_lisp): New function.
* src/xterm.h: Update prototypes.
2022-06-17 10:24:11 +08:00
Stefan Monnier
e75ce9ca38 * src/fns.c (Fmapconcat): Optimize the case where separator=="" 2022-06-16 16:30:44 -04:00
Eli Zaretskii
5eb9383ccc Fix disruption of windows' display by shr.el
* src/window.c (struct saved_window): New member 'vscroll'.
(Fset_window_configuration, save_window_save): Save and restore
the window's vscroll value.

* lisp/net/shr.el (shr-insert-document): Restore the original
window's hscroll, in case we are rendering in a window other than
where the document will be eventually displayed.  This avoids
resetting hscroll of windows we use temporarily for shr's
rendering job.  (Bug#56008)
2022-06-16 19:53:45 +03:00
Mattias Engdegård
a0f7d81a8d * src/fns.c (mapcar1): Test types in rough order of likelyhood. 2022-06-16 16:04:48 +02:00
Mattias Engdegård
946d70a891 Use BASE_EQ instead of EQ where obviously safe
* src/alloc.c (deadp):
* src/buffer.c (reset_buffer_local_variables, candidate_buffer)
(Fkill_buffer, Fbuffer_swap_text, Fmake_overlay, Fmove_overlay):
* src/callint.c (Fcall_interactively):
* src/coding.c (decode_coding_object, encode_coding_object)
(code_convert_region, Ffind_operation_coding_system):
* src/comp.c (Fcomp_el_to_eln_rel_filename):
* src/conf_post.h (RE_TRANSLATE_P):
* src/data.c (Fkill_local_variable, Fash, expt_integer):
* src/dired.c (file_name_completion):
* src/dispnew.c (set_window_cursor_after_update, update_frame_1)
(Fframe_or_buffer_changed_p):
* src/doc.c (Fdocumentation, Fdocumentation_property)
(default_to_grave_quoting_style):
* src/editfns.c (Fconstrain_to_field, save_excursion_save)
(save_excursion_restore, Fngettext):
* src/eval.c (Fautoload, un_autoload, specbind):
* src/fileio.c (Fmake_temp_file_internal):
* src/fns.c (string_char_to_byte, string_byte_to_char)
(Fnthcdr, Fnreverse):
* src/indent.c (vmotion):
* src/inotify.c (add_watch):
* src/keyboard.c (command_loop_1, read_char)
(read_char_minibuf_menu_prompt):
* src/lread.c (oblookup):
* src/macfont.m (macfont_descriptor_entity, macfont_open):
* src/minibuf.c (Finnermost_minibuffer_p, Ftry_completion)
(Ftest_completion):
* src/nsfns.m (ns_set_icon_name):
* src/pdumper.c (dump_queue_dequeue):
* src/pgtkfns.c (pgtk_set_icon_type, pgtk_set_icon_name):
* src/process.c (Faccept_process_output):
* src/textprop.c (set_text_properties):
* src/w32fns.c (w32_set_icon_type, w32_set_icon_name):
* src/w32select.c (validate_coding_system):
* src/window.c (decode_next_window_args, window_loop)
(save_window_save):
* src/xdisp.c (wset_redisplay):
* src/xfaces.c (Fx_family_fonts, resolve_face_name)
(gui_supports_face_attributes_p):
* src/xfns.c (x_set_icon_type, x_set_icon_name):
* src/xselect.c (clean_local_selection_data):
Use BASE_EQ instead of EQ where it is obvious that neither argument
can be a symbol with properties or at least one argument is a
non-symbol.
2022-06-16 14:49:58 +02:00
Po Lu
b2b939e5a1 Fix byte-swapping of Motif DND tables
* src/xterm.c (xm_read_targets_table_rec): Swap nitems first
before checking the length.
2022-06-16 15:30:21 +08:00
Po Lu
55e9d729ca Fix Motif DND after atom ownership is lost due to frame destruction
* src/xterm.c (xm_get_drag_atom_1): Record owner.
(x_free_frame_resources): Clear drag atom if owner was freed.
* src/xterm.h (struct x_display_info): New field
`motif_drag_atom_owner'.
2022-06-16 14:00:27 +08:00
Stefan Kangas
054832c9e1 Merge from origin/emacs-28
4d7a936ac2 ; * src/fileio.c (Fset_file_modes): Improve previous change
32cff740e2 Describe 'set-file-modes' argument prompting
2022-06-16 06:52:01 +02:00
Po Lu
6dd4c5b953 Improve drag atom computation
* src/xterm.c (xm_get_drag_window): Avoid leak if error occured
creating drag window.  Also use StructureNotifyMask instead of
ButtonPressMask.
(xm_get_drag_atom_1): Update.  Make EMACS_DRAG_ATOM a list of
atoms and use the first one that isn't currently owned.
(xm_get_drag_atom): Stop owning selection here.
(xm_setup_drag_info): Record chosen atom.
(x_dnd_cleanup_drag_and_drop, x_dnd_begin_drag_and_drop)
(x_dnd_update_state, handle_one_xevent, x_connection_closed):
Use chosen atom.
* src/xterm.h (struct x_display_info): New field
`motif_drag_atom_time'.
2022-06-16 12:49:52 +08:00
Paul Eggert
343482d641 Streamline time decoding and conversion
* src/lisp.h (lisp_h_BASE2_EQ, BASE2_EQ): New macros and functions.
* src/timefns.c (tzlookup, Fdecode_time): Use them.
(Ftime_convert): Convert to symbol once, instead of many times.
2022-06-15 23:27:08 -05:00
Paul Eggert
9bce1f3d70 Prefer BASE_EQ in time-sensitive ops
* src/timefns.c (tzlookup, lisp_time_hz_ticks)
(decode_time_components, lisp_to_timespec, lispint_arith)
(time_arith, time_cmp, Fdecode_time, Fencode_time)
(Ftime_convert): Prefer BASE_EQ to EQ where either will do.
2022-06-15 23:27:07 -05:00
Po Lu
9accc800a7 Comply with the Motif requirement for unique drag atoms
* src/xselect.c (x_handle_selection_request)
(Fx_get_selection_internal, syms_of_xselect): New variable
`x-selection-alias-alist'.  Respect that alist of aliases.

* src/xterm.c (x_atom_refs): Intern _EMACS_DRAG_ATOM.
(xm_get_drag_atom_1, xm_get_drag_atom): New functions.
(xm_setup_drag_info, x_dnd_cleanup_drag_and_drop)
(x_dnd_begin_drag_and_drop, x_dnd_update_state, handle_one_xevent)
(x_connection_closed, x_intern_cached_atom): Alias the drag atom
to XdndSelection.  Use it instead of XdndSelection to set the
Motif index atom.
(x_get_atom_name): Handle new atoms.
(syms_of_xterm): New defsym.
* src/xterm.h (struct x_display_info): New fields for new atoms
and their names.
2022-06-16 10:08:12 +08:00
Robert Pluim
4d7a936ac2 ; * src/fileio.c (Fset_file_modes): Improve previous change 2022-06-15 15:16:47 +02:00
Po Lu
9b053968ef Implement using the OffiX protocol for dropping
* lisp/x-dnd.el (x-dnd-use-offix-drop): New user option.
(x-dnd-handle-unsupported-drop): Return t if the OffiX protocol
was used.
(x-treat-local-requests-remotely): New defvar.
(x-dnd-convert-to-offix, x-dnd-do-offix-drop): New functions.

* src/xterm.c: Update commentary.
(x_term_init): Extend number of DND atoms allocated by default.
2022-06-15 21:03:31 +08:00
Robert Pluim
32cff740e2 Describe 'set-file-modes' argument prompting
* src/fileio.c (Fset_file_modes): Document that FILENAME is prompted
for.  (Bug#55984)
2022-06-15 14:27:28 +02:00
Po Lu
36f96c351a Handle coordinates for the old KDE drop protocol
* src/xterm.c (x_atom_refs): Add DndProtocol and _DND_PROTOCOL.
(x_coords_from_dnd_message): Handle the old KDE protocol.
* src/xterm.h (struct x_display_info): New atoms.
2022-06-15 14:47:11 +08:00
Po Lu
1302c329eb Fix link action handling with Motif DND
* src/xterm.c (enum xm_drag_operation): New alternate
definition.
(XM_DRAG_OPERATION_IS_LINK): New macro.
(handle_one_xevent): Use it instead.
2022-06-15 11:37:39 +08:00
Po Lu
2e2913654b Handle coordinates from XM_DRAG_REASON_DRAG_MOTION replies
* src/xterm.c (struct xm_drag_motion_reply): New struct.
(xm_read_drag_motion_reply): New function.
(x_coords_from_dnd_message): Handle those messages as well.
2022-06-15 09:26:46 +08:00
Po Lu
8fa1cdc1fa ; Improve doc of `x-dnd-native-test-function'
* src/xterm.c (syms_of_xterm): Improve doc.  Suggested by Eli
Zaretskii <eliz@gnu.org>.
2022-06-14 19:50:31 +08:00
Po Lu
82ce218394 Handle coordinates of Motif drop start messages
* src/xterm.c (xm_read_drop_start_message): New function.
(xm_read_drag_motion_message): Check that the originator is
correct.
(x_coords_from_dnd_message): Read drop start messages as well.
2022-06-14 13:52:45 +08:00
Po Lu
f5fb969cab Handle coordinate extraction for more event types
* src/xterm.c (xm_read_drag_motion_message): New function.
(x_coords_from_dnd_message): Handle XM_DRAG_REASON_DRAG_MOTION.
2022-06-14 10:12:48 +08:00
Po Lu
907f3a4f8d Use coordinates provided by DND messages if available
This avoids an extra sync, which matters when dropping onto
Emacs running over a slow connection.

* src/xselect.c (x_handle_dnd_message): New args
`root_window_coords', `root_x' and `root_y'.
* src/xterm.c (x_coords_from_dnd_message): New function.
(handle_one_xevent): Pass root window coordinates to
x_handle_dnd_message.
* src/xterm.h: Update prototypes.
2022-06-14 09:41:59 +08:00
Paul Eggert
24b2cc177a Pacify GCC 12.1.1 -Wanalyzer-use-of-uninitialized-value
* src/xfont.c (xfont_list_pattern): Initialize a local.
Although I’m not sure this is needed, it doesn’t change
behavior (except possibly to make undefined behavior defined).
2022-06-13 13:39:48 -07:00
Paul Eggert
de6601e62e Pacify GCC 12.1.1 in default developer build
* src/pdumper.c (pdumper_load): Use explicit memset to work around
GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105961>.
2022-06-13 13:39:48 -07:00
Po Lu
a1a435b3f6 Respect test function when performing local drag-and-drop
* lisp/x-dnd.el (x-dnd-test-function): Fix doc string to
describe what is actually accepted.
(x-dnd-known-types, x-dnd-targets-list): Fix coding style.
(x-dnd-handle-native-drop): New function.

* src/xselect.c (x_atom_to_symbol): Export.

* src/xterm.c (x_dnd_note_self_drop): Call new variable to
determine what action to return.
(x_clear_dnd_action): New function.
(x_dnd_begin_drag_and_drop): Respect new variable.
(syms_of_xterm): New defvar `x-dnd-native-test-function'.
* src/xterm.h: Update prototypes.
2022-06-13 15:02:41 +08:00
Po Lu
16df1f4fae Improve DND tooltip updating
* src/xterm.c (x_dnd_update_tooltip_now): Add missing part of
last change.
(x_monitors_changed_cb, handle_one_xevent): Only update if a
change in monitor configuration really happened.
2022-06-13 12:49:12 +08:00
Po Lu
1ce0d8d9ef Keep tooltip position in sync with monitor changes
* src/xterm.c (x_dnd_update_tooltip_now): New function.
(x_monitors_changed_cb):
(handle_one_xevent): Call that function on monitor change.
2022-06-13 09:42:12 +08:00
Po Lu
79f50e913d Fix special DND event coordinates
* src/xterm.c (x_dnd_note_self_drop): Set DND action to
XdndActionPrivate.
(x_dnd_begin_drag_and_drop): Don't return XdndPrivate specially
here.
(handle_one_xevent): Fix order of arguments to
x_dnd_note_self_drop.
2022-06-13 09:11:08 +08:00
Po Lu
6263f586b8 Fix handling of scroll bar clicks on Haiku
* src/haiku_support.cc (class EmacsView, BasicMouseDown)
(BasicMouseUp): Move MouseDown and MouseUp here.  New parameter
`scroll_bar'.
(MouseDown, MouseUp): Call basic variants.

(class EmacsScrollBar): New field `parent'.
(BScrollBar_make_for_view): Rename to
`be_create_scroll_bar_for_view'.
* src/haiku_support.h (struct haiku_button_event): New field
`scroll_bar'.
* src/haikuterm.c (haiku_scroll_bar_from_widget): Handle NULL
widget.
(haiku_scroll_bar_create): Update calls.
(haiku_mouse_position): Fix scroll bar part.
(haiku_read_socket): Handle button events on scroll bars as
scroll bar click events.
2022-06-12 13:04:37 +00:00
Mattias Engdegård
bab1d41280 Use BASE_EQ when comparing with Qunbound
Qunbound is uninterned and can therefore never be EQ to any symbol
with position.

* src/buffer.c (Fbuffer_local_value, buffer_lisp_local_variables)
(buffer_local_variables_1):
* src/bytecode.c (exec_byte_code):
* src/comp.c (compile_function, Fcomp__compile_ctxt_to_file):
* src/composite.c (composition_gstring_cache_clear_font):
* src/data.c (Fboundp, Fsymbol_value, set_internal)
(Fdefault_boundp, Fdefault_value, Fmake_variable_buffer_local):
* src/emacs-module.c (module_global_reference_p):
* src/eval.c (Fdefault_toplevel_value, defvar)
(run_hook_with_args):
* src/fns.c (hash_put, Fmaphash):
* src/font.c (font_put_extra):
* src/frame.c (gui_set_frame_parameters)
(gui_frame_get_and_record_arg, gui_default_parameter)
(gui_figure_window_size):
* src/haikufns.c (get_geometry_from_preferences)
(haiku_create_frame, haiku_create_tip_frame):
* src/haikuterm.c (haiku_draw_text_decoration)
(haiku_default_font_parameter):
* src/json.c (lisp_to_json_nonscalar_1):
* src/keymap.c (access_keymap_1, access_keymap, current_minor_maps):
* src/lread.c (readevalloop, define_symbol):
* src/minibuf.c (read_minibuf, Ftry_completion):
(Fall_completions, Ftest_completion):
* src/pgtkfns.c (pgtk_default_font_parameter, Fx_create_frame)
(x_create_tip_frame):
* src/pgtkselect.c (Fpgtk_own_selection_internal):
* src/print.c (print):
* src/profiler.c (evict_lower_half, record_backtrace):
* src/terminal.c (create_terminal):
* src/textprop.c (set_properties):
* src/w32fns.c (my_create_window, w32_icon)
(w32_default_font_parameter, Fx_create_frame)
(w32_create_tip_frame):
* src/w32term.c (w32_draw_glyph_string):
* src/xdisp.c (handle_single_display_spec)
(cursor_row_fully_visible_p, calc_pixel_width_or_height):
* src/xfns.c (x_default_scroll_bar_color_parameter, x_icon_verify)
(x_icon, x_default_font_parameter, Fx_create_frame)
(x_create_tip_frame):
* src/xselect.c (x_handle_selection_request):
* src/xterm.c (x_draw_glyph_string, x_term_init):
Use BASE_EQ instead of EQ when comparing with Qunbound.
2022-06-12 12:42:35 +02:00
Po Lu
5bf409329b Fix phantom drag-and-drop targets showing up in some programs
* src/xterm.c (x_dnd_cleanup_drag_and_drop)
(x_dnd_begin_drag_and_drop): Delete XdndTypeList if it was set
after the DND operation completes.  Some programs apparently
think its presence on the drag source means there are more than
3 targets.
2022-06-12 16:42:10 +08:00
Po Lu
c2695621fc Don't repetitively initialize type lists during DND
* src/xterm.c (x_dnd_send_enter): Only set XdndTypeList once.
(x_dnd_begin_drag_and_drop): Clear type list flag.
2022-06-12 13:45:31 +08:00
Po Lu
6aa8baaea1 Use cached monitor info during DND if available
* src/xterm.c (x_dnd_begin_drag_and_drop): Use previously cached
monitor attributes if they exist.
2022-06-12 10:17:19 +08:00
Po Lu
574c5d1de4 * src/nsfns.m (ns_move_tooltip_to_mouse_location): Handle invisible frames. 2022-06-12 10:13:04 +08:00
Po Lu
0adbb21ece Don't rely on XdndAware on frames for dropping to work
* src/xterm.c (x_dnd_get_target_window): New parameter
WAS_FRAME.  If toplevel is a frame, set it and clear proto and
motif.
(x_dnd_send_enter, x_dnd_send_position, x_dnd_send_leave)
(x_dnd_send_drop): Remove special-cased self dropping code.
(x_dnd_note_self_position, x_dnd_note_self_drop): New functions.

(x_dnd_begin_drag_and_drop, x_dnd_update_state):
(handle_one_xevent): Handle our own frames using those functions
instead.
2022-06-12 09:32:33 +08:00
Mattias Engdegård
98365c7b1e * src/fns.c (internal_equal): Use BASE_EQ where possible. 2022-06-11 18:45:49 +02:00
Po Lu
eeec16819b Fix timestamp of special drop events
* src/xterm.c (x_dnd_send_drop): Set special event timestamp
to the timestamp of the drop instead of CurrentTime.
2022-06-11 21:16:51 +08:00
Eli Zaretskii
9ea98a68f4 ; * src/fileio.c (Finsert_file_contents): Fix a typo. (Bug#18370) 2022-06-11 16:12:10 +03:00
Lars Ingebrigtsen
cb4579ed6b Allow inserting parts of /dev/urandom with insert-file-contents
* doc/lispref/files.texi (Reading from Files): Document it.
* src/fileio.c (Finsert_file_contents): Allow specifying END for
special files (bug#18370).
2022-06-11 14:39:54 +02:00
Po Lu
3675809696 Fix some drag-and-drop handling on Haiku
* lisp/term/haiku-win.el (haiku-drag-and-drop): Don't raise
frame for some types of drags.

* src/haikuselect.c (haiku_unwind_drag_message): Don't hide
tooltip here.
(Fhaiku_drag_message): Only clear grab and hide tooltip if the
drag was successful.
2022-06-11 12:01:22 +00:00
Po Lu
ab63000b6a Fix initializers for Haiku scroll bars
* src/haiku_support.cc (class Emacs):
(class EmacsScrollBar): Fix initializers.
2022-06-11 12:01:21 +00:00
Po Lu
46b9bfb9fc Fix queuing already-present selection requests
* src/xterm.c (x_defer_selection_requests): Move kbd_fetch_ptr
if possible and fix counter increment order.
2022-06-11 14:15:44 +08:00
Po Lu
9c27c7f7ce Handle allocation errors when interning large amounts of atoms
* src/xfns.c (Fx_begin_drag): Catch BadAlloc errors around
XInternAtoms.
2022-06-11 11:13:48 +08:00
Po Lu
46e6b8a1e4 Prevent crash handling keyboard input from non-frame windows
* src/xterm.c (handle_one_xevent): Use `dpyinfo' to access xkb
desc.  (bug#55890)
2022-06-11 09:19:05 +08:00
Po Lu
7def8baa08 Fix cancelling DND upon a regular X error
* src/xterm.c (x_connection_closed): The display isn't dead upon
a non-IO error, so don't avoid sending messages to clean stuff
up.
2022-06-11 09:12:44 +08:00