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

3609 Commits

Author SHA1 Message Date
Christophe CURIS
30c8c1c645 wmaker: removed variable whose value never changed
In the function wHandleAppIconMove there is an event handling loop
which was supposed to be finished with the variable 'done'.

As the code is using 'return' inside the loop, which is both more
convenient and easier to read, this variable was never set, making
the loop an infinite looking loop.

This patch removes the variable so it will be clear how it behaves.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
1bac0c9dcb wmaker: fixed flag to avoid reloading config multiple times
The code includes a check whose goal is to avoid reloading more than once
the configuration, in case Inotify would report more than one change during
the event processing.

But the flag was not set so mechanism was ineffective, which is probably
ok anyway but as it is here let's make it work.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
af059d408b WINGs: optimisations to 'WMReadPropListFromPipe'
The function did spend its time re-copying data and searching the
end of the read buffer, which is not really efficient.

The new code reads directly from file to the end of previous data,
avoiding unneccesary duplication, and keeps track of the end of
data to avoid searching it for next read.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
654dcfeb28 wrlib: merged both R*FlipImage function into one for the public API
It is generally not a good idea to have an API with a high number of
functions because it adds complexity for user and for maintainability,
so both function have been "merged" into a single RFlipImage with
a parameter to specify what flip is expected.

As a bonus, the function can perform both flips at once if wanted.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
cd29983e03 wrlib: do not create an alpha channel if the original image did not have it in RFlipImage
As it does not cost anything in the current code to not add this channel,
it is then probably a good idea to keep the output image with the same
format as the input image, this avoid wasting +33% of memory for something
that may be at best unused and at worst will induce extra cost when
manipulating the image.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
f2dea1b840 wrlib: code refactoring in RFlipImage functions
Instead of calling all variables with variants of 'image', changed
the name to reflect what image it is about for clarity.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
f85066a19e wrlib: move fixed angle rotation code to dedicated functions
The function RRotateImage contains code to handle efficiently the 4 simple
angles 0, 90, 180 and 270 degrees, which makes it a long function.

This patch separate the code for the different cases into dedicated
functions so the main function's code ends up being simple (aka: easier to
understand/review/maintain).

