1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-07 08:00:48 -08:00
Commit graph

46404 commits

Author SHA1 Message Date
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
Po Lu
7c4a780721 Prevent errors when Lisp code asks for props of invalid windows
* src/xfns.c (Fx_window_property):
(Fx_window_property_attributes): Catch X errors.
2022-05-24 21:01:24 +08:00
Lars Ingebrigtsen
388e0c18f4 Make the nativecomp test eln directory more reliably be removed
* lisp/startup.el (startup-redirect-eln-cache, normal-top-level):
Don't create the nativecomp directory here, because this led to
brittle deletions of the directory -- there would be several
instances of the directory left over after a test run.

* lisp/emacs-lisp/ert.el (ert-run-tests-batch-and-exit): Create
the nativecomp directory.
2022-05-24 14:06:38 +02:00
Lars Ingebrigtsen
59951f7af5 Audit quoting symbols in C doc strings
* test/manual/etags/c-src/emacs/src/keyboard.c (Frecursive_edit):
* src/xfns.c (syms_of_xfns):
* src/xdisp.c (Fwindow_text_pixel_size):
(syms_of_xdisp):
* src/w32notify.c (Fw32notify_add_watch):
(Fw32notify_add_watch):
* src/frame.c (Fframe_child_frame_border_width):
* src/comp.c (Fcomp__subr_signature):
* src/alloc.c (Fgarbage_collect):
* lib-src/make-docfile.c (scan_c_stream): Audit quoting symbols in C
doc strings.
2022-05-24 11:51:18 +02:00
Po Lu
6fe45ed969 Allow the user to fix `x-mouse-click-focus-ignore-position' on some systems
* src/xterm.c (handle_one_xevent): Apply that variable instead.
(syms_of_xterm): Update doc string and add new option to adjust
the focus click timeout.
2022-05-24 15:11:19 +08:00
Po Lu
7527c941f7 Fix use of wrong event structure handling XI_Enter events
* src/xterm.c (handle_one_xevent): Use `enter' instead of `xev'
to set the mouse click timeout.
2022-05-24 13:50:07 +08:00
Po Lu
06671a70a4 * src/nsmenu.m (ns_menu_show): Use SAFE_ALLOCA. 2022-05-24 10:55:36 +08:00
Po Lu
cd355038d9 Minor fixes to cursor color handling on Haiku
* src/haikufns.c (haiku_decode_color): New function.
(haiku_set_foreground_color, haiku_set_background_color)
(haiku_set_cursor_color, haiku_set_mouse_color): Use that
function to decode colors instead.  Also set cursor GC
foreground when setting background color.

