1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-21 21:38:00 +01:00
Commit Graph

3900 Commits

Author SHA1 Message Date
Christophe CURIS
285a926539 wmaker: update error message to have only one string to be translated
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>
2014-11-23 22:43:38 +00:00
Christophe CURIS
65e5f452ec wmaker: fix possible buffer overrun in readMenuPipe (Coverity #50211, #50212)
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>
2014-11-23 22:43:37 +00:00
Christophe CURIS
d726eaf617 wmaker: fixes in function 'UnescapeWM_CLASS' (Coverity #50101, #50186, #50187)
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>
2014-11-23 22:43:37 +00:00
Christophe CURIS
ac3212b001 wmaker: fix memory leak in get_icon_filename (Coverity #50132)
Coverity pointed that in the typical code path the function FindImage would
be called twice, leading in leakage of the allocated result from the first
call.

This patch updates the condition so that the case won't arise.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
7013b72dce wmaker: remove unnecessary null check in readMenuDirectory (Coverity #50190)
As pointed by Coverity, the pointer cannot be null, otherwise the code
would have crashed earlier. As the code seems to always set a valid
pointer, there's no need to make a check there.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
de5ef8c4f1 wmaker: make parsing on display name less prone to crash in SetupEnvironment (Coverity #50096)
When creating the environment variable for the sub-process that wmaker can
create, Coverity pointed that if was possible to crash if the name of the
display did not contain the ':', which is probably ok in most case, but we
can't be sure about what it could contain in special cases.

This patch adds a proper check so, at least, it would not crash if the case
were to arise.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
38463df102 wmaker: fix incomplete null pointer check in wFrameWindowChangeTitle (Coverity #50058)
As pointed by Coverity, despite the numerous null pointer checks there is
still a case where one can pass trough and make wmaker crash.

This patch simplifies it all but making only one check at the beginning so
the code is safe and the remaining is simpler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
e27bab9f36 wmaker: remove unnecessary null check (Coverity #50196)
As pointed by Coverity, text cannot be null in this part of code. The
analysis shows that if it were, the function wIconChangeImageFile would
have directed execution to the 'else' branch. (and if it hadn't, the code
would have crashed beforehand because 'strlen' does not like null pointers)

Coverity recommends to remove the unnecessary check for code the
maintainability.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
694e66e30d wmaker: removed unnecessary variable 'done' in panelBtnCallback
The variable is assigned a value that never change, so it adds extra
complexity which is not good for code maintainability. It is probable that
this was meant for cases that are handled in current code with early
function return, which are better for code readability.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
a6d7ac8cb9 wmaker: removed unnecessary null pointer check (Coverity #50041)
As pointed by Coverity, the 'cmd' is checked for null at the beginning of
the function, so the second case to handle the null pointer is not needed.
This also means that 'command' cannot be null (wstrdup never returns null)
so the code can also be simplified.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
421e9f942c wmaker: improve error messages when trying to start the helper
Try to provide better messages to understand what went wrong, including
more information, and made them translatable;

Changed the call to 'dup' into 'dup2' which has a safer behaviour because
we can specify the target descriptor we want;

Removed a few check for the 'close()' because in these cases we do not
really care if they fail (we can't do anything about it and it just adds
noise in the logs).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
39357e4f90 wmaker: close unneeded file handles when running the bg helper (Coverity #50137)
As pointed by Coverity, the file descriptor used in 'dup' to become the
child process's STDIN is leaked, because it will not be used anymore, so we
close it after the dup.

Similarly, the file descriptors that represent the other ends of the pipe
for each process are useless, so let's close them too to keep a reasonable
number of opened file descriptors over time.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
e16c6fbf2a wmaker: moved the code for the bg helper to a dedicated function
In order to make code easier to maintain, the code related to creating the
Helper process (which helps by setting the background of the workspace) is
moved to a dedicated function, which have been moved to the same location
as the function for communicating with the helper.

Took opportunity to de-CamelCase the related names.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
38d160cb8c wmaker: minor fixes for the size of an aperçu
There was a probable bug when reading settings, because the function used
was 'getInt' which would try to store the result in a 'char'. As it would
be probably easier for user to have the value directly in pixels, the
storage is now done in an int so there won't be problem anymore.

Changed the behaviour of the constant APERCU_BORDER, which would be assumed
to be the size of the border in pixel, but in previous code it was actually
the sum of the two border (1 on each side). All maths have been changed to
have it as a single border width.

Took opportunity to group variable assignation for titleHeight and
shortenTitle in a single place, because it is not convenient to have them
spread around (one value in the beginning and others later in the code) and
using default values prevents some checks that modern compiler can do to
help produce safer code.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:43:37 +00:00
Christophe CURIS
572af55c9f wmaker: removed unnecessary assignation (Coverity #50257)
As pointed by Coverity, the return value is saved into a variable, but this
value is never used. As the variable is re-used afterwards, this
assignation could mislead on what is done, so for code maintainability the
value is just ignored.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:19 +00:00
Christophe CURIS
3d9c059591 wmaker: removed unnecessary check when painting application icon (Coverity #50052)
As pointed by Coverity, there was a check for null pointer on
scr->dock_dots, but this check was not made in the 2nd use of it, done if
the HIDDENDOT feature was enabled.

Investigation show that it is not possible that this pointer could be
created NULL, so let's remove the unneeded check.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:19 +00:00
Christophe CURIS
810796b390 WMaker: Fixed crash if the RContext creation fail on a Screen (Coverity #50066)
As pointed by Coverity, it is possible that RCreateContext fails for more
reasons that were handled by wScreenInit, so we provide an error message
for the other cases along with cleaner return from function.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:19 +00:00
Christophe CURIS
00f3ab0eaa wmaker: avoid allocating temporary memory in GetShortcutKey (Coverity #50115)
As pointed by Coverity, the function GetShortcutKey was allocating memory
for temporary operation, and did not free it in the end.

Because it participates in memory fragmentation and it is not really
efficient, this patch removes the allocation and uses a local storage on
the stack, and replaces wstrappend in favour of a fast string build.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:19 +00:00
Christophe CURIS
894d3e89bf wmaker: replaced dangerous function type conversion by argument conversion
A type conversion applied to a function when used as a pointer is dangerous
because the compiler may not be able to make sure arguments will be
compatible across architectures, so it can crash the application.

This is replaced by a function prototype matching exactly what is expected
for the callback, and have the type conversion on the argument done inside
the function so the compiler have complete liberty to generate any code
needed to handle it safely.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:19 +00:00
Christophe CURIS
f60f14b7bd WINGs: fix possible null pointer dereference in W_RealizeView (Coverity #50060)
As pointed by Coverity, the function makes use of a pointer which may be
null, so we have to properly check that to ensure application will not
crash.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:19 +00:00
Christophe CURIS
0c659c1618 WINGs: removed unnecessary size checks in WMGetBrowserPaths
The function is building strings from the directory names into an allocated
buffer, but the function took time first to calculate the exact size needed
for the resulting string, so the check on wstrlcat's result will never
fail.

As we still use wstrlcat it is not possible to overrun the buffer, we would
just return a truncated string in the list instead of return no list at all
but the case where it would happen is impossible.

This should fix Coverity #50111 (Resource leak) which was present in the
code of one of the related early return.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
082de93ca0 WINGs: inverted the direction for mouse wheel on WMSliders
The original choice may have looked mathematically correct, but it was
actually counter-intuitive and opposite to what every other application
do with sliders.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
01fbeab1d4 WUtil: fix default rights for file created when saving PropList
When creating the temporary file that will become the final file if no
problem occurs, there is a chmod done which does not give write access to
the group and to the others, but this is the task of the user-set umask.

This patch makes the rights to everything (except execution, of course) and
still applies the umask, so in the end the file will have the rights that
user wants.

Took the opportunity to make a little change related to the umask: it seems
that some version of mkstemp have a security issue, which is in not a
problem in our use case, but Coverity reports it (#50201) so as it does not
cost anything, the patch also fixes it with an appropriate comment to
explain the situation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
155e1f1fe1 WUtil: rewrote wcopy_file for better error handling and to fix Coverity #50234
The original code used the libc "fopen" kind of operation, which are handy
when manipulating text files, but:
 - bring an overhead for binary files that we don't need here;
 - does not provide the mechanisms for safe error handling and special cases

As Coverity reported a Time-of-Check/Time-of-Use type of security issue,
took the opportunity to fix it and increased the size of the buffer used
for data to allow better use of modern disk performances.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Christophe CURIS
662b83769a WUtil: changed order for null pointer check in array functions (Coverity #72806, #72807, #72819)
As pointed by Coverity, there were some null pointer checks that had been
misplaced, due to a pointer dereference present in a preceding check. This
had been fixed by adding another null check in the check, making a
duplicate check.

This patch moves the null pointer check in first place, and remove the
pointer check from the range check to separate the pointer check on one
side and the range check on the other side.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-23 22:42:18 +00:00
Alwin
40139e208b Catch-up and some cosmetic changes of the Dutch .po files
Catch-up and some cosmetic changes of the Dutch .po files

Recently added msgid's were translated, plus a few really minor
changes. Kept some entries for last stable release.
2014-11-23 22:42:18 +00:00
Gaspar Chilingarov
7cb948098a wmaker: Support omnipresent setting toggle from keyboard 2014-11-23 22:42:18 +00:00
Christophe CURIS
33855a7a12 WPrefs: replaced call to external program "chmod" by the equivalent system call
It is more efficient to use the dedicated function than to call an external
binary program to do the job, and it reduce the risk of problem in case the
path would end up with potentially problematic characters.

It should also close Coverity bug #50225 ("Use of untrusted string value")

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-23 22:42:18 +00:00
Christophe CURIS
34f35ee534 WPrefs: changed label from "msec" to the standard "ms" from the SI
The International System of Units defines "ms" as the standard abbreviation
for milliseconds, so let's use it everywhere to be consistent.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-23 22:42:18 +00:00
Christophe CURIS
3846609072 WPrefs: minor improvements to the Workspace panel
It is general practice to not consider the strings displayed in a dialog as
real sentences, so this patch removes the dots at the end (including in the
translation);

Took the opportunity to fix some translated string that were probably not
found anymore to due other changes;

Moved a few widgets to make everything look better centered;

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-23 22:42:18 +00:00
Christophe CURIS
7e40a61d16 WPrefs: minor reorganisation in the Keyboard Shortcut panel
The goal was to reduce the risk of truncated lines in the list of actions
(a few of them are a bit long - and need to be!), so it was an opportunity
to align the widgets with consistent spacing.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:04 +00:00
Christophe CURIS
14dc8dd415 WPrefs: minor improvements to the Focus Preference panel
It is general practice to not consider the strings displayed in a dialog as
real sentences, so this patch removes the dots at the end (including in the
translation);

Took the opportunity to make a light cleanup of the translations in the
concerned areas, and fix some translated string that were probably not
found anymore to due other changes;

Make small reorganisation of the widgets to reduce the risk of truncated
strings, with keeping the overall clean aspect of the panel;

Took the opportunity to clarify the label related to the colormap to avoid
misunderstanding, and include a balloon text to clarify its reason-to-be
because, as modern display tend to all be TrueColor, it may not be
intuitive to new user what it's for.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:04 +00:00
Christophe CURIS
1b183633e1 WPrefs: small reorganisation in the Dock Preferences panel
The goal is to reduce the risk for truncated label, and take the
opportunity to align everything with consistent spacings.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:03 +00:00
Christophe CURIS
c3c8a0654c WPrefs: reorganised the Window Handling Settings panel for better look
Due to a long history of evolution, it was time to rethink the placement
of all widgets to achieve a clean look. The frames have been reshuffled to
be aligned to each other, and as a bonus the Mod+Wheel setting now has its
own frame instead of being part of another unrelated frame.

Took opportunity to include an info balloon to explain what the "by
keyboard" checkbox actually means.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:03 +00:00
Christophe CURIS
753f44ca83 WPrefs: reorganised the Preference panel for better look
As many option have been added to it, the panel started to look overloaded.
With a little rework, it now displays the same options in a cleaner way.
Took opportunity to include some balloon help for the AppIcon option to try
to be clearer than what the short label allows.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:03 +00:00
Christophe CURIS
03a7771c86 WPrefs: reorganised the Mouse Settings panel for better look
As many option have been added to it, the panel started to look overloaded.
Content have been slightly moved to make it look nicely organised inside
the window, and with possibly less truncated text.

Took opportunity to include a visual feedback to the user, when checking
the "Disable mouse actions" box then we disable the related popup menu
buttons to reflect this.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:03 +00:00
Christophe CURIS
60d9fc5bb7 WPrefs: grouped items related to the mouse actions in a single place
Having all these information spread in different places makes it error
prone when wanting to add/remove/change something in the list are there are
many unrelated places to keep in sync.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:03 +00:00
Christophe CURIS
17c3404bef WPrefs: grouped the balloon text for the dock configuration with the rest of the struct
As the data to create the icons for the dock configuration was already
grouped in a structure, it is a good idea to also include the balloon text
which is linked to them in the array, so the code is simpler and safer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:03 +00:00
Christophe CURIS
68e550b924 WPrefs: moved the titles of Clip Delay frames to an array
As the code is already treating these frames as an array, it is a good idea
to do the same for their titles so it is possible to reuse its size at
convenient places to make the code safer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-08 20:12:03 +00:00
Doug Torrance
48ce9d046e debian: Capitalize "Maker" in X session desktop entry. 2014-11-08 11:22:52 +00:00
Doug Torrance
0acbec36ac WINGs: Link examples against Xlib.
The font lister WINGs example program was failing to build because it uses
the XOpenDisplay() function from Xlib.
2014-11-04 14:33:08 +00:00
Doug Torrance
4a2e202af8 WINGs: Avoid cast from pointer to integer of different size compiler warnings. 2014-11-02 13:14:54 +01:00
Doug Torrance
a47f07cfc3 WINGs: Fix unused parameter compiler warnings in examples. 2014-11-02 13:14:54 +01:00
Doug Torrance
fc35dfd277 WINGs: Fix decimal/hexadecimal conversion bug in color panel.
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.
2014-11-02 13:14:54 +01:00
Christophe CURIS
74dc2d2cc0 WPrefs: use length of array instead of hard-coded constant for sample colours
In the panel for Appearance configuration, there are some sample colours
proposed to users; the code used to have a bunch of constants hard-coded
to handle these colours.

This patch replace all constants with the macro wlengthof to use the number
of element in the array determined by the compiler, so modifying the list
won't cause hidden bugs. This include a somehow smarter code to dispatch
the colours in the window to automatically arrange them cleanly whatever
their number is.

Took opportunity to de-CamelCase the name of the array as it did not add
complexity in the patch.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:20 +01:00
Christophe CURIS
efe0da4618 WPrefs: grouped items related to the possible window placement algorithms in a single place
Having all these information spread in different places makes it error
prone when wanting to add/remove/change something in the list are there are
many unrelated places to keep in sync.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:20 +01:00
Christophe CURIS
8522283d68 WPrefs: grouped items related to the behaviour of moving a maximized window in a single place
Having all these information spread in different places makes it error
prone when wanting to add/remove/change something in the list are there are
many unrelated places to keep in sync.

Took the opportunity to de-CamelCase the name of the variable to comply
with project's coding rules.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:20 +01:00
Christophe CURIS
d02d362295 WPrefs: grouped items related to the AppIcon bouncing configuration in a single place
Having all these information spread in different places makes it error
prone when wanting to add/remove/change something in the list are there are
many unrelated places to keep in sync.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:20 +01:00
Christophe CURIS
e73c3e84de WPrefs: grouped items related to the help balloon configuration in a single place
Having all these information spread in different places makes it error
prone when wanting to add/remove/change something in the list are there are
many unrelated places to keep in sync. It also makes the code simpler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:19 +01:00
Christophe CURIS
454c7bec5d WPrefs: grouped items related to the window title alignment in a single place
Having all these information spread in different places makes it error
prone when wanting to add/remove/change something in the list are there are
many unrelated places to keep in sync.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:19 +01:00