1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-05 05:41:40 -07:00
Commit graph

47962 commits

Author SHA1 Message Date
Po Lu
bcbd06b4bb Make drag-and-drop wheel movement work locally too on X
This is provided by the XDND protocol, so it isn't fair for it
to not work with local drag-and-drop.

* lisp/x-dnd.el (x-dnd-note-wheel-movement): New function.  Set
it as the `x-dnd-wheel-function'.
* src/xterm.c (x_dnd_cleanup_drag_and_drop): Clear new flags.
(x_dnd_note_self_wheel): New function.  Set some flags.
(x_dnd_process_quit, x_dnd_begin_drag_and_drop, handle_one_xevent)
(x_connection_closed, x_delete_terminal, mark_xterm): Handle and
set new wheel movement flags
(syms_of_xterm): New variable `x-dnd-wheel-function'.
2022-07-19 09:33:09 +08:00
Eli Zaretskii
7dcea5a428 * src/xdisp.c (set_vertical_scroll_bar): Remove stale comment. 2022-07-18 22:51:25 +02:00
Eli Zaretskii
0699f80f85 Fix calculation of the vertical scroll bar's thumb
* src/xdisp.c (set_vertical_scroll_bar): Compute window's end
position "by hand" if w->window_end_pos cannot be relied upon.
2022-07-18 22:49:20 +02:00
Gregory Heytings
1ff69cc744 Improve the heuristic for long lines detection.
* src/buffer.h (struct buffer_text): New 'unchanged_size' field.
(BUF_UNCHANGED_SIZE): New macro to access the field.

* src/buffer.c (Fget_buffer_create): Initialize the field.
(Fbuffer_swap_text): Handle it.

