Commit graph

44926 commits

Author SHA1 Message Date
Po Lu
53cf2cf81b * src/pgtkterm.c (pgtk_handle_event): Add pinch event support. 2021-12-27 12:43:50 +08:00
Po Lu
d9977018e0 Fix menu window persistence and entry/leave events on Lucid on XI2
* src/xmenu.c (x_activate_menubar): Always clear the XI2 grab on
Xt.
* src/xterm.c (handle_one_xevent): On XI2, ignore LeaveNotify
events coming from the shell widget and use `x_window_to_frame'
to find the frame when handling XI_Leave events.
2021-12-27 10:05:01 +08:00
Po Lu
2ccb156887 Fix Lucid popup menu being stuck on XI2 builds
* src/xmenu.c (x_activate_menubar): Make some changes
conditional on XI2.
(create_and_show_popup_menu): Clear XI2 grab before showing
popup.
* src/xterm.c (xi_grab_or_ungrab_device): Don't grab device
if popup is activated on Lucid.
2021-12-27 09:16:18 +08:00
Po Lu
c609865258 Accumulate deltas in pinch events that were skipped
* src/keyboard.c (kbd_buffer_get_event): Accumulate relative deltas
inside skipped events when coalescing them.
2021-12-26 20:09:47 +08:00
Po Lu
deab5f413f Coalesce pinch gestures in the keyboard buffer
* src/keyboard.c (kbd_buffer_get_event): Coalesce consecutive
pinch gesture events.
2021-12-26 19:36:18 +08:00
Po Lu
472bc18ffd Change x-server-input-version' to x-server-input-extension-version'
* src/xfns.c (Fx_server_input_version)
(Fx_server_input_extension_version): Rename to
`x-server-input-extension-version'.
(syms_of_xfns): Update defsubr.
2021-12-26 15:01:55 +08:00
Po Lu
62339e62d8 Add configure tests for faulty XI2 installations
* configure.ac: Detect cases where XI 2.4 headers are installed
without the correct event structures.
* src/xterm.c (handle_one_xevent): Don't use structures that
might not exist unless configure found them.
2021-12-26 14:48:13 +08:00
Po Lu
50484ad7d7 Only focus frame implicitly if focus flag is set
* src/xterm.c (x_detect_focus_change): Test for focus flag on
XI entry events.
2021-12-26 14:48:13 +08:00
Po Lu
101bbd1392 Add support for pinch gestures to the XI2 build
* doc/lispref/commands.texi (Misc Events): Document new event
type `pinch'.
* etc/NEWS: Announce new event `pinch'.
* etc/PROBLEMS: Document problems with mismatched libXi
versions.
* lisp/face-remap.el (text-scale--pinch-start-scale): New
variable.
(text-scale-pinch): New command.
* src/keyboard.c (make_lispy_event): Handle PINCH_EVENTs.
(syms_of_keyboard): New symbol `pinch'.
* src/termhooks.h (enum event_kind): New enum `PINCH_EVENT'.
* src/xfns.c (setup_xi_event_mask): Add pinch events to event
mask if available.
* src/xterm.c (handle_one_xevent): Handle pinch events.
2021-12-26 13:55:05 +08:00
Stefan Kangas
4e2058aec3 Merge from origin/emacs-28
89a82182cb Improve documentation of read-multiple-choice
5fccd1e371 Explain why we remove stuff from 'user-full-name'
2021-12-26 06:30:37 +01:00
Po Lu
ab3d5b8b32 Don't clear internal border if frame isn't realized
* src/pgtkterm.c (pgtk_clear_under_internal_border): Don't clear
border if frame isn't realized.  (bug#52705)
2021-12-26 09:20:51 +08:00
Stefan Kangas
7f43b3759d Fix unused variable warning in xfns.c
* src/xfns.c (Fx_server_input_version): Fix unused variable
warning.
2021-12-25 16:41:06 +01:00
Po Lu
e0a78429ca Add a utility function to query the XI2 version on a display
* src/xfns.c (Fx_server_input_version): New function.
(syms_of_xfns): Define new subr.
2021-12-25 20:09:37 +08:00
Eli Zaretskii
5fccd1e371 Explain why we remove stuff from 'user-full-name'
* src/editfns.c (Fuser_full_name): Document why we chop everything
starting from the first comma.  (Bug#52785)
2021-12-25 09:38:39 +02:00
Po Lu
71eb1aac54 Add support for XI 2.4
We will be able to use touchpad (not touchscreen) gestures, such
as pinch and swipe gestures after this change, but they are not
yet exposed to Lisp.

* src/xterm.c (x_term_init): Declare support for XI 2.4 if
present.
2021-12-25 10:38:23 +08:00
Po Lu
8b0e9f44b7 Fix Emacs tooltips on PGTK
* src/pgtkfns.c (x_create_tip_frame): Don't set cursor and
show window.
(Fx_show_tip): Set cursor and show window.
2021-12-25 08:29:00 +08:00
Po Lu
552b74ba9e Fix text decoration display on stretch glyphs with no box on NS
* src/nsterm.m (ns_dumpglyphs_stretch): Draw decorations if
there is no box.
2021-12-24 15:51:34 +08:00
Po Lu
8e0d327b8c Remove useless functions from PGTK port that were breaking emacsbug
* src/pgtkfns.c (Fx_server_vendor, Fx_server_version): Remove
useless functions that returned invalid values.
(syms_of_pgtkfns): Stop defining removed subrs.
2021-12-24 15:24:35 +08:00
Po Lu
965b8b0fad Grab the server when warping the client pointer
* src/xfns.c (Fx_set_mouse_absolute_pixel_position):
* src/xterm.c (x_make_frame_invisible): Avoid race conditions
where the client pointer is destroyed between when it is
obtained and when XIWarpPointer is called.
2021-12-24 14:23:23 +08:00
Po Lu
fbe026cb3e Acquire draw lock when updating menubar on Haiku
* src/haikumenu.c (digest_menu_items): Acquire draw lock.
2021-12-24 03:21:21 +00:00
Po Lu
7078af622b Fix menu grabs on XI2 Motif builds
* src/xmenu.c (x_activate_menubar) [USE_MOTIF]: Clear XI grab.
* src/xterm.c (xi_grab_or_ungrab_device) [USE_MOTIF]: Always
ungrab if a popup is active.
2021-12-24 11:10:09 +08:00
Po Lu
8c99628a71 Fix some more incorrect valuator clearing
* src/xterm.c (handle_one_xevent): Improve detection of stray
ungrab events.
2021-12-24 09:55:15 +08:00
Po Lu
20647467be Drop scrollbar motion events when valuators are found
* src/xterm.c (handle_one_xevent): Drop XI_Motion if it's on
top of a scroll bar and a valuator is found.
2021-12-24 09:20:44 +08:00
Po Lu
d54d8a88e9 Allow window-text-pixel-size to measure pixels around a position
* doc/lispref/display.texi (Size of Displayed Text): Announce
new meaning of `from'.
* etc/NEWS: Announce changes.

* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-up-page):
Use new feature.

* src/xdisp.c (window_text_pixel_size): Understand a special
format of `from' that specifies the amount of pixels above or
below a position.

(Fwindow_text_pixel_size): Update doc string.
2021-12-23 18:55:54 +08:00
Alan Third
ec1312d76a Add native HEIC support on macOS (bug#51381)
* lisp/image.el (image-type-header-regexps):
(image-type-file-name-regexps):
(image-type-auto-detectable): Add auto-detect code for heic.
* src/image.c (syms_of_image): Add heic as an image type under NS.
* src/nsimage.m (ns_can_use_native_image_api): Add heic to list of
possible image types in the native image support lookup.
2021-12-22 20:48:19 +00:00
Alan Third
ab0d7a2b83 Allow resizing undecorated frames on macOS (bug#28512, bug#31795)
* src/nsterm.m (FRAME_DECORATED_FLAGS, FRAME_UNDECORATED_FLAGS):
Remove unused defines.
* src/nsterm.m ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]):
Since this is now the only place these defines are used just put them
inline and add NSWindowStyleMaskResizable for undecorated frames on
Cocoa.
2021-12-22 20:48:19 +00:00
Alan Third
89749a62b5 Make NS toolbar item ID more unique (bug#50160)
* src/nsmenu.m
([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]):
Add the label to the identifier to avoid collisions between toolbar
items that use the same image.
2021-12-22 20:48:19 +00:00
Alan Third
42601d3a93 Make NS toolbar use NSString instead of C strings
* src/nsfns.m ([NSString stringWithLispString:]): Ensure that the lisp
object is actually a string.
* src/nsmenu.m (update_frame_tool_bar): Convert to NSString instead of
C strings.
([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]):
No need to convert to NSString here anymore.
2021-12-22 20:48:19 +00:00
Alan Third
308ad05d37 Fix macfont backend color handling
* src/macfont.m (get_cgcolor): Replace use of ns_lookup_indexed_color.
(CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND):
(CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND):
(CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND): Fix call to get_cgcolor
and fix all callers.
2021-12-22 20:48:19 +00:00
Alan Third
11c0b25503 Further cleanup of NS color code
* src/dispextern.h (FACE_COLOR_TO_PIXEL): Remove define and fix all
callers.
* src/nsterm.h (struct nsfont_info): Remove color_table.
* src/nsterm.m ([NSColor colorWithUnsignedLong:]): Always assume the
input contains the correct alpha value.
(ns_lookup_indexed_color):
(ns_index_color):
(ns_color_index_to_rgba): Remove functions and fix all callers.
(ns_query_color): No longer set pixel to the lookup table index,
always just set it to the ARGB integer value.
(ns_defined_color): Ignore makeindex as we no longer set pixel to the
lookup table index.
(ns_initialize_display_info):
(ns_redisplay_interface): Remove lookup table.
(ns_term_init): Fix the alpha setting.

thing
2021-12-22 20:48:19 +00:00
Alan Third
0f427befe8 Simplify NS color handling
* src/image.c (RGB_TO_ULONG):
(ARGB_TO_ULONG):
(RED_FROM_ULONG):
(RED16_FROM_ULONG):
(GREEN16_FROM_ULONG):
(BLUE16_FROM_ULONG): Define these here for NS too.
* src/nsfns.m (ns_set_foreground_color):
(ns_set_background_color): Use new EmacsColor methods.
* src/nsterm.h (struct ns_color_table): Replace this struct with a
built-in Objective C type.
(RGB_TO_ULONG):
(ARGB_TO_ULONG):
(ALPHA_FROM_ULONG):
(RED_FROM_ULONG):
(GREEN_FROM_ULONG):
(BLUE_FROM_ULONG):
(RED16_FROM_ULONG):
(GREEN16_FROM_ULONG):
(BLUE16_FROM_ULONG): These are no longer needed in the NS specific code.
(struct ns_display_info): Use an NSMutableArray instead of a custom struct.
* src/nsterm.m ([NSColor colorWithUnsignedLong:hasAlpha:]):
([NSColor unsignedLong]): New methods.
(ns_lookup_indexed_color):
(ns_index_color): Use the NSMutableArray lookup table.
(ns_term_init):
(ns_color_index_to_rgba):
(ns_query_color): Use the new EmacsColor methods.
(ns_initialize_display_info):
(ns_delete_display): Initialize and release the NSMutableArray lookup table.
2021-12-22 20:48:19 +00:00
Po Lu
3dbe7caed7 * src/pgtkterm.c (scroll_event): Fix scroll delta scale. 2021-12-22 21:36:18 +08:00
Po Lu
551fe22557 * src/pgtkterm.c (scroll_event): Fix sign of delta_y. 2021-12-22 21:33:00 +08:00
Po Lu
141bf182da Fix horizontal scrolling on PGTK
* src/pgtkterm.c (scroll_event): Fix for when
`mwheel-coalesce-scroll-events' is nil.
2021-12-22 17:29:27 +08:00
Po Lu
f703232b7f Use XI2 calls to warp the client pointer
* src/xfns.c (Fx_set_mouse_absolute_pixel_position):
* src/xterm.c (frame_set_mouse_pixel_position): Replace
calls to XWarpPointer with calls to XIWarpPointer with
the client pointer explictly specified.  This avoids the
odd situation where the client pointer of the root window
is not the client pointer of the frame.
2021-12-22 11:13:23 +08:00
Po Lu
026804b606 Fix GTK crash when clicking on xwidgets on XI2
* src/xterm.c (handle_one_xevent): Drop button events destined
for an xwidget.
2021-12-22 09:24:05 +08:00
Eli Zaretskii
678b29711b ; * src/xdisp.c (display_string): Fix a typo in a comment. 2021-12-21 19:18:33 +02:00
Po Lu
264589cdf7 Fix xg_event_is_scrollbar for grab-related events on XI2
* src/gtkutil.c (xg_event_is_for_scrollbar): Don't return true
if event coordinates are outside the frame on XInput 2.
2021-12-21 19:26:40 +08:00
Po Lu
c0e9785c7c ; * src/xterm.c (handle_one_xevent): Fix typo in last change. 2021-12-21 15:02:37 +08:00
Po Lu
e703735383 Ignore XI_TouchBegin events on the GTK tool bar
* src/xterm.c (handle_one_xevent): Ignore TouchBegin events
that target the tool bar.
2021-12-21 15:00:08 +08:00
Lars Ingebrigtsen
cf2597da0d Revert "Speed up find_field when called from outside a field"
This reverts commit 4d8af56c76.

This leads to lisp-mode-tests failures
2021-12-21 05:25:50 +01:00
Lars Ingebrigtsen
18ce031f9b Remove the `mode-line-percent-position' min width hack
* lisp/bindings.el (mode-line-position): Remove hack to get
min-width to work on the `mode-line-percent-position' bit.
* src/xdisp.c (display_string): Respect min-width in the non-Lisp
string case (bug#52332).
2021-12-21 05:23:11 +01:00
Lars Ingebrigtsen
4d8af56c76 Speed up find_field when called from outside a field
* src/editfns.c (find_field): Speed up the field functions when
called from outside a field (bug#52593).  (In some cursory tests,
this makes the called-from-outside-a-field case about 3x faster.)
2021-12-21 05:23:11 +01:00
Po Lu
43356423a2 Don't drop touch events we're not interested in on GTK3
* src/xterm.c (handle_one_xevent): Allow GTK to handle
unwanted TouchBegin events.
2021-12-21 10:01:37 +08:00
Po Lu
513fe2d6ff Fix touch event menu bar detection
* src/xterm.c (handle_one_event): Don't drop menu bar touch
events.
2021-12-21 09:58:14 +08:00
Po Lu
a5509a2a5e Fix xg_event_is_for_menubar for XI2 events
* src/gtkutil.c (xg_event_is_for_menubar): Use correct fields
for XI2 events.
* src/xterm.c (handle_one_event): Drop TouchBegin events we
know about.
2021-12-21 09:53:10 +08:00
Po Lu
4234995d42 * src/xterm.c (handle_one_xevent): Set user time on touch events. 2021-12-21 09:43:23 +08:00
Po Lu
2bcd299431 Ignore all emulated button events (i.e. those from touchscreens)
* src/xterm.c (handle_one_xevent): Ignore all XIPointerEmulated
events if the display supports XI 2.2 or later.
2021-12-21 09:41:40 +08:00
Paul Eggert
aa1fdb3f6f Put AM_V_GEN etc. first
With the recent changes to src/verbose.mk.in, it’s more important
to be consistent about putting AM_V_GEN and similar macros at the
start of a rule’s recipe, since ‘make’ now outputs the diagnostic
before it executes the recipe rather than the shell outputting it.
Most of the uses were already this way, but there were a few
outliers.  Problem reported by Pip Cet.
* Makefile.in (${srcdir}/info/dir):
* admin/unidata/Makefile.in (${unidir}/charprop.el, ${unifiles})
(${unidir}/emoji-labels.el):
* lib/Makefile.in (libgnu.a, libegnu.a):
* lisp/Makefile.in (TAGS):
* src/Makefile.in (lisp.mk, Emacs):
* test/Makefile.in (%.log, $(test_module)):
Put AM_V_GEN and similar macros first.
2021-12-20 15:05:08 -08:00
Paul Eggert
eaa44ca40e Prefer $(info) to @echo
Have GNU Make output some diagnostics directly, instead of forking
and execing a shell to do it.
* GNUmakefile (help):
* doc/lispref/two-volume.make (vol2.pdf, elisp2med-init)
(elisp2-init):
* doc/misc/Makefile.in (echo-info, echo-sources):
* lib-src/Makefile.in (archlibdir, install, check):
* src/verbose.mk.in (AM_V_AR, AM_V_CC, AM_V_CXX, AM_V_CCLD)
(AM_V_CXXLD, AM_V_ELC, AM_V_ELN, AM_V_GEN, AM_V_GLOBALS)
(AM_V_RC):
* test/Makefile.in (subdirs, subdir-targets):
Prefer $(info) to @echo.
* GNUmakefile (MAKECMDGOALS, configure, Makefile):
Prefer $(warning) to @echo >&2.
* src/verbose.mk.in (AM_V_ELN): Output target, like the others.
2021-12-20 12:24:04 -08:00