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

158 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
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05: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
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
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08: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
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
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
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
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Paul Eggert
ec168376d1 Tweak X toolkit code to pacify modern GCC
* lwlib/lwlib-Xaw.c, lwlib/lwlib-Xm.c, lwlib/lwlib.c:
Don’t include <stdlib.h>, since this code now calls emacs_abort
rather than abort.
* lwlib/lwlib-Xaw.c (make_dialog, xaw_generic_callback)
(wm_delete_window):
* lwlib/lwlib-Xm.c (make_menu_in_widget, do_call):
* lwlib/lwlib.c (instantiate_widget_instance, lw_make_widget):
* lwlib/xlwmenu.c (abort_gracefully, draw_separator)
(separator_height, XlwMenuInitialize):
Use emacs_abort, not abort.  Without this change, some calls
to ‘abort’ were invalid, as stdlib.h was not always included.
* src/widget.c (resources, emacsFrameClassRec):
* src/xfns.c (x_window) [USE_X_TOOLKIT]:
* src/xmenu.c (create_and_show_popup_menu) [USE_X_TOOLKIT]:
* src/xterm.c (emacs_options) [USE_X_TOOLKIT}:
(x_term_init) [USE_X_TOOLKIT]:
Cast string constants to char * to pacify --enable-gcc-warnings.
2017-03-10 09:31:59 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Paul Eggert
7d7e742fe3 Remove SunOS 4.x cruft
Support for SunOS 4.x was removed in Emacs 23 but some cruft was left behind.
* lib-src/pop.c [sun]: Remove no-longer-needed include.
* lwlib/xlwmenu.c (SUNSO41): Remove.
2015-12-18 17:11:23 -08:00
Paul Eggert
b5919771ae Assume C89 offsetof in xterm.c, xlwmenu.c
* lwlib/xlwmenu.c (offset):
* src/xterm.c (cvt_string_to_pixel_args):
Use offsetof, not XtOffset.
2015-04-14 00:58:37 -07:00
Stefan Monnier
872481d9e2 Add classes as run-time descriptors of cl-structs.
* lisp/emacs-lisp/cl-preloaded.el (cl--struct-get-class): New function.
(cl--make-slot-desc): New constructor.
(cl--plist-remove, cl--struct-register-child): New functions.
(cl-struct-define): Rewrite.
(cl-structure-class, cl-structure-object, cl-slot-descriptor)
(cl--class): New structs.
(cl--struct-default-parent): Initialize it here.
* lisp/emacs-lisp/cl-macs.el (cl--find-class): New macro.
(cl-defsubst, cl--defsubst-expand, cl--sublis): Move before first use.
(cl--struct-default-parent): New var.
(cl-defstruct): Adjust to new representation of classes; add
default parent.  In accessors, signal `wrong-type-argument' rather than
a generic error.
(cl-struct-sequence-type, cl-struct-slot-info)
(cl-struct-slot-offset): Rewrite.
* lisp/emacs-lisp/cl-generic.el (cl--generic-struct-specializers)
(cl-generic-generalizers): Rewrite.
* src/alloc.c (purecopy): Handle hash-tables.

* lisp/emacs-lisp/debug.el (debug--implement-debug-on-entry):
Bind inhibit-debug-on-entry here...
(debug): Instead of here.

* lisp/emacs-lisp/macroexp.el (macroexp--debug-eager): New var.
(internal-macroexpand-for-load): Use it.

* lwlib/xlwmenu.c (pop_up_menu): Remove debugging code.
2015-03-18 10:31:07 -04:00
Jan D
e605af8880 * xlwmenu.c (remap_menubar): Re-realize menu to force move under Gnome 3. 2015-02-28 16:20:45 +01:00
Paul Eggert
7e09ef09a4 Update copyright year to 2015
Run admin/update-copyright.
2015-01-01 14:26:41 -08:00
Paul Eggert
1e6879dbdb Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy.  strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 15:44:23 -08:00
Dmitry Antipov
0882152e22 * xlwmenu.c (openXftFont): Do not load regular X font here.
(XlwMenuInitialize): Remove ancient #if 0 code.
(XlwMenuDestroy): Likewise.  Free regular X font here.
2014-06-03 08:17:53 +04:00
Paul Eggert
ba3189039a Update copyright year to 2014 by running admin/update-copyright. 2014-01-01 07:43:34 +00:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Paul Eggert
fee0bd5f32 Use URLs, not Boston addresses, in copyright notices. 2012-12-31 07:34:32 -08:00
Paul Eggert
620f13b061 Use ASCII tests for character types.
* admin/merge-gnulib (GNULIB_MODULES): Add c-ctype.
* lwlib/lwlib-Xaw.c, lwlib/lwlib.c, lwlib/xlwmenu.c:
Don't include <ctype.h>; no longer needed.
* lwlib/lwlib-Xaw.c (openFont):
* lwlib/xlwmenu.c (openXftFont): Test just for ASCII digits.
* src/category.c, src/dispnew.c, src/doprnt.c, src/editfns.c, src/syntax.c
* src/term.c, src/xfns.c, src/xterm.c:
Don't include <ctype.h>; was not needed.
* src/charset.c, src/doc.c, src/fileio.c, src/font.c, src/frame.c:
* src/gtkutil.c, src/image.c, src/sysdep.c, src/xfaces.c:
Include <c-ctype.h> instead of <ctype.h>.
* src/nsterm.m: Include <c-ctype.h>.
* src/charset.c (read_hex):
* src/doc.c (Fsnarf_documentation):
* src/fileio.c (IS_DRIVE) [WINDOWSNT]:
(DRIVE_LETTER) [DOS_NT]:
(Ffile_name_directory, Fexpand_file_name)
(Fsubstitute_in_file_name):
* src/font.c (font_parse_xlfd, font_parse_fcname):
* src/frame.c (x_set_font_backend):
* src/gtkutil.c (xg_get_font):
* src/image.c (xbm_scan, xpm_scan, pbm_scan_number):
* src/nsimage.m (hexchar):
* src/nsterm.m (ns_xlfd_to_fontname):
* src/sysdep.c (system_process_attributes):
* src/xfaces.c (hash_string_case_insensitive):
Use C-locale tests instead of locale-specific tests for character
types, since we want the ASCII interpretation here, not the
interpretation suitable for whatever happens to be the current locale.
2012-08-16 14:58:44 -07:00
Paul Eggert
cf38a720e8 Clean out last vestiges of the old HAVE_CONFIG_H stuff. 2012-06-25 18:05:39 -07:00
Paul Eggert
845ca89390 Switch from NO_RETURN to C11's _Noreturn.
Fixes: debbugs:11750
2012-06-24 10:39:14 -07:00
Paul Eggert
ba93a18774 Remove obsolete '#define static' cruft.
* etc/PROBLEMS: Remove obsolete '#define static' cruft.
* lwlib/xlwmenu.c [emacs]: Include "bitmaps/gray.xbm".
(gray_bitmap_width, gray_bitmap_height, gray_bitmap_bits) [!emacs]:
Remove; all uses replaced with definiens.
* src/s/hpux10-20.h (_FILE_OFFSET_BITS): Don't #undef.
This #undef was "temporary" in 2000; it is no longer needed
now that '#define static' has gone away.
* src/xfns.c, src/xterm.h (gray_bitmap_width, gray_bitmap_height)
(gray_bitmap_bits): Remove; no longer needed.
All uses replaced with definiens.
* src/xterm.c: Include "bitmaps/gray.xbm".
2012-05-30 22:08:37 -07:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Paul Eggert
40ba43b4b7 Spelling fixes. 2011-11-19 23:30:16 -08:00
Paul Eggert
3ed8598c49 Spelling fixes. 2011-11-18 00:31:02 -08:00
Dmitry Antipov
81d40c9208 Use xfree, not free, to avoid crash with --enable-checking=xmallocoverrun. 2011-10-13 07:55:46 -07:00
Paul Eggert
1fbb460913 * xlwmenu.c (MINL): Define only if not emacs. 2011-04-15 18:38:14 -07:00