* src/xdisp.c (mark_window_display_accurate_1): Set the field.
(redisplay_window): Use the field for long lines detection.
2022-07-18 17:54:55 +02:00
Gregory Heytings
6a097a8621 Shorter and safer fix for the segfault.
* src/xdisp.c (get_visually_first_element): Shorter and safer fix for
the segfault.  Improves the fix introduced in cc7f37b2a4.
2022-07-18 16:07:07 +02:00
Eli Zaretskii
8f9993bb3f ; * src/buffer.c (syms_of_buffer) <mode-line-format>: Doc fix. 2022-07-18 15:31:26 +03:00
Mattias Engdegård
9de0b06e74 Clarify take and ntake documentation (bug#56521)
* doc/lispref/lists.texi (List Elements): Describe `ntake` better.
* src/fns.c (Ftake, Fntake): Rephrase doc strings.
2022-07-18 12:49:29 +02:00
Gregory Heytings
cc7f37b2a4 Further improvements to long lines handling.
* src/xdisp.c (get_visually_first_element): Fix segfault.
(get_narrowed_begv): Specific improvement for character-only terminals.
2022-07-18 12:11:08 +02:00
Po Lu
7b259b2eb1 Implement last change on Haiku as well
* lisp/term/haiku-win.el (haiku-dnd-drag-handler): Stop
redisplaying here.
* src/haikuselect.c (haiku_note_drag_motion): Use
redisplay_preserve_echo_area.
2022-07-18 04:49:46 +00:00
Po Lu
5480d02cc5 Preserve echo area message when running DND mouse movement function
* lisp/term/x-win.el (x-dnd-movement): Stop redisplaying here.
* src/xterm.c (x_dnd_begin_drag_and_drop): Redisplay with the
echo area preserved.
2022-07-18 12:42:55 +08:00
Po Lu
356618ca6a Handle virtual modifiers in the DND scrolling code
* lisp/x-dnd.el (x-dnd-modifier-mask): Handle virtual modifiers.
* src/xfns.c (Fx_get_modifier_masks): New function.
(syms_of_xfns): Define new subr.
* src/xterm.c (x_get_keyboard_modifiers): New function.
* src/xterm.h: Update prototypes.
2022-07-18 09:20:05 +08:00
Mattias Engdegård
d62766305a Add take and ntake (bug#56521)
These are useful list primitives, complementary to `nthcdr`.

* src/fns.c (Ftake, Fntake): New.
(syms_of_fns): Defsubr them.
* doc/lispref/lists.texi (List Elements):
* lisp/emacs-lisp/shortdoc.el (list): Document.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Declare `take` pure and side-effect-free.
* test/src/fns-tests.el (fns-tests--take-ref, fns--take-ntake):
New test.
* etc/NEWS: Announce.
2022-07-17 17:35:49 +02:00
Eli Zaretskii
637436970f Fix leaking of file descriptors due to pipe processes on MS-Windows
* src/w32proc.c (reader_thread): Wait for 'sys_close' to finish
processing the pipe read descriptor, before trying to close it.

* src/w32.c (sys_close): Attempt to detect when the reader thread
already exited, so that it would be possible to close descriptors
open by pipe processes for reading from the pipe.  (Bug#56606)
2022-07-17 15:44:50 +03:00
Eli Zaretskii
0c9ca96c06 ; * src/xdisp.c (redisplay_tool_bar): Fix a possible typo. 2022-07-17 13:12:03 +03:00
Eli Zaretskii
5db4ec20fe Fix tab-bar resizing under 'auto-resize-tab-bars' = 'grow-only'
* src/xdisp.c (redisplay_tab_bar): Compute the desired height of
the tab-bar before iterating over the tab-bar string, to detect
the required resizing earlier.  Default 'change_p' to 'false'.

* lisp/tab-bar.el (tab-bar--update-tab-bar-lines): Support
'auto-resize-tab-bars' set to 'grow-only'.
2022-07-17 12:33:34 +03:00
Po Lu
e2ccd358c9 Handle scrolling during XDND drag-and-drop
* lisp/x-dnd.el (x-dnd-get-object-rectangle): Handle cases where
`posn-x-y' is nil.
(x-dnd-modifier-mask, x-dnd-hscroll-flags, x-dnd-note-click):
New functions.
(x-dnd-click-count): New defvar.
(x-dnd-handle-xdnd): Handle button press events.

* src/xterm.c (x_dnd_send_position): Fix handling of mouse
rects.
2022-07-17 11:06:14 +08:00
Po Lu
211ca9f916 Fix drag-and-drop button button flags
* src/xterm.c (x_dnd_send_position): Always send buttons
regardless of version.  Fix bit indices.
(handle_one_xevent): Likewise.
2022-07-17 09:13:28 +08:00
Gregory Heytings
66704fbbcf Fix typo in e7b5912b23. 2022-07-17 01:36:10 +02:00
Gregory Heytings
e7b5912b23 Improvements to long lines handling.
* src/buffer.h (struct buffer): New field 'long_line_optimizations_p'.

* src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'.
(reset_buffer): Initialize the 'long_line_optimizations_p' field.
(Fbuffer_swap_text): Handle it.

* src/xdisp.c (redisplay_window): Set 'long_line_optimizations_p' when
a buffer contains long lines.
(init_iterator): Use 'long_line_optimizations_p'.
(get_narrowed_begv): Update.
(SET_WITH_NARROWED_BEGV): New macro.
(unwind_narrowed_begv): New internal function used by the new macro.
(back_to_previous_line_start, get_visually_first_element,
move_it_vertically_backward): Use the new macro.

* src/search.c (find_newline1): Make it externally visible.

* src/lisp.h: Make 'find_newline1' externally visible.

* src/dispextern.h (struct it): Update comment.  Remove the
'WITH_NARROWED_BEGV' macro.

* etc/NEWS: Mention the 'long-line-threshold' variable.
2022-07-16 21:13:33 +02:00
Eli Zaretskii
9a5b52dace * src/composite.c (find_automatic_composition): Fix off-by-one error. 2022-07-16 16:29:24 +03:00
Eli Zaretskii
058cc53ea7 ; * src/xdisp.c (try_window): Expand the commentary. (Bug#56561) 2022-07-16 11:21:05 +03:00
Po Lu
00501e82c7 Handle XDND mouse rects synchronously
* src/xterm.c (x_dnd_send_position): Record event X and Y for
consumption by the XdndStatus handler.  Ignore mouse rects if
waiting for status.
(x_dnd_send_leave): Clear pending DND event.
(handle_one_xevent): When handling XdndStatus, check if the
pending event is contained in the new mouse rect.
2022-07-16 11:53:42 +08:00
Andreas Schwab
889943e2bd Fix ASAN error with fringe bitmap on NS
* src/nsterm.m (ns_define_fringe_bitmap): Correctly access fringe
bitmap data.  (Bug#56553)
2022-07-15 17:26:39 +02:00
Po Lu
bd35ced042 ; * src/nsterm.m (ns_draw_window_cursor): Fix last change. 2022-07-15 22:04:52 +08:00
Po Lu
c829e63b0a Fix double unfocus during NS cursor display
* src/nsterm.m (ns_draw_window_cursor): Unfocus around calls to
draw_phys_cursor_glyph, then focus again later.  (bug#56559)
2022-07-15 22:00:57 +08:00
Po Lu
c96a6a0c9f Only preserve PRIMARY and CLIPBOARD selection ownership by default
* lisp/cus-start.el (standard): Update defcustom type.
* src/xselect.c (x_should_preserve_selection): New function.
(x_clear_frame_selections): Use it to determine whether or not
to preserve a selection.
* src/xterm.c (x_preserve_selections): Fix tail initialization.
(syms_of_xterm): Update doc string of
`x-auto-preserve-selections'.
2022-07-15 21:47:09 +08:00
Eli Zaretskii
ed4ba79ea8 Avoid infloop in redisplay when displaying a tooltip
* src/xdisp.c (try_window): Ensure we fail if 'display_line'
indicates that the dimensions of the glyph matrix are
insufficient.  (Bug#56561)
2022-07-15 13:49:56 +03:00
Po Lu
200938b95d Fix generated drag-and-drop mouse rectangles
* lisp/x-dnd.el (x-dnd-get-drop-width-height): Handle window
width and height correctly.  Remove unused parameter.
(x-dnd-after-move-frame): New function.
(move-frame-functions): Add new hook.
(x-dnd-compute-root-window-position): New function.
(x-dnd-get-drop-x-y): Use that instead of `left' and `top'
parameters, which include the title bar.
(x-dnd-handle-xdnd): Update accordingly.
* src/xfns.c (Fx_translate_coordinates): New function.
(syms_of_xfns): New defsym.
2022-07-15 16:19:52 +08:00
Po Lu
2e0c76e397 Fix sending button presses if the drop target specified a mouse rectangle
* src/xterm.c (x_dnd_send_position): Handle button presses
specially, ignoring mouse rectangles.
2022-07-15 10:30:18 +08:00
Lars Ingebrigtsen
90f8c8400f Fix --without-x build after previous image cache changes
* src/alloc.c (garbage_collect): Fix --without-all --without-x build.
2022-07-14 20:07:37 +02:00
Lars Ingebrigtsen
564f6c171e Prune animation cache when images are no longer reachable
* lisp/image.el (image-animate-timeout): Eject cached animated
images that are no longer reachable (bug#56546).

* src/image.c (Fclear_image_cache): Allow specifying a cached
animated image to eject.
(gif_load, webp_load): Adjust what to use as the caching key --
the identity of the list itself is apparently changed by some
callers.
2022-07-14 18:59:09 +02:00
Lars Ingebrigtsen
4c542747bd Make image-cache-size also include the animation cache
* src/image.c (struct anim_cache, anim_create_cache): Store approx
cache size.
(gif_load, webp_load): Ditto.
(Fimage_cache_size): Also report animation cache size (bug#56546).
2022-07-14 18:59:09 +02:00
Lars Ingebrigtsen
95966b28fb Prune the animation cache from gc
* src/alloc.c (garbage_collect): Prune animation cache
(bug#56546).
2022-07-14 18:59:09 +02:00
Eli Zaretskii
f2e131f1ae * src/gtkutil.c (xg_free_frame_widgets): Avoid compiler warning. 2022-07-14 19:00:12 +03:00
Eli Zaretskii
8c6402844e ; * src/xterm.c (x_scroll_bar_expose, mark_xterm): Fix last change. 2022-07-14 18:56:46 +03:00
Stefan Kangas
fdf110b884 Silence unused variable warning in a build --without-all
* src/xfns.c (Fx_double_buffered_p): Silence unused variable warning
in a build --without-all.
2022-07-14 16:34:26 +02:00
Eli Zaretskii
c02986e4c3 ; Fix compilation warnings in a build --without-all
* src/xterm.c (x_scroll_bar_expose, handle_one_xevent)
(mark_xterm): Avoid compiler warnings.  (Bug#56551)
2022-07-14 16:37:44 +03:00
Stefan Kangas
35238c4fc0 Pacify -Wunused-macros in --without-all builds
* src/image.c (IMAGE_TYPE_INIT): Make conditional on image support.
2022-07-14 14:02:27 +02:00
Stefan Kangas
41e612cfd6 ; Fix typos 2022-07-14 12:52:32 +02:00
Po Lu
ade1238bce Try to restore the initial "daemon" frame when a display goes down
* src/xterm.c (x_try_restore_frame): New function.
(x_connection_closed): Call it if selected_frame is nil.
2022-07-14 18:49:19 +08:00
Stefan Kangas
2a05479c22 ; Fix typos: prefer American spelling 2022-07-14 12:13:31 +02:00
Lars Ingebrigtsen
4738aa1e12 Make clear-image-cache clear the animation cache
* src/dispextern.h: Declare image_prune_animation_caches for use
in gc.

* src/image.c (Fclear_image_cache): Clear animation cache.
(anim_prune_animation_cache, anim_get_animation_cache): Allow
clearing in addition to pruning.
(imagemagick_prune_animation_cache)
(imagemagick_get_animation_cache): Ditto.
(image_prune_animation_caches): New function (bug#56546).
2022-07-14 11:49:47 +02:00
Stefan Kangas
4e79f77635 Merge from origin/emacs-28
5e47ec9511 ; * lisp/url/url-http.el (url-http-parse-headers): Fix typo.
ba0871bef1 ; Fix typos: prefer American spelling
e3e7f31faa Adapt Tramp doc

# Conflicts:
#	etc/NEWS
#	etc/themes/modus-themes.el
#	lisp/emacs-lisp/byte-opt.el
#	test/lisp/so-long-tests/spelling-tests.el
2022-07-14 11:37:42 +02:00
Po Lu
d37ba6f259 Fix killing Emacs upon display disconnect
* src/xterm.c (x_connection_closed): On Xt builds terminals can
be left alive without any frames on them, so take that into
account.  (bug#56528)
2022-07-14 11:47:00 +08:00
Po Lu
9a888323c6 ; * src/xterm.c (x_error_handler): Fix magic numbers. 2022-07-14 09:11:37 +08:00
Po Lu
9f6d8486b4 Fix recursive calls of x_connection_closed leading to dead terminal
* src/xterm.c (x_connection_closed): Return if called again for
the current display.
(x_io_error_quitter): Fix attributes.  (bug#56528)
2022-07-13 20:16:45 +08:00
Stefan Kangas
ba0871bef1 ; Fix typos: prefer American spelling 2022-07-13 13:04:22 +02:00
Po Lu
defe6cf2d9 Implement TIMESTAMP target for Haiku selections
* lisp/term/haiku-win.el (haiku-selection-targets): Fix return
values.
(gui-backend-get-selection): Handle TIMESTAMP specially.
* src/haiku_select.cc (be_get_clipboard_count): New function.
* src/haikuselect.c (Fhaiku_selection_timestamp): New function.
(syms_of_haikuselect): Add new defsubr.
* src/haikuselect.h: Update prototypes.
2022-07-13 05:45:30 +00:00
Po Lu
6be201cf51 Fix closing displays when preserving selections is enabled
* src/frame.c (delete_frame): Bind `x-auto-preserve-selections'
to nil if deleting display.
* src/xselect.c (x_clear_frame_selections): Pass original frame
to that function.
* src/xterm.c (x_preserve_selections): Fix determining the new
owner.
(syms_of_xterm): New defsym `x-auto-preserve-selections'.
* src/xterm.h: Update prototypes.
2022-07-13 11:01:59 +08:00
Lars Ingebrigtsen
f62e1f39be Fix buffer-stale-function fix
* src/buffer.c (Fmake_indirect_buffer): Kill the local
buffer-stale-function variable instead of setting it
buffer-locally to the default value.  This should have the same
effect, but is less confusing.
2022-07-12 14:39:52 +02:00