1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00
Commit Graph

577 Commits

Author SHA1 Message Date
Paul Eggert
ce660c5c30 lwlib: pacify gcc -Wmissing-variable-declarations
* lwlib/lwlib.c (lwlib_toolkit_type): Remove unused var.
* lwlib/xlwmenu.c (submenu_destroyed): Now static.
* src/xmenu.c (widget_id_tick): Declare extern, as a FIXME.
2024-06-03 22:34:33 -07:00
Po Lu
657275529e Revert "Add new swap macro and use it"
typeof is an extension which does not exist in Standard C, so macros
using it are unsuitable for inclusion in Emacs.

This reverts commit 3788952327.
2024-01-06 15:28:14 +08:00
Stefan Kangas
3788952327 Add new swap macro and use it
A `swap` macro prevents programming errors and is more concise.
It is a natural addition to our existing `min` and `max` macros.

* src/lisp.h (swap): New macro.
* lwlib/xlwmenu.c (draw_shadow_rectangle, draw_shadow_rhombus):
* src/androidterm.c (android_get_surrounding_text):
* src/buffer.c (Fmake_overlay, modify_overlay, Fmove_overlay):
* src/dispnew.c (swap_glyphs_in_rows, reverse_rows):
* src/editfns.c (Finsert_buffer_substring)
(Fcompare_buffer_substrings):
* src/eval.c (run_hook_wrapped_funcall):
* src/fns.c (extract_data_from_object):
* src/regex-emacs.c (forall_firstchar_1):
* src/textconv.c (textconv_query, get_extracted_text)
(get_surrounding_text):
* src/textprop.c (validate_interval_range)
(verify_interval_modification):
* src/w32uniscribe.c (OTF_INT16_VAL):
* src/xfaces.c (load_face_colors):
* src/xterm.c (SWAPCARD32): Prefer using above macro to open-coding.
2024-01-06 08:22:08 +01:00
Po Lu
8e1c56ae46 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
Paul Eggert
1b9ffd2811 Fix dependency bug when building lwlib
* lwlib/Makefile.in (DEPFLAGS): Use OBJS to calculate dependency
file names, not ALLOBJS.  This fixes a typo introduced
in 2015-05-15 "Replace AC_SUBST_FILE in configure with include in
Makefiles" that caused lwlib/*.o to not be rebuilt sometimes
when that was needed.
2023-01-13 23:39:51 -08:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Paul Eggert
97067349a8 Fix unlikely core dump with Xaw
* lwlib/lwlib-Xaw.c (make_dialog): Don’t dump core if calloc fails.
Caught with --enable-gcc-warnings.
2022-08-25 18:30:10 -07:00
Po Lu
05a022c36e Fix calculation of default highlightForeground in the lucid menu bar
* lwlib/xlwmenu.c (xlwMenuResources, display_menu_item)
(make_drawing_gcs, make_shadow_gcs, openXftFont, XlwMenuRealize)
(XlwMenuSetValues): Use -1 as the default for
highlight_foreground.  Replace that with the normal foreground
when creating GCs.  Reported by Colin Baxter
<m43cap@yandex.com>.
2022-07-20 19:06:27 +08:00
Manuel Giraud
38f9e9cb2c Colored menu highlight in Lucid backend
* lwlib/xlwmenuP.h:
* lwlib/xlwmenu.h:
* lwlib/xlwmenu.c: Introduce resources to handle colored highlighting
of menu entries.
* doc/emacs/xresources.texi (Lucid Resources): Documentation.
2022-07-16 18:59:09 +08:00
Manuel Giraud
d8225e9fa1 ; * lwlib/xlwmenu.c (make_shadow_gcs): Remove "a = a" pattern.
* lwlib/xlwmenu.c (make_shadow_gcs): Remove code that sets a value
to itself (bug#56479).
2022-07-11 12:09:13 +02:00
Po Lu
a4dcc8b9a9 Fix recent change to xlwmenu.c
* lwlib/xlwmenu.c (ungrab_all): Ungrab keyboard if it was
grabbed.  This handles `lucid--menu-grab-keyboard' changing
while the menu is open.

(XlwMenuDestroy):
(pop_up_menu): Record if the keyboard was grabbed.
2022-06-21 22:14:49 +08:00
Eli Zaretskii
3518ab51d1 ; * lwlib/xlwmenu.c (ungrab_all): Fix typo. 2022-06-21 15:35:22 +03:00
Lars Ingebrigtsen
649b43d20c Make Lucid menus work from the keyboard also when uninstalled
* lwlib/xlwmenu.c (ungrab_all, pop_up_menu): Use it.

* src/keyboard.c (syms_of_keyboard): New variable (bug#46990).
2022-06-21 12:15:11 +02:00
Po Lu
d6b5ac0f94 * lwlib/lwlib.c (lw_separator_p): Fix empty strings being separators. 2022-05-06 11:32:19 +08:00
Po Lu
6efed75ff3 Implement `pre_activate' callbacks for Motif menus
* lwlib/lwlib-Xm.c (make_menu_in_widget): Add
xm_pop_up_callback as the popup callback.
(xm_pop_up_callback): New function.
2022-03-05 09:35:44 +08:00
Po Lu
f980eed4c1 Fix crashes and other bugs on LessTif
* lwlib/lwlib-Xm.c (make_menu_in_widget): XmIsRowColumn is
broken on the latest LessTif release, so avoid that here.
* src/xfns.c (x_window): Add PropertyChangeMask which LessTif
doesn't do itself.
2022-03-01 19:15:46 +08:00
Po Lu
17431ca1cc Fix Motif menu help text in submenus
* lwlib/lwlib-Xm.c (xm_arm_callback):
(make_menu_in_widget):
(update_one_menu_entry):
(xm_update_one_widget):
(do_call): Pass instance to arm callback and use wv as user data
instead of call data.
2022-03-01 11:30:52 +08:00
Po Lu
704a40ad75 Don't send help-echo on menu button arming not caused by motion events
* lwlib/lwlib-Xm.c (xm_arm_callback): Ignore arming if the arm
was not caused by an EnterNotify or MotionNotify event.
2022-02-27 19:33:16 +08:00
Po Lu
65f0785917 Fix menu bar not opening after popup menu is dismissed on Lucid
* lwlib/xlwmenu.c (XlwMenuDestroy): Only set submenu_destroyed
if menu bar widget.
2022-02-08 10:37:24 +08:00
Po Lu
a5e6a7c3bc * lwlib/xlwmenu.c (pop_up_menu): Fix cast. 2022-02-07 17:48:00 +08:00
Po Lu
32dc552a53 * lwlib/xlwmenu.c (pop_up_menu): Work around motion problems on XI2. 2022-02-06 13:40:21 +08:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Po Lu
d257d92d17 * lwlib/xlwmenu.c (fit_to_screen): Adjust correctly for child menus. 2021-12-28 17:53:20 +08:00
Po Lu
b6b2f797d9 Fix menu placement on multiple-display setups when using lwlib
* lwlib/xlwmenu.c (fit_to_screen):
(pop_up_menu): Adjust menu position based on dimensions of the
current monitor's workarea.  (bug#52809)

* src/xfns.c (x_get_monitor_attributes): Stop testing for the
RandR extension here.
(xlw_monitor_dimensions_at_pos_1):
(xlw_monitor_dimensions_at_pos): New functions.

* src/xterm.c (x_term_init): Query for the RandR extension when
connecting to a display.
* src/xterm.h (xlw_monitor_dimensions_at_pos): New prototype.
2021-12-28 10:52:38 +08:00
Gregory Heytings
8efee422e1 Re-enable the disabledForeground X resource.
* doc/emacs/xresources.texi (Lucid Resources): Document the resource.
Also document the 'cursor' resource (bug#52052).
* lwlib/xlwmenu.c (make_drawing_gcs): Re-enable the use of the
disabledForeground resource.  The use of this X resource was disabled
without reason in commit ef93458b2f by overwriting its value with the
value of the foreground resource.
2021-11-24 11:55:58 +01:00
Gregory Heytings
2ba7d1e84e Implement the buttonForeground resource
* lwlib/xlwmenu.c (draw_shadow_rectangle, draw_shadow_rhombus):
Use the buttonForeground resource color (bug#51988).
2021-11-20 10:37:20 +01:00
Gregory Heytings
24a817ccad New X resource to control the border thickness of menus
* lwlib/xlwmenu.h (XtNborderThickness, XtCBorderThickness): New X
resource name.
* lwlib/xlwmenuP.h (XlwMenuPart): New border_thickness field.
* lwlib/xlwmenu.c (xlwMenuResources): Access the new resource.
(draw_shadow_rectangle): Use the new resource value.
* doc/emacs/xresources.texi (Lucid Resources): Document the new
resource (bug#51867).
2021-11-16 09:00:24 +01:00
Glenn Morris
305e4807a4 Base the "extraclean" Make rule on "maintainer-clean"
* Makefile.in (FIND_DELETE): New, set by configure.
(extraclean_dirs): Remove.
(extraclean): Make it just a small variation on maintainer-clean.
* admin/charsets/Makefile.in (extraclean):
* admin/grammars/Makefile.in (extraclean):
* admin/unidata/Makefile.in (extraclean):
* leim/Makefile.in (extraclean):
* lib-src/Makefile.in (extraclean):
* lisp/Makefile.in (extraclean):
* lwlib/Makefile.in (extraclean):
* nt/Makefile.in (extraclean):
* src/Makefile.in (extraclean): Remove target.
* lib/Makefile.in (extraclean): Merge into maintainer-clean.
2021-05-09 18:14:12 -07:00
Eli Zaretskii
12d2fd6037 Fix 'extraclean' targets
* GNUmakefile: Add description of 'extraclean'.

* Makefile.in (extraclean_dirs): Add lwlib.

* lwlib/Makefile.in (clean mostlyclean extraclean): Add
'extraclean' target.

* lisp/Makefile.in (extraclean): Remove ${loaddefs}, not just
${LOADDEFS}.  Delete all backup and autosave files.
2021-04-01 15:57:55 +03:00
Glenn Morris
d632622b5a Simplify silent-rules build machinery
* src/verbose.mk.in: New file.
* configure.ac (AM_V, AM_DEFAULT_V): Remove output variables.
(src/verbose.mk): New output file.
* Makefile.in, admin/charsets/Makefile.in:
* admin/grammars/Makefile.in, admin/unidata/Makefile.in:
* doc/emacs/Makefile.in, doc/lispintro/Makefile.in:
* doc/lispref/Makefile.in, doc/misc/Makefile.in, leim/Makefile.in:
* lib-src/Makefile.in, lib/Makefile.in, lisp/Makefile.in:
* lwlib/Makefile.in, nt/Makefile.in, oldXMenu/Makefile.in:
* src/Makefile.in, src/verbose.mk.in, test/Makefile.in:
Include src/verbose.mk rather than repeatedly defining AM_V_at etc.
2021-03-06 16:28:46 -08:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
YAMAMOTO Mitsuharu
da00a6f317 Fix Xaw widget text disappearing when built with cairo (bug#43418)
* lwlib/lwlib-utils.c (crxft_font_open_name): Use FcFontMatch to
get a pattern to pass to cairo_ft_font_face_create_for_pattern.
2020-12-06 14:21:35 +09:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Paul Eggert
d7c6836288 Avoid some strlen work, primarily via strnlen
* admin/merge-gnulib (GNULIB_MODULES): Add strnlen.
* lib-src/etags.c (find_entries):
* src/emacs.c (main):
* src/nsmenu.m (parseKeyEquiv:):
* src/nsterm.m (ns_xlfd_to_fontname):
* src/term.c (vfatal):
Prefer !*X to !strlen (X).
* lib-src/etags.c (pfnote, add_regex):
* lib-src/pop.c (pop_open):
* lib-src/update-game-score.c (main):
* lwlib/lwlib.c (lw_separator_p):
* src/doprnt.c (doprnt):
* src/emacs.c (main):
* src/inotify.c (inotifyevent_to_event):
* src/keyboard.c (menu_separator_name_p, parse_tool_bar_item):
* src/sysdep.c (get_current_dir_name_or_unreachable):
* src/xdisp.c (store_mode_line_string):
Use strnlen to avoid unnecessary work with strlen.
* lib-src/etags.c (Prolog_functions, prolog_pr)
(Erlang_functions, erlang_func):
Prefer ptrdiff_t to size_t when either will do.
(prolog_pr, erlang_func): New arg LASTLEN, to avoid
unnecessary strlen call. All callers changed.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/strnlen.c, m4/strnlen.m4: New files, copied from Gnulib.
* lwlib/lwlib.c (lw_separator_p):
* src/json.c (json_has_prefix):
Use strncmp to avoid unecessary work with strlen + memcmp.
* src/process.c (set_socket_option): Use SBYTES instead of strlen.
2019-06-25 14:55:08 -07:00
YAMAMOTO Mitsuharu
82052afb24 Avoid empty menu bar on Xaw with cairo
* lwlib/lwlib-utils.c (crxft_font_open_name) [USE_CAIRO]: Return NULL if
font extents are bogus.
2019-06-10 12:57:30 +09:00
YAMAMOTO Mitsuharu
5f4e8e2e08 Don't link libXft when using cairo
* configure.ac: Check cairo early.  Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined	USE_CAIRO || defined HAVE_XFT.
2019-04-24 12:31:37 +09:00
YAMAMOTO Mitsuharu
085929ca93 Release xft_data in widget destroy callback to avoid visual distraction
* lwlib/lwlib-int.h (struct _widget_instance) [HAVE_XFT]: Remove nr_xft_data.
* lwlib/lwlib-Xaw.c (find_xft_data, xaw_update_one_widget) [HAVE_XFT]: Loop
while widget member is not NULL instead of using nr_xft_data.
(xaw_destroy_instance) [HAVE_XFT]: Move xft_data release code from here ...
(destroy_xft_data) [HAVE_XFT]: ... to here.
(make_dialog) [HAVE_XFT]: Add destroy_xft_data as destroy callback for dialog.
2019-04-23 17:27:04 +09:00
YAMAMOTO Mitsuharu
21db386ac0 Fix text metrics calculation in Xft support for lwlib
* lwlib/lwlib-Xaw.c (get_text_width_and_height) [HAVE_XFT]:
* lwlib/xlwmenu.c (string_width) [HAVE_XFT]: Use xOff member instead of width.
2019-04-21 11:39:06 +09:00
YAMAMOTO Mitsuharu
75e68b8777 * lwlib/lwlib-Xaw.c (draw_text) [HAVE_XFT]: Fix memory leak. 2019-04-21 09:53:39 +09:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Paul Eggert
e8bb0420a0 More porting to GCC 8 of --enable-gcc-warnings
Backport from master.
I ran into this when building Emacs 26 with GCC 8 on Fedora 29 x86.
* lwlib/lwlib-Xaw.h (xaw_update_one_value, xaw_popup_menu):
* lwlib/lwlib-Xlw.h (xlw_update_one_value, xlw_pop_instance):
* lwlib/lwlib.h (lw_allow_resizing, lw_set_main_areas) [!USE_MOTIF]:
No longer const.
* src/emacs-module.c: Ignore -Wcast-function-type.
2018-12-17 08:16:17 -08:00
Paul Eggert
3624317969 Fix ‘make clean’ with a file named ‘-.o’
Problem reported by T.V Raman in:
https://lists.gnu.org/r/emacs-devel/2018-09/msg00866.html
* Makefile.in (clean, extraclean):
* doc/emacs/Makefile.in (mostlyclean):
* doc/lispintro/Makefile.in (mostlyclean):
* doc/lispref/Makefile.in (mostlyclean):
* doc/misc/Makefile.in (mostlyclean, clean):
* etc/refcards/Makefile (clean):
* lib-src/Makefile.in (mostlyclean, extraclean):
* lib/Makefile.in (clean):
* lwlib/Makefile.in (clean mostlyclean):
* oldXMenu/Makefile.in (clean mostlyclean):
* src/Makefile.in (mostlyclean, extraclean):
* test/Makefile.in (mostlyclean):
Say ‘rm ./*.o’ instead of ‘rm *.o’ to avoid undesirable failure
when a file name begins with ‘-’.
2018-09-24 10:45:07 -07:00
Glenn Morris
ef02c9fd1a Merge from origin/emacs-26
5bdc344 ; Reduce quoting for SELECTOR in 'make -C test' (Bug#31744)
b6b793b ; test/Makefile.in: Add TEST_INTERACTIVE option (Bug#31744).
1aa906f Make 'tags' targets respect --with-silent-rules (Bug#31744)

Conflicts:
	test/Makefile.in
	test/README
2018-06-18 12:14:24 -07:00
Noam Postavsky
1aa906f10d Make 'tags' targets respect --with-silent-rules (Bug#31744)
* lwlib/Makefile.in (TAGS):
* lisp/Makefile.in (TAGS):
* src/Makefile.in (TAGS): Use AM_V_GEN and AM_V_at.
* src/Makefile.in: Note that TAGS are generated in build dir.
2018-06-12 07:26:06 -04:00
Paul Eggert
ef1deb48f4 More porting to GCC 8 of --enable-gcc-warnings
* lwlib/lwlib-Xaw.h (xaw_update_one_value, xaw_popup_menu):
* lwlib/lwlib-Xlw.h (xlw_update_one_value, xlw_pop_instance):
* lwlib/lwlib.h (lw_allow_resizing, lw_set_main_areas) [!USE_MOTIF]:
No longer const.
* src/emacs-module.c: Ignore -Wcast-function-type.
2018-05-03 11:17:32 -07:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Paul Eggert
8cdd8b920a Merge from Gnulib
This is mostly to change http: to https: in licenses.
* COPYING, build-aux/config.guess, build-aux/config.sub:
* doc/emacs/doclicense.texi, doc/emacs/gpl.texi:
* doc/lispintro/doclicense.texi, doc/lispref/doclicense.texi:
* doc/lispref/gpl.texi, doc/misc/doclicense.texi:
* doc/misc/gpl.texi, etc/COPYING, leim/COPYING:
* lib-src/COPYING, lib/COPYING, lisp/COPYING, lwlib/COPYING:
* msdos/COPYING, nt/COPYING, src/COPYING:
Copy from Gnulib.
2017-10-01 18:31:10 -07:00
Paul Eggert
cbc8324488 Prefer HTTPS to HTTP for gnu.org
This catches some URLs I missed in my previous scan,
or perhaps were added after the scan.
2017-09-29 17:48:22 -07:00