Commit graph

46181 commits

Author SHA1 Message Date
Po Lu
19231f7db2 Remove unused variable in Haiku selection code
* src/haiku_select.cc (selection_state_flag):
* src/haikuselect.h: Remove variable.
2022-05-04 08:40:58 +00:00
Po Lu
4c9a7010bc Correctly encode and decode filenames on NS
* src/nsfns.m (Fns_read_file_name): Run dir through ENCODE_FILE
and fname through DECODE_FILE.
2022-05-04 15:31:32 +08:00
Po Lu
273b0b95c2 Fix file name encoding on Haiku file dialogs
* src/haikufns.c (Fhaiku_read_file_name): Use ENCODE_FILE and
DECODE_FILE correctly.
2022-05-04 07:26:43 +00:00
Po Lu
268713e227 Set initial size in the Haiku font dialog
* src/haiku_support.cc (class EmacsFontSelectionDialog)
(EmacsFontSelectionDialog): New argument `initial_size'.
(be_select_font): Likewise.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (Fx_select_font): Set font dialog size to the
pixel size of the current font.
2022-05-04 05:46:24 +00:00
Po Lu
10284ca3d3 Encode and decode filenames correctly on Haiku
* src/haikufns.c (Fhaiku_read_file_name): Decode file names
correctly.
2022-05-04 03:32:23 +00:00
Po Lu
b5cf6c1ab6 Clean up Haiku file panel code
* lisp/term/haiku-win.el (x-file-dialog): Fix nil values of
`default-filename'.
* src/haiku_io.c (haiku_len): Remove `FILE_PANEL_EVENT'.
(record_c_unwind_protect_from_cxx, c_specpdl_idx_from_cxx)
(c_unbind_to_nil_from_cxx): Delete functions.
* src/haiku_support.cc (MessageReceived): Write pointer to
buffer to file panel port instead.
(struct popup_file_dialog_data): Delete strict.
(unwind_popup_file_dialog): Delete functions.
(be_popup_file_dialog): Accept a pointer to
`process_pending_signals' and run nested event loop as usual.

* src/haiku_support.h (enum haiku_event_type): Remove
`FILE_PANEL_EVENT'.
(struct haiku_file_panel_event): Delete struct.
* src/haikufns.c (unwind_popup): Delete function.
(Fhaiku_read_file_name): Update and quit on invalid filename.

* src/haikuterm.c (struct unhandled_event): Delete struct.
(haiku_read_socket): Remove "unhandled events".
2022-05-04 03:23:11 +00:00
Po Lu
7dfb068c13 * src/haikufns.c (haiku_create_frame): Improve default border width. 2022-05-04 01:42:30 +00:00
Po Lu
185c2f1904 Fix display of placeholder composite string on Haiku
* src/haikuterm.c
(haiku_draw_composite_glyph_string_foreground): Correct
translation of XDrawRectangle.
2022-05-04 00:47:52 +00:00
Po Lu
a1dc1512b3 Fix event mask and source indication of _NET_WM_STATE messages
* src/xselect.c (x_send_client_event): Make static.
* src/xterm.c (set_wm_state): Send event with correct mask and
source indication set.
* src/xterm.h: Update prototypes.
2022-05-04 08:40:12 +08:00
Po Lu
b8dfd8400a * src/haiku_support.cc (DrawContent): Use right UI color. 2022-05-03 08:19:41 +00:00
Po Lu
5adc84a27b Make menu bar help text work on macOS as well
* lisp/tooltip.el (tooltip-show-help): Resort to displaying
messages in the echo area on NS.

* src/nsmenu.m ([EmacsMenu menu:willHighlightItem:]): Call
`show_help_echo' instead of storing an event into the keyboard
buffer.
2022-05-03 16:12:24 +08:00
Po Lu
f9dea5b4c5 Fix default font in macOS font dialogs
* src/nsterm.m ([EmacsView noteUserSelectedFont]): Use current
font if none was selected.
2022-05-03 16:05:46 +08:00
Po Lu
64aac418c2 Fix some font parsing problems on NS
* src/nsterm.m (ns_font_desc_to_font_spec): Fix processing of
condensed width.
2022-05-03 16:02:02 +08:00
Po Lu
0b94669c14 Handle GraphicsExpose events on scroll bars
* src/xterm.c (x_scroll_bar_expose): Handle GraphicsExpose
events.
(handle_one_xevent): Give graphics exposures to scroll bars.
2022-05-03 13:40:54 +08:00
Po Lu
c77ef7d193 Make sure rectangles are drawn correctly on X
* src/xfaces.c (prepare_face_for_display): Always use line-width
of 1.
* src/xfns.c (x_make_gc): Likewise.
* src/xterm.c (x_scroll_bar_expose): Comment out obsolete code.
2022-05-03 11:43:32 +08:00
Po Lu
61a5829c1e Fix glyphless glyph display on Haiku
* src/haikuterm.c
(haiku_draw_glyphless_glyph_string_foreground): Fix rectangle
width.
2022-05-03 03:18:11 +00:00
Po Lu
0d5befb882 Fix font matching of "Fira Code Retina" and "Fira Code Regular" on Haiku
* src/haiku_font_support.cc (font_family_style_matches_p): Don't
allow matches on fonts with an adstyle if none was specified in
the input pattern.
2022-05-03 02:44:16 +00:00
Po Lu
952cc28e58 Clean up X11 double buffering code
This fixes several latent bugs where code went down the path
with double buffering enabled when it wasn't, and vice versa.

