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 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>
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 were 2 options that were not documented at all, which are now listed
in the 'wmaker --help';
The man page have been updated according to the 'check-cmdline-opts' script
feedback, including:
- adding 2 options that were missing (global_def_path, no-drawer);
- removed 2 options that do not exist anymore (no-cpp, create-stdcmap);
- sorting the options, to make them easier to search for.
In addition, took opportunity to:
- remove the double description for 'visual-id';
- improve a number of descriptions to make them clearer;
- fix minor stuff (typo, spaces at end of lines).
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Juan Giordana, the autocomplete/history feature which is
available to Run dialogs brought up by the root menu is not available to Run
dialogs brought up by a keyboard shortcut. This patch enables this
behavior.
Autoconf have been providing the option '--localedir' for a long time now,
so this patch removes the deprecated '--with-nls' option and makes use of
the standard '--localedir' instead.
Took opportunity to define the path in the 'config-paths.h' in the same way
the other paths are defined to be consistent, which also simplify the
compilation commands.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by the new script, a number of source file were not included in
the list of files to check for translations.
Took opportunity to make translatable a few of the messages.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The name of the 2 settings have been changed:
- enable: MiniwindowApercuBalloons -> MiniwindowPreviewBalloons
- size: ApercuSize -> MiniPreviewSize
The old name is still supported to avoid breaking user's configuration, but
WPrefs will update the setting to the new names when updating the
configuration.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
To be consistent, all place where the not-properly-written "apercu" was
used in the source code (of wmaker and WPrefs) it has been replaced by an
appropriate "minipreview" or similar, to be in line with the new name
suggested by Yuri Tarasievich.
This new name is better understood by contributors who speak usual english,
but not this word which comes From french but is sparsely understood by
british people.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Having an thing whose name requires special UTF-8 character to be properly
displayed is a source of portability problem (including xgettext issue
reported by Alwin);
Considering also that this french word is only understood (sparesely) in
Great Britain, but not by international english speaking community;
This patch then replace it by the "Mini-Preview" suggested by Yuri
Tarasievich, which is more likely to be understood.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As found by Rodolfo García Peñas, this flag is never given a value; further
investigations in the history of the project show that this flag have never
been implemented because its action is totally redundant with the flag
"noupdate".
As the later flag's name is more clear about what the behaviour for the
user is, as opposed to what is being done under the hood, its name is kept
and the "nopolling" flag is removed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Moritz, the Qt toolkit (and maybe a few other ones) are
using the content of this property, but WindowMaker did not set it properly
so for examples the menus in KDE could fail to display in multi-screen
configuration (probably because the toolkit is using the property to make
sure the menu stays in the visible area).
The original code just assumed it was safe to use the usable area of the
1st screen in the list, but unfortunately it is not that simple.
The new code calculates a rectangle that contains the usable region from
all the screens, so the toolkit gets a more accurate value.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Include a comment to explain what their aim is, and why WindowMaker is not
making use of them. They are not simply removed because it is informative
for future contributors that we know about them and we purposedly decided
to not use them.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This parameter is given always the same value, so there is not reason to
keep it. The code is updated to take this value into account, and the
related constants are removed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
These 2 constants have been defined at the beginning of the project, but
where never used later. As the use of the associated constants suggests
that they are not bringing anything useful, this patch simply removes them.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The goal is to explain the reason why we don't do anything about them, so
people looking at the code in the future will know why it is this way. The
expected side effect is also to silent warnings [-Wunused-macros] from gcc.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by gcc, this constant is not used anywhere in the code. It seems
to have been prepared for a scroll animation when the switchpanel would be
too big to fit the screen, but the code looks like to never have been
activated, and was cleaned away in commit
6d08aa22d8
If the feature were to be re-added, it would be better to use something
proportional to the menu scroll speed parameter that can be configured by
user anyway.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by gcc, this macro is not used anywhere, that is probably
because the code have been relying on the function "IsDoubleClick" for a
very long time now.
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, the 4 constant the define the corner positions are not
used anywhere in the code, and it looks like it has always been like this.
As it is a cost for maintainability, get rid of them.
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>
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>
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>
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>
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>
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 is adding the core code needed to run the workspace pager.
Currently when called, a new frame presenting mini workspace images
are displayed at the bottom of the screen above other windows.
When clicking on one of the miniatures, the workspace is switched and
the frame is closed.
Drawbacks: a screenshot of the workspace is used for the miniatures.
This screenshot is taken only when a workspace switched event occurs.
First, it means that the workspace switching process can be longer than
usual. Secondly, updated minitatures can only be available when the
workspace is "opened" (cause windows have to be mapped to be able to
be copied).
So when wmaker is (re)started or when for example a window is moved to
another workspace the corresponding miniature is NOT updated.
(I did not find a clean and easy way to do so, feel free to share if
you have some ideas)
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.
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>
As pointed by Coverity, if dock is still null at this point then the
function will return via the previous check, because it is not possible to
have icon_pos >= 0 if dock is null.
This patch removes the check because it complicate the code which is not
recommended for maintainability.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Using a variable to store the return value that will be used later is not a
good idea, because it forces to track everywhere in the function when
needing to work on the function.
This patch removes the variables and places explicit return if each case,
so on first look it is clear where the code stops.
It also fixes a bug where the function would handle an event but still
returns False (meaning the event was not treated), whose root cause was
coming from the complexity brought by the variable.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Coverity complain that there can be security issues because the variable
'i' is being modified using untrusted data (coming from a file). This is
probably pessimistic, because in the present case we're talking with the
kernel.
Using the correct signedness for the variable should however keep us safe,
and (I hope) make Coverity happy.
Took opportunity to include an error message in case of read problem
because it can help to debug.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, we store a value into the variable 'entry' but we
never use it later, although we re-use the variable.
For the maintainability of the code, it is not really good as it could
mislead into thinking the value could be used, so this patch removes the
assignation.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Coverity warned because the 2 strcpy may overflow the target buffer (the
code relies on a constant for the max allowed workspace name length).
As in both cases the temporary copy is not useful because the temp copy
will be strdup'd just after, this patch removes the temporary buffer and
uses directly the string.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
In case of problem with a directory when building the list of files for the
Icon Chooser dialog, an error message was generated using a temporary
allocated buffer. This is not really good for memory fragmentation, so this
patch re-uses the local buffer which will be enough for all reasonable
cases.
Took opportunity to make message less prone to translation difficulties,
and include more information about the problem to the user so he may know
what went wrong.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is a possible (yet improbable) buffer overrun
when building the list of files to be used in the Icon Chooser dialog.
Better safe than sorry, let's use the safer function to build the complete
name, and add a little message to the user in case of problem so at least
he can know something was not right.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there were a number of copies done into fixed-size
buffer, it's safer to use the function that sets a limit on the size to
avoid a crash.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is in the same procedure a check for null
pointer before use, and later a direct use without check.
In most case, the pointer is not null, but it one case it is hard to be
sure that the pointer cannot be null, so it's safer to just add a check
there also.
Took opportunity to swap the order of the arguments in the if, because if
the config flag is false it is not necessary to spend time on doing the
more expensive strcmp.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Germán Arias, some windows in GNUstep did not have a title
bar because they declare themselves with the NET_WM type MENU.
A closer look at the spec shows that this type is meant for stuff like tear
off menus, and thus like for toolbar it is not expected that the
application does not want a titlebar, as opposite to DROPDOWN_MENU,
POPUP_MENU and COMBO.
So, this patch moves the case for TYPE_MENU to be the same as TYPE_TOOLBAR
and remove the flag that disables having a title bar.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the sizeof used was not done on the right type.
This worked because the element was a pointer all pointers types have the
same size in most platforms.
For code maintainability, the code will now take the size from the first
element of the array to be sorted, so that if the structure gets changed
someday the expression will stay valid.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
There is a check a few line above that already return from the function
because there is nothing to do for that case, so the case statement cannot
be reached. As not all case are covered in that switch anyway that won't
make a difference, and because an 'int' is used instead of an 'enum' the
compiler will not be able complain anyway.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
The warning message was duplicated many times for each possible case, but
it could have used the same message everywhere, which ease the work of
translators. Took opportunity to include the complete command being
processed so that the user will know more about the problem and may be able
to fix it.
Updated the French translation to show the gain, but not the other
languages because it require more knowledge than what Google Translate can
provide me.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
As coverity pointed, the duplicated string was never freed. Considering
what is done with it, is not necessary to allocate a duplicate for it, it
is a waste of time and participates in memory fragmentation.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
As a previous patch modified some instances of the error message to include
more information to the user, it is a good idea to update also the other
uses of the message, so that:
- people helping on translation will have less messages to translate
- this mean we provide more information to the user in these places too,
which can help him solve the problem
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
As Coverity pointed, when building the command line to execute the current
code just assumed that it would fit in the large buffer. If user were to
provide a line too long, this would crash.
Factually this is probably not possible at current time because the command
given to the function was actually already limited to the MAXLINE size when
it was read, but this may not be guaranteed in future evolution.
Better safe than sorry, so the patch implement a size check when appending
strings, using a more efficient method (strcat re-parse the destination
string from the beginning to find its end every time).
Took the opportunity to:
- not include a trailing space at the end of the command
- do not run command if it was truncated (it could be a problem) but
provide a message to the user about it, so he may fix the problem
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
As coverity found a number of problem in the code, a few changes are made
to the function:
- allocate better sizes for the strings (the original code allocated too
much room in many cases and missed the room for the final '\0' in a case)
- do not free strings if empty anymore (the actual check was not correct
anyway), but avoid allocating in first place if it is not necessary.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>