Replace calls to wusergnusteppath() which just append "/Library" by calls
to wuserdatapath().
Take opportunity to replace hardcoded "/WindowMaker" directories with
the existing PACKAGE_TARNAME macro (which comes from autotools).
The choice of 'TARNAME' is because it meant to be used in filename, thus
less likely to have problematic characters than PACKAGE_NAME (meant for
display purpose) and PACKAGE which is there for historical reason.
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>
This patch removes these warnings in the hsbInit function.
wcolorpanel.c: In function ‘hsbInit’:
wcolorpanel.c:3456:16: warning: ‘%u’ directive writing between 1 and 5 bytes into a region of size 4 [-Wformat-overflow=]
sprintf(tmp, "%d", value[0]);
^~
wcolorpanel.c:3456:15: note: directive argument in the range [0, 65535]
sprintf(tmp, "%d", value[0]);
^~~~
wcolorpanel.c:3456:2: note: ‘sprintf’ output between 2 and 6 bytes into a destination of size 4
sprintf(tmp, "%d", value[0]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
The problem is that the hue variable in the RHSVColor struct. This variable is not an integer, is a shor variable, so using the printf using the "%d" modifier spects an integer. Using a "%hu" prints a unsigned short value.
typedef struct RHSVColor {
unsigned short hue; /* 0-359 */
unsigned char saturation; /* 0-255 */
unsigned char value; /* 0-255 */
} RHSVColor;
This patch removes this warning. The default case should not be used.
wcolorpanel.c: In function ‘rgbIntToChar’:
wcolorpanel.c:2392:2: warning: ‘format’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sprintf(tmp, format, value[1]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes this warning. The patch adds a switch case that never should happend.
wcolorpanel.c: In function ‘rgbInit’:
wcolorpanel.c:3403:2: warning: ‘format’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sprintf(tmp, format, panel->color.rgb.green);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
As reported by Coverity, the function 'customSetPalette' is making a call
to 'WMGetPopUpButtonSelectedItem', but this function does nothing to the
widget but only return a value, which is not used at all, so this patch
removes the call to the function.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
For code maintainability, it is better to have a single definition of the
constant than many ones dispatched in many places. In addition, we try to
count on the constant M_PI that can be defined by the header <math.h> if
possible because it may have the best accuracy for the platform.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
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>
This macro was define a *very* long time ago, in commit
d98f1fa645
but was not used at that time, and have never been used anywhere since
then.
As the macro does not look like a good idea for performance anyway, get rid
of it before anyone could get tempted to use it.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
In particular, the values were only being converted when the RGB slider was used
to pick the color. If another tool was used, e.g., the magnifying glass, th e
value was assumed to be decimal, even if hexadecimal was selected.
This macro supposes that the called lib function clears the 'errno'
variable on success which is not the case. The macro was (luckily) not
used in these file yet, by removing it we make sure it won't happen.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the code was checking for NULL pointer to avoid
misbehaviour, but it actually dereferenced the pointer beforehand so the
crash would still happen.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity, the function 'WMGetTextFieldText' allocates memory
to generate the result string, so it has to be freed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This allow compiler to raise a warning in case a new value would be added
to the enum; it also change order in the check so that WMGetButtonSelected
will be called only once, only for the case of interest.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The RGB panel of the WINGs color panel lists the red, green, and blue values as
base 10 numbers. However, hexadecimal numbers are very common when dealing with
RGB colors. This patch adds two radio buttons at the bottom of the RGB panel
to allow users to choose their preferred number system.
For version 2 of the patch:
Based on Cristophe's suggestions regarding the new decimal/hexadecimal RGB color
feature introduced in commit 83d8ad6, this patch changes rgbState from an int
to an enum, converts some if statements to switches, and changes from atoi to
strtol for the base 10 string conversion.
In addition, the "hexadecimal" text was too wide for the default size of its
radio button for some fonts, so both radio buttons are now resized to fit the
width of the panel.
The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
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>
The mechanism of Notifications in the WINGs toolkit is relying on
callbacks to dispatch notifications, 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>
...in order to avoid clashes that happen during compilation of
wmakerconf.
This is a new function in WINGs, so renaming it at this point is
not a big deal.
Thanks to Rodolfo García for the heads up.
The idea is to use the fetchFile() in getstyle.c and in wcolorpanel.c
instead of using two very similar functions.
In order to do that, let's move the most generic one (fetchFile()) to
libWUtils, and this is the first step.
There are were a few uses of 'strncpy' that could lead to a missing NUL,
resulting in possible garbage being displayed. As suggested by Tamas,
use 'wstrlcpy' instead
* 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)
wsyserrorwithcode - Not used, no point either.
wsyserror->werror - qualifying "error" with a "type" hardly makes
sense if there are not at least two "type"s. There are not. Safe trip.
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
- Does away with the O_BINARY abomination
- as a byproduct, plugs an fd leak in wcolorpanel.c:fetchFile()
- sprinkle some fsync()s to files that have been written to (this
needs to be done everywhere)
+ fix brown paper bag thinko in configure.ac
These are some of the fixes sent to the wmaker-dev list by
Vladimir Nadvornik, with minor modifications to address Dan
Pascu's concerns.
Original-post: http://lists.windowmaker.info/dev/msg00293.html
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 :-)
shouldn't release it. It is just a reference to the internal WMText color.
This should make all the functions returning colors from widgets behave
consistently
are affected. Fixes for old code too.
- Double buffering in WMList. All widgets or apps using WMList and
having user drawing porcedures in place will inherit this double
buffering automatically too.
- New functions in WINGs: WMGetColorAlpha(), WMIsAAFont()
- Misc code cleanups in WINGs and src/dialog.c
WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
arguments. WMDrawImageString() receives 2 colors (text & background).
This is to allow easy extension for Xft/Xrender and hide X low level details
- Added alpha channel to WMColor. 2 new functions also:
WMCreateRGBAColor() and WMSetColorAlpha()
- Miscelaneous code cleanups in wtext.c
- Removed obsoleted acconfig.h and implemented its functionality using
AC_DEFINE and AC_DEFINE_UNQUOTED as autoconf 2.5x recommends.
This will definitely enforce the need to use autoconf 2.5x