Commit graph

45654 commits

Author SHA1 Message Date
Mattias Engdegård
fe65db05f4 Maintain end of specpdl instead of size
Keep track of the end of specpdl explicitly since that is what we are
comparing against on critical code paths.

* src/eval.c (init_eval_once_for_pdumper, signal_or_quit)
(grow_specpdl_allocation):
* src/fileio.c (Fdo_auto_save):
* src/lisp.h (grow_specpdl):
* src/thread.c (run_thread, Fmake_thread):
* src/thread.h (struct thread_state):
Replace specpdl_size with specpdl_end, according to the equation
specpdl_end = specpdl + specpdl_size.
2022-03-12 17:32:31 +01:00
Mattias Engdegård
213483124b Inline record_in_backtrace
It's critical in several function call paths.

* src/eval.c (grow_specpdl_allocation): Make non-static.
(grow_specpdl, record_in_backtrace): Move from here...
* src/lisp.h (grow_specpdl, record_in_backtrace): ... to here,
and declare inline.
2022-03-12 17:32:31 +01:00
Po Lu
6ef9dc7797 Fix the PGTK build
* src/gtkutil.c (xg_finish_scroll_bar_creation): Fix ifdefs
preventing x_window from being correctly set.
(xg_get_scroll_id_for_window): Ifdef out unused function.
2022-03-12 20:58:18 +08:00
Po Lu
82a454915c Try really hard to make GTK 3 scroll bars fit
* src/gtkutil.c (xg_get_widget_from_map): New argument DISPLAY.
All callers changed.
(find_scrollbar_cb): New function.
(xg_finish_scroll_bar_creation, xg_remove_scroll_bar)
(xg_update_scrollbar_pos, xg_update_horizontal_scrollbar_pos)
(xg_set_toolkit_scroll_bar_thumb)
(xg_set_toolkit_horizontal_scroll_bar_thumb, xg_initialize):
Stop using id_to_widget_map on X builds with GTK 3 and set the
event box as the x_window instead.
* src/xterm.c (x_window_to_scroll_bar): Don't look for ID on GTK
3.
(handle_one_xevent): If a ConfigureNotify event is found for a
scroll bar and the dimensions are wrong, resize the X window to
the right ones.
2022-03-12 20:44:35 +08:00
Stefan Kangas
3af12cb8f2 Merge from origin/emacs-28
dbe6a3ecf7 Fix regression in 'custom-prompt-customize-unsaved-options'
a9920473f6 Improve documentation of 'map-charset-chars'
2022-03-12 06:34:05 +01:00
Po Lu
b5ac604b15 Fix some issues with input methods that depend on button state
* src/xterm.c (handle_one_xevent): Translate button state before
filtering events.
2022-03-12 13:03:00 +08:00
Po Lu
d0ff20f2e6 Fix horizontal scroll bar updating on Haiku
* src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb): Just
take portion and position without adjustments.
2022-03-12 03:16:00 +00:00
Po Lu
37cda51353 Use more reasonable default timeouts in Haiku menu loop
* src/haiku_support.cc (BMenu_run): Set default timeout to 10
seconds.
2022-03-12 03:02:03 +00:00
Po Lu
3ba3fdf7aa Make C-mouse-3 on scroll bars work on Haiku
* src/haiku_support.cc (class EmacsScrollBar): New field
`handle_button'.
(MouseDown, MouseUp): Pass button events with ControlMask to
parent view.
2022-03-12 02:47:03 +00:00
Po Lu
b279e1a5ec Slightly improve scrollbar position accounting on Haiku
* src/haiku_support.cc (MessageReceived): Use floats for
calculating portion and subtract proportion directly.
* src/haikuterm.c (haiku_set_scroll_bar_thumb): Take ceiling of
value instead of rounding it.
2022-03-12 00:46:39 +00:00
Po Lu
610d85782b Fix a crash inside Haiku popup menus
* src/haiku_support.cc (BMenu_run): Handle B_WOULD_BLOCK from
wait_for_objects loop.
2022-03-11 12:41:30 +00:00
Po Lu
0dcc9fdc17 Fix initial values of scroll bar foreground and background on GTK 3
* src/gtkutil.c (xg_create_frame_widgets): Stop creating
scrollbar stylesheet providers.
* src/xfns.c (Fx_create_frame): Create scroll bar stylesheet
providers here instead.
(x_set_scroll_bar_background):
(x_set_scroll_bar_foreground): Ignore tooltip frames.
2022-03-11 20:26:31 +08:00
Po Lu
7ad1df5e16 Implement customization of scroll bar colors on GTK 3
* src/gtkutil.c (xg_create_frame_widgets): Create CSS providers
for scroll bars.
(xg_finish_scroll_bar_creation): Attach created CSS providers.
* src/xfns.c (x_set_scroll_bar_foreground):
(x_set_scroll_bar_background): Put appropriate content into CSS
providers.
* src/xterm.c (x_free_frame_resources): Free CSS providers.
* src/xterm.h (struct x_output): New fields for scroll bar
stylesheet providers.
2022-03-11 20:10:23 +08:00
Po Lu
92ebfe7da4 * src/frame.c (scroll_bar_adjust_thumb_portion_p): Adjust doc string. 2022-03-11 19:38:45 +08:00
Po Lu
fc987de94b Improve scroll bar treatment on Haiku
* src/haiku_support.cc (MessageReceived): Subtract portion from
range of scroll bar.
* src/haikuterm.c (BE_SB_MAX): Adjust values for better
rounding.
(haiku_set_scroll_bar_thumb): Round values instead of
truncating them.
2022-03-11 10:44:33 +00:00
Po Lu
88d474308e Fix inconsistent thumb position on Haiku scroll bars
* src/haikuterm.c (haiku_set_scroll_bar_thumb): If
scroll_bar_adjust_thumb_portion is nil, directly calculate thumb
portions without setting page_size.
2022-03-11 08:57:06 +00:00
Po Lu
b1d0d8e1f7 Allow C-mouse-2 to split windows on XInput 2 builds
* src/xterm.c (handle_one_xevent): Use x_scroll_bar_handle_click
if ControlMask is set.
2022-03-11 13:59:42 +08:00
Po Lu
170cae0e90 Fix scroll bar portion on Haiku scroll bars
* src/haiku_support.cc (EmacsScrollBar): Set steps to
appropriate value.
(ValueChanged): Test new value against old value before sending
value event.
(MessageReceived): Handle portion and range.
(BView_scroll_bar_update): New argument for portion.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_set_scroll_bar_thumb):
(haiku_set_horizontal_scroll_bar_thumb): New functions.
(haiku_set_horizontal_scroll_bar):
(haiku_set_vertical_scroll_bar): Use those functions to set
scroll bar values.
(haiku_read_socket): Handle new meanings of scroll bar values.
* src/haikuterm.h (struct scroll_bar):
2022-03-11 01:33:24 +00:00
Alan Third
22dde4e621 Fix NS toolbar identifier (bug#54326)
* src/nsterm.m ([EmacsWindow createToolbar:]): Set the identifier to
something that will always be unique to that frame.
2022-03-10 21:23:55 +00:00
Po Lu
1044338ae7 Fix display of minibuffer prompts in some circumstances on Haiku
* src/haikuterm.c (haiku_flush): Always flip buffers as long as
buffer flipping is not blocked.
2022-03-10 10:39:31 +00:00
Eli Zaretskii
a9920473f6 Improve documentation of 'map-charset-chars'
* doc/lispref/nonascii.texi (Character Sets):
* src/charset.c (Fmap_charset_chars): Clarify the codepoint issue
in using 'map-charset-chars'.
2022-03-10 09:29:29 +02:00
Po Lu
65fea3ff58 Fix menu bar activation on PGTK
* src/gtkutil.c (menu_bar_button_pressed_cb): Only update menu
bar if no menu is active, and the event window is not the widget
window itself.  Also make menu in use.
* src/pgtkmenu.c (popup_deactivate_callback): Make menu not in
use.
* src/xdisp.c (redisplay_internal): Return if popup_activated
also on PGTK.
2022-03-10 11:48:12 +08:00
Po Lu
4a845b2cd0 Fix stray button release events being reported on GTK 2
* src/xterm.c (handle_one_xevent): Drop ButtonRelease events
that are destined for a popup menu.
2022-03-10 09:16:39 +08:00
Po Lu
70d63ead21 Fix menu bar event detection on XI2 builds using Core Input
* src/gtkutil.c (xg_get_gdk_scale): Always return 1 on GTK+ 2.
(xg_event_is_for_menubar): Fix some ifdefs.
* src/xterm.c (handle_one_xevent): Update a comment.
2022-03-10 09:13:08 +08:00
Po Lu
94f3424381 Fix some issues with GTK native input and modifiers on GTK 2
* src/gtkutil.c (xg_widget_key_press_event_cb): Manually ignore
modifier keys on GTK 2.
2022-03-09 21:33:48 +08:00
Po Lu
fe8d49e1ad Make XInput 2 features work on GTK 2 builds
* src/xfns.c (setup_xi_event_mask): On GTK 2, select for
button, motion, entry/exit and key events.
* src/xmenu.c (create_and_show_popup_menu): Clear XI grab if
appropriate.
* src/xterm.c (handle_one_xevent): Pass some kinds of input
extension events to GTK manually on versions of GTK+ that don't
understand them.
2022-03-09 21:29:17 +08:00
Po Lu
b883e8bc65 Fix GTK widgets not appearing inside child frames
* src/xfns.c (x_set_parent_frame): Disable GTK's own frame
synchronization in child frames.
2022-03-09 20:43:59 +08:00
Po Lu
06d826d0ca Fix error when creating frames on NS with no main window
* nsfns.m (Fx_create_frame): If main window is not present,
center frame window instead of cascading it.
2022-03-09 16:28:33 +08:00
Po Lu
f599b58afe Don't update Haiku menu bar if nothing changed
* haikumenu.c (set_frame_menubar): If Lisp-level contents didn't
change, refrain from actually updating the menu bar.
2022-03-09 06:58:01 +00:00
Po Lu
e8d35b98bb Fix flicker during frame resize on Haiku
* haikuterm.c (haiku_update_end): Call BWindow_Flush directly.
(haiku_set_vertical_scroll_bar): Stop calling flush_frame.
(haiku_flush): Only flip buffer of tooltip frames.
2022-03-09 03:50:16 +00:00
Po Lu
9cf69e1171 Improve handling of tooltips inside menus on Haiku
* src/haiku_support.cc (BMenu_run): Make
`process_pending_signals_function' return a struct timespec.
* src/haiku_support.h: Update prototypes.
* src/haikumenu.c (haiku_process_pending_signals_for_menu):
Return result of `timer_run'.
* src/haikuterm.c (haiku_flush): Flip buffers if frame is dirty.
2022-03-09 03:22:04 +00:00
Paul Eggert
6e66d1f90a Decouple mod-test.c from Gnulib
mod-test.c should not use Gnulib code, as that creates
unnecessary coupling between Emacs internals and this test module.
Also Gnulib code is compiled without -fPIC whereas mod-test.c
needs -fPIC and recompiling Gnulib with -fPIC would be too painful.
* src/Makefile.in (LIB_NANOSLEEP): New macro.
(LIBES): Use it.
* test/Makefile.in (REPLACE_FREE, FREE_SOURCE_0, FREE_SOURCE_0):
Remove.  All uses removed.
(LIB_CLOCK_GETTIME, LIB_NANOSLEEP): New macros.
(MODULE_CFLAGS): Do not -I from lib as that would include Gnulib
modifications to standard .h files (e.g., "#define nanosleep
rpl_nanosleep") and we don’t want the Gnulib replacements.
Instead, for gmp.h (on platforms lacking <gmp.h>) simply '-I.'
with a suitable gmp.h.
(gmp.h): New rule to create a suitable gmp.h.
($(test_module)): Depend on config.h since the code uses config.h.
Depend on gmp.h if we need to create a suitable one.
If compiling mini-gmp.h, compile the original one and not
the Emacs-specific one, to lessen coupling with Emacs internals.
Link with LIB_CLOCK_GETTIME and LIB_NANOSLEEP.
(clean): Remove gmp.h.
* test/src/emacs-module-resources/mod-test.c: Don’t include timespec.h.
All uses of timespec.h APIs changed to use system-supplied APIs.
Change _Static_assert to plain assert, so that we needn’t rely
on Gnulib’s _Static_assert.
(timespec_le) [CLOCK_REALTIME]: New function.
Change use of timespec_cmp changed to use this instead.
(Fmod_test_sleep_until, Fmod_test_nanoseconds):
Define these functions and their Lisp names mod-test-sleep-until
and mod-test-nanoseconds only if CLOCK_REALTIME,
since they now won’t work on platforms lacking CLOCK_REALTIME.
(Fmod_test_nanoseconds): Just use _Static_assert since it
should work on all platforms.
* test/src/emacs-module-tests.el (mod-test-sleep-until)
(mod-test-nanoseconds, mod-test-double):
Skip test if the corresponding functione is not defined.
2022-03-08 18:51:18 -08:00
Paul Eggert
ec35e2621a Do not include <attribute.h> from <config.h>
This is because mod-test.c shouldn’t use source code from lib,
but it does need to include <config.h>.
* lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c:
* lib-src/make-docfile.c, lib-src/movemail.c:
* lib-src/seccomp-filter.c, src/dynlib.h, src/lisp.h:
* src/syssignal.h, src/sysstdio.h, src/systhread.h, src/tparam.h:
Include <attribute.h>.
* src/conf_post.h: Do not include <attribute.h>.
All uses of attribute.h macros replaced with their _GL_ equivalents.
2022-03-08 18:51:17 -08:00
Po Lu
f7032bdafe * src/xterm.c (handle_one_xevent): Add more dead keys. 2022-03-09 08:50:24 +08:00
Eli Zaretskii
d509d1e1a8 Merge from origin/emacs-28
d184773 Avoid assertion violations in 'bidi_resolve_brackets'
2022-03-08 15:41:48 +02:00
Eli Zaretskii
d184773c2e Avoid assertion violations in 'bidi_resolve_brackets'
* src/bidi.c (bidi_resolve_brackets): Move assertion to where it
really matters.  (Bug#54295)
2022-03-08 15:35:39 +02:00
Po Lu
a7fdbed880 Handle XI focus change events that specify implicit focus correctly
* src/xterm.c (x_detect_focus_change): If detail is
XINotifyPointer, set focus type to implicit.
2022-03-08 21:26:37 +08:00
Po Lu
bbbb47704f Fix detection of modifier keys on XInput 2
* src/xterm.c (handle_one_xevent): Fix iteration over sets of
modifiers.
2022-03-08 18:33:23 +08:00
Po Lu
212aa7748b Fix more uses of opaque Visual structure
* src/image.c (x_kill_gs_process):
* src/xfaces.c (x_free_colors):
(x_free_dpy_colors):
* src/xfns.c (Fxw_display_color_p):
(Fx_display_grayscale_p):
(Fx_display_visual_class):
* src/xterm.c (x_copy_color):
* src/xterm.h (x_mutable_colormap): Stop using private fields of
Visual.
2022-03-08 15:19:37 +08:00
Po Lu
39a2eb04f3 Return actual color cell count in x-display-color-cells
* src/xfns.c (Fx_display_color_cells): Return the actual amount
of color cells, or the amount of individual combinations of
components.
2022-03-08 14:16:56 +08:00
Po Lu
bacd7ae4b6 Avoid color leaks while better ensuring a close color is found
* src/xterm.c (x_alloc_nearest_color_1): Verify nearest can be
allocated, and use that color value.
2022-03-08 09:40:21 +08:00
Po Lu
b19db4861f Fix choice of visuals for XPM icon
* src/xterm.c (x_bitmap_icon): Allow using XPM icon on
StaticColor and StaticGray as well.
2022-03-08 08:41:15 +08:00
Lars Ingebrigtsen
530ac51f5b Remove lock file in --no-build-details, too
* src/filelock.c (current_lock_owner): Make file writes work when
using --no-build-details (bug#54294).
2022-03-07 18:03:14 +01:00
Po Lu
418e5da5d3 Correctly handle exposure in oldXMenu
* oldXMenu/Activate.c (XMenuActivate): Call set expose_func if
no pane was found.
(XMenuActivateSetExposeFunction): New function.
* oldXMenu/XMenu.h: New typedef `expose_func'.  Update
prototypes.
* src/xmenu.c (x_menu_expose_event): New function.
(x_menu_show): Set expose event handler.
* src/xterm.c (x_dispatch_event): Make `static' only on GTK.
* src/xterm.h: Expose `x_dispatch_event' on no-toolkit builds.
2022-03-07 21:36:25 +08:00
Po Lu
8a7df412a6 Improve color handling on colormapped displays
* src/xfns.c (select_visual): Set `visual_info' field whenever
appropriate.
(x_create_tip_frame, XDisplayCells): Don't access private fields
of Visual.

* src/xterm.c (x_color_cells, x_alloc_nearest_color_1): Use
colormap_size instead of default cell count.
(XTflash, x_bitmap_icon, x_term_init):
* src/xterm.h (struct x_display_info, FRAME_X_VISUAL_INFO): Stop
accessing private fields of Visual.
2022-03-07 21:10:53 +08:00
Po Lu
4b0e1c6502 Handle color allocation failures caused by colormap changes
* src/xterm.c (x_alloc_nearest_color_1): Recompute color cells
if allocation of cached value failed.
2022-03-07 21:10:53 +08:00
Po Lu
c7d3ebc7fd ; * src/xterm.c (x_alloc_nearest_color_1): Commit missing hunk (again). 2022-03-07 19:57:19 +08:00
Po Lu
9e1186a732 ; * src/xterm.c (x_alloc_nearest_color_1): Add missing part of change. 2022-03-07 19:56:23 +08:00
Po Lu
f2b58db280 Fix color leak
* src/xterm.c (x_alloc_nearest_color_1): Don't allocate colors
multiple times when searching for a closest match.
2022-03-07 19:53:52 +08:00
Po Lu
03b07fd62e Fix maximum selection size reporting
* src/xselect.c (selection_quantum): Take into account extended
request size.
2022-03-07 13:09:41 +08:00