1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-16 02:51:29 -07:00
Commit graph

47962 commits

Author SHA1 Message Date
Po Lu
48ef8ab15f Try to implement `dnd-indicate-insertion-point' on macOS
* lisp/term/ns-win.el (ns-handle-drag-motion): New function.
* src/nsterm.m ([EmacsView draggingUpdated:]): Call that
function instead.
(syms_of_nsterm): Clean up old style defvars and add new
defvar for the DND drag function.
2022-05-30 10:36:43 +08:00
Po Lu
5b770b60f4 Further clean up DND target handling
* src/xfns.c (Fx_begin_drag): Alloca target list.

* src/xterm.c (x_set_dnd_targets): Copy the given targets list.
(x_dnd_begin_drag_and_drop): Record freeing the targets list on
the specpdl.
(handle_one_xevent, x_dnd_cleanup_drag_and_drop)
(x_connection_closed, x_delete_terminal): Stop calling
`x_set_dnd_targets' manually to free the targets list.
2022-05-30 09:25:03 +08:00
Po Lu
e2e232933c Fix crash when loading Postscript images
* src/xterm.c (handle_one_xevent): Catch errors around
`x_kill_gs_process'.
2022-05-30 09:07:27 +08:00
Po Lu
b6a4766388 Use XDrawPoint to clear relief rect corners
* xterm.c (x_clear_point): New function.
(x_draw_relief_rect): Use that instead.
2022-05-30 08:49:24 +08:00
Po Lu
6f8e856ada Keep display mm width and height up to date after changes
* src/xfns.c (Fx_display_mm_width, Fx_display_mm_height): Use
new fields if they are set.
* src/xterm.c (handle_one_xevent): Set new fields on RRNotify if
the screen is correct.
* src/xterm.h (struct x_display_info): New fields
`screen_mm_width', `screen_mm_height'.
2022-05-29 15:49:48 +08:00
Po Lu
22a3e92dc6 Make DND target list lifecycle a little clearer
* src/xfns.c (Fx_begin_drag): Pass target atoms and ntargets to
x_dnd_begin_drag_and_drop instead.
* src/xterm.c (x_set_dnd_targets): Make static.
(x_clear_dnd_targets): Delete function.
(x_dnd_begin_drag_and_drop): Adjust to set targets here instead.
* src/xterm.h: Update prototypes.
2022-05-29 12:56:37 +08:00
Stefan Kangas
6303cb7e9f Merge from origin/emacs-28
f9ee83bfb9 do_switch_frame: before leaving mini-window, check other (...
908e2e09d0 Fix commands used to produce on-line HTML docs
fff770fb97 Fix a bad cross-reference in elisp.pdf
ebea3415b0 Fix documentation of 'string-pad'
2022-05-29 06:30:21 +02:00
Po Lu
c92d73d271 Fix pending window changes in haiku_set_window_size
* src/haikuterm.c (haiku_set_window_size): Wait for
FRAME_RESIZED events, then call `do_pending_window_change'.
(haiku_read_socket): Allow waiting for FRAME_RESIZED events.
2022-05-29 01:05:54 +00:00
Po Lu
28d4952d42 Improve error trapping on X
* xterm.c (x_uncatch_errors, x_had_errors_p): Don't sync if no
request was made since the error trap was installed.
2022-05-29 08:51:17 +08:00
Alan Mackenzie
f9ee83bfb9 do_switch_frame: before leaving mini-window, check other (mru) window is live
This fixes bug#55684.  There, with a minibuffer-only frame at start up,
Emacs tried to switch to this frame, whose selected window was the
mini-window.  There is no other active window in this frame, so the
attempt to swith to another window failed.

* src/frame.c (do_switch_frame): On switching to a frame whose selected
window is as above, before selecting the most recently used window, check
this ostensible window is an actual live window.  Otherwise leave the
mini-window selected.
2022-05-28 12:55:32 +00:00
Po Lu
f91e87cc8a Add more cursor bitmaps on Haiku
* src/haikufns.c (cursor_bitmaps_for_id): Add hourglass cursor.
2022-05-28 04:35:12 +00:00
Po Lu
79ae40c8e4 Improve documentation on what callers of `x-begin-drag' should do
* doc/lispref/frames.texi (Drag and Drop):
* src/xfns.c (Fx_begin_drag): Improve documentation of how the
chosen action should be performed.
2022-05-28 10:30:45 +08:00
Po Lu
b52f36a33d Improve documentation of `x-begin-drag'
* src/xfns.c (Fx_begin_drag): Fix typos and improve wording.
2022-05-28 10:21:52 +08:00
Po Lu
73237458ba Improve safety of various DND callbacks
* src/xterm.c (x_dnd_begin_drag_and_drop): Restore selection
events if DND is no longer in progress and don't call
x-dnd-movement-function.
2022-05-28 10:09:19 +08:00
Po Lu
ac13957b86 Fix frame destruction issues and misuse of x_get_atom_name
* src/frame.c (delete_frame): Prevent deleting the dnd frame
while waiting for finish as well.
* src/xselect.c (Fx_get_atom_name): Clean up code and fix
uninitialized use of need_sync.
* src/xterm.c (x_dnd_send_unsupported_drop, x_dnd_send_drop)
(handle_one_xevent): Clean up usage of x_get_atom_name.
(x_get_atom_name): Accept NULL for need_sync.

* src/xterm.h: Update declarations.
2022-05-28 09:37:29 +08:00
Po Lu
b2c8e8a299 ; * src/nsselect.m (ns_decode_data_to_pasteboard): Fix GNUstep build. 2022-05-28 09:21:40 +08:00
Po Lu
6d6d1adbe7 Fix build on earlier versions of Mac OS X
* src/nsselect.m (ns_decode_data_to_pasteboard): Respect
NS_USE_NSPasteboardTypeFileUrl.
2022-05-28 09:19:33 +08:00
Po Lu
ffab237cbf Add file dragging support to NS port
* lisp/dired.el (dired-mouse-drag-files): Document that
`dired-mouse-drag-files' now works on NS.

* lisp/term/ns-win.el (x-begin-drag): Handle FILE_NAME.
* src/nsselect.m (ns_decode_data_to_pasteboard): Handle file URL
type.
(ns_lisp_to_pasteboard, Fns_begin_drag): Handle new type `file'.
2022-05-28 09:18:09 +08:00
Po Lu
3c5fbfe4ac Improve DND documentation
* doc/lispref/frames.texi (Drag and Drop):
* src/xfns.c (Fx_begin_drag): Document that x-begin-drag may
return immediately if no mouse buttons are held down.
2022-05-28 09:03:29 +08:00
Po Lu
5c07aed894 Fix x_dnd_movement_frame detection on GTK builds
* src/xterm.c (x_dnd_begin_drag_and_drop): Make sure movement
frame is on the correct display.
2022-05-28 08:55:13 +08:00
Po Lu
26588e9594 ; * src/xterm.c (x_color_cache_bucket_size): Improve doc string. 2022-05-28 08:48:29 +08:00
Paul Eggert
3bbf047cd8 Remove stray decl of nonexistent var
* src/lisp.h (symbols_with_pos_enabled): Remove decl.
2022-05-27 16:34:54 -07:00
Paul Eggert
eb37e4814e Fix unlikely null pointer dereference
* src/xselect.c (Fx_get_atom_name): Fix unlikely core dump when
build_string is called on a null pointer.  Found by GCC -fanalyzer.
2022-05-27 11:45:01 -07:00
Paul Eggert
cb57db513b Add ATTRIBUTE_DEALLOC to extern functions
This can help static checking.  It’s not as important for static
functions, where GCC can figure this stuff out own its own.
* src/sysstdio.h (emacs_fopen): Add ATTRIBUTE_DEALLOC (fclose, 1).
* src/tparam.h (tparam): Add ATTRIBUTE_DEALLOC_FREE.
Include stdlib.h so that ‘free’ is declared.
* src/xterm.h (x_get_atom_name): Add ATTRIBUTE_DEALLOC_FREE.
2022-05-27 11:45:01 -07:00
Paul Eggert
7f3d781dab Pacify gcc -Wsuggest-attribute-malloc
* src/xterm.h (x_get_atom_name): Add ATTRIBUTE_MALLOC.
2022-05-27 11:45:01 -07:00
Eli Zaretskii
8399c6a821 Improve font selection on MS-Windows
The Arial Unicode MS font claims in its USB (Unicode Subset
Bitfields) values support for several scripts for which it
doesn't actually have glyphs.  This sometimes caused Emacs to
decide to use Arial Unicode MS for some script, only to
discover later that there are no glyphs for that script's
characters.  This change fixes the USB values according to
actual font coverage, as determined by BabelMap.
* src/w32font.c (add_font_entity_to_list): Fix USB values of Arial
Unicode MS font according to its actual coverage of scripts.
2022-05-27 15:12:09 +03:00
Po Lu
82b75a97ba Fix GNUstep build
* src/nsterm.h (NSPasteboardNameGeneral): Fix definition.
2022-05-27 17:11:59 +08:00
Po Lu
5d2523dcd0 Fix NS drag and drop on macOS
* lisp/term/ns-win.el (gui-backend-set-selection):
* src/nsselect.m (Fns_begin_drag): Fix deprecation warnings and
selection/value mixup.
2022-05-27 17:11:07 +08:00
Po Lu
27de58af8b Implement some drag and drop functions on NS
* lisp/term/ns-win.el (ns-selection-exists-p):
(gui-backend-set-selection):
(x-begin-drag): New functions and selection types.
* src/nsfns.m (Fns_get_resource):
(Fns_set_resource):
(Fx_server_max_request_size): Fix coding style.
* src/nsselect.m (ns_decode_data_to_pasteboard):
(ns_lisp_to_pasteboard):
(ns_dnd_action_to_operation):
(ns_dnd_action_from_operation):
(Fns_begin_drag): New functions.
(syms_of_nsselect): New subrs.
* src/nsterm.h (EmacsWindow): New fields and messages.
(NSPasteboardNameGeneral): New define.
* src/nsterm.m ([EmacsView mouseDown:]): Store last mouse event.
([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Clear that event.
([EmacsWindow dealloc]): Free last mouse event.
2022-05-27 16:33:12 +08:00
Po Lu
edd11a2c6e Update comments in some X code
* src/xterm.c (x_parse_color): Update comment.
(syms_of_xterm): Add new debugging option too.
2022-05-27 14:40:43 +08:00
Po Lu
bb0317442b Fix XI scroll valuator reset on X Toolkit builds
* src/xterm.c (handle_one_xevent): Reset valuators on XI_Leave
if leave->event is an edit widget as well.
2022-05-27 10:34:04 +08:00
Po Lu
c0807daedc Improve lookup efficiency of color cache and prevent leaking
* src/xterm.c (x_parse_color): Move recently used colors to the
start of the cache and free unused entries when there are too
many.
(x_term_init, x_delete_display): Initialize and free new fields.
* src/xterm.h (struct x_display_info): New field
`color_names_length'.
2022-05-27 09:40:40 +08:00
Po Lu
8dcebc9629 Handle allocation errors when creating menu items on Haiku
* src/haiku_support.cc (class EmacsMenuItem): Don't abort on
failed strdup.
2022-05-27 00:24:12 +00:00
Po Lu
061c2d683f Fix longjmp/siglongjmp mixup
* src/xterm.c (xm_drag_window_io_error_handler)
(x_dnd_io_error_handler): Use `siglongjmp'.  Reported by Ken
Brown <kbrown@cornell.edu>.
2022-05-27 08:13:09 +08:00
Stefan Monnier
80ba4c1707 eval.c: New functions defvar-1 and defconst-1 (bug#55156)
The bytecode interpreter can't directly call special forms, so
the byte-compiler usually converts special forms into some sequence of
byte codes (basically, providing a duplicate definition of the special
form).  There are still two exceptions to this: `defconst` and `defvar`,
where the compiler instead generates a convoluted chunk of code like:

    (funcall '(lambda (x) (defvar <sym> x <doc>)) <value>)

where the quote makes sure we keep the function non-compiled, so as
to end up running the special form at run time.

Get rid of this workaround by introducing `defvar-1` and `defconst-1`
which provide a *functional* interface to the functionality of the
corresponding special form.

* src/eval.c (defvar, Fdefvar_1, Fdefconst_1): New functions, extracted from
`Fdefvar` and `Fdefconst`.
(Fdefvar, Fdefconst): Use them.
(syms_of_eval): `defsubr` the new functions.

* lisp/emacs-lisp/bytecomp.el (byte-compile-tmp-var): Delete const.
(byte-compile-defvar): Simplify using the new functions.

* doc/lispref/variables.texi (Defining Variables): Adjust the doc of
`defvar` to reflect the actual semantics implemented.
2022-05-26 12:21:32 -04:00
Po Lu
e490b80a10 Handle alternate actions for Motif drop targets
* src/xterm.c (xm_side_effect_from_action): Handle
`XdndActionAsk'.
(xm_operations_from_actions): New function.
(xm_send_top_level_leave_message, x_dnd_cleanup_drag_and_drop)
(x_dnd_update_state, handle_one_xevent, x_connection_closed):
Use those actions when building a side effect.
(x_dnd_begin_drag_and_drop): Keep track of the set of
alternative drag-and-drop actions.
2022-05-26 21:00:35 +08:00
Po Lu
036b72575a Fix the `x_trace_wire' option
* src/xterm.c (x_trace_wire):
(x_term_init): Fix debugging code for modern C and Xlib.
2022-05-26 14:37:27 +08:00
Po Lu
c67c7ab53c Use x_get_atom_name for some more things
* src/xterm.c (x_dnd_send_unsupported_drop, x_dnd_send_drop):
Use x_get_atom_name instead of XGetAtomName.
2022-05-26 14:27:32 +08:00
Po Lu
79d0b1a14c * src/xselect.c (Fx_register_dnd_atom): Use x_intern_cached_atom. 2022-05-26 10:40:54 +08:00
Po Lu
974a7e541c Make X error checking more asynchronous
This makes some operations (such as x-get-atom-name and
x-change-window-property) up to 2600x faster by avoiding calls
to XSync when setting up an error handler, and when checking for
or uncatching errors if all requests were already processed.

* src/xterm.c (X_COMPARE_SERIALS): New macro.
(struct x_error_message_stack): Add new field `first_request'.
(x_find_error_handler): New function.
(x_error_catcher): New parameter `stack'.  Use it instead.
(x_catch_errors_with_handler): Keep a record of the next
protocol request serial inside the stack entry.
(x_uncatch_errors, x_check_errors, x_had_errors_p, x_clear_errors)
(x_error_handler): Avoid XSync if all requests were processed by
the X server and look for the error handler matching the display
and request serial when processing errors.
2022-05-26 10:22:24 +08:00
Po Lu
c7e4c1a5fa Improve x_get_atom_name for some predefined atoms
* src/xterm.c (x_get_atom_name): Handle XSETTINGS and cm atoms.
2022-05-26 08:13:17 +08:00
Po Lu
9ab7d98bc6 Fix 32-bit warnings again
* src/print.c (struct print_stack_entry): Make
u.list.tortoise_idx intmax_t.
2022-05-26 08:11:36 +08:00
Eli Zaretskii
97bb31be9f Merge from origin/emacs-28
86b49d5865 ; * etc/NEWS: Announce changes in 'desktop-kill'.  (Bug#55...
d5ccf2621a ; Fix last change
f1c1fd7184 Improve documentation of mail-user-agent.
b05d1e9b98 ; * lisp/desktop.el: Update the commentary.  (Bug#55560)
139bfa1a08 More fixes in abbrev.el doc strings
d80dea6036 Add note about Tramp completion to completion-styles doc s...
9e7c0cf57d Remove mention of removed nnimap-nov-is-evil variable
90aae0bca2 Improve documentation strings and prompts in abbrev.el
dfa3e6f424 Restore the Fselect_window call in gui_consider_frame_title.
de35e9728f Advise against settings in the MS-Windows system registry
3ffa3d3403 ; Minor addition to make-tarball.txt
7dc026f9ea Fix kmacro-keymap binding after previous change
4f0fd54bc4 Add glossary entries for "interactively"
af1c05a3c4 Fix the name of a kmacro command.

# Conflicts:
#	etc/NEWS
#	lisp/abbrev.el
2022-05-25 13:57:59 -04:00
Po Lu
9661c82920 Lower the roundtrip overhead of x-get-atom-name by 50% for common atoms
* src/xselect.c (Fx_get_atom_name):
* src/xterm.c (x_dnd_begin_drag_and_drop): Use that instead.  Don't
sync to handle errors if using `x_get_atom_name' resulted in no
protocol request being made.
(x_get_atom_name): New function.
* src/xterm.h: Update prototypes.
2022-05-25 20:29:47 +08:00
Po Lu
25439cb8ed Add more predefined atoms for the benefit of DND code
* src/xterm.c (x_intern_cached_atom): Handle `CARDINAL' and
`WINDOW' as well.
2022-05-25 18:22:59 +08:00
Po Lu
9394027fd6 Improve atom interning in `x-change-window-property'
* src/xfns.c (Fx_change_window_property): Improve doc string and
use `x_intern_cached_atom'.
* src/xterm.c (x_intern_cached_atom): New argument
`predefined_only'.  All callers changed.
* src/xterm.h: Update prototypes.
2022-05-25 14:54:47 +08:00
Po Lu
822350d198 Fix cursor color adjustment on Haiku
* src/haikufns.c (haiku_set_foreground_color): Maybe set cursor
color correctly if it was equal to the old foreground color.
2022-05-25 02:18:00 +00:00
Po Lu
458d8db7e8 Add more atoms that don't need a roundtrip to intern
* src/xterm.c (x_intern_cached_atom): Handle dpyinfo atoms that
depend on the screen number and common selection atoms.
2022-05-25 09:39:04 +08:00
Po Lu
fcf80d7e62 Fix compilation on GTK when Xrandr is not present
* src/xterm.c (x_term_init): Make term always present on GTK.
2022-05-25 08:53:31 +08:00
Po Lu
6f3925eace Add more error checking to some X functions
* src/xfns.c (Fx_change_window_property, Fx_delete_window_property)
(Fx_window_property, Fx_window_property_attributes): Check for
errors in case the window is invalid.  Also use better function
for interning prop names.

* src/xterm.c (struct x_atom_ref): New structure.
(x_atom_refs): New list.  Extract from x_term_init.
(x_intern_cached_atom): New function.  Use it in several places
to avoid interning common atoms.
(x_term_init): Adjust accordingly.

* src/xterm.h: Update prototypes.
2022-05-24 21:20:46 +08:00