Po Lu [Sat, 12 Mar 2022 12:33:18 +0000 (20:33 +0800)]
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.
Po Lu [Sat, 12 Mar 2022 00:46:39 +0000 (00:46 +0000)]
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.
Po Lu [Fri, 11 Mar 2022 10:44:33 +0000 (10:44 +0000)]
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.
Po Lu [Fri, 11 Mar 2022 08:56:54 +0000 (08:56 +0000)]
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.
Po Lu [Fri, 11 Mar 2022 01:33:24 +0000 (01:33 +0000)]
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):
Eli Zaretskii [Thu, 10 Mar 2022 18:26:13 +0000 (20:26 +0200)]
Fix regression in 'custom-prompt-customize-unsaved-options'
* lisp/cus-edit.el (custom-prompt-customize-unsaved-options):
Don't depend on the value returned by 'customize-unsaved'. Fix
the doc string. Patch by Sebastian Miele <iota@whxvd.name>.
(Bug#54329)
Michael Albinus [Thu, 10 Mar 2022 11:31:22 +0000 (12:31 +0100)]
Support remote home directories via connection property
* doc/misc/tramp.texi (Home directories): New section.
(Top, Usage): Add it to the menue.
(Predefined connection information): Mention "~".
(Multi-hops, File name syntax): Fix typos.
* lisp/net/tramp.el (tramp-handle-expand-file-name): Check for
remote home directory. (Bug#53847)
Po Lu [Thu, 10 Mar 2022 03:48:12 +0000 (11:48 +0800)]
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.
Po Lu [Wed, 9 Mar 2022 13:29:17 +0000 (21:29 +0800)]
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.
Po Lu [Wed, 9 Mar 2022 03:21:36 +0000 (03:21 +0000)]
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.
Paul Eggert [Wed, 9 Mar 2022 02:46:47 +0000 (18:46 -0800)]
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.
Paul Eggert [Wed, 9 Mar 2022 02:46:47 +0000 (18:46 -0800)]
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.
* lisp/eshell/esh-var.el (eshell-parse-variable-ref): Use
'eshell-unescape-inner-double-quote' and improve robustness of quoted
variable name matching.
(eshell-parse-indices): Use 'eshell-unescape-inner-double-quote'.
* doc/misc/eshell.texi (Dollars Expansion): Improve wording of
subscript notation.
Stefan Monnier [Tue, 8 Mar 2022 03:27:19 +0000 (22:27 -0500)]
(cl-macro-list): Simplify by unifying the variants
* lisp/emacs-lisp/cl-macs.el (cl-macro-list): Add the &whole and the
dotted tail cases from `cl-macro-list1`.
(cl-macro-list1, cl-define-compiler-macro-list): Delete edebug elem specs.
(cl-destructuring-bind, cl-define-compiler-macro): Use `cl-macro-list`
instead, now that it covers all the cases we need.
Po Lu [Mon, 7 Mar 2022 13:36:25 +0000 (21:36 +0800)]
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.
* lisp/net/tramp-compat.el (tramp-file-name-handler): Declare.
(tramp-compat-exec-path): Use it.
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-gvfs-handle-expand-file-name): Rewrite tilde handling.
(tramp-gvfs-handle-get-home-directory): New defun.
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-sh-handle-get-home-directory): New defun.
(tramp-sh-handle-expand-file-name): Rewrite tilde handling.
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-smb-handle-expand-file-name): Rewrite tilde handling.
(tramp-smb-handle-get-home-directory): New defun.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-sudoedit-handle-expand-file-name): Rewrite tilde handling.
(tramp-sudoedit-handle-get-home-directory): New defun.
* lisp/net/tramp.el (tramp-file-name-for-operation):
Add `tramp-get-home-directory'.
(tramp-get-home-directory): New defun.
(tramp-handle-abbreviate-file-name): Use it.
(tramp-set-file-uid-gid, tramp-get-remote-uid)
(tramp-get-remote-gid): Use `tramp-file-name-handler'.
(tramp-get-remote-null-device): Do not check for null VEC, it
doesn't happen anymore.
Restore documented Emacs 27.2 behaviour of browse-url-of-dired-file
* lisp/net/browse-url.el (browse-url-of-dired-file): Restore the
documented behaviour -- open a web browser instead of passing to
the various handlers.
* lisp/net/browse-url.el (browse-url--file-name-coding-system):
Factor out into own function.
(browse-url-file-url): Property encode non-ASCII characters so
that external browsers can understand them.
(browse-url-emacs): Make `W' in Dired work with non-ASCII file
names (bug#54271).
Po Lu [Mon, 7 Mar 2022 00:53:50 +0000 (08:53 +0800)]
Get rid of a loop through all frames when processing events
* src/xterm.c (handle_one_xevent): Just flip back buffer of f
and any instead.
(flush_dirty_back_buffer_on): New function.
(flush_dirty_back_buffers): Delete function.
* lisp/progmodes/gdb-mi.el (bindat): Require.
(gdb-invalidate-locals): Use `-stack-list-variables` instead of
the deprecated `-stack-list-locals`. Additionally, this allow
function arguments to be displayed in the locals buffer.
(gdb-locals-values-buffer, gdb-locals-values-buffer-name)
(gdb-locals-simple-values-only, gdb-locals-values-table): New
variables.
(gdb-locals-values-handler-custom): Create a new gdb buffer for
extracting local variable values. To
extract the values for 'complex' data-types, the command
`-stack-list-locals` is used with the `--all-values` flag.
The extracted values are then stored in a hash-table for later use in
the `gdb-locals-handler-custom` that performs the actual update of the
Local variable buffer.
All variable values are filtered to fit it into a single line, being
truncated as necessary by the user customizable option
`gdb-locals-value-limit`.
The old behavior of hiding complex values can be restored using the
customizable `gdb-locals-simple-values-only` option.
Patch amended by William Xu <william.xwl@gmail.com>.
* lisp/url/url-http.el (url-http): Factor out url-interactive-p.
* lisp/url/url-auth.el (url-basic-auth):
(url-basic-auth):
(url-digest-prompt-creds): Use it to not query the user.
* lisp/url/url-queue.el (url-queue-start-retrieve): Don't send a
bogus empty Authorization header (bug#54246) -- this triggers
Cloudflare's anti-attack software. Instead rely on
url-request-noninteractive.
* lisp/url/url-vars.el (url-interactive-p): New utility function.
Don't accept whitespace or hex floats in rgbi: colour specs
`color-values-from-color-spec` (new in Emacs 28) erroneously accepted
leading whitespace and hex floats in rgbi: components.
Reported by Philip Kaludercic.
* src/xfaces.c (parse_float_color_comp): Disallow leading whitespace
and hex floats.
* test/src/xfaces-tests.el
(xfaces-internal-color-values-from-color-spec): Add test cases.
Po Lu [Sun, 6 Mar 2022 02:02:03 +0000 (10:02 +0800)]
Reduce non-toolkit scroll bar flicker
* src/xterm.c (x_scroll_bar_create): Initialize double buffer
for scroll bar.
(x_scroll_bar_set_handle)
(x_scroll_bar_remove, x_scroll_bar_expose): Draw to back buffer
instead.
(x_scroll_bar_end_update): New function.
(x_scroll_bar_clear): Fill the scroll bar with the background
instead when double buffered.
* src/xterm.h (struct scroll_bar): New field `x_drawable'.
Robert Pluim [Sat, 5 Mar 2022 19:00:09 +0000 (20:00 +0100)]
Use pselect instead of select in nsterm.m
* src/nsterm.m ([EmacsApp fdhandler:]): Use pselect instead of
the single remaining use of select (because we try to avoid using
select directly) (bug#54245).
Po Lu [Sat, 5 Mar 2022 10:20:04 +0000 (10:20 +0000)]
Obey decorator-specified width and height of tooltip frames on Haiku
* src/haiku_support.cc (BWindow_dimensions): New functions.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (Fx_show_tip): Use actual dimensions, because
the decorator might specify a minimum width and height for the
tooltip frame.
* src/haikuterm.c (haiku_update_size_hints): Ignore tooltip
frames.
Paul Eggert [Sat, 5 Mar 2022 03:21:38 +0000 (19:21 -0800)]
Fix process-attributes time precision on BSD
* src/sysdep.c (timeval_to_timespec) [__FreeBSD__ || DARWIN_OS]:
Remove; no longer needed.
(make_lisp_s_us) [__FreeBSD__ || DARWIN_OS || __OpenBSD__]:
New function.
(make_lisp_timeval) [__FreeBSD__ || DARWIN_OS || __OpenBSD__]:
Rework in terms of make_lisp_s_us.
(system_process_attributes) [__FreeBSD__ || DARWIN_OS ||
__OpenBSD__]: Simplify by using the above. This fixes some minor
problems where timestamps promised more precision than was
actually available.