* src/haikuterm.c (haiku_merge_cursor_foreground): Fix color
equality test.
2022-05-24 02:09:59 +00:00
Po Lu
689be0bdd5 Only send fallback MONITORS_CHANGED_EVENT when dimensions really changed
* src/xterm.c (handle_one_xevent): Test that root window
configure width and height are not the same as the previously
recorded ones.
2022-05-24 08:30:51 +08:00
Eli Zaretskii
8c4498e62e Avoid compiler warnings on macOS (bug#55595)
* configure.ac: Don't use -Wunknown-pragmas with Clang.

* src/comp.c (load_comp_unit): Avoid Clang compilation warning.
2022-05-23 19:26:18 +03:00
Mattias Engdegård
5a1a67a256 Less wrong printed circular list tail index (bug#55395)
When printing a circular list and `print-circle` is nil, use a
somewhat more meaningful ". #N" tail index.  The previous method for
calculating that index was based on Floyd circularity detection being
used so it had been broken ever since the change to Brent's algorithm.

The new index is correct with respect to the start of the list itself
which is what it used to be before being completely broken.
It does not take into account the nesting depth of the list context.

* src/print.c (struct print_stack_entry, print_object):
Keep track of the tortoise index (which is cheap) instead of trying
to derive it from the printed element index.
* test/src/print-tests.el (print-test-rho, print-circular):
New test.
2022-05-23 16:50:00 +02:00
Eli Zaretskii
b3e4526f21 * src/w32menu.c (w32_menu_show): Use SAFE_ALLOCA. (Bug#55068) 2022-05-23 16:54:17 +03:00
Po Lu
1799e5d35a Adapt last change to Haiku as well
* src/haikumenu.c (digest_menu_items, haiku_menu_show): Use
SAFE_ALLOCA for various temporary buffers.
2022-05-23 12:50:27 +00:00
Po Lu
cec2ef73a6 Fix stack overflows with large popup menus
* src/xmenu.c (x_menu_show): Allocate various stacks with
SAFE_ALLOCA.
2022-05-23 20:31:18 +08:00
Po Lu
ca6899a0ef Fix default child-frame-border-width on PGTK
* src/pgtkfns.c (Fx_create_frame): Make default
`child-frame-border-width' nil.  (bug#55588)
2022-05-23 20:16:46 +08:00
Lars Ingebrigtsen
250b728284 Improve command-error-function discoverability
* lisp/subr.el (error, user-error): Point to command-error-function.

* src/keyboard.c (syms_of_keyboard): Add an example (bug#40750).
2022-05-23 13:56:12 +02:00
Po Lu
7ff88efc02 Fix coding style of recent change
* src/emacs.c (main): Fix coding style by putting the = operator
on the right row.
2022-05-23 18:31:11 +08:00
Po Lu
caec741c00 Implement monitor change functions on Haiku
* src/haiku_io.c (haiku_len): Handle new event type.
* src/haiku_support.cc (class EmacsScreenChangeMonitor): New
class.
(class Emacs, Emacs): Create new screen change monitor.
(DispatchMessage): Update fullscreen state if the screen
changed.
(SetFullscreen): Don't punt if fullscreen mode is identical.

* src/haiku_support.h (enum haiku_event_type): New event
`SCREEN_CHANGE_EVENT'.
(struct haiku_screen_changed_event): New struct.

* src/haikuterm.c (haiku_read_socket): Handle new event.
2022-05-23 10:23:59 +00:00
Lars Ingebrigtsen
a9b393c773 Include development data in --version output
* src/emacs.c (main): Include development into in --version output
(bug#38657).
2022-05-23 11:58:22 +02:00
Po Lu
b629cb3f54 Minor fixes to PGTK child frames
* src/gtkutil.c (xg_check_special_colors): Handle child frames
correctly.
* src/pgtkfns.c (pgtk_set_child_frame_border_width): Synchronize
code from X.  (bug#55588)
* src/pgtkmenu.c (pgtk_menu_show, pgtk_dialog_show): Allow in
child frames.  There are no problems here.
* src/pgtkterm.c (pgtk_mouse_position): Clean up coding style.
2022-05-23 13:30:33 +08:00
Po Lu
5346b67fc2 Implement monitor change functions on GNUstep
* src/nsfns.m (Fns_display_monitor_attributes_list): Fix coding
style.
* src/nsterm.m (nstrace_leave, nstrace_restore_global_trace_state)
(nstrace_fullscreen_type_name): Fix coding style.
(ns_displays_reconfigured, ns_term_init): Make a record of the
previous display attributes list and avoid storing duplicate
events.
([EmacsApp init]): Listen for
NSApplicationDidChangeScreenParametersNotification.
([EmacsApp updateMonitors:]): New method.
(syms_of_nsterm): New staticpro.
2022-05-23 11:13:45 +08:00
Po Lu
20662ecd21 Handle screen size changes if the RandR library isn't available
* src/xterm.c (handle_one_xevent): [!HAVE_XRANDR]: Store
MONITORS_CHANGED_EVENT upon root window reconfiguration.
2022-05-23 10:55:48 +08:00
Po Lu
7a709b36ef Fix `gui-backend-selection-owner-p' on Haiku
* src/haiku_select.cc (be_update_clipboard_count): New function.
(be_set_clipboard_data): Update clipboard counts.
(BClipboard_owns_clipboard, clipboard_owner_p)
(BClipboard_owns_primary, primary_owner_p)
(BClipboard_owns_secondary, secondary_owner_p): Rename functions
somewhat.
(be_clipboard_owner_p): New function.
* src/haikuselect.c (Fhaiku_selection_put)
(Fhaiku_selection_owner_p): Update selection counts as well.
* src/haikuselect.h: Update prototypes.
2022-05-23 01:57:19 +00:00
Po Lu
42e48f788a Use GDK for handling monitor changes when built with GTK
* src/xterm.c (x_monitors_changed_cb): New function.
(handle_one_xevent): Don't handle RRNotify and
RRScreenChangeNotify on GTK.
(x_term_init): Connect to GdkScreen::monitors-changed instead of
selecting for RRNotify events.
(mark_xterm): Also mark `last_monitor_attributes_list' on GTK.
* src/xterm.h (struct x_display_info): Enable
`last_monitor_attributes_list' on GTK builds as well.
2022-05-23 09:29:32 +08:00
Stefan Monnier
cc878319f9 Run minibuffer-exit-hook in the right buffer
* src/minibuf.c (run_exit_minibuf_hook): Take the minibuffer as arg
and run the hook in that buffer.
(read_minibuf): Adjust accordingly.
2022-05-22 10:39:02 -04:00
Po Lu
4c1af80322 Clean up Haiku code
* src/haiku_support.cc (movement_locker, class EmacsWindow)
(MouseMoved): Delete `movement_locker' and associated hack,
since it's superseeded by some code in haiku_read_socket.
(key_map, key_chars, dpy_color_space, popup_track_message)
(alert_popup_value, grab_view, grab_view_locker)
(drag_and_drop_in_progress): Write comments and fix
initializers.

* src/haikuterm.c (haiku_read_socket): Update comment.
2022-05-22 12:23:51 +00:00
Po Lu
ae8b1b8fd4 Implement `display-monitors-changed-functions' on MS Windows
* src/w32term.c (w32_read_socket): Handle WM_DISPLAYCHANGE by
sending monitor change events.
2022-05-22 17:15:10 +08:00
Po Lu
73df958411 Fix uninitialized use of xm drag receiver data
* src/xterm.c (xm_read_drag_receiver_info): Just return if the
protocol is invalid.  Reported by Jashank Jeremy
<jashank@rulingia.com.au>.
2022-05-22 15:56:20 +08:00
Po Lu
9988047f47 Fix build with --enable-check-lisp-object-type
* src/xterm.c (handle_one_xevent): Fix use of Fequal.  Reported
by Jashank Jeremy <jashank@rulingia.com.au>.
2022-05-22 15:34:21 +08:00
Po Lu
d52749202f Fix use-after-free in x_destroy_window
* src/xterm.c (x_destroy_window): Fix use after free of the
dpyinfo.
2022-05-22 13:13:01 +08:00
Po Lu
67685de75c Fix focus redirection to/from surrogate minibuffer frames on Haiku
* src/haikuterm.c (haiku_get_focus_frame): New function.
(haiku_create_terminal): Register new hook.
2022-05-22 05:03:12 +00:00
Po Lu
714970f596 Fix GNUstep build
* src/nsfns.m (ns_implicitly_set_icon_type): Don't use UTType if
GNUstep.
2022-05-22 11:18:32 +08:00
Po Lu
e5e474baae Fix compiler warnings on Mac OS X 10.12
* configure.ac: Check for Mac OS X 12 and link with
UniformTypeIdentifiers.framework.

* src/nsfns.m (IOMasterPort): Define to `IOMainPort' on Mac OS X
12.
(ns_implicitly_set_icon_type, Fns_read_file_name):
* src/nsxwidget.m: ([XwWebView
initWithFrame:configuration:xwidget:]): Fix uses of obsolete
things.
2022-05-22 11:02:24 +08:00
Po Lu
672af0a5da Set display size upon RRScreenChangeNotify
* src/xterm.c (handle_one_xevent): Handle RRScreenChangeNotify
correctly.
2022-05-22 09:38:21 +08:00
Po Lu
e465ea816d Don't unnecessarily call monitor change functions
* src/xterm.c (handle_one_xevent): If monitor attributes didn't
change, don't send monitor change event.
(x_term_init, mark_xterm): Mark and init new field.
* src/xterm.h (struct x_display_info): New field
`last_monitor_attributes_list'.
2022-05-22 09:27:46 +08:00
Po Lu
cf21e38543 Fix compiler warnings in printer code on 32-bit systems
* print.c (enum print_entry_type, struct print_stack_entry):
Clean up coding style.
(struct print_stack): Make print_stack_entry.list.idx intmax_t,
like it was before the nonrecursive printing was installed.
Also clarify what "Brent cycle detection" means in the comments.
2022-05-21 14:46:57 +08:00
Po Lu
3e3fe06307 Compute frame workareas on Haiku
* lisp/frame.el (display-monitor-attributes-list): Implement
specially on Haiku as well.
* src/haiku_support.cc (get_zoom_rect): New function.  Extract
CalculateZoomRect here.
(class EmacsWindow, SetFullscreen): Use that instead of
CalculateZoomRect.
(be_get_explicit_workarea): New function.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (Fhaiku_display_monitor_attributes_list): New
function.
(syms_of_haikufns): Register new subr.
2022-05-21 06:28:06 +00:00
Po Lu
b7b14e9203 Implement monitor change hooks on NS
This hasn't been tested with anything more complicated than
removing an emulated monitor.

* nsterm.m (ns_displays_reconfigured): New function.
(ns_term_init): Register display reconfiguration callbacks.
2022-05-21 11:50:08 +08:00
Po Lu
5a290eb7d3 Call XRRUpdateConfiguration when the root window geometry changes
* src/xterm.c (handle_one_xevent): Call XRRUpdateConfiguration
on RRScreenChangeNotify and upon ConfigureNotify events for the
root window.
2022-05-21 11:34:51 +08:00
Po Lu
98163f48a0 Implement `display-monitors-changed-hook' on PGTK
* src/pgtkterm.c (pgtk_draw_glyphless_glyph_string_foreground):
Pacify GCC 12.
(pgtk_monitors_changed_cb): New function.
(pgtk_term_init): Attach new signal handler.
2022-05-21 11:29:27 +08:00
Po Lu
edf9700c3c Add a hook run upon monitor configuration changes
* doc/lispref/frames.texi (Multiple Terminals): Document new
hook `display-monitors-changed-functions'.
* etc/NEWS: Announce new abnormal hook.

* src/keyboard.c (kbd_buffer_get_event): Handle
MONITORS_CHANGED_EVENT.
(syms_of_keyboard): New hook and defsyms.
* src/termhooks.h (enum event_kind): Add new event
`MONITORS_CHANGED_EVENT'.

* src/xterm.c (handle_one_xevent): Handle RRNotify and
RRScreenChangeNotify events.
(x_term_init): Select for RRScreenChange, RRCrtcChange and
RROutputChange.
* src/xterm.h (struct x_display_info): Improve RandR version
detection.
2022-05-21 11:17:34 +08:00
Po Lu
dd6a24ebed ; * src/xterm.c (struct x_client_list_window): Improve comment. 2022-05-20 20:08:31 +08:00
Po Lu
8db0acb0f0 Check for allocation errors when setting XdndActionDescription
* src/xterm.c (x_dnd_begin_drag_and_drop): Check for BadAlloc
when setting action descriptions.
2022-05-20 20:08:31 +08:00
Lars Ingebrigtsen
69f42faa50 Clarify select-active-regions doc string
* src/keyboard.c (syms_of_keyboard): Clarify doc string (bug#29889).
2022-05-20 12:05:43 +02:00
Po Lu
c1fbbc57a9 Fix race conditions processing zoom events on Haiku
* src/haiku_support.cc (Zoom):
* src/haiku_support.h (struct haiku_zoom_event): Include the
current fullscreen mode in the event.

* src/haikuterm.c (haiku_read_socket): Use that instead of the
current frame's fullscreen mode.
2022-05-20 09:29:08 +00:00