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
27a2259934 WPrefs: fix memory leak when editing the label of a menu (Coverity #50130)
As pointed by Coverity, the function 'WMGetTextFieldText' already allocates
memory for its return string, so it is not necessary to wstrdup it.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
c54bb11ee9 WPrefs: fix memory leak in loadRImage (Coverity #50107)
As pointed by Coverity, if there is a problem when reading the binary data
of an RImage from a file, the area allocated to store it would not be
freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
a9e2923f67 WPrefs: fix memory leak in buildPLFromMenu (Coverity #50105)
As pointed by Coverity, the PLArray that is created to store the return
value of the function 'processData' can be left allocated if some case
handling decide to return NULL instead.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
dc2a991e21 WPrefs: fix possible crash when saving mouse modifier (Coverity #50098)
As pointed by Coverity, there is a possible NULL pointer dereference in the
code that extracts the selected modifier (from a popup button list).

The code assumes that there is always a space between the core name of the
modifier (which is used for saving) and the more user friendly name. This
is true if the list could be successfully generated in fillModifierPopUp,
but it may not be the case if that function has to fall-back to the
default list (XGetModifierMaping failure).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
4b7bb5bc5c WPrefs: fix NULL pointer dereference in the Pixmap/Icon path panel (Coverity #50073 + #50150)
As pointed by Coverity, it is possible to dereference the NULL pointer in
the function 'browseForFile'.
This should have been reported by the compiler ("possible use of
uninitialised variable") but the assignation of a default value to the
variable 'lPtr' hides this, but as the default value is not a good one then
the code could crash.
This patch removes the default value, so we may have some info from the
compiler and handles the case smoothly.

It also fixes a potential memory leak pointed also by Coverity in the
case where the string returned by WMGetFilePanelFileName would be a 0
length non-null string.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-01 20:35:06 +01:00
Christophe CURIS
c5744aaa8b WPrefs: make fall-back value look like a fall-back value in Texture Panel (Coverity #50031)
As pointed by Coverity, the return value of 'sscanf' is not checked, which
may not be a problem because the fall-back value for 'i' is provided before.

However, if sscanf fails there is no guarantee that all implementation would
leave 'i' untouched in case of parsing error, and for convenience it is more
logical to write the code is such a way that the value assignment looks like
the fall-back value it is.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-31 19:25:58 +01:00
David Maciejak
db9f5c9658 WINGs: fix duplicate if/else branch in W_LookupString
cppcheck is reporting the msg below:

[../WINGs/winputmethod.c:215] -> [../WINGs/winputmethod.c:209]:
(style) Found duplicate branches for 'if' and 'else'.

The patch is fixing it by setting a default return call.
2014-05-28 16:04:02 +01:00
Carlos R. Mafra
5088b6755d wmgenmenu: Do not force command line options upon everybody
There are other ways to obtain the same result, e.g. setting the
options in ~/mrxvtrc.
2014-05-26 16:54:23 +01:00
David Maciejak
35a43c9430 wrlib: fixed transformation functions
With a set of images i was able to detect that
the flip functions was shifting the image by 1px.

The 90 and 270 degrees rotation were not working as
the functions were also mirroring the img.

The patch is also fixing the C style based on checkpatch.
2014-05-26 16:15:36 +01:00
Amadeusz Sławiński
dda7f48407 wmaker: alt-tab to shaded windows when "SwitchPanelImages = None" is set
Reported-by: Josip Deanovic <djosip+news@linuxpages.net>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-26 00:20:32 +01:00
Amadeusz Sławiński
e749c455c6 wmaker: raise shaded window when alt tabbing
Reported-by: Josip Deanovic <djosip+news@linuxpages.net>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-26 00:20:32 +01:00
David Maciejak
29301d9b03 wrlib: RRotateImage function not fully implemented
when the rotation angle value passed to RRotateImage is a modulo of 90,
the function is working well but in other cases the rotateImage()
function is called. That last function is half implemented but
the half already implemented part is also segfaulting (use the testrot.c
to replay the crash).
So the patch is moving the 'not implemented' msg to disable the whole
rotateImage() function and comment it out.
2014-05-21 13:10:09 +01:00
David Maciejak
5ee39b7a27 util/wmiv: correct errors and warnings
This patch is correcting all errors and almost all warnings reported
by checkpatch.
2014-05-21 13:10:09 +01:00
David Maciejak
057048e09b wrlib: add image flip functions
This patch adds RVerticalFlipImage and RHorizontalFlipImage functions.
2014-05-21 13:10:09 +01:00
Christophe CURIS
1265873fa3 WMaker: removed use of dangerous RETRY macro in GetCommandForPid for Linux (Coverity #50267)
As pointed by Coverity, the function GetCommandForPid did use a macro
'RETRY' for the 'close' of file descriptor, which is not correct because
on success the function 'close' does not reset errno, and in case of
failure the file descriptor is not more valid anyway.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
1a64ca8275 WMaker: change conceptually imperfect code in drawerDestroy (Coverity #50265)
Factually, the program works because the function 'drawerRemoveFromChain'
uses only the address of the drawer and not the content of the structure,
but conceptually this address point to a storage space that has been
de-allocated, so that's calling for trouble for future code changes.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
68e4ccca58 WMaker: removed check that is always true in wDefaultsInitDomain (Coverity #50243)
As pointed by Coverity, the function 'wdefaultspathfordomain' cannot
return a NULL path, so it is not necessary to check for it.  (in the
present case, it led Coverity to think it was possible to have the
structure 'stbuf' uninitialised)

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
788a51c116 WMaker: fix memory leak in the window inspector when saving settings (Coverity #50175)
As pointed by Coverity, there is one case where the string returned by
WMGetTextFieldText could be left allocated.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
e750f9307e WMaker: fix memory leak in the window inspector when saving settings (Coverity #50174)
As pointed by Coverity, there is one case where the application dictionary
which is created temporarily (when saving the changes in the Window
Inspector) could be left allocated. It is now freed in the common path to
avoid problems.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
a75699faef WMaker: fix possible memory leak in the icon chooser dialog (Coverity #50173)
As reported by Coverity, it was possible to return early from the function
'listCallback' without de-allocating a temporary string. The string is now
requested after this early return.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
bec0272584 WMaker: fix dangerous code in file scanning for wAdvancedInputDialog (Coverity #50172)
As pointer by Coverity, the function wstrappend may move the string in
memory (because that's what realloc does if it can't expand the allocated
buffer in-place), so it is important to use the returned address and not
assume the old pointer is still valid.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
32c8dc04ce WMaker: fix memory leak in windows saved state handling (Coverity #50171)
As pointed by Coverity, the caller of the function 'getSavedState' assumes
that if the function returns 0 then the wstate is not initialised. This was
not actually true, so this patch changes 'getSavedState' to behave as
expected.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
4501d4c078 WMaker: fix memory leak when respawning after crash (Coverity #50165)
As pointed by Coverity, the memory allocated to contain the argument list
for spawning ourself was never released.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
659519f306 WMaker: fix memory leak in the crash handling dialog (Coverity #50163)
As pointed by Coverity, if the function wShowCrashingDialogPanel is not
able to connect to the default screen, then the memory allocated for the
panel would be leaked.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
c2a357fe1b WMaker: fix memory leak in app icon changing (Coverity #50139)
As pointed by Coverity, there are some cases where the name of the file
returned by wIconChooserDialog could be left unfreed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
3a68e974b6 WMaker: removed unnecessary case handling in appicon setting
The function wIconChooserDialog already makes sure that it returns
NULL if its result would have been an empty string, so it is not
necessary to re-check this in setIconCallback, this leads to
more complicated code and can't be optimised by the compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:57 +01:00
Christophe CURIS
fab73f47c7 WMaker: fix memory leak in screen initialisation (Coverity #50134)
As pointed by Coverity, if the function wScreenInit fails to properly
attach to the screen then the storage structure and content were not
released before returning.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
9940073530 WMaker: fix memory leak in the switchpanel backgroung image (Coverity #50131)
As pointed by Coverity, if the target width or height for the center ended
being <= 0 then the image created to contain the generated assemblage would
be leaked.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
7d48855077 WMaker: fix memory leak in workspace switching (Coverity #50126)
As pointed by Coverity, if there's no window to unmap in a workspace, then
the array used to build the list of the windows to be unmapped for
workspace change would not be freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
9f2f94a174 WMaker: fix memory leak in root menu parser (Coverity #50123 and #50124)
As pointed by Coverity, if an invalid OPEN_MENU is used then the memory
allocated when parsing the line containing it would be leaked.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
741243a792 WMaker: fix memory leak in the root menu parser (Coverity #50122)
As pointed by Coverity, if the word "WITH" was used in the content of the
root menu definition then its string would not be freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
bee02df72f WMaker: fix memory leak in wDockTrackWindowLaunch (Coverity #50120 and #50121)
As pointed by Coverity, the function 'ProgGetWMClass' always allocates the
strings returned in wm_class and wm_instance, so they always must be freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
d292c62080 WMaker: fix memory leak in the windows icon chooser (Coverity #50117.2)
As pointed by Coverity, a string could be left unfreed in the case where
the window's attribute dialog is closed before an icon would be actually
chosen from the Icon Chooser Dialog.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
dc4df6455a WMaker: fix memory leak in the docked apps icon chooser (Coverity #50117.1)
As pointed by Coverity, a string could be left unfreed in the case where
the docked application's settings dialog is closed before an icon would be
actually chosen from the Icon Chooser Dialog.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
4894e3fe4d WMaker: fix memory leak in window inspector (Coverity #50116)
As pointed by Coverity, in this specific case the string previously stored
in 'file' was lost when replaced with the string from 'db_icon'. The logic
have been simplified to avoid the case.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
43972d307a WMaker: fix memory leak in windows menu (Coverity #50109)
As pointed by Coverity, there was a memory leak when updating the shortcuts
in the menu for windows which occured when a shortcut was associated with
the window and this shortcut did not change.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Christophe CURIS
7f840db1aa WMaker: remove unnecessary check in Balloon show function (Coverity #50065)
As pointed by Coverity, there is a check to make sure a pointer is not NULL
but it is still dereferenced later in the function. As the code is done so
that this pointer cannot be NULL then it is not necessary to check that.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-20 21:29:56 +01:00
Amadeusz Sławiński
ca64091f05 Add missing options to wmsetbg manpage
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-19 22:09:58 +01:00
Amadeusz Sławiński
c478a39a4a reformat output so it fits on terminals with 80 columns
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-19 22:09:58 +01:00
Amadeusz Sławiński
c6991fb991 Allow setting "FrameFocusedBorderColor" from WPrefs
Adds separate entry in menu and draws border around focused window.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-19 21:37:26 +01:00
Amadeusz Sławiński
bc8ccee72f Allow setting separate border color for focused windows
This patch adds "FrameFocusedBorderColor" option for theming,
It should allow having borders better matching titlebar colors.
By default it's set to black.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-19 21:37:26 +01:00
Amadeusz Sławiński
9d503d2abc Fix segfault in Wprefs when background is set to fpixmap (wmsetbg --fillscale)
Long time ago I added this option so I could have wallpaper filling my
screen while preserving aspect ratio.
Seems like I didn't add it to WPrefs

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-19 20:58:20 +01:00
Christophe CURIS
8c6525a2b7 WPrefs: changed renderTexture to always fallback to solid black when image can't be loaded
As raised by Carlos R. Mafra and Doug Torrance, when an image is used in a
texture but the image cannot be loaded, there are some case where WPrefs
misbehaves.
This patch display a warning in every case where the image could not be
loaded, and always switch to black texture as a fallback, which was not the
case previously.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-19 19:02:10 +01:00
Doug Torrance
1a01ac103f Removed references to obsolete DisplayFont
According to NEWS, the DisplayFont option was removed in version 0.62.0 and
replaced by the WINGs system font.  However, it was still referenced in a large
number of style files, as well as the utils getstyle, setstyle, convertfonts,
and the manpages for getstyle and setstyle.  This patch removes all of these
references.

In addition, it updates the Czech, Slovak, and Russian translations of these
manpages to match the English versions.  Note that I relied on Google translate, and it appears I may have re-encoded some characters when I saved the Czech
and Slovak files -- if you speak these languages, please take a look!

A few minor spelling errors were corrected in the English manpages.
2014-05-19 18:18:56 +01:00
Carlos R. Mafra
337a6e9228 Add checkpatch.pl, stolen from the linux kernel
The coding style in wmaker.git follows the conventions of the linux kernel.

Therefore, I'm stealing their 'checkpatch' tool in an attempt to maximize
"perfect" patches to wmaker-dev, at least coding-style wise :-)

Before submitting your patch, please ('please' here means you must) check
it with:

./checkpatch your-patch.diff

and use your common sense to address any violations (error and/or warnings) detected.

There will always be false positives and other complaints that sometimes are better
dealt with by leaving them alone. No tool is perfect, but it _will_ detect obvious
errors which you must fix (warnings can be sometimes ignored).

I modified the script by removing kernel-specific stuff, but I don't guarantee
that I removed everything. I also increased the line length warning to 115.

In any case, it seems to work here and hopefully it will lead to a cleaner
and more consistent code base for wmaker.

PS: You can also check existing files, e.g.,

./checkpatch.pl --file src/icon.c
2014-05-19 17:28:52 +01:00
Doug Torrance
0121d78e54 WINGs: Click on colored portion of color well also opens color panel.
The color well contains two views: view, consisting of the outer "button", and
colorView, consisting of the color itself.  Previously, only clicking on view
would bring up the corresponding color panel, resulting in nonintuitive
behavior.
2014-05-19 15:12:14 +01:00
Doug Torrance
13a9ebedcf WPrefs: updates to FrameBorderColor/FrameSelectedBorderColor options
In response to Amadeusz's comments regarding my patch "WPrefs: Add ability to
edit FrameBorderColor/FrameSelectedBorderColor", this new patch attempts to
reduce the confusion between focused and selected windows.  In particular,
only the frame border color for non-selected windows appears in the preview.
The frame border color for selected window colors can still be changed, but it
does not appear in the preview.  In addition, the hand icon has been removed
from the preview for these two options.

I also looked into the possibility of adding a new border color for focused
windows.  This appears to be nontrivial, as the border color belongs to
WFrameWindow, but the state of being focused belongs to WWindow.
2014-05-19 14:13:24 +01:00
Christophe CURIS
ca9dd144ae WINGs: removed unnecessary gotos in handleTextKeyPress
When the condition can be simply checked in an if, it is better to do that
than to use a flow breaking goto.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
3a191af838 WINGs: fix probable crash in drag'n'drop (Coverity #50264)
As reported by Coverity, the structure containing the callback functions
to handle the drag-and-drop actions could be freed but later re-used.
The correct behaviour is to keep the allocated memory for the structure.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00
Christophe CURIS
7a39f32816 WINGs: fix possible NULL pointer dereference (Coverity #50197)
As pointed by Coverity, the 'paintItem' function in the WMBrowser widget
is checking for nullity of its text argument, but before that it called the
strlen function which crashes on NULL pointer. This patch moves the strlen
call to the right place and reduce the lifespan of 'textLen' to highlight
incorrect tries to use the variable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-18 23:01:43 +01:00