Commit graph

46067 commits

Author SHA1 Message Date
Po Lu
e2d870016c Allow looking up window system colors on Haiku
* lisp/help-fns.el (help-fns--editable-variable): Fix describing
variables which don't have symbol values.
* lisp/term/haiku-win.el (haiku-allowed-ui-colors): Set list of
allowed UI colors.
* src/haiku_support.cc (be_get_ui_color): New function.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (haiku_get_color): Look for defined UI color.
(syms_of_haikufns): New defvar `haiku-allowed-ui-colors'.
* src/haikuterm.c (haiku_term_init): Fix coding style.
2022-04-24 05:37:22 +00:00
Po Lu
ddbf2e8ab7 Fix disabling double buffering on Haiku
* src/haikufns.c (haiku_set_inhibit_double_buffering): Garbage
frame correctly after changing double buffering.
* src/haikuterm.c (haiku_calculate_relief_colors)
(haiku_draw_relief_rect, haiku_draw_underwave): Clean up coding
style.
2022-04-24 02:55:19 +00:00
Po Lu
9b6580ccb7 Speed up color cache lookup on X
* src/xterm.c (x_hash_string_ignore_case): New function.
(x_parse_color): Turn color cache into a hash table.
(x_term_init): Allocate color cache.
(x_delete_display): Free color cache correctly.
* src/xterm.h (struct x_display_info): Turn color cache into a
hash table and add appropriate fields.
2022-04-24 08:44:18 +08:00
Juri Linkov
164a7ebdbc Allow not clearing the echo area
* doc/lispref/display.texi (Displaying Messages): Document it.
* lisp/minibuffer.el (clear-minibuffer-message): Return nil.

* src/xdisp.c (clear_message): Respect the dont-clear-message
value.
2022-04-23 17:17:15 +02:00
Eli Zaretskii
ceaa609523 ; Improve doc strings of completion primitives
* src/minibuf.c (Ftry_completion, Fall_completions): Clarify the
doc strings.
2022-04-23 17:15:27 +03:00
Lars Ingebrigtsen
b4b0db72d6 Mention the case of the result in the try-completion doc string
* src/minibuf.c (Ftry_completion): Mention the case of the results
(bug#39484).
2022-04-23 15:16:41 +02:00
Po Lu
759d337b0d Fix key navigation of Lucid menus on XI2
* src/xmenu.c (popup_get_selection): Fix cookie claiming of
input extension events.
(Fx_menu_bar_open_internal): Use right timestamps on XI2.
* src/xterm.c (handle_one_xevent): Dispatch XI2 key events via
Xt when popup is active.
2022-04-23 19:34:46 +08:00
Po Lu
132fa71615 Avoid unnecessary calculations when handling button events during DND
* src/xterm.c (handle_one_xevent): Only calculate DND grab for
button release events.
2022-04-23 10:05:13 +08:00
Po Lu
a0ebc6f20f Avoid clearing splash screen message during DND on Haiku
* src/haikuterm.c (haiku_read_socket): Respect any_help_event_p
when sending help events for DND.
2022-04-23 00:36:45 +00:00
Po Lu
05705454d5 Don't transfer window attributes trying to find the XM drag window
* src/xterm.c (xm_get_drag_window): Select for impossible event
mask instead of asking for the window attributes.
2022-04-22 19:43:42 +08:00
Po Lu
381eb5d5a0 Fix default frame name on Haiku
* src/haikufns.c (haiku_set_background_color)
(haiku_set_cursor_color, haiku_get_pixel, haiku_put_pixel)
(haiku_set_internal_border_width)
(haiku_set_inhibit_double_buffering)
(Fhaiku_mouse_absolute_pixel_position, Fxw_color_defined_p)
(Fxw_color_values, Fx_double_buffered_p)
(Fx_display_backing_store): Clean up coding style.
(haiku_set_name): Use correct default name and don't cons extra
string all the time.

* src/haikuterm.c (haiku_read_socket): Remove unused variable.
(haiku_term_init): Set default name.
(mark_haiku_display): Mark new field.

* src/haikuterm.h (struct haiku_display_info): New field
`default_name'.
2022-04-22 05:42:09 +00:00
Po Lu
664da3e936 Add an option to disable XI2 for debugging purposes
* src/xterm.c (handle_one_xevent): Accept resource
`disableInputExtension', which means to skip setting up the X
input extension.
2022-04-22 09:06:44 +08:00
Po Lu
6a50ce949b * src/haiku_support.cc (gui_abort): Get rid of extern "C" declarations. 2022-04-21 12:41:26 +00:00
Eli Zaretskii
6b9596fff8 Unbreak build with MinGW64.
* src/w32.c (CONSOLE_FONT_INFO): Define only when _WIN32_WINNT is
less than _WIN32_WINNT_WINXP, i.e. for building with mingw.org's
MinGW.
2022-04-21 13:53:57 +03:00
Po Lu
cdf926371d Clean up PGTK code some more
* src/pgtkterm.c (x_alloc_lighter_color): Simplify.  Do not try
to "allocate" colors, remove unused flag and impossible return
value.
(pgtk_clear_frame): Remove unused code from NS port and remove
incorrect workaround for now-fixed double buffering.
(pgtk_make_frame_visible_wait_for_map_event_cb)
(x_clear_glyph_string_rect, x_draw_glyph_string_background)
(x_draw_glyph_string_foreground)
(x_draw_composite_glyph_string_foreground)
(x_draw_glyphless_glyph_string_foreground)
(x_fill_trapezoid_for_relief, x_erase_corners_for_relief)
(pgtk_setup_relief_color, x_draw_relief_rect, x_draw_box_rect)
(x_draw_glyph_string_box, x_get_scale_factor)
(x_draw_horizontal_wave, pgtk_draw_horizontal_wave)
(x_draw_underwave, x_draw_image_relief)
(x_draw_glyph_string_bg_rect, x_cr_draw_image)
(x_draw_image_foreground, x_draw_image_glyph_string)
(x_draw_stretch_glyph_string, pgtk_draw_glyph_string)
(x_draw_hollow_cursor, x_draw_bar_cursor, pgtk_draw_window_cursor)
(pgtk_cr_draw_image, pgtk_draw_fringe_bitmap, hourglass_cb)
(pgtk_show_hourglass, pgtk_redraw_scroll_bars, pgtk_flash)
(x_create_toolkit_scroll_bar)
(x_create_horizontal_toolkit_scroll_bar, x_scroll_bar_create)
(x_scroll_bar_remove, pgtk_set_vertical_scroll_bar)
(pgtk_set_horizontal_scroll_bar, pgtk_judge_scroll_bars)
(x_new_focus_frame, x_focus_changed, enter_notify_event)
(leave_notify_event, focus_in_event, focus_out_event)
(pgtk_cr_accumulate_data): Clean up coding style, rename
functions copied over from X and modified, and remove duplicate
definition of at least one function.
2022-04-21 16:30:25 +08:00
Po Lu
03d16d6d4c Don't leave xm drag initiator info around
* src/xterm.c (x_cleanup_drag_and_drop)
(x_begin_drag_and_drop): Don't confuse GTK+ 2.x by leaving drag
initiator info around after DND completes.
2022-04-21 13:53:43 +08:00
Po Lu
8c282d68bd Use a cache on Haiku to avoid constantly reading fonts during font lookup
* src/haiku_font_support.cc (struct font_object_cache_bucket):
New struct.
(language_code_points): Make `int'.
(hash_string): New function.
(cache_font_object_data, lookup_font_object_data)
(font_object_has_chars): New functions.
(font_check_wanted_chars, font_check_one_of)
(font_check_language): Lookup in cached font object instead.
(be_init_font_data, be_evict_font_cache): New functions.

