1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00
Commit Graph

86 Commits

Author SHA1 Message Date
Christophe CURIS
fb2a6d2e61 WPrefs: Use the constants added in config-paths.h for paths
Replace hard-coded directory names by the constants that have been
previously added to the common header.
2021-08-10 09:42:43 +01:00
John D Pell
5c90ed9d2d WPrefs: Use wdefaultspathfordomain() to build path to the root menu file
For the Menu edition tab, when building the path to the file that contains
the menu data, rely on wdefaultspathfordomain instead of constructing the
path with many hard-coded names.
2021-08-10 09:42:43 +01:00
Christophe CURIS
8e47ca8e62 WPrefs: Add check for invalid OPEN_MENU/EXEC in PL-Menu to avoid potential crash
As reported by Coverity (CID #50047, #50048), if the proplist is incorrect
and has an OPEN_MENU or (SH)EXEC command without its arguments, we did
dereference a NULL pointer.
Now we simply return the NULL value, appropriate to have the caller of the
function issue a message.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
4559cbbccc WPrefs: Fix memory leak in the Menu tab
As reported by Coverity (CID #331559), the call to 'wfindfile' replaces
the value for variable 'path' but we did not free its previous content.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
David Maciejak
5f18f60fd2 WPrefs: increased open submenu label size
Give more space for the open submenu label to be displayed properly
2020-03-28 01:02:41 +00:00
Christophe CURIS
070f0ad8f4 WPrefs: Dead code removal
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2019-02-22 16:08:36 +00:00
Christophe CURIS
2913ac0f09 Do not allocate memory for a temporary buffer
This kind of things participates in memory fragmentation, so it is
generally a bad practice when an on-stack allocation is enough.
Took opportunity to reduce the buffer size, there's no point in
overallocating memory (the new size being still way too much).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2019-02-22 16:08:36 +00:00
Christophe CURIS
dae63b5e96 WPrefs: Prefer use of 'sizeof' instead of hard-coded values
Hard-coding a value is prone to errors when maintaining the code; using the
builtin C macro 'sizeof' is a much safer choice.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2019-02-22 16:08:36 +00:00
Doug Torrance
2dbd778ed4 WPrefs: Inform user which menu file is being edited. 2017-08-19 15:59:13 +01:00
Doug Torrance
f63635dd17 WPrefs: Save menu back to the file we read it from.
Previously, we saved any modifications back to WMRootMenu, regardless of
the file we read the menu from.
2017-08-19 15:59:13 +01:00
Doug Torrance
97702618de WPrefs: Display warning when attempting to modify a read-only menu file. 2017-08-19 15:59:13 +01:00
Doug Torrance
02cc702029 WPrefs: Edit proplist menus referenced by WMRootMenu.
Previously, WPrefs could only be used to edit the menu specified in
WMRootMenu.

In a recent commit, the ability to specify a menu in proplist format defined
in another file which is referenced by WMRootMenu was added.  However, if a
user attempted to edit such a menu in WPrefs, an error dialog appeared.

We add the ability for WPrefs to read such a menu.  After the user makes any
changes, the result is stored in WMRootMenu, and *not* the original file.
2017-08-19 11:14:38 +01:00
Doug Torrance
23417d9934 WPrefs: Update path for Debian menu 2016-11-13 15:52:06 +00:00
Alwin
94136ad29a WPrefs: trivial fixes in text strings
Fix a typo in an error message. Remove an inconsistent dot on a
button. Adds a missing dot in Expert preferences.
2014-12-24 15:24:42 +00:00
Christophe CURIS
1d0f02f5ca remove a few unused constant for size of buffers
As pointed by gcc, a few constants which contain sizes for buffers are not
used anywhere in the code. This is probably due to code cleanup, where
these buffers have been removed or where size is automatically calculated
by using 'sizeof' instead to reduce risk of bugs.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
Christophe CURIS
4bb93d3dab WPrefs: replaced a few constants by the macro 'wlengthof'
This reduce the risk to miss something in case the array they refer to gets
updated, because with the macro the proper number of element will be
evaluated by the compiler automatically.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:19 +01:00
Christophe CURIS
a9e2923f67 WPrefs: fix memory leak in buildPLFromMenu (Coverity #50105)
As pointed by Coverity, the PLArray that is created to store the return
value of the function 'processData' can be left allocated if some case
handling decide to return NULL instead.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
f8d9e4cd53 WPrefs: Marked args as unused for compiler in callback code
The function is a callback, which means having a fixed argument list.

It is then correct to not use all the arguments, so this patch adds the
appropriate stuff to avoid a false report from compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2013-12-30 18:11:02 +00:00
Christophe CURIS
5e9ebfea76 WPrefs: Removed unused argument in function 'WGetEditMenuSubmenu'
The function did not use the argument 'mPtr', so removed it.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2013-12-30 18:11:02 +00:00
Christophe CURIS
ce1513f89f WPrefs: Removed unused Screen argument to the 'Init*' functions
The functions that create the different configuration panels were taking
the screen structure as argument, but it turns out that none of them
actually need it.

We just remove the argument to make code simpler and easier to maintain.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:11 -02:00
Christophe CURIS
066d0cdef7 WPrefs: Marked args as unused for compiler in WINGs callback code
The WINGs toolkit dispatch events on widgets using callbacks, which means
having a fixed argument list for the handling function.

It is then correct to not use all the arguments, so this patch adds the
appropriate stuff to avoid a false report from compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:10 -02:00
Christophe CURIS
5a65dbeb3d WPrefs: Cleaned dangerous function prototype usage
- remove extern declaration in source file, use header instead

- add inclusion of header defining the functions of the file to
get the compiler to cross-check them

- marked static the functions that should not be visible ouside
their file
2013-05-12 01:01:20 +01:00
Christophe CURIS
b5101fc8ae WPrefs: Added 'const' attribute to function parameters 2013-05-12 01:01:19 +01:00
Christophe CURIS
f73ccae798 Removed temporary allocation to build a path that is actually a constant
This allocation was certainly participating to memory fragmentation.
2013-05-11 00:17:27 +01:00
Christophe CURIS
a18fd7cd69 Fixed const correctness in functions using 'wusergnusteppath'
The change introduced in previous commit for const correctness has
a small impact on WindowMaker's code, this patch fixes all the new
warnings.
2013-05-04 16:25:44 +01:00
Andreas Bierfert
066de301df Teach WPrefs about OPEN_PLMENU
From 35f19d77874d1b50de5505b6b1cb31531e1c055a Mon Sep 17 00:00:00 2001
From: Andreas Bierfert <andreas.bierfert@lowlatency.de>
Date: Thu, 31 Jan 2013 22:35:42 +0100
Subject: [PATCH 3/3] Teach WPrefs about OPEN_PLMENU

Add option to WPrefs to read, add and edit OPEN_PLMENU menu entries
2013-02-10 11:26:33 +00:00
Tobias Stoeckmann
72546aab81 Get rid of NEW definition.
The NEW definition merely calls wmalloc now, therefore it is not needed
anymore.  Pointed out and requested by Carlos R. Mafra.
2012-05-07 20:36:10 -03:00
Tobias Stoeckmann
cc30444dda No need to call memset after wmalloc
memset is the last function call in wmalloc, just before it returns the
newly allocated memory.  Therefore it is not needed to call it again
after wmalloc call.  Although I would prefer to switch wmalloc to a
calloc-based wcalloc function, the compatibility of WINGs for old apps
should be kept.
2012-05-04 18:41:01 -03:00
Kamil Rytarowski
7d11577a82 Stop using old /usr/X11R6 directory
...it's replaced in xorg-x11 by standard /usr

Switch from /usr/X11R6 to /usr in all files except debian and FAQ.
2012-02-17 10:50:12 +00:00
Rodolfo García Peñas (kix)
3ae34b958c WPrefs: Remove duplicated function captureShortcut()
The function captureShortcut() is implemented in both files KeyboardShortcuts.c
and Menu.c, with just a minor difference regarding the conversion to upper case.

To unify them, define a new function which includes a new boolean paramenter to
dictate whether the upper case conversion should be done or not.
2012-01-20 21:50:12 +00:00
Rodolfo Garc??a Pe??as (kix)
6ae01b9d90 WPrefs: Fetch default menu from system path
If you delete the file ~GNUStep/Defaults/WMRootMenu and run WMPrefs
and go to the Menu Edit tab, it will show a dialog about keeping the menu or
discarding it. If you discard it then WPrefs shows an error:

"Could not open default menu from
'/home/user/GNUStep/Library/WindowMaker/plmenu"

The problem is at WPrefs.app/Menu.c:1424, and it happens because it tries
to load the default menu from the user's GNUstep home, but plmenu is not
copied there during the installation.

Of course, the file doesn't need to be copied to the users home, so
WPrefs should try to read it from /usr/share/WindowMaker/plmenu (Debian)
or /usr/local/share/WindowMaker/plmenu (upstream).
2012-01-12 22:07:01 +00:00
Tamas TEVESZ
f65b99e615 Remove warnings
* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
  to be tweaked on a per-implementation basis as problems arise)
2011-03-24 16:19:52 +01:00
Tamas TEVESZ
3c408fa179 Update local copy of GPLv2 and FSF address in copyrights
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-08 18:13:56 +02:00
Tamas TEVESZ
7859e2d59f Silence a few warnings
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Carlos R. Mafra
e10e7d08fa WPrefs: Replace Netscape and Acrobat Reader menu entries
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
35ed80648b Prevent a WPrefs segfault
Prevent WPrefs (menu panel) segfaulting upon coming by an invalid command in
the root menu.

Reported and first patch version by Bento Loewenstein.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
badecc244b simplify WMWritePropListToFile()
remove the choice of atomic/non-atomic writes. firstly, the only users
of non-atomic writes were getstyle and geticonset; secondly, who in their
right minds would ever want non-atomic writes; thirdly, the file system
will screw you anyway *G*.
2010-03-17 11:12:53 +01:00
Pedro Martelletto
2706f7217c WPrefs: Fix crash due to wtokenfree() memory leak fix
After the fix to avoid a memory leak in wtokenfree(), WPrefs crashes
when opening the 'Applications Menu Definition' dialogue.

The problem is that WPrefs code relied on the fact that the first token
in the array would not be free'd by wtokenfree(), a misbehaviour which
is correctly addressed with this patch.

Retrieved-from: http://www.mail-archive.com/ports@openbsd.org/msg12731.html

[crmafra: small changes in the commit log from the webpage]
2009-08-22 20:51:47 +02:00
Carlos R. Mafra
688a56e8ab Change to the linux kernel coding style
for arq in `git ls-files *.c`; do
    echo $arq;
    indent -linux -l115 $arq;
    done

The different line break at 115 columns is because
I use a widescreen monitor :-)
2009-08-20 00:59:40 +02:00
dan
d8862b0bdf fixed some bugs 2004-10-26 03:40:44 +00:00
dan
6830b05716 changed indentation to use spaces only 2004-10-12 21:28:27 +00:00
dan
b0d72a3db2 - Fixed aspect of window list menu (window name was too close to workspace
indicator)
- Fixed menu panel in WPrefs.app. Explanatory text did not fit into the label
2003-07-01 23:00:25 +00:00
dan
4153e2fde4 - Fixed crashing bug in menu.c
- Updated year from 2002 to 2003
2003-01-16 23:30:45 +00:00
dan
048b43aea4 - fixed a frame size in WPrefs menu editor
- removed // comments
- commented out printfs in unfinished selection code
2002-07-01 23:52:22 +00:00
dan
77b8fe05ac - removed configure.in. use only autoconf 2.5x fom now
- fixed a bug and memleak in WMBox code.
- updated some translations
- fixed some bug in the menu code about drawing disabled entries.
- fixed Clip menu not to allow selecting of "Autoraise" if "Keep On Top"
  is active.
- Added a "Browse" button to the menu editor in WPrefs where a program to run
  is specified (not finished).
2002-02-20 22:22:40 +00:00
kojima
5db8b5660f cleaning the house today 2002-02-15 21:34:46 +00:00
dan
cab71ba6a1 - Fixed text in info panel for multibyte (Seiichi SATO <ssato@sh.rim.or.jp>)
- Separated the font caches for normal fonts and fontsets in WINGs (they can
  have the same names and collide in the cache giving unwanted results)
- Updated the years in the copyright notices
2002-01-04 07:32:37 +00:00
dan
9f62c660d7 - Changelog update about latest fixes.
- Applied patch to fix gnome problems.
2001-11-15 02:52:51 +00:00
kojima
cc9abd6e7e fixed crash bug with empty menus 2001-11-14 13:18:26 +00:00
dan
72150b1da7 - Slovak .po file updates from (Jan Tomka <judas@linux.sk>)
- "Save Workspace state" confirmation switch on the exit dialog panels
  (based on a patch from Jan Tomka <judas@linux.sk>)
2001-11-05 23:19:46 +00:00