summaryrefslogtreecommitdiff
path: root/src/menus.c
AgeCommit message (Collapse)Author
2024-03-16Fix read from uninitialized dataHEADmasterTim Wiederhake
Syscall param writev(vector[0]) points to uninitialised byte(s) at 0x4B836C0: writev (writev.c:26) by 0x4C74FBF: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0) by 0x4C753B0: xcb_writev (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0) by 0x48B2A24: _XSend (in /usr/lib/x86_64-linux-gnu/libX11.so.6.4.0) by 0x48B3088: _XReply (in /usr/lib/x86_64-linux-gnu/libX11.so.6.4.0) by 0x48AE6FE: XSync (in /usr/lib/x86_64-linux-gnu/libX11.so.6.4.0) by 0x11C523: HandleEnterNotify (events.c:2112) by 0x117847: DispatchEvent (events.c:335) by 0x117921: HandleEvents (events.c:363) by 0x12FCBD: main (twm.c:648) Address 0x5036874 is 148 bytes inside a block of size 16,384 alloc'd at 0x48459F3: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x48A23AA: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.4.0) by 0x49E5A12: XtOpenDisplay (in /usr/lib/x86_64-linux-gnu/libXt.so.6.0.0) by 0x12EB45: main (twm.c:319) Uninitialised value was created by a stack allocation at 0x12828E: send_clientmessage (menus.c:2861) Signed-off-by: Tim Wiederhake <twied@gmx.net> Part-of: <https://gitlab.freedesktop.org/xorg/app/twm/-/merge_requests/29>
2024-03-07Provide defaults for externally defined symbolsTim Wiederhake
AM_CPPFLAGS defines several symbols that do not have to be there. By providing default values in twm.h, this list can be reduced in size while still allowing to override these values. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-03-07Remove version.c and version.hTim Wiederhake
These files define only a single variable that is used in only one place. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-03-05include "gram.h" only from "parse.h"Thomas E. Dickey
all of the users of (generated) gram.h rely upon (custom) parse.h, and the order of those headers affects portability. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-01-21Add explicit cast after memory allocationTim Wiederhake
Still valid c, but now also valid c++. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-21Rename field 'class' to 'xclass' in TwmWindowTim Wiederhake
'class' is a keyword in c++. Its usage confuses some tools that work with c and c++ source code. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-21Remove storage specifier 'register'Tim Wiederhake
'register' is an optimization hint to the compiler that is generally not necessary and needlessly prevents using a c++ compiler to compile twm. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-20Remove global variables JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMaskTim Wiederhake
Replace with a local variable following the naming scheme from Identify() in src/menus.c. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-20Remove global variables JunkX, JunkYTim Wiederhake
Replace with a local variable following the naming scheme from Identify() in src/menus.c. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-20Remove global variables JunkRoot, JunkChildTim Wiederhake
Replace with a local variable following the naming scheme from Identify() in src/menus.c. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-20Rework dummy variable usage in ExecuteFunctionTim Wiederhake
twm defines several "junk" variables to use with functions like XQueryPointer or XGetGeometry. In some instances, the returned values are actually used, which makes the code confusing and hard to reason about. Use dedicated variables in those cases. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-20Split up InitMenusTim Wiederhake
Preparation for the removal of FirstScreen: Separate code that is executed for all screens from code that is executed for only the first screen. Signed-off-by: Tim Wiederhake <twied@gmx.net>
2024-01-01Remove disabled codeTim Wiederhake
Signed-off-by: Tim Wiederhake <twied@gmx.net>
2021-11-28Fix spelling/wording issuesAlan Coopersmith
Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-06-19use new warning-message functions in the remaining places where suitable,Thomas E. Dickey
since -q option can be used to silence those if wanted Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2020-06-18fix the cppcheck style- and format-warningsThomas E. Dickey
also bump version to 1.0.11.1, reflecting ongoing work since release Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2020-06-16eliminate a fixed-size buffer in Execute() function.Thomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-11-23Formatted most of the C files using "twm-indent", part of cindent atThomas E. Dickey
https://invisible-island.net/cindent/ That is essentially a script which adds typedefs to the x-indent.sh script. No object-code changed in this reformatting. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-16caddr_t used to be used in X code before XPointer was established; it's ↵Thomas E. Dickey
obsolete and less portable Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-16gcc-stricter warnings, no object changeThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-15fix gcc-normal compiler warnings, no object changeThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2015-09-28Adapt callers to ExpandFilename change.Thomas Klausner
It now always allocates memory, so remove some unnecessary checks. While here, improve handling of an error case. Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-31Remove custom version of system(3c) for SolarisAlan Coopersmith
Was originally added in 1993 with the comment: make f.exec do the right thing to get working xterms under Solaris2. Doesn't seem to be needed any more on modern Solaris. As a bonus, gets rid of error found by Oracle Parfait 1.5.1 that if the execl() call fails, the function falls through and returns an uninitialized value for status and then both parent & child go back to running the same code. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-08-18Stop casting return values from malloc & callocAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-08-18Stop casting pointers to (char *) when freeing themAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-31Make more functions static that aren't called from other filesAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-31Use (void) to declare functions that take no arguments, instead of ()Alan Coopersmith
It's time for C89. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: <wharms@bfs.de>
2013-07-18Constification cleanup - fix dozens of gcc warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-19Terminate execl() arguments with NULL instead of 0Alan Coopersmith
Makes sure that a full 64-bits of 0 is passed in 64-bit builds, and clears gcc warning of: menus.c: In function ‘System’: menus.c:2344:2: warning: missing sentinel in function call Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-07-14Whitespace fixes in src filesAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-07-12Replace most sprintf calls with snprintfAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-05-12Add extra sanity checking to avoid possible NULL dereferencesJeremy Huddleston
menus.c:569:10: warning: Access to field 'func' results in a dereference of a null pointer (loaded from variable 'ActiveItem') if (ActiveItem->func != F_TITLE && !ActiveItem->state) ^~~~~~~~~~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-12Add sanity checking to avoid a possible NULL dereferenceJeremy Huddleston
menus.c:934:26: warning: Access to field 'fore' results in a dereference of a null pointer (loaded from variable 'cur') cur->hi_back = cur->fore = f3.pixel; ~~~ ^ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-12Address a possible NULL pointer dereferenceJeremy Huddleston
menus.c:523:24: warning: Access to field 'w' results in a dereference of a null pointer (loaded from variable 'ActiveMenu') if (XFindContext(dpy, ActiveMenu->w, ScreenContext, &context_data) == 0) ^~~~~~~~~~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-11Fix: menus.c:2374: warning: implicit declaration of function `putenv`Alan Coopersmith
Ensure _GNU_SOURCE is defined on Linux builds before including <stdlib.h> so the prototype is exposed in the header properly. https://bugs.freedesktop.org/show_bug.cgi?id=32696 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-01-05Fix many gcc strict-aliasing warningsAlan Coopersmith
menus.c:518: warning: dereferencing type-punned pointer will break strict-aliasing rules and many more of the same message at different lines Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-10-06Purge cvs tags.Jesse Adkins
Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
2006-06-03Coverity #1508: Variable "action" not freed or pointed-toAlan Coopersmith
2005-07-30Add prototypes of Xalloc/free functions.XORG-6_8_99_900Alan Coopersmith
Export ImUtil.h to match modular tree install. Define SVR4 to 1 to avoid warning about redefining to different values. Include missing headers to clear more compiler warnings.
2005-03-11xc/programs/twm/add_window.cRoland Mainz
xc/programs/twm/cursor.c xc/programs/twm/events.c xc/programs/twm/gc.c xc/programs/twm/gram.y xc/programs/twm/iconmgr.c xc/programs/twm/icons.c xc/programs/twm/list.c xc/programs/twm/menus.c xc/programs/twm/parse.c xc/programs/twm/resize.c xc/programs/twm/twm.c //bugs.freedesktop.org/show_bug.cgi?id=2566) attachment #2083 (https://bugs.freedesktop.org/attachment.cgi?id=2083) ANSI-fy twm window manager code. The conversion preserves the comments which annotate variables and function arguments (these have been moved into doxygen(esque?) "stubs" above each function. Patch by Mike Owens <etc@filespanker.com>.
2004-04-23Merging XORG-CURRENT into trunkxprint_packagertest_20041217_basexprint_packagertest_20041125_baserel-0-6-1lg3d-rel-0-7-0lg3d-rel-0-6-2lg3d-baseXORG-6_8_2XORG-6_8_1_904XORG-6_8_1_903XORG-6_8_1_902XORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGExprint_packagertest_20041217xprint_packagertest_20041125lg3d-masterlg3d-eventlg3d-dev-0-7-1lg3d-dev-0-7-0lg3d-dev-0-6-latestlg3d-dev-0-6-2lg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3d-dev-0-6-1-1lg3d-dev-0-6-1lg3dXORG-6_8-branchCOMPOSITEWRAPEgbert Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_903_specialxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-012804-2330Kaleb Keithley
2003-11-14XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1Kaleb Keithley
2003-11-14R6.6 is the Xorg base-lineXORG-MAINKaleb Keithley