The original macro used over-complicated things, like:
- useless uses of 'eval',
- split AC_CACHE_CHECK construct (AC_MSG_CHECKING + AC_CACHE_VAL +
AC_MSG_RESULT)
- dubious variable name (CPPFLAGS_old, which is not the "old" value but
the "saved" value for a temporary change)
- variable CPPFLAGS was changed at wrong hierarchy level
- calculate the integer value for XFT_VERSION in m4 instead generating
shell commands that had to do it on user side
- indentation was missing
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The goal is to use standard macros, which make code easier to maintain
(smaller, more consistent). We still keep the legacy "xfg-config" method
because we don't want to drop support for old hardware/software.
A side effect is the change in the name of the variables for the makefile,
but this goes in favour of consistency.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The header "wraster.h" needs different behaviour depending on whether the
support for X Shared Memory extension was enabled or not; but the related
macro USE_XSHM is defined by WindowMaker's configure. After this header
have been installed, the macro is no more useable.
This patch makes the "wraster.h" a generated file, so it will be different
depending on USE_XSHM, but will not make use of the macro itself.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The translation check would complain because it does not find any '.po'
files, so I am providing one translation.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The original error messages tended to be a bit sparse, now they try to be
a little bit more helpful, and translatable in user's language.
In xutil.c:122, took opportunity fix a problem because calling 'perror'
after other function which are likely to have changed the errno is likely
to provide a wrong error string.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Because the library does not have an initialisation function, we need to
rely on an automatic called-on-load mechanism, which is provided through
a compiler attribute 'constructor'.
However, as the project aims to still compile on old hard/software, we
include a check in 'configure' to ensure it works, and if not use the
legacy solution.
Note: Because we introduce a new DEFINE, the 'config.h.in' needs to be
regenerated, otherwise you may get a compilation error in wrlib. This is
done by re-running './autogen.sh'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This patch is just adding a single header, but because it also modifies
all the C files to add the #include, it was made as a patch on its own to
ease review.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The library did not propose the mechanisms to be translated, this patch is
creating the structure in autoconf/automake and the translation directory
so its messages can be also translated.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
When creating the list of possible shortcut for windows to populate the
window menu, a temporary buffer was allocated to hold that string.
As this allocation participates to memory fragmentation, this patch makes
use of storage on the stack instead which is also faster.
Took opportunity to include the shortcut number (%i) in the string to be
translated, because it is unlikely that adding that number at the end of
the string is right in all languages. Updated french translation because
it is the only one I am confident with.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
With proper attributes, the compiler is able to do some extra checks on
user side to make code safer and/or better optimised.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity (CID #50181, #50182 and #50183) the strings allocated by parse_wmconfig_line were not freed after use.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
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>
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>
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>
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>
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>
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>
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>
As reported by Coverity (CID #331553), we leak the allocated string
returned by 'WMGetTextFieldText'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
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>
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>
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>
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>
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.
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>
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>
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>
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.
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.
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.
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.
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.
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).
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
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.
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.
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.