As a side effect, the function for the 180 degree function is not static
because it can be reused to flip an image both horizontally and vertically.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Alwin
be5d04525d Catch-up with new strings, and overall improvements of the Dutch language files
Catch-up with new strings, and overall improvements of the Dutch language files
2014-06-21 00:13:10 +01:00
Christophe CURIS
b431dcc399 util: cosmetic updates to the list of terminals for wmmenugen
Added a comment to describe each terminal, so it will be easier to maintain
the list in the future; added const attributes to help compiler generate
better code; changed list parsing to use the size of the array instead of
a null pointer mark for better compiled result.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
ecbee34f3a Removed definitions of dangerous macro RETRY that does not work as expected
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>
2014-06-16 20:00:09 +01:00
Christophe CURIS
35b912dd25 util: rewrote path building in makeThemePack
Use a better name for local variable and allocate the (almost) correct
number of characters for the path instead of a fixed offset that could be
a problem if the constant part of the path were to be updated.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
d90c8d5370 util: add check for size validity (Coverity #50224)
As pointed by Coverity, when reading the size of data using 'readmsg' that
size cannot be fully trusted (possibly in case of bugs in present case),
so this patch adds a check to ensure it is valid before continuing.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
8e9c06627d util: replaced sprintf with snprintf to avoid buffer overflow (Coverity #50220)
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
36ac3b3344 util: fix possible buffer overrun in the function that create L2 menus (Coverity #50219)
As pointed by Coverity, the buffer used to store the command for the menu
has a fixed size, so a check is welcome to avoid buffer overflow.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
7c142f54d0 util: add proper check for null pointer in wmsetbg (Coverity #50198)
As pointed by Coverity, it is possible that the variable 'image' remains
NULL in the function parseTexture, so this case must be checked
appropriately where it is used.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
3250826215 util: fix leaks in wmsetbg's changeTextureForWorkspace (Coverity #50169)
As pointed by Coverity, some locally created PropList objects are not freed
when the function returns. The truth is their refCount is 1 more than what
they should be, but that's more than what Coverity can detect today.

This patch adds the appropriate release calls when they are not needed
anymore, which will actually not free them but get their refCount right so
they will be freed as soon as the PropList in which they are used are
released.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
e5ebe0cb92 util: fixed memleak in wmsetbg's updateDomain (Coverity #50167)
As pointed by Coverity, the function wstrconcat is allocating memory to
return its result, which is not freed in old coding of the function.

This patch uses a local storage buffer to have a simpler code to generate
the command to bu run with 'system' without leak.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
9cef8c882e util: fix image leak in wmsebg's parseTexture (Coverity #50166)
As pointed by Coverity, in some case of texture with image that needs to
be scaled the temporary scaled image would be leaked if and error occured
during its conversion.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
1a9ece0438 util: fix leak in getstyle's makeThemePack (Coverity #50164)
As pointed by Coverity, the function is creating a temporary array with
the list of keys of the Style dictionnary, but it was not freed in the end.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
f2a7f233e3 util: remove unnecesary allocation in addWMMenuEntryCallback (Coverity #50161)
As pointed by Coverity, the string passed to 'findPositionInMenu' is not
freed, and as the function does not modify it it is not necessary to
allocate a new storage for the argument.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Christophe CURIS
75511e2ec8 util: fix leak in setstyle (Coverity #50151+#50152)
As pointed by Coverity, there are a few cases where the list of the keys
of a dictionary is being requested, but at the end the array that was
created to hold these keys was not freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:08 +01:00
Christophe CURIS
2e7ca448ae util: fix misleading indentation in assemblePLMenuFunc (Coverity #50094)
As pointed by Coverity, the indentation for a block of code could lead to
misinterpretation on when it is executed. To make code safer, re-indented
the code properly and added some blank lines for clarity.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:08 +01:00
Christophe CURIS
b5e2821c3e util: removed unnecessary RReleaseImage in wmsetbg (Coverity #50077)
As pointed by Coverity, it is not useful to call RReleaseImage if we are in
the branch of code where we know that the image for which it is being
called is NULL.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:08 +01:00
Christophe CURIS
b9eb99ca73 util: simplify the code for 'find_terminal_emulator' (Coverity #50076)
As pointed by Coverity, the code was making an explicit use of a null
pointer, which is certainly not what was initially expected. The code was
simplified to fix the case and to make it easier to understand and
maintain.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:08 +01:00
David Maciejak
382337c980 wmaker: redo logo
This patch is providing the logo still in 48x48 size
but with a better definition.
2014-06-15 19:45:20 +01:00
Iain Patterson
bb9f91a355 Consistent terms for switch panel cycling.
The terms "switch panel" and "cycling" have been used in Window Maker
since time immemorial but have not always been applied consistently.
2014-06-15 19:45:20 +01:00
Christophe CURIS
a772f2797d wrlib: add explicit type definition in API to allow compiler Type Checks (3/3)
When defining enums as types instead of simple enums allows to use these
types at the places where the corresponding enum values are expected, then
allowing the compiler to check that, potentially reporting incorrect use
of values to the user.

This patch adds the type for the gradient style for RRender*Gradient.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
bc4084e679 wrlib: add explicit type definition in API to allow compiler Type Checks (2/3)
When defining enums as types instead of simple enums allows to use these
types at the places where the corresponding enum values are expected, then
allowing the compiler to check that, potentially reporting incorrect use
of values to the user.

This patch adds the types for the drawing operations used by the functions
who drawing shapes into an RImage.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
eb3f0b12f8 wrlib: add explicit type definition in API to allow compiler Type Checks (1/3)
When defining enums as types instead of simple enums allows to use these
types at the places where the corresponding enum values are expected, then
allowing the compiler to check that, potentially reporting incorrect use
of values to the user.

This patch adds types for the configuration fields in the RContextAttributes
structure.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
96a6e4da1e wrlib: new headers to contain definition of internal stuff
Using local function prototype redefinition is dangerous, now a single
prototype is seen in all the files that are concerned.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
6c3cd08dad wrlib: return NULL if XImage could not be taken, for consistency
To be consistent with RCreateXImage and because it should not be up to the
caller to handle this, when XGetImage returns a NULL pointer then the
function RGetXImage will also return NULL instead of an RXImage structure
with a NULL pointer.

This consistent behaviour helps fixing a memory leak in WMaker reported by
Coverity (#50125).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
ad07a97788 wrlib: remove unnecessary variable assignation (Coverity #50258)
As pointed by Coverity, this value is never used, the assignation has no
effect, so Coverity reports that it is unnecessary complexity that is not
compatible with code maintainability.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
173eaee9c2 wrlib: initialise value for variable to avoid possible crash (Coverity #50245)
As pointed by Coverity, there's a free on the content of this buffer at
function's end, but if the image's width or height is lower than 1 then we
could reach this free before allocating anything, thus having an
uninitialised pointer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
907dd97e45 wrlib: added a limit to the image cache size (Coverity #50223)
As pointed by Coverity, environment variables cannot be considered
trustworthy ("tainted"), so we need to make sure the values provided are
within reasonable bounds for safe operations.

Seized the opportunity to try to provide clearer name for the constants
defining the default value.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
6623c27f4e wrlib: removed macro RETRY that does not does what is expected (Coverity #50160)
As pointed by Coverity, the behaviour of fopen/fread/fclose in case of
error is not really what the macro RETRY assumes. So the macro is removed
and appropriate action is implemented.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
6505b2f81c wrlib: fix possible incorrect shifting operations (Coverity #50204, #50205, #50206)
As pointed by Coverity, the shift operation performed for color-to-pixel
transform may not behave as well as expected because of the types used
(Coverity pointing suspicious sign extension because of int type being
involved).

The new code tries to leave no open interpretation to the compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Christophe CURIS
1cd354d796 wrlib: fix possible incorrect shifting operations (Coverity #50203)
As pointed by Coverity, the shift operation performed for color-to-pixel
transform may not behave as well as expected because of the types used
(Coverity pointing suspicious sign extension because of int type being
involved).

The new code tries to leave no open interpretation to the compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
David Maciejak
5f1e25152c wmaker: darken labels from docked application settings
This patch darkens DnD labels when support is not compiled in.
2014-06-15 19:45:20 +01:00
David Maciejak
3b298e8964 WINGs: add function to set the color of the frame title
This patch adds a function used to set the color of the frame title
2014-06-15 19:45:20 +01:00
David Maciejak
cb5076794a wrlib: load.c clean coding style
just some code cleaning stuff.
2014-06-15 19:45:20 +01:00
David Maciejak
1bd9074464 WMaker: src/misc.c remove obsolete code
This patch is removing the call to get_dnd_selection function
which was removed long time ago.
2014-06-15 10:11:55 +01:00
David Maciejak
f33c89e369 WPrefs: add expert option to disable switch panel
This patch is adding a checkbox option in the expert panel
to let the user enable/disable switching panel.
2014-06-05 08:34:22 +01:00
Doug Torrance
b323800c02 Add checkpatch.pl to distribution tarball.
This patch includes checkpatch.pl in the EXTRA_DIST variable in Makefile.am so
that it is included when a tarball is built using "make dist".
2014-06-05 08:32:51 +01:00
Doug Torrance
137a571fec WPrefs: set IconTitleColor, IconTitleBack, ClipTitleColor, and CClipTitleColor
This patch adds the ability to set the colors for IconTitleColor, IconTitleBack,
ClipTitleColor, and CClipTitleColor, the only four colors set by setstyle which
previously were not configurable using WPrefs.

The icon in the preview window appears as a miniwindow if IconTitleColor or
IconTitleBack are being configured and as the clip if ClipTitleColor or
CClipTitleColor are being configured.
2014-06-02 21:28:54 +01:00
David Maciejak
97d281e310 util/wmiv: add image auto orientation detection
Based on libexif feature, this patch is adding orientation
detection and provides 2 more shortcuts for live
right/left rotation. Internal version was bumped to 0.7.
2014-06-02 14:06:03 +01:00
Christophe CURIS
9b65f55f53 WPrefs: add warning when renderTexture encounters some unknow settings
Having the warning displayed will help devs to understand what is going
on and where to look at for a fix.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:07 +01:00
Christophe CURIS
266d9a2945 WPrefs: fix NULL pointer handling when getting the Modifiers (Coverity #50200)
As pointed by Coverity, the allocated value returned by XGetModifierMapping
is assumed to be non-NULL everywhere except when releasing it.
Removed this last check (useless) and added a little check at the beginning
to avoid an (improbable) crash.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:07 +01:00
Christophe CURIS
8eb6c82231 WPrefs: fix memory leak when saving window handling settings (Coverity #50158)
As pointed by Coverity, the functions WMCreatePLString return a newly
allocated WMPropList, which must be released when not needed anymore.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
f4f96a8fb7 WPrefs: fix memory leak when editing a delay for the dock (Coverity #50156)
As reported by Coverity, the return string of WMGetTextFieldText is
malloced so it needs to be freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
894d1c80a3 WPrefs: fix memory leak when saving settings (Coverity #50140 + #50157 + #50159)
As pointed by Coverity, the string returned by 'WMGetTextFieldText' is
allocated dynamically, so it must be freed when not needed anymore.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00