* src/xfns.c (x_set_inhibit_double_buffering): Improve
commentary and only define when HAVE_XDBE.
(x_mark_frame_dirty): Only set buffer flip flag when HAVE_XDBE.
(initial_set_up_x_back_buffer): Clean up coding style and remove
unnecessary block_input pair.
(Fx_double_buffered_p): Always return nil if !HAVE_XDBE.
(x_frame_parm_handlers): Don't set double buffering handler if
!HAVE_XDBE.

* src/xftfont.c (xftfont_drop_xrender_surfaces, xftfont_driver):
Only define when XDBE is available.

* src/xterm.c (x_drop_xrender_surfaces): Likewise.
(x_clear_window): Don't test double buffering flags when
!HAVE_XDBE.
(show_back_buffer): Only define when HAVE_XDBE.
(x_flip_and_flush): Don't try to flip when !HAVE_XDBE.
(XTframe_up_to_date): Likewise.
(XTbuffer_flipping_unblocked_hook): Only define when Xdbe is
available.
(x_clear_area): Don't test double buffering flags when Xdbe is
not available.
(flush_dirty_back_buffer_on): Don't define if there's no DBE.
(handle_one_xevent, x_create_terminal): Likewise.

* src/xterm.h (FRAME_X_DRAWABLE): Fix coding style.
2022-05-03 09:22:06 +08:00
Po Lu
64bcfcbd32 ; * src/nsterm.m (syms_of_nsterm): Fix typo in defsym. 2022-05-03 08:43:26 +08:00
Po Lu
7bf17ceee8 Wait for events from all displays in Xm dialogs even on XI2
* src/xfns.c (Fx_file_dialog): Always process events from all
displays.
2022-05-02 20:18:21 +08:00
Stefan Kangas
2fba71cf1f Fix handling double-click-time nil or t
* lisp/mouse.el (mouse-double-click-time): New function to always
return a number for `double-click-time'.
* lisp/emulation/viper-mous.el (viper-multiclick-timeout):
* lisp/foldout.el (foldout-mouse-swallow-events):
* lisp/help.el (help--read-key-sequence):
* lisp/org/org-mouse.el (org-mouse-show-context-menu): Use
'mouse-double-click-time' instead of 'double-click-time'.
* src/keyboard.c (syms_of_keyboard): Mention
'mouse-double-click-time' in doc string of 'double-click-time'.
* test/lisp/mouse-tests.el (mouse-test-mouse-double-click-time):
New test.
2022-05-02 12:03:08 +02:00
Po Lu
3894522559 Fix inconsistencies in Haiku font selection dialog
* src/haiku_font_support.cc (font_family_style_matches_p): Fix
coding style.
* src/haikufont.c (haikufont_pattern_from_object): Set slant and
width using correct object.
2022-05-02 09:05:40 +00:00
Po Lu
f70dfb74cc Fix handling of some weights in the Haiku font driver
* src/haiku_font_support.cc (font_style_to_flags):
* src/haiku_support.h (enum haiku_font_weight):
* src/haikufont.c (haikufont_weight_to_lisp)
(haikufont_lisp_to_weight): Make `ultralight' and `extralight'
mean the same thing.
2022-05-02 08:46:23 +00:00
Po Lu
a6a4f1d6d1 Improve font dialog on macOS
* src/nsterm.m ([EmacsView changeFont:]): Don't exit loop here
on macOS.
([EmacsView noteUserSelectedFont]): New function.
([EmacsView showFontPanel]): Add explicit "OK" button on macOS.
2022-05-02 15:06:58 +08:00
Po Lu
3ea1a6672b Default to currently selected font in Haiku font dialogs
* src/haiku_font_support.cc (be_find_font_indices): New
function.
* src/haiku_support.cc (class EmacsFontSelectionDialog)
(UpdateStylesForIndex, EmacsFontSelectionDialog): Allow
specifying an initial font family and style.
(be_select_font): New parameters `initial_family' and
`initial_style'.
* src/haiku_support.h: Update prototypes.

