vscr: Join loops

This patch join the creation loop and the set element loop for the
virtual screen.
wmaker: work around compilers that do not support nested functions

There are a few cases in which nested functions are an helpful way to write
code, as this is explained in 'script/nested-func-to-macro.sh'. However,
some compiler do not support them (like clang), so this patch proposes an
elegant solution, where developers can get the benefit of them, but for
users they are automatically converted to C macro if needed.

The advantage of this solution is that we keep the code simple, there is no
hack in the source (like #ifdef and code duplication), yet still having the
full advantages.

The translation is done according to what have been detected by configure
(see the WM_PROG_CC_NESTEDFUNC macro) so that user has nothing to do.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
merge with c0d4c16336b98d9baf0d89aaa42d3e4520b73cae

As pointed by Clang, the declaration of array was using the GNU old syntax,
not the standard C.
WPrefs: link against math library because it is used in a few places

The code is making use of a few of the libm functions, but it looks like
gcc adds automatically the libm dependency (either by trying to be smart or
as an inherited dependency?).

Apparently, when compiling with clang-3.5 the function 'round' still needs
the use of math library (the others do not seem to), so this patch adds it
to the list of link libraries, which is more portable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Make sub-directories visible the automake's "dist*" targets

We have a few directories with source codes that we tell configure to
prepare, but we do not actually want them built during normal operations
(tests and examples only).

However, there are some special targets brought by automake which still
need to see them, so this patch adds these directories to the list, but
only for these rules, we keep them unvisited by the normal build process.

The wanted side effect of this is that now "make distcheck" works untill
the end as expectable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
WINGs: add functions to set widget background image

With this patch we can set widget background image.
As now, only background color was available.
WINGs: increment version

This patch is incrementing version number as the API changed.
WPrefs: add workspace pager configuration

This patch is adding a checkbox in the expert zone to disable
completely the workspace pager and add an entry in keyshortcut preference
to set the shortcut used to open the pager.
wmaker: add workspace pager underlying configuration

This path is adding the functions and variables needed for workspace pager preferences.
An option to enable/disable the workspace pager, and one to set a default background image.

THIS PATCH WAS MODIFIED BY Rodolfo García Peñas (kix) because cannot be
applied in the awmaker git without changes. This patch is based in the
original patch created by David Maciejak <david.maciejak@gmail.com>.
wmaker: add core workspace pager functions

This patch is adding the core code needed to run the workspace pager.

THIS PATCH WAS MODIFIED BY Rodolfo García Peñas (kix) because cannot be
applied in the awmaker git without changes. This patch is based in the
original patch created by David Maciejak <david.maciejak@gmail.com>.

This patch has a lot of changes, first the support for vscr, and changes
about code style for the new files wsmap.[ch].
wmaker: moved the variable 'process_workspacemap_event' to the global namespace

The definition in the local header was not correct; it works because gcc is
tolerant to this kind of errors but other compilers are not. The
declaration was creating a local variable in each file that call header,
and because it is not static gcc's linker will merge them. Other compilers
will at best complain for duplicate symbol, and at worst silently duplicate
the variable so it will not work as expected.

The variable is now moved to the existing structure meant for global
variables, so now the code is really clear about using a global variable
instead of a static/local one.

Took opportunity to add some missing 'static' attributes to some variables.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>

THIS PATCH WAS MODIFIED BY Rodolfo García Peñas (kix) because cannot be
applied in the awmaker git without changes. This patch is based in the
original patch created by Christophe CURIS <christophe.curis@free.fr>.

This patch has a lot of changes, mostly the support for vscr, that is
included in screen.h instead of Windowmaker.h

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
wmaker: remove unnecessary null pointer checks in handle_event of wsmap

The function is called only if wsmap is not null, and the function is not
modifying its value so it won't become null. Removed the checks to keep the
code as simple as possible for maintainability.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>

THIS PATCH WAS MODIFIED BY Rodolfo García Peñas (kix) because cannot be
applied in the awmaker git without changes. This patch is based in the
original patch created by Christophe CURIS <christophe.curis@free.fr>.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
makefile: make silent rule work also for generated files

A few files are generated using custom commands, which so far did not
follow the silent rule as the compilation stuff.

This patch adds the needed stuff so they will also be silent if the user
wants so, leading to a cleaner build process where warning/error messages
are more visible.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>

THIS PATCH WAS MODIFIED BY Rodolfo García Peñas (kix) because cannot be
applied in the awmaker git without changes. This patch is based in the
original patch created by Christophe CURIS <christophe.curis@free.fr>.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
wmaker: replaced macro by an inline function, in X Modifier initialisation

A macro can be a source of problems, because the compiler has no type on
the arguments to make checks. Using an inline function allows to do those
checks, meaning clearer error messages, it provides clear info in case of
name collision, it is easier to maintain (no need for the hacky '\' for
multi-lines) and the scope of visibility can be controlled more easily (no
need for #undef).

Took opportunity to change a 0 to the constant NoSymbol which is the name
defined by X for this case and another to NULL which is the right way to
set a null pointer in C.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>

THIS PATCH WAS MODIFIED BY Rodolfo García Peñas (kix) because cannot be
applied in the awmaker git without changes. This patch is based in the
original patch created by Christophe CURIS <christophe.curis@free.fr>.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
wmaker: replaced macro 'store_modifier' by an inline function, in X Modifier initialisation

A macro can be a source of problems, because the compiler has no type on
the arguments to make checks. Using an inline function allows to do those
checks, meaning clearer error messages, it provides clear info in case of
name collision, it is easier to maintain (no need for the hacky '\' for
multi-lines) and the scope of visibility can be controlled more easily (no
need for #undef).

The macro store_modifier had to face a slight change because its 2nd
parameter is used as a reference, which is now clearly visible in the
prototype of the function.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
checkpatch: fix bug in regular expression

Recent version of perl seem to report incorrect stuff in regular expression
and this seems to be fixed in the kernel reference file, so this patch
brings the fix to our (older) version so we won't get that spurious message
when running the script.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
WPrefs: fix memory leak when storing the list of texture in Appearence panel (Coverity #50112)

As pointed by Coverity, the PLStrings created to store the information on
the texture leak. This is due to the fact that they are created with a
refCount of 1, then the PLArray in which they are placed increments that
count, so at list destruction the count would return to 1 instead of 0,
meaning the PLStrings won't be freed.

This patch release the PLStrings once after adding them to the PLArray so
the count will go back to 1, which means they will be properly freed when
the PLArray will be released.

Took opportunity to remove the call to WMRetainPropList on the titem-prop
because it artificially increases the refCount but this is already done
when adding to the PLArray.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
WPrefs: fix icon used in the Opaque/Non-opaque Move setting

Apparently, some pixels from the close button on the window image were
missing from the Non-opaque image, they have been added in the XPM file
which was then converted to TIFF with ImageMagick's command:
  convert -depth 8 -compress lzw xpm/nonopaque.xpm tiff/nonopaque.tiff
to have a file similar to what was there before

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
wrlib: Merge some duplicate code when allocating color

This patch is adding a static function named allocateColor to merge
some duplicate code.
configure: rewrote the detection for -Wunused-macro

This flag is always detected as unsupported because every time autoconf is
generating a test program for any feature, it puts at the beginning of the
test source all the '#define' that have been detected so far, which is what
we expect normally.

But for this option, as we cannot reasonably make a dummy use of every
macro, the warning triggers and falsely gets autoconf into thinking it does
not work.

This patch creates a dedicated macro (WM_CFLAGS_GCC_OPTION_UNUSEDMACROS)
for this flag, which works around the problem by having no '#define' in the
test source. It also adds a new macro WM_CFLAGS_GCC_OPTION_POSTPONED
because if the flag works, we still cannot add it to the compilation
command because it could fail all further tests done, so the macro will add
it to CFLAGS only at the end.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>