Commit graph

45092 commits

Author SHA1 Message Date
Sergey Vinokurov
a5ce31a192 Use assq_no_quit on all local_var_alist accesses
* src/data.c (Fkill_local_variable):
* src/buffer.c (buffer_local_value): Use assq_no_quit instead of
Fassoc/Fassq on local_var_alist (bug#53242).

* src/data.c (Flocal_variable_p): Use assq_no_quit instead of
open-coding the search on local_var_alist.
2022-01-14 08:50:06 +01:00
Po Lu
1158c880e2 Try to make sure an XKB desc is always available
* src/xterm.c (handle_one_xevent): Re-retrieve XKB map if it's
unavailable for some reason upon handling an XKB map or keyboard
notify event.
2022-01-14 14:57:55 +08:00
Po Lu
4e1bf9bf48 Fix out of bounds bitmap access on Haiku
* src/haiku_draw_support.cc (BView_DrawBitmapWithEraseOp): Fix
out of bounds access to bitmap data.
2022-01-14 01:24:34 +00:00
Po Lu
83ae392d59 Refresh keyboard mapping upon receiving new XKB map
* src/xterm.c (handle_one_xevent): Call
XkbRefreshKeyboardMapping where required.
2022-01-14 08:52:53 +08:00
Eli Zaretskii
1ee9275c1b Avoid scrolling display when point moves into invisible text
* src/xdisp.c (try_cursor_movement): Handle point moving into
invisible text.  (Bug#53215)
2022-01-13 15:40:30 +02:00
Eli Zaretskii
8ec475e558 Improve preserving X coordinate during scroll commands
* src/window.c (window_scroll_pixel_based): Don't unnecessarily
move the iterator.  (Bug#53220)
2022-01-13 14:21:10 +02:00
Po Lu
8c8403af36 Fix passive input focus when the pointer moves over inferiors
* src/xterm.c (handle_one_xevent): Don't detect focus on entry
and exit events if we're not on the top window.
2022-01-13 19:43:55 +08:00
Po Lu
626c1dce02 Filter key release events through GTK when using native input
* src/gtkutil.c (xg_filter_key): Set correct event type for key
release events.
* src/xterm.c (x_filter_event): Also filter release events.
2022-01-13 17:56:55 +08:00
Gregory Heytings
48159c16b5 Undelete deleted frames.
* lisp/frame.el (undelete-frame): New command.
(undelete-frame--handle-delete-frame): New auxiliary function.
(undelete-frame--deleted-frames): New auxiliary variables.
(undelete-frame-mode): New minor mode.
(ctl-x-5-map): Bind the new command.

* etc/NEWS: Document the new command and minor mode.

* src/frame.c (Fdelete_frame): Update docstring, and mention the
minor mode.

* lisp/menu-bar.el (menu-bar-file-menu): Add an entry for the
new command.

* doc/emacs/frames.tex (Frame Commands): Document the new command
and minor mode.

See bug#51883.
2022-01-13 10:31:43 +02:00
Po Lu
46f24bf08f Fix GTK native input methods randomly freezing input
* src/gtkutil.c (xg_widget_key_press_event_cb): Exercise the X11
connection causing pselect to return immediately from input.
(bug#53160)
2022-01-13 10:12:39 +08:00
Po Lu
931b6ac973 Block input when drawing fringe bitmaps on Haiku
* src/haikuterm.c (haiku_draw_fringe_bitmap): Block input.
2022-01-13 01:59:23 +00:00
Po Lu
8ba316736f Use XI2 focus events on X toolkit builds
* src/xfns.c (setup_xi_event_mask): Set focus masks on both the
shell window and the frame window.
* src/xterm.c (x_detect_focus_change): Enable XI2 focus code on
Xt.
2022-01-13 09:32:14 +08:00
Eli Zaretskii
7ebcb4b6f2 Avoid assertion violations with variable-weight fonts
* src/font.c (font_score, font_delete_unmatched): Don't assume
weight, slant, and width properties of the font must be fixnums:
some variable-weight fonts violate that assumption.  Reported
by Sean Whitton <spwhitton@spwhitton.name>.  This is for builds
with Fontconfig < v2.11.91, for which the fix in
'ftfont_pattern_entity' cannot work.  (Bug#52888)
2022-01-12 16:52:14 +02:00
Sean Whitton
f373b52ba9 Skip virtual FcPattern entries for variable weight fonts
* src/ftfont.c (ftfont_list): Pass FC_VARIABLE to FcObjectSetBuild.
* src/ftfont.c (ftfont_pattern_entity): Skip meta/virtual FcPattern
entries for variable weight fonts (Bug#52888).
2022-01-12 16:42:27 +02:00
Po Lu
492bf1e06e Use correct coordinates when translating XI2 crossing events
* src/xwidget.c (xwidget_motion_or_crossing): Use displaced
position instead of event position.
2022-01-12 20:13:28 +08:00
Po Lu
aa685a465b Ignore scroll lock key on Haiku
* src/haiku_support.cc (keysym_from_raw_char): Return special
value for keys that shouldn't be sent to Emacs.
(DispatchMessage): Respect said value.
2022-01-12 11:09:38 +00:00
Po Lu
60dd962507 Translate more keys on Haiku
* src/haiku_support.cc (keysym_from_raw_char): Translate print,
scroll lock, and pause/break.
2022-01-12 07:21:28 +00:00
Po Lu
9376f456af Fix display of text decorations in the mode line
This is considered a temporary fix until the cause of
fringe-overwriting underlines is established.

* src/xterm.c (x_draw_glyph_string): Don't constrain decorations
if the row is a tab or modeline.
2022-01-12 11:09:52 +08:00
Po Lu
f2fcea2716 Avoid unnecessary lookup of min and max keycodes when XKB is present
* src/xterm.c (x_emacs_to_x_modifiers): Avoid calling
XDisplayKeycodes when that information is available in the xkb
desc and is not needed anyway.
2022-01-12 10:24:01 +08:00
Po Lu
ee025b7f0c Ignore resetting devices upon some events we don't have to handle
* src/xterm.c (handle_one_xevent): Ignore SlaveSwitch
DeviceChanged events.
2022-01-12 09:28:48 +08:00
Juri Linkov
ecdda194a8 * src/window.c (other-window-scroll-default): New variable (bug#51210).
(Fother_window_for_scrolling): Use it.
2022-01-11 19:28:52 +02:00
Paul Eggert
a980795fd0 Clean up filelock code related to errno
Reduce dependency on Haiku internals, by not assuming that
Haiku errno values (which are negative) are neither -1 nor -2.
This removes an #ifdef HAIKU while still maintaining
portability to Haiku.
* src/filelock.c (NEGATIVE_ERRNO, ANOTHER_OWNS_IT, I_OWN_IT):
New constants, which should work regardless of whether
we are on Haiku or B_USE_POSITIVE_POSIX_ERRORS is defined.
(current_lock_owner, lock_if_free, lock_file, unlock_file)
(Ffile_locked_p): Use them, without assuming anything about errno
value sign.
2022-01-11 08:58:39 -08:00
Po Lu
46c1dd4cd5 Stop ungrabbing when freeing XI devices
This breaks when x_free_xi_devices is called from a
HierarchyChange event where a master device has been removed or
a slave device has been detached, and it should no longer be
required since we now rely on passive grabs.

* src/xterm.c (x_init_master_valuators): Stop calling
XIUngrabDevice on all devices.
2022-01-11 19:06:41 +08:00
Po Lu
e351948667 Make native input work on GTK 2
* src/gtkutil.c (xg_create_frame_widgets): Allow focusing fixed
widget.
2022-01-11 18:13:04 +08:00
Po Lu
73e4335c58 Stop decoding GTK event strings when using native input
* src/gtkutil.c (xg_widget_key_press_event_cb): Stop decoding
event strings.
2022-01-11 18:06:37 +08:00
Stefan Monnier
73b15f45f9 Merge remote-tracking branch 'origin/emacs-28' into trunk 2022-01-10 22:34:55 -05:00
Po Lu
81cb96df88 Use window beneath mouse for determining scroll deltas on Haiku
* src/haikuterm.c (haiku_read_socket): Use window underneath
wheel for calculating scroll deltas.
2022-01-11 01:30:14 +00:00
Po Lu
c060e374a1 * src/filelock.c (lock_if_free): Fix Haiku positive errno check. 2022-01-11 00:51:53 +00:00
Paul Eggert
5705644810 Assume C99 when defining pD
* src/lisp.h (pD): Assume C99 or later, to simplify the ifdefs.
2022-01-10 15:24:30 -08:00
Po Lu
aca1e31e36 Implement recent improvements to underline display on PGTK
* src/pgtkterm.c (pgtk_draw_glyph_string): Respect new underline
face fields.
2022-01-10 20:07:12 +08:00
Po Lu
77c3d41adc Prevent text decorations from overwriting surrounding areas on X
* src/xterm.c (x_draw_underwave): New parameter
`decoration_width'.
(x_draw_glyph_string): Constrain decoration width to current
text area.
2022-01-10 19:54:36 +08:00
Po Lu
4f50d964e5 Allow controlling the underline position of faces
* doc/lispref/display.texi (Face Attributes): Document new
`:position' property of the `:underline' attribute.
* etc/NEWS: Announce new property.
* lisp/cus-face.el (custom-face-attributes): Implement
customization for new face attribute.
* src/dispextern.h (struct face): New fields
`underline_pixels_above_descent_line' and
`underline_at_descent_line_p'.
* src/haikuterm.c (haiku_draw_text_decoration):
* src/nsterm.m (ns_draw_text_decoration):
* src/w32term.c (w32_draw_glyph_string):
* src/xterm.c (x_draw_glyph_string): Respect new face fields.

* src/xfaces.c (realize_gui_face): Handle new `:position'
keyword.
(syms_of_xfaces): New symbol `:position'.
2022-01-10 19:26:46 +08:00
Po Lu
b1f33ff951 Load X resources from a settings file like other programs on Haiku
* doc/emacs/haiku.texi (Haiku Basics): Document how X resources
are discovered on Haiku.
* src/haiku_support.cc (class Emacs): Load settings file.
(be_find_setting): New function.
* src/haiku_support.h (be_find_setting): New prototype.
* src/haikuterm.c (get_string_resource): Look in the settings
file if there's nothing in the in-memory resource database.
2022-01-10 10:01:33 +00:00
Po Lu
16ed07ac8d Use phys cursor height instead of font base to set spot Y
* src/xfns.c (xic_set_xfontset): Use `phys_cursor_height' to
avoid the spot potentially appearing at an incorrect position.
2022-01-10 14:38:18 +08:00
Po Lu
f591835838 Don't set callbacks on XIC when adjusting spot if callbacks are off
* src/xfns.c (xic_set_preeditarea): Don't set callbacks if the
XIC style is not XIMPreeditCallbacks.  (bug#53146)
2022-01-10 14:36:21 +08:00
Po Lu
d5cf772cad ; * src/xterm.c (handle_one_xevent): Fix typo in last change. 2022-01-10 11:35:30 +08:00
Po Lu
697298e745 Make toggling native input methods via shift work again
* src/xterm.c (handle_one_xevent): Start filtering XI key
release events again, but drop the event if the IM asked.
2022-01-10 11:31:41 +08:00
Po Lu
bf121747de Don't hard code key codes on Haiku
* src/haiku_support.cc (keysym_from_raw_char): New function.
(DispatchMessage): Map raw character to keysym if applicable.
(be_map_key): Delete function.
* src/haiku_support.h (struct haiku_key_event): Update fields
to hold keysym and character instead.
* src/haikuterm.c (haiku_read_socket): Don't call be_map_key,
and use keysym field if provided instead.
2022-01-10 02:32:01 +00:00
Po Lu
f3b1badfd6 Map some more keypad keys on Haiku
* src/haiku_support.cc (BMapKey): Rename to `be_map_key'.
(be_map_key): Recognize more key codes.
* src/haiku_support.h (BMapKey, be_map_key): Adjust accordingly.
* src/haikuterm.c (haiku_read_socket): Likewise.
2022-01-10 01:59:34 +00:00
Po Lu
8d0a2e4dce Fix build without X11 I18N
* src/xterm.c (event_handler_gdk):
(handle_one_xevent):
(x_draw_window_cursor):
(x_term_init): Fix build without HAVE_X_I18N.
2022-01-10 09:00:48 +08:00
Po Lu
0f5f2af51e Fix off-by-one errors in caret position application
* src/gtkutil.c (xg_im_context_preedit_changed):
* src/xfns.c (xic_preedit_caret_callback):
(xic_preedit_draw_callback): Constrain caret position to
SCHARS (arg) - 1.
2022-01-10 08:40:26 +08:00
Eli Zaretskii
4b6efda54e ; * src/filelock.c (lock_if_free): Fix comment wording. 2022-01-09 19:21:03 +02:00
Eli Zaretskii
362ceb75a9 ; * src/fns.c (Frequire): Fix wording of doc string. 2022-01-09 19:02:17 +02:00
Po Lu
691015fedb Fix filelock.c for Haiku
This was found during the investigation surrounding bug#53136,
but is not directly related.

* src/filelock.c (lock_if_free): Explictly test err against -1
or -2, and reverse sign of system errors on Haiku.  (No Haiku
error occupies -1 or -2.)
2022-01-09 13:34:19 +00:00
Po Lu
e91848344e Pass through caret position from native GTK input methods
* src/gtkutil.c (xg_im_context_preedit_changed): Set caret
position appropriately.
* src/xfns.c (xg_widget_key_press_event_cb): Ignore modifier
keys.
(xic_preedit_caret_callback, xic_preedit_draw_callback):
Constrain caret position to the string length as well.
2022-01-09 20:43:17 +08:00
Po Lu
59ede5cce8 Fix specification of caret position
* src/xfns.c (xic_preedit_caret_callback):
(xic_preedit_draw_callback): Use `cursor' property correctly.

* src/xterm.c (handle_one_xevent): Stop filtering XI release
events.  This caused more problems than it fixed.
2022-01-09 20:30:58 +08:00
Po Lu
5cee447ed0 Add missing part of last commit
* src/xterm.h (struct x_output): Add field `preedit_caret'.
2022-01-09 19:48:13 +08:00
Po Lu
d5499e3eb2 Display caret in preedit text where the input method asked
* src/xfns.c (xic_preedit_start_callback): Clear caret position.
(xic_preedit_caret_callback): Record new caret position and
announce it.
(xic_preedit_done_callback): Clear caret position.
(xic_preedit_draw_callback): Set caret position appropriately.
2022-01-09 19:46:14 +08:00
Po Lu
3dfefb8bb4 Fix native GTK input for cyrillic input methods
* src/gtkutil.c (xg_widget_key_press_cb): Get unicode mapping of
keyval if string doesn't exist.
* src/xterm.c (handle_one_xevent): Fix build without
HAVE_X_I18N.
2022-01-09 18:16:46 +08:00
Po Lu
51ee62bf28 Reduce flicker on Haiku Emacs tooltips
* src/haikuterm.c (haiku_read_socket): Ignore motion events from
tooltip frames.
2022-01-09 06:54:08 +00:00