* src/haikufont.c (haikufont_lisp_to_weight)
(haikufont_lisp_to_slant, haikufont_lisp_to_width): Handle
`regular'.
(haikufont_pattern_from_object): New function.
(haikufont_spec_or_entity_to_pattern): Fix coding style.
(Fx_select_font): Compute indices based on currently selected
font.
(syms_of_haikufont): New defsyms.
2022-05-02 05:49:42 +00:00
Po Lu
be3267eb34 Fix race conditions with async input in some Haiku dialogs
* src/haikufns.c (Fhaiku_save_session_reply):
* src/haikufont.c (Fx_select_font): Block sigio around system
calls.
2022-05-02 01:59:52 +00:00
Po Lu
48ea81af97 Fix the macOS build
* src/nsterm.m (ns_font_desc_to_font_spec, syms_of_nsterm):
Define missing symbols that are only on GNUstep.
2022-05-02 09:38:36 +08:00
Po Lu
7b05f351f2 Make the NS font dialog return more correct values
* src/nsfns.m (Fx_select_font): Update doc string.
* src/nsterm.m (ns_font_desc_to_font_spec): New
function.
([EmacsView showFontPanel]): Return selected font as a
font spec instead.
2022-05-02 09:32:54 +08:00
Po Lu
4fac694669 Fix devices staying disabled in some cases
* src/xterm.c (handle_one_xevent): Process queued disables
before handling an XIDeviceEnabled situation.
2022-05-02 08:49:40 +08:00
Po Lu
9370a4763a Replace NS code that implemented font panels in a different way
* doc/emacs/macos.texi (Mac / GNUstep Events): Document removal
of `ns-change-font' event.  The font panels are now implemented
normally, via `x-select-font'.

* lisp/term/common-win.el (x-setup-function-keys): Likewise.

* lisp/term/ns-win.el (global-map, ns-popup-font-panel): Remove.
(x-select-font, mouse-set-font, ns-input-font):
(ns-input-fontsize): Remove.
(ns-respond-to-change-font): Delete function.

* src/nsfns.m (Fns_popup_font_panel): Delete function.
(Fx_select_font): New function.
(syms_of_nsfns): Update subrs.
* src/nsterm.h (@interface EmacsView):
* src/nsterm.m (ns_select_1): New function.
(ns_select): Wrap around that instead.
([EmacsView changeFont:]): Exit nested event loop
([EmacsView showFontPanel:]): New function.
2022-05-01 21:39:54 +08:00
Lars Ingebrigtsen
730ad4a373 Make scroll-other-window respect target window remappings
* lisp/window.el (scroll-other-window, scroll-other-window-down):
Moved from window.c and change implementation so that they respect
command remappings in the target window (bug#20236).
2022-05-01 12:47:41 +02:00
Eli Zaretskii
8734d60b05 Improve documentation of 'malloc-trim'
* src/alloc.c (Fmalloc_trim): Fix the doc string.

* etc/NEWS: Document which systems support 'malloc-trim'.
2022-05-01 13:06:33 +03:00
Lars Ingebrigtsen
29f3d4d2c6 Add new function `malloc-trim'
* configure.ac (PGTK_LIBS): Check for malloc_trim.

