There are some times when we need a Switch Button (aka CheckBox) with more
than 2 states, generally to express check/uncheck/leave-as-is.
This patch extends the Button widget to support the new WBTTriState type,
similar to the existing WBTSwitch except it supports a 3rd state which is
reported to application as '-1'.
The implementation was done in order to not break the binary API. The
version have been incremented in the WINGs header to reflect the change,
but not the version in the 'configure.ac' because that have already been
done in commit c6e323e75d for the next Window Maker release.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As there is already an attribute to allow changing this behaviour, and this
is being using for the Net WM hints, there is no reason to not support it
for MWM Hints also; contrary to the initial guess suggested by the comment
it costs actually nothing to properly support that.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The structure containing the information on windows contains 2 sets of
attributes, client_flags which contains those asked by the application
through Hints (like MWM Hints and others) and user_flags which was defined
to allow the user to override them.
Unfortunately many places of the code was using the wrong structure to save
the attributes to (for example by using the WSETUFLAG macro) which was
merely ok as the user_flags have priority, but when we want to provide a
clean consistent behaviour to users, we need to get things in the right
place.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The Window Inspector is used to let user change a list of advanced options
for all the windows of an application. This list was defined through many
hard-coded things; by defining an array with everything at the beginning of
the file it is easier to maintain (the code is simpler because it is more
generic) and to make it evolve.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The Window Inspector is used to let user change a list of advanced options
for a window. This list was defined through many hard-coded things; by
defining an array with everything at the beginning of the file it is easier
to maintain (the code is simpler because it is more generic) and to make it
evolve in the future.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The Window Inspector is used to let user change the list of attributes for
a window. This list of attributes was defined through many hard-coded
things; by defining an array with everything at the beginning of the file
it is easier to maintain (the code is simpler because it is more generic)
and to make it evolve.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by the "checkpatch.pl" script, one line was too long in respect
of the coding style.
This line contains the calculation of an offset when storing a value in an
array, as this offset is a constant during all the loop, this patch is
calculating the offset only once before the loop and then uses this result,
which should make the code faster (although gcc may already optimise this
kind of things), makes it compliant with coding style, and takes the
opportunity to explain the reasons behind this offset.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
By defining the const array with everything at the beginning of the file,
it is easier to maintain and to make evolve.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
By defining the const array with everything at the beginning of the file,
it is easier to maintain and to make evolve (all stuff at the same place).
Merged the function makeMakeShortcutMenu into makeOptionsMenu because it
allows to use a simple callback in the structure like for the other
submenus and because its complexity did not justify a dedicated function.
Took opportunity to give a more appropriate name to the index
MC_DUMMY_MOVETO which did not mean what the entry is about.
As a side effect, this should close Coverity #50251 which was about saving
the return value of function into a variable but not using it, which is not
really good for maintainability.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
There was the possibility to include a global sub-menu to the root menu
using a dedicated file, but this does not look like it is really useful as
this root menu is already defined by a user file, and the root menu is
already specific enough that it does not need anything more 'global'.
Furthermore, the variable enabling this feature (GLOBAL_SUBMENU_FILE) is
not defined anywhere (neither from "configure", nor in "wconfig.h", ...) and
is also not documented at all.
Considering it was introduced a very long time ago (1999!) and was not
touched anymore, this patch removes the dead code associated with it.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
It is not really efficient to call it twice because the strings will not
change, and by using the appropriate trick it can make the code smaller,
with less redundancy, so less prone to bugs and easier to maintain.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The function does not need to be passed a array of pointer to windows
because it does not change content of the pointers. It is more efficient to
directly use an array of windows as the parameter, and simpler also.
As 'SlideWindow' is also concerned, it can be simplified and turned into
an inlinable function so the compiler can optimise it.
Took opportunity to de-CamelCase the name of the functions to comply with
the project's coding style.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Changed the code to return as soon as the result is known because it makes
the code simpler to understand, which is good for maintainability.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
It is generally considered bad practice to place an assignation inside the
expression for an "if" statement because it is often a source of bug,
because of possible typos and because it makes reviewing code more
complicated.
This patch fixes as much cases as possible to make the code easier to read.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The code for animating stuff needs some parameters in a few functions,
which are not used when animations are disabled at compile time, so the
compiler issues some warnings about them.
This patch adds the appropriate statements to disable declaration that
are not needed in this case, and tell the compiler it is ok to not use
the parameters not needed, thus fixing the warnings.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The old behaviour was to expect the user to go modify manually a source
file which is not a great idea because that's typically the kind of things
in charge of the configure script.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
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>
As pointed by the new check script, the preference "show_clip_title" is
defined as a Boolean value in the preference loading function, which uses
the callback function "getBool", which expect a variable of type "char",
but the variable was not defined with that type.
This patch changes the type for the appropriate one to avoid possible
problems.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Because the C compiler cannot check the consistency between the type of the
variable being pointed to, and the type expected by the call-back function
that is used to parse and store the value from the configuration file,
there is a risk of mismatch that can cause Window Maker to misbehave due to
data corruption, which depends strongly on the configuration values and the
architecture on which Window Maker is running.
This patch introduces a script that checks the consistency where possible, to
raise the issues when performing "make check".
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Recently added/changed msgid's were translated, plus a few
improvements. Kept some entries for last stable release. Removed
abbreviated forms from menu comment.
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
The original code assumed that the sizeof returns a long int type, which is
true on 64 bits platform but not on 32 bits platforms, as pointed by gcc.
The new code does an explicit conversions to 'int' (which should be enough
for that case) so the format specifier in printf will always be ok,
whatever platform Window Maker is compiled for.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Martin Dietze, when switching workspace (mainly with
keyboard shortcut) while the focus was set on a sticky note from the
GNUstep application "Affiche.app" would cause Window Maker to crash.
This crash was due to the application creating its menu with an Omnipresent
state; Window Maker tried to be smart by smartly setting the focus to this
window after the workspace change, unfortunately when removing the window
of the note from the screen the application would decide to remove also the
omnipresent menu (because it is not necessary anymore).
Because we kept a pointer to an outdated WWindow, we would silently corrupt
memory, which would later cause a crash in an unrelated place (fortunately
in this case it happened quite soon).
This patch adds a check to make sure the window we want to focus is still
a valid one, and if it is not we just ignore it to fall back on another
mechanism already in place for picking the window to focus.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
There are some risks associated with the way arguments are used in macros,
and using a function also allows check on the type of arguments and leaves
more room to the compiler for making the best optimisation choice; it also
allows writing easier to read code (and thus, to maintain).
As a side effect, this should also help Coverity in avoiding false positive
bug reports (like #109605 and #109607).
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the variable 'path_dst' was first free'd, then it
was used in the 'unlink' function.
This patch fixes the call order to de-allocate the string only when it is
no more needed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
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>
As pointed by Coverity, the pointer in wwin->frame have already been
dereferenced many times in the function, so it is useless to include a
check later; removing it makes the code smaller thus easier to maintain.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there was a memory leak because the buffer used to
create the wmsetbg command is allocated twice.
Because it is not really necessary to call 'wmalloc' for such a small case
(it is not efficient and participates to memory fragmentation), this patch
replaces the dynamic memory allocation by a buffer on the stack, which also
solves to de-allocation issue.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is a safety check on the number of workspace
which aborts the function, but the storage memory have already been
allocated so it would leak this buffer.
The case where the number of workspace is 0 is probably not supposed to
happen (there should always be at least 1 workspace, the current one), but
it is better to keep safety checks, so this patch is moving the check at
the beginning so no leak will occur.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, when increasing the size of the array allocated to
store the pointers to menus in a cascaded menu, the incorrect value was
used in argument to the sizeof which lead to over-allocating memory.
This patch replaces the name of the structure (which should have been the
pointer type) by the variable actually being used, fixing the size issue
and making maintainability easier by tracking the type of the variable
which is less prone to bugs in case of change.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, a temporary proplist is created with the list of
keys to be removed from the source proplist, but this temporary proplist
was not released at the end, leaking memory.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, in the "Configuration" panel of WPrefs there are
some images loaded, but if the images cannot be loaded correctly then the
returned NULL pointer can crash the application as it is dereferenced in
further function calls.
To solve this case, this patch is adding a NULL pointer check in the
functions RScaleImage (wrlib) and WMCreatePixmapFromRImage (WINGs), so both
can accept that NULL pointer to also return NULL, which means the existing
check for "icon == NULL" in the WPrefs code will be useful.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity, the return value for XGetWindowAttributes is
usually checked in many places, because it is a good practice to ensure
that it did work, but it was not checked when called in the function
'wClientCheckProperty'.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Douglas Torrance, the script that generates the plain text
documentation from the texinfo source would crash due to the cross-
references when the version of awk used is "mawk".
This is actually a known bug in mawk:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=172774
It looks like the bug have been fixed in mawk, but Debian is still
providing a broken version. To avoid problems, this patch is introducing a
workaround in the matching pattern that causes the issue every time it is
being used.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Douglas Torrance, there are some case where the 2 docs
INSTALL-WMAKER and README.i18n are not re-generated properly, one of the
cases being if the user grabs the sources from Git to make a source package
only (ie, without compiling anything).
This patch adds a hook to "make dist" so it will re-generate the docs if
needed. Because the "dist-hook" is run after Automake has copied the files
to the temporary directory (distdir) then we also include an explicit copy
of the files there to have the latest version.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'.
As the feature concerns the Dock and not DnD in general (WINGs support is
not disabled), make it a bit more clear in the macro name and document the
configure flag in the Installation Manual.
Took opportunity to compile the corresponding file only when the feature is
not disabled.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The old behaviour was to expect the user to go modify manually a source
file which is not a great idea because that's typically the kind of things
in charge of the configure script.
As a side effect, we can now use an automake conditional to avoid compiling
the source file in charge of the feature when not used, instead of trying
to compile an empty-looking file.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
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>
There are a few rare cases where some options listed in the program's
built-in help page may not be documented for a valid reason. This patch
provides an option to the checking script to not complain about them, but:
- the listed options must include a comment about why, to ensure that the
user thinks twice about it and because it is better for maintainability;
- the listed option must be part of the options listed by the application
to ensure the command line invocation of the script will remain up to date.
This new option is then used for the check of the "configure" options
because for a few of them the right place to document them is in the
INSTALL file provided by Autoconf and not in our Window Maker specific doc.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As there are many options, they have been split into 5 sections; added
documentation for all the legacy Window Maker options that were missing and
for the new ones; added documentation for a few of the "autotools" standard
options that can be considered interesting.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
In order to ease the job of keeping the documentation aligned against the
sources, this patch adds a check of the list of options returned by
"configure --help" against the options that are listed in the
INSTALL-WMAKER file.
The check is ran as part of "make check", which also implies it will break
a "make distcheck" operation when not in line.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Setting LANG/LINGUAS to en_RN should not be a problem with the current
configure script, so don't mention it;
Removed the section about the "WindowMaker-extra" package, because this
things looks to be deprecated;
Removed the 2 errors related to configure, because as the Autotool versions
is now specified in the configure.ac this situation should not arise.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
- update the list of supported platforms according to current known status;
- updated URL links to all dependencies to the current known URL;
- moved the dependency on Autotools to a dedicated section, because it is
not supposed to be necessary for people compiling from the distributed
source archive, and updated the version according to current status;
- extended the chapter on getting the sources to contain all info that
could be needed;
- added a note about compiler requirement to ease understanding the actual
requirements;
- documented some long-time known dependancies (libbsd, inotify, boehm gc);
- fixed a few strings here and there;
- made an appropriate reference to the README.i18n for the troubleshooting
of NLS.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The source of the documentation is in Texinfo format to have the
possibility someday to distribute in more format that just plain text;
The INSTALL-WMAKER original file will now be generated automatically when
running the 'autogen.sh' script (for those who made a git-checkout) and
when running 'make' (for the people who create the distribution archive).
The current document have seen these changes:
- added all the texinfo header (including the copyright notice);
- texinfo formatting command in place everywhere applicable;
- re-ordering of the content to try to get a consistent document.
Apart from this, the document should not have seen any change on the
content, because this deserves dedicated patches to show the evolution.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The texinfo format provides 3 commands @ref, @xref and @pxref to make cross
references to existing @nodes in the document; it also provides a command
@anchor to place arbitrary targets for cross-reference.
Because these will be handy for the Installation Manual that already does
some references, this patch implements the 4 commands:
- change the '@node' command, that did nothing, to now track potential
reference points;
- add the '@anchor' command to register a new target for x-ref;
- implement the 3 '@*ref' commands with similar behaviour as the texinfo
format states, with support for all arguments, generating a temporary
"@x##@" pattern for the line target;
- generate a new file (*.xrf, a sed script) at the end with the
replacement for x-ref patterns with the correct line number, and perform
a few consistency checks;
- during the final search-and-replace used to insert the Table of Content,
include the x-ref replacement.
The current script has some limitations:
- because we cannot know in advance the target line number for the x-ref,
we insert it with a constant size of 5 characters to avoid breaking the
justification alignment when doing the replace;
- there is a strict order to respect between @node and @chapter/@section,
which is needed because we have to include a line offset to get it right
when using the order given in the texinfo manual.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The texinfo format provides a command '@table' which is useful to provide
a list of object (function, variables, options, ...) with their associated
description.
As this will be very handy for the Installation Manual, this patch
implements the command in the script.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The texinfo format provides a command to generate list of item which are
prefixed by an auto-incremented number or letter.
This command was not implemented but as it will be used by the Installation
Manual of Window Maker, this patch implements it, reusing much of the code
that was handling the unordered lists.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
There are some cases where it can be useful to embed a list of item into
another list; the script was almost ready to handle this case, this patch
brings the missing stuff to get it to work properly.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>