* src/haiku_support.h (struct haiku_font_pattern): Make
`uint32_t's ints instead.
* src/haikufont.c (haikufont_apply_registry, syms_of_haikufont):
Adjust for those changes.

* src/haikuterm.c (haiku_frame_up_to_date): Clear font lookup
cache every 50 updates.
2022-04-21 03:09:22 +00:00
Po Lu
ab530ddeb5 Make some frame params work on Haiku tooltip frames
* src/haiku_support.cc (RecomputeFeel): Handle tooltips.
(BWindow_set_tooltip_decoration): Use RecomputeFeel instead of
setting window feel by hand.
2022-04-21 00:37:07 +00:00
Po Lu
30812fc084 Implement `below' z-group on Haiku
* src/haiku_support.cc (BWindow_set_z_group): Handle
Z_GROUP_BELOW by setting the B_AVOID_FRONT flag.
2022-04-20 11:47:27 +00:00
Basil L. Contovounesios
b8524003dc Fix build for --enable-checking=structs
* src/pdumper.c (dump_subr): Update Lisp_Subr hash after last change
of 2022-04-18 "Port struct Lisp_Subr to C99".
2022-04-20 12:52:22 +03:00
Po Lu
e4ed7e0ce9 Reset Motif DND protocol numbers when writing targets table
* src/xterm.c (xm_setup_dnd_targets): Set header.protocol to 0
when writing table.
2022-04-20 16:06:06 +08:00
Po Lu
9e48d7468a Implement `above' z-group on Haiku
* src/haiku_support.cc (class EmacsWindow): New field `z_group'.
(RecomputeFeel): New function.
(ParentTo, BWindow_set_override_redirect): Use that instead
instead of manually juggling the window feel around.
(BWindow_set_z_group): New function.

