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

3887 Commits

Author SHA1 Message Date
Christophe CURIS
f030ab7664 wmmenugen: Fix memory leaks in XDG menu generation when getting locale-dependant name
As reported by Coverity as CID #50142, #50143, #50144 and #50145, all the
strings allocated by 'parse_locale' were never freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
2a8fc1df9a wmmenugen: Fix memory leak when parsing names for menus in XDG format
As reported by Coverity (CID #50146), if the function getLocalizedStringValue
returns without matching the entry, the storage for the entry's locale was
leaked.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
296456f361 wmmenugen: Fix memory leak when parsing categories in an XDG menu
Reported by Coverity (CID #50147)

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
f2cd2c9f03 WRaster: Properly set file's mtime in the cache when loading an image
The library maintains a cache to not reload a file that was previously
loaded. In order to still reload an image in case its file would have
changed in the meantime, the cache saves the file's modification time.

As reported by Coverity (CID #331576) the 'stat' function was not on the
execution path the first time an image is loaded, which means the cache
information is populated with junk data. This could lead to an image not
being reloaded for example.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
d125f80dee WRaster: Stop parsing number in PPM file if invalid syntax is found
When the function 'pm_getuint' is reading a number, it prints an error
message if it encounters a non-digit number, yet it still enters the
processing loop which will cause an invalid number to be calculated.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +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
29cf48b934 WPrefs: Provide fall-back colour in the case of colour name not found
As reported by Coverity (CID #331571), we did not check the return value of
the call to XParseColor. If the function is given a colour name that it
does not know, we would return an uninitialised colour.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
816fa00625 WUtil: Make sure wmalloc/wrealloc won't fail because of the abort handler
As pointed by Coverity (#50074), despite the expected behaviour that
'wmalloc' should never return NULL, it may still happen if an abort handler
set by user (with wsetabort) does not call exit() as expected. In such
case we make sure the NULL pointer dereference does not happen inside
WINGs code because we assume it is a known user choice.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
6ebec0bb9f WUtil: Fix non-closed file handle in WMWritePropListToFile
As reported by Coverity (CID #50129), in case of error during the write
operation, the failure path does include close of the file handle. In
addition to the resource leak, this may be a problem if the application
were to make a second try on the same file.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
7c50721747 WPrefs: Fix memory leak in Expert tab
As reported by Coverity (CID #331553), we leak the allocated string
returned by 'WMGetTextFieldText'

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
Christophe CURIS
e828e1c074 Fix use-after-free error in wIconStore reported by Coverity
The function always returns the filename where the icon have been saved,
but in the case where the save operation failed we would free the memory
for that file name, yet still return this pointer like if it were valid.

Took opportunity to remove redundant free(path) which is done a couple
lines later, because redundancy is a source of problem for code
maintenance.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
97a9300aa4 Fix memory leak reported by Coverity
As reported in CID #331577, we re-use the variable 'tmp' without freeing
the previously allocated pointer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
fd56152202 WPrefs: fix memory leak and potential buffer overflow
Coverity pointed that the "text" returned by WMGetTextFieldText was never
freed (CID #331578, because WMSetTextFieldText does its own copy, it does
not take the pointer as-is).

By looking at the code, there is also a potential buffer overflow because
the buffer alloc'd for "value" is sized for the exact number of digits
before increase, but the +delta can make the number use more digits so we
may write past the end of original buffer.
We write to a stack-allocated one, so it does not cost anything and does
not participates to memory fragmentation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
58862300f9 WINGs: Fix invalid handling of Blue in the HSV conversion in ColorPanel widget
Because of a minor bug, when pure blue was chosen in RGB in the ColorPanel,
the conversion to HSV would mistreat it as white and resets its hue,
leading to possible user annoyance.
2021-05-18 17:49:17 +01:00
Christophe CURIS
1612d2f345 WINGs: increase temporary buffer to silence a gcc warning
The code limits the integer number to 0..359 so we need 4 bytes to store
that, but that require too complex flow processing for compilers to deduce
it.

It does not cost to increase the temporary buffer to the minimum size
requested by GCC, so let's do this, because spurious warnings can
potentially divert us from more important ones.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
920c6d16b1 wraster: Remove duplicate code
Duplicating things makes maintenance error-prone, which is not a good idea.
In case the abort procedure would need an update, it would be easy then
to forget some place, leading to leaks, if not worse.

Beside, goto is not as bad as academics would like people to believe, when
it is used correctly (and this case is one of them).
The name for the label was given an explicit meaning to make code easy to
understand.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
8aecba27d1 Fix usage of float constant reported by gcc
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
fc63d72032 WINGs: Fix incorrect use of macro USE_PANGO in installed header
The header "WINGsP.h" needs different behaviour depending on whether the
support for Pango was enabled or not. But the related macro USE_PANGO is
defined by WindowMaker's configure, and after this header have been
installed the macro is no more valid.

This patch makes the "WINGsP.h" a generated file, so it will be different
depending on USE_PANGO, but will not make use of the macro itself.

As a side effect of being now generated, the include paths in the makefile
have been updated to include build-dir too, because for users doing an
out-of-tree build the generated file (that is used during compilation) is
placed in the build-dir.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Xander
eb2a9d97a2 Make dock dots scalable
This patch makes the three dots in the dock change their size when bigger icon size is used.
The logic here is such that the dots are scaled only when a certain icon size is reached;
for instance, the dots will remain unchanged if icon size is less than 128x128 px, and will
be twice as big if it's set to a value from 128x128 to 184x184 px. The get_dot_mult() func
calculates and returns the scale multiplier. In the draw_dot() func, XDrawLine() and
XDrawPoint() were replaced with XFillRectangle() because those funcs do not allow their
result to be scalable. This patch does not require additional icon size values (those bigger
than 96x96 px) to exist, but makes no use without them.
2021-05-07 18:03:19 +01:00
Xander
9abe4165d1 Add icon sizes
The classic WindowMaker allows tile icon size up to 96x96 px. This patch rises this value
to 256x256 px. It also sets the max number of visible items in the corresponding pref list
to 29 (instead of 9), so the new values show up in the list. This patch makes it possible
to use dockapps that allow changing their size to bigger than 64x64 px, see
https://gitlab.com/xander1988/dockapps for more info.
2021-05-07 18:02:03 +01:00
82ab2d2d06 Correct calculation of usable space for reserved area.
Previous patch has correct the way, how reserved area found in
_NET_WM_STRUT was calculated. Unfortunately, the calculation was not
precise, as for not reserved areas (i.e. values of 0 for one of the
cardinals is set) must be calculated anyway for given head, otherwise
usable area might be too broad.
2021-03-18 16:08:40 +00:00
bbf24d1d39 Correct way for reserved space on multihead environment.
Applications such a panels or docks have ability for reserving space so
that no windows should cover or overlap them. There is (partially)
support for it by checking the _NET_WM_STRUT property, although
calculation for the reserved space was wrong in case of several heads
enabled.

In this patch calculation for reserved area has been corrected.
2021-03-16 20:39:54 +00:00
Helge Kreutzmann
224cb403a7 Tippfehler in de.po von WPrefs (WindowMaker)
per Zufall habe ich einen Tippfehler gefunden
2020-12-07 16:53:16 +00:00
Nick Berendsen
1cd8fea423 Add support for _NET_WM_STATE_FOCUSED
Thanks to Jeremy Sowden for sending the patch to the mailing list.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2020-10-27 15:35:08 +00:00
Diedrich Vorberg
a98680cd14 Patch for GetCommandForPid() in osdep_darwin.c
the function mentioned above caused segfaults on MacOS. The attached patch
seems to solve that.

Details: The functions provides an array of string pointers (the argument
vector) pointing to a buffer allocated and referred to by a static local
variable `args`. This buffer was used on each subsequent call. For one
thing this would overwrite old values and for another this caused segfaults.

My new implementation allocates a buffer for the argument vector plus the
actual string data on each call. The caller will wfree() the buffer, but
until then has available an independent copy of the strings.
2020-10-19 20:38:29 +01:00
Alexander Komarov
7d423a3a0f Added Expert option: "Close rootmenu when mouse (left or right) is clicked outside focus.
Common WindowMaker's rootmenu behavior if press right mouse button open menu and close only with same button.
It's uncomfortably, it patch  allows close menu by left or right is clicked outside focus.
Changed func "static WMenu*configureMenu(WScreen *scr, WMPropList *definition)" to non-static forglobal use.
Added new  OPTION_WMAKER for this Expert-option. Changed event.c: for correct work should use initialization
func configureMenu afterwMenuDestroy (this is a feature of the event implementation XEvent).
2020-09-13 16:56:09 +01:00
Alexander Komarov
033d2d9a6f Changed Russian translation 2020-08-11 10:49:13 +01:00
Alexander Komarov
6e2075f3df Double click on titlebar maximize a window to fullscreen 2020-08-10 12:15:01 +01:00
XOR
5d2fd7bf7e WPrefs: Create Turkish translation 2020-06-28 17:54:15 +01:00
Christophe CURIS
f6742662ec Tell git to ignore files created during i18n preparation
The 'pot' files are templates generated when we want to update the 'po'
files against latest source code;

the 'mo' files are compiled 'po' files to be installed
2020-06-28 11:33:31 +01:00
Doug Torrance
583f66ec4e Turn off automake's warning messages about using GNU make extensions
We've been using addsuffix in WindowMaker/Makefile.am and may use others
in the future.
2020-06-22 18:07:09 +01:00
cd23e77fd1 Remove Debian related build files.
Keeping Debian related build files should not be the duty of wmaker
development team, but Debian package maintainers.
2020-05-31 17:34:28 +01:00
230a501d36 Fix typo on defining imagemagick version.
In this patch we will fix an issue during compilation on systems, which
have ImageMagick version 7, and slightly more recent version of
compiler. If we define USE_MAGICK with null value, compilation will fail
on preprocessor check on such defined variable.
2020-04-20 09:03:56 +01:00
Doug Torrance
3022edd060 wrlib: Fix typo in macro containing ImageMagick version
It's USE_MAGICK, not USE_MAGIC.  Also, we wrap the if/else statement
in an ifdef.  This doesn't really affect anything since load_magick.c
won't be compiled if USE_MAGICK is undefined because of an if statement
in the Makefile.  But in the off chance that it is somehow, then we will
try to load a nonexistent version 6 header file since USE_MAGICK will
be interprested as 0 and 0 < 7 is true.
2020-04-19 07:58:28 +01:00
Doug Torrance
1713a88656 debian: Remove ImageMagick patch; an equivalent patch now exists in next
If a user wanted to build a Debian package from the next branch, then
it would fail immediately when quilt tried to apply the patches.
2020-04-19 07:58:28 +01:00
Doug Torrance
00a25db9ea checkpatch.pl: Escape curly braces in regexes
Unescaped curly braces  have been deprecated since Perl 5.26 and are
illegal in Perl 5.30. I copied the relevant lines from the latest kernel
source, so we'll inherit a couple other improvements as well.
2020-04-18 22:27:29 +01:00
Doug Torrance
c678580621 debian: Update with version 0.95.9-2 packaging. 2020-04-18 19:49:26 +01:00
Doug Torrance
44bc9cc264 Fix various abs() issues.
The abs() function should take an int as argument, but there were
several instances in the code where it was taking an unsigned int or a
double.  In these case, we took one of the following approaches:

* If the argument was a double, use fabs() instead.
* If the argument was unsigned and was certainly going to be positive
  (i.e,. no subtraction), then drop abs() altogether.
* If the argument was unsigned as result of adding or subtracting signed
  and unsigned ints, then we cast all the unsigned ints to signed ints.
2020-04-18 19:49:26 +01:00
Doug Torrance
dfa92906c0 wrlib: Compile with either ImageMagick 6 and 7
We dropped ImageMagick 6 support in 0.95.9.  However, ImageMagick 6 is
still widespread (e.g., ImageMagick 7 has not been packaged in Debian
yet), and upstream plans on maintaining it until at least 2028 [1].

In this patch, we detect the version of the MagickWand library installed
on the user's system and include the appropriate header file when
building wrlib.

Note: I've only tested this with ImageMagick 6, so I'd appreciate
confirmation that it works with ImageMagick 7.

[1] https://github.com/ImageMagick/ImageMagick6/blob/master/NEWS.txt
2020-04-18 19:49:25 +01:00
Doug Torrance
27dc5efd2e debian: Update with version 0.95.9-1 packaging. 2020-04-17 08:20:50 +01:00
Doug Torrance
86659be668 wmlib: Use X flags from configure
We use the AC_PATH_XTRA macro to find all the X library paths during
build, but we weren't actually using the variables it generated for
building wmlib.  Instead, we just hardcoded the linker flag "-lX11",
which may or may not actually work.
2020-04-09 14:54:06 +01:00
Doug Torrance
e314f10909 configure: Fix typo in libXmu check.
As the literal string "wm_cv_xext_xmu" will never be equal to "xno",
we always ran the code that was supposed to run when the variable
$wm_cv_xext_xmu was not equal to "no".  In particular, if libXmu
was not found, then we proceeded as if it had been found.
2020-04-09 14:54:06 +01:00
Doug Torrance
54a24ab6f7 Remove trailing whitespace.
Also, the script is a one-liner, stolen from [1]:

ack --print0 -l '[ \t]+$' | xargs -0 -n1 perl -pi -e 's/[ \t]+$//'

[1]
https://stackoverflow.com/questions/149057/how-to-remove-trailing-whitespace-of-all-files-recursively
2020-04-09 14:28:09 +01:00
Doug Torrance
a17d131da3 Remove apostrophes from instances of possessive "its".
I noticed one instance of this while looking at the code the other day,
and after a quick grep, realized it happened a *lot*!  One of the many
frustrating things about the English language is that we use apostrophes
to make pretty much everything possessive *except* the pronoun "it".
In that case, we use "its".  "It's" is reserved for the contraction
meaning "it is" or "it has".
2020-04-09 09:05:50 +01:00
David Michael
6320bb6219 configure: Allow changing default search paths
This changes the behavior of the --with-{inc,lib}s-from arguments
to replace the default paths instead of adding to them.  This is
required when cross-compiling in a sysroot, since the default paths
will include files from the host system which can have an
incompatible architecture.
2020-04-06 16:35:53 +01:00
Carlos R. Mafra
f9bc310fa6 Window Maker 0.95.9 wmaker-0.95.9 2020-04-04 11:02:28 +01:00
Carlos R. Mafra
58249c2b9b Update .gitignore file 2020-04-04 10:55:42 +01:00
David Maciejak
bb716a4ca1 util: renamed wmiv DEBUG constant name
To prevent compilation warning message saying DEBUG name is already defined
2020-03-28 10:13:11 +00:00
David Maciejak
91f8e21668 WPrefs: fixed malformed TIFF file generating libtiff warnings
The original ergonomic.tiff file samples/pixel property was wrong which was generating the warning message from libtiff
"TIFFReadDirectory: Warning, Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSamples.."
2020-03-28 01:02:56 +00:00