* src/alloc.c (Fmalloc_trim): Add new function (bug#45200).
2022-05-01 11:51:43 +02:00
Po Lu
6984f325bd Fix specifying zero as a size for fonts on Haiku
* src/haiku_support.cc (MessageReceived): Set `size_specified'
correctly.
2022-05-01 09:08:33 +00:00
Po Lu
7c50fb248d Improve display of Haiku font dialog
* src/haiku_support.cc (EmacsFontSelectionDialog)
(class EmacsFontSelectionDialog, FrameResized): Set minimum size
based on individual view dimensions and add label to size
control.
(BWindow_set_min_size): Delete function.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_update_size_hints): Stop setting min
size, since that doesn't work correctly on Haiku.
2022-05-01 08:54:26 +00:00
Po Lu
d17d9c50c5 Allow specifying font size in the Haiku font selection dialog
* src/haiku_support.cc (struct font_selection_dialog_message):
New fields `size' and `size_specified'.
(class EmacsFontSelectionDialog): New `size_entry' control.
(MessageReceived): Set size from that control if available.
(EmacsFontSelectionDialog): Initialize that control.
(FrameResized): Handle layout for that control.
(be_select_font): New field `size'.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (Fx_select_font): Populate font spec with
size.
2022-05-01 05:42:32 +00:00
Po Lu
ece2ee965f Allow quitting inside font selection dialogs on Haiku
* src/haiku_support.cc (WaitForChoice): Accept new function for
checking quit flag.
(be_select_font): Pass that function.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (haikufont_should_quit_popup): New function.
(Fx_select_font): Give said function to `be_select_font'.
2022-05-01 03:20:58 +00:00
Po Lu
ed0de6200d Allow invoking fonts in the Haiku font dialog
* src/haiku_support.cc (MessageReceived): Handle invocations.
(EmacsFontSelectionDialog): Set style panel invocation message.
2022-05-01 02:43:18 +00:00
Po Lu
7dda9835c6 Improvements to the Haiku font dialog
* src/haiku_support.cc (class EmacsFontSelectionDialog)
(EmacsFontSelectionDialog, FrameResized): Fix colors and respect
monospace only.
(be_select_font): New parameter `allow_monospace_only'.
* src/haiku_support.h: Update prototype.
* src/haikufont.c (Fx_select_font): Respect
`exclude-proportional'.
2022-05-01 02:17:04 +00:00
Po Lu
07ae30d8f2 Also fix some compiler warnings in xterm.c that didn't show up
* src/xterm.c (x_dnd_begin_drag_and_drop): Don't define unused
variable on GTK builds.
2022-05-01 09:45:20 +08:00
Po Lu
4e6eb023e0 Fix the GTK build
* src/xterm.c (x_dnd_begin_drag_and_drop): Let GTK handle events
again.
2022-05-01 09:43:08 +08:00
Po Lu
905fabe590 * src/xterm.c (x_dnd_begin_drag_and_drop): Fix typo. 2022-05-01 09:41:16 +08:00
Po Lu
ba0264e191 Fix processing events from multiple displays during DND
* src/xterm.c (x_next_event_from_any_display): New function.
Only used on no-toolkit builds.
(x_dnd_begin_drag_and_drop): Compute correct dpyinfo for
handle_one_xevent.
2022-05-01 09:37:12 +08:00
Po Lu
61d6d43fe5 Clean up X Windows tooltip code
* src/xfns.c (x_hide_tip): Remove "bloodcurdling hack".
* src/xterm.c (handle_one_xevent): Add a better version here
instead.  The code is unlikely to be hit as well, since tooltip
frames are typically deleted, not just hidden.
2022-05-01 09:15:52 +08:00
Po Lu
b2fdf78fd9 Implement font selection dialog on Haiku
* src/haiku_font_support.cc (font_style_to_flags): Handle style
allocation failures.
(be_font_style_to_flags): New function.

* src/haiku_support.cc (struct font_selection_dialog_message):
New struct.
(class EmacsFontSelectionDialog): New class.
(be_select_font): New function.

* src/haiku_support.h: Update prototypes.
* src/haikufont.c (Fx_select_font): New function.
(syms_of_haikufont): Define new subr.
2022-05-01 01:00:15 +00:00
Lars Ingebrigtsen
0ea0aa255c Fix Vx_show_tooltip_timeout in ns build, too
* src/nsfns.m (Fx_show_tip): Respect Vx_show_tooltip_timeout here,
too.
2022-04-30 18:21:51 +02:00
Lars Ingebrigtsen
52e6352b81 Fix compilation after recent x-show-tooltip-timeout changes
* src/dispnew.c (syms_of_display): Move x-show-tooltip-timeout to
a common file to avoid breaking other systems.
2022-04-30 18:20:19 +02:00
Lars Ingebrigtsen
655d2319bc Use x-show-tooltip-timeout in all the implementations
* src/haikufns.c (Fx_show_tip): Use the timeout variable.
* src/pgtkfns.c (Fx_show_tip): Ditto.

* src/w32fns.c (Fx_show_tip): Ditto.

* src/xfns.c (Fx_show_tip): Doc fix.
2022-04-30 17:38:34 +02:00
Lars Ingebrigtsen
86b6a69f86 Don't hard code the default x-show-tip timeout
* src/xfns.c (Fx_show_tip): Use it.
(syms_of_xfns): Add a new x-show-tooltip-timeout variable
(bug#23341).
2022-04-30 17:09:02 +02:00
Po Lu
2a2b3f5834 Fix some cases of flicker on MS Windows
* src/w32term.c (w32_read_socket): Fix typo in check before
flipping buffers.
2022-04-30 19:03:09 +08:00