* src/haiku_support.h (enum haiku_z_group): New enum.
* src/haikufns.c (haiku_set_parent_frame): Clean up coding
style.
(haiku_set_z_group): New function.
(haiku_create_frame): Always set z group after window creation,
like on X.
(haiku_frame_parm_handlers): Add `haiku_set_z_group'.
2022-04-20 07:38:47 +00:00
Po Lu
bd3b2a6781 Fix enabling menu bar multiple times on Haiku
* src/haiku_support.cc (FrameResized): Adjust width and height
appropriately when sending menu bar resize event.
* src/haikufns.c (haiku_set_menu_bar_lines): Don't always reset
FRAME_MENU_BAR_LINES and FRAME_MENU_BAR_HEIGHT.
* src/haikumenu.c (free_frame_menubar): Clear Haiku menu bar.
(set_frame_menubar): Fix coding style.
* src/haikuterm.c (haiku_read_socket): Don't adjust height here
anymore.
2022-04-20 03:06:58 +00:00
Paul Eggert
67940394c0 Pacify gcc -std=c99 with printf %p
* src/print.c (print_vectorlike): Assign pointer-to-function
to void * before printing it with %p, as the C standard
doesn’t bless printing function pointers with %p.
2022-04-19 19:19:35 -07:00
Paul Eggert
cfadba6f23 Pacify gcc -std=c99
* src/sysdep.c (system_process_attributes): Use %llu instead of
%Lu for sscanf, as %llu is standard and %Lu is not, and the latter
can provoke warnings if gcc is used pedantically.
2022-04-19 19:19:35 -07:00
Po Lu
f165887819 Check for integer overflow when writing Motif targets tables
* src/xterm.c (xm_setup_dnd_targets): Check for integer overflow
when adding list to target table.
2022-04-20 09:10:48 +08:00
Stefan Monnier
71005decb4 Fix GCC warnings when CHECK_LISP_OBJECT_TYPE
* src/lisp.h (lisp_h_Qni): New macro.
(DEFUN): Use it.
* src/alloc.c (syms_of_alloc): Use it.

* src/bytecode.c (Fbyte_code): Fix Lisp_Object/int mixup.
2022-04-19 08:25:19 -04:00
Po Lu
5fe75feafc Fix `x-mouse-click-focus-ignore-position' for odd coincidences across displays
* src/xterm.c (handle_one_xevent): Save the display alongside
the next mouse click timeout.
(x_delete_display): Clear that display here if applicable.
(x_initialize): Likewise.
2022-04-19 18:51:45 +08:00
Eli Zaretskii
237f4f9295 Fix dimensions of console window of restarted Emacs on MS-Windows
* src/w32.c (get_console_font_size): New function.
(w32_reexec_emacs): Call 'get_console_font_size' to set up the
dimensions of the restarted Emacs's console window to the same
values as that of the original Emacs.
2022-04-19 12:50:01 +03:00
Po Lu
d168decab4 Deal with Motif drag window related races
* src/xterm.c (xm_drag_window_error_handler): New function.
(xm_get_drag_window): If a drag window was created and we have
the temp display grabbed, use that instead.
2022-04-19 15:49:27 +08:00
Po Lu
d78e446072 Minor cleanups to Haiku menu code
* src/haiku_draw_support.cc (BView_SetHighColorForVisibleBell):
Delete function.
* src/haiku_font_support.cc (BFont_dat): Rename to
`BFont_metrics'.
* src/haiku_support.cc (DrawContent): Use correct UI color for
control text.
* src/haiku_support.h (HAIKU_MODIFIER_ALT): Turn into enum.
(enum haiku_modifier_specification): New enum.
* src/haikufont.c (haikufont_open, haikufont_close): Fix coding
style.
2022-04-19 04:39:37 +00:00
Po Lu
92667cc2fb Fix last change for GTK 2
* src/xfns.c (x_set_alpha_background):
* src/xterm.c (x_update_opaque_region): Move some ifdefs around.
2022-04-19 11:18:25 +08:00
Po Lu
4dd47196f6 Fix opaque region treatment on GTK 3
* src/xfns.c (x_set_alpha_background):
* src/xterm.c (x_update_opaque_region): Update opaque region for
tooltip frames the correct way on GTK.
2022-04-19 11:13:59 +08:00
Paul Eggert
9751250adb Port struct Lisp_Subr to C99
* src/lisp.h (struct Lisp_Subr): Don’t use an anonymous union,
a feature missing from C99 and not supported by older OS X.
All uses changed.
2022-04-18 19:47:37 -07:00
Paul Eggert
75dfc1e870 Port module_bignum_count_max to strict C
* src/emacs-module.c (module_bignum_count_max): Make
this a macro, not an enum, since it might not fit into
int as C99 requires.
2022-04-18 19:47:36 -07:00
Po Lu
ace1f32ac1 Fix display of glyphless characters on Haiku
* src/haikuterm.c (haiku_draw_glyph_string_foreground): Fix pen
size when drawing composite string w/o font.
(haiku_draw_glyphless_glyph_string_foreground): Correctly
display glyphless character rectangle.
2022-04-19 01:15:33 +00:00
Alan Third
fa91925e13 Fix glyphless glyph display on NS (bug#54970)
* src/nsterm.m (ns_draw_glyphless_glyph_string_foreground): New
function.
(ns_draw_glyph_string): Use the new function.
* src/nsfont.m (nsfont_draw): Fix the location the glyphs are drawn,
and also which glyphs are drawn.
(ns_glyph_metrics): Reverse ascent and descent.
2022-04-18 20:24:51 +01:00
Eli Zaretskii
a45c1c45a2 Minor improvements in 'restart-emacs' on MS-Windows
* src/w32.c (w32_reexec_emacs): Explicitly request a new console
for the restarted Emacs -nw, and specify its dimensions.  Specify
NULL instead of security attributes, per examples on the Internet.
* src/w32console.c (initialize_w32_display): Check errors in call
to GetConsoleCursorInfo.
2022-04-18 21:04:57 +03:00
Lars Ingebrigtsen
fac640ee86 Make it easier to use Emacs as a script interpreter
* doc/emacs/cmdargs.texi (Initial Options): Document -x.
* lisp/startup.el (command-line-1): Add new -scripteval.
(command-line--eval-script): New function.

* src/emacs.c (main): Transform -x to -scripteval.
(standard_args): Add -x (bug#20682).
2022-04-18 12:59:03 +02:00
Po Lu
89a5aa4ca7 Add missing Motif atoms
* src/xselect.c (symbol_to_x_atom):
(x_atom_to_symbol):
(syms_of_xselect): Optimize for XmTRANSFER_SUCCESS and
XmTRANSFER_FAILURE as well.
2022-04-18 18:39:43 +08:00
Lars Ingebrigtsen
088cb6115f Make `restart-emacs' work when Emacs is started with --chdir
* src/emacs.c (find_emacs_executable): Rename from
load_pdump_find_executable and always define.
(load_pdump): Return the executable.
(main): Store the executable.
(Fkill_emacs): Use the stored executable so that --chdir works
with relative executable names, and so that we attempt to restart
the same executable and not some other Emacs from PATH.
2022-04-18 11:31:28 +02:00
Lars Ingebrigtsen
9fc3b00373 Improve `restart-emacs' error reporting
* src/emacs.c (Fkill_emacs): Do better error reporting on restarting.
2022-04-18 11:02:55 +02:00
Lars Ingebrigtsen
e0009409b8 Make "restart" erroring slightly more reliable
* src/emacs.c (Fkill_emacs): Use emacs_perror for the "restart"
errors -- we've already shut down Emacs at this point, so the
normal erroring machinery isn't reliable.
2022-04-18 10:50:45 +02:00
Po Lu
736fd8b258 Stop skipping ShapeNotify events during DND on GTK+
* src/xterm.c (handle_one_xevent): Don't skip ShapeNotify events
because we can't send these events back to GDK manually.
2022-04-18 16:08:19 +08:00
Po Lu
96b21b8da1 Clarify computation of header line vpos
* src/dispnew.c (update_text_area): Test vpos is more than 1
only if is both a tab and header line.  Reported by Eli
Zaretskii <eliz@gnu.org>.
2022-04-18 16:01:44 +08:00
Eli Zaretskii
2363366862 Fix 'restart-emacs' in -nw mode on MS-Windows
* src/w32.c (openat): #ifdef away: not used.
(w32_reexec_emacs): Kludgey solution for restarting Emacs in the
"-nw" mode.
2022-04-18 10:05:15 +03:00
Po Lu
5b5608c614 Fix glyph skipping optimization when a tab line is enabled
* src/dispnew.c (update_text_area): Compute vpos of header line
correctly when window has tab line.
2022-04-18 13:23:23 +08:00
Po Lu
a9b2206def ; Fix typo in last change
* src/xterm.c (x_wm_set_size_hint): Fix typo.
2022-04-18 09:26:12 +08:00
Po Lu
d1f315751d Minor cleanups to PGTK code
* src/gtkutil.c (xg_set_geometry):
(xg_frame_set_char_size):
(x_wm_set_size_hint): Rename to `xg_wm_set_size_hint'.  All
callers changed.
* src/gtkutil.h: Update prototypes.
* src/pgtkfns.c (unwind_create_frame):
(Fx_create_frame):
(compute_tip_xy):
* src/pgtkterm.c (x_free_frame_resources):
(x_destroy_window):
(x_calc_absolute_position):
(x_set_offset):
(pgtk_set_window_size):
(x_display_pixel_height):
(x_display_pixel_width):
(x_set_parent_frame): Rename `x_foo' functions to `pgtk_foo'.
Get rid of some copy-pasted code from various places.
(pgtk_create_terminal): Clean up coding style.
* src/pgtkterm.h: Update prototypes.
2022-04-18 09:24:36 +08:00
Paul Eggert
0bb8e127b0 Port sqlite.c to OS X 10.6.8 with Xcode 3.2.6
Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg00923.html
* src/sqlite.c (Fsqlite_open): Don’t assume SQLITE_OPEN_MEMORY
is defined.
2022-04-17 17:55:45 -07:00