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

114 Commits

Author SHA1 Message Date
John D Pell
bd38778bef Use wuserdatapath() everytime it is applicable
Replace calls to wusergnusteppath() which just append "/Library" by calls
to wuserdatapath().
Take opportunity to replace hardcoded "/WindowMaker" directories with
the existing PACKAGE_TARNAME macro (which comes from autotools).

The choice of 'TARNAME' is because it meant to be used in filename, thus
less likely to have problematic characters than PACKAGE_NAME (meant for
display purpose) and PACKAGE which is there for historical reason.
2021-08-10 09:42:43 +01:00
Christophe CURIS
29cf48b934 WPrefs: Provide fall-back colour in the case of colour name not found
As reported by Coverity (CID #331571), we did not check the return value of
the call to XParseColor. If the function is given a colour name that it
does not know, we would return an uninitialised colour.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Rodolfo García Peñas (kix)
3dce639aae Appearance.c Removed fallthrough warning
This patch adds some comments to remove the falthrough warning.

Appearance.c: In function ‘renderTexture’:
../WINGs/WINGs/WUtil.h:230:32: warning: this statement may fall through [-Wimplicit-fallthrough=]
 #define wwarning(fmt, args...) __wmessage( __func__, __FILE__, __LINE__, WMESSAGE_TYPE_WARNING, fmt, ## args)
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Appearance.c:675:4: note: in expansion of macro ‘wwarning’
    wwarning(_("unknown direction in '%s', falling back to diagonal"), type);
    ^~~~~~~~
Appearance.c:676:3: note: here
   case 'D':
   ^~~~

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2019-06-20 22:04:31 +01:00
Alwin
3d6da4b210 WPrefs: trivial fixes in text strings
Fix some typos.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2015-04-28 09:06:33 -04:00
Christophe CURIS
d6abbafeef WPrefs: fix list of source files for translation
A few files were missing from the list of sources files to be translated.

Took opportunity to make a few strings translatable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2015-01-20 21:29:24 +00:00
Christophe CURIS
be4849448f 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>
2014-12-10 10:19:18 +00:00
Christophe CURIS
80f18f60d2 WPrefs: Use standard C declaration of array instead of GNU syntax
As pointed by Clang, the declaration of array was using the GNU old syntax,
not the standard C.
2014-12-07 09:52:21 +00:00
Christophe CURIS
8ed6eacd06 WPrefs: fix memory leaks on temporary colours to draw icon's title in Appearence preview (Coverity #72808, #72810)
Two WMColor were created to draw the background for the title on icons for
iconified windows, in the Appearance panel. As pointed by Coverity, these
colors were not released after use, which this patch fixes.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-29 18:44:48 +00:00
Christophe CURIS
54feb499cb WPrefs: fix memory leak when storing the list of colors in Appearence panel
The name of the color is stored in a newly created PLString which leaks.
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
PLString won't be freed.

This patch properly calls  WMReleasePropList after addition to the list, so
that the count goes back to 1, which means it will be automatically freed
when the PLArray will be released.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-29 18:44:48 +00:00
Christophe CURIS
3a15750ad5 WPrefs: add check for image validity in 'loadRImage' (Coverity #50221, #50081)
As pointed by Coverity, the function blindly trust the data read from the
file, but in case of problem (corrupted file, not enough memory) it could
behave badly.

This patch adds a check for the depth, counts on RCreateImage to check the
width and height, and in any case it now includes a message for the user in
case he would like to understand what's wrong.

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
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
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
Christophe CURIS
c0d4c16336 WPrefs: grouped items related to the menu style 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
Christophe CURIS
6ac27ba842 WPrefs: created macro 'wlengthof_nocheck' for the cases were wlengthof cannot be used
Because the macro wlengthof preforms a check of validity of its argument
with static_assert, there is a use case where it fails with a compiler
error. This patch introduces an alternate macro without the check, to be
used only for this specific case.

To be able to use the size of the array, a few of those array declaration
have to be moved before the structure in which their size is used.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:13:19 +01:00
Christophe CURIS
18d77de91c WPrefs: grouped items related to the texture selection 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.

By merging everything in a single struct array it is a lot easier to
maintain this list.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
2925e54bc1 WPrefs: grouped items related to the color selection 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.

By merging everything in a single struct array it is a lot easier to
maintain this list.

Took the opportunity to properly document a little hack which is used to
avoid complex handling for a special case.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +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
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
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
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
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
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
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
Doug Torrance
963b4b2b78 WPrefs: Add ability to edit FrameBorderColor/FrameSelectedBorderColor.
As part of the process, some #defines were turned into enums.  Also, the *_COL
when needed.

This brings the code for colors in line with the code for textures, and
allows us to use them as array indices to improve readability, e.g.,
colorOptions[MTITLE_COL] instead of colorOptions[3].
2014-05-18 23:00:15 +01:00
Doug Torrance
5182b32fe9 WPrefs: new enum in Appearances.c for tab identifiers to increase readability 2014-05-18 23:00:15 +01:00
Doug Torrance
82e857a49e WPrefs: remove unfinished background tab from appearances panel code
WPrefs.app/Appearances.c contained code for an unfinished feature
in the appearances panel of WPrefs, a tab for setting the background.

Since this feature has now been implemented as part of the texture
tab (see commit c2aca1a ("WPrefs: Set workspace background")), there
is no reason to keep this code.
2014-05-18 23:00:15 +01:00
Amadeusz Sławiński
2cb3119e08 WPrefs: Value stored to 'timage' is never read
three times in a row

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:15 +01:00
Doug Torrance
96c9ec185a WPrefs: fix segfault when image not found
Previously, when an image could not be loaded by WPrefs when rendering textures
for the Appearances panel, a segfault would occur.  This could happen, e.g., if
a user moved or deleted an image file without editing their ~/GNUstep/Defaults/
WindowMaker file.

This patch first checks if a texture contains an image, and if it does, it
checks to see if that image can be loaded.  If it can't, a solid black texture
is loaded instead.

The patch also has the added benefit of combining some of the code used for
rendering both pixmap and textured gradient textures.
2014-05-18 23:00:15 +01:00
Doug Torrance
66556c421d WPrefs: Set workspace background
This patch enables users to set the workspace background (WorkspaceBack) in the
Appearance Preferences section of WPrefs.  It appears as a new item in the
popup menu in the Texture tab, in the list of textures below, and a preview
appears in the background of the preview panel on the left.
2014-05-17 15:59:47 +01:00
David Maciejak
aa890c8868 WPrefs: Fixed compiler warnings
This patch is used to catch some return function value, to make the
compiler happy.
2014-04-24 10:47:44 +01:00
Rodolfo García Peñas (kix)
3919363aa3 Arguments not used in SetButtonAlphaImage
The arguments for SetButtonAlphaImage() are not used, so can be removed to
avoid compiler warnings.

This patch removes these arguments, so the code in SetButtonAlphaImage(), not
used, can be removed too.
2014-01-31 19:38:18 +00:00
Christophe CURIS
8d7db5d744 WPrefs: Make the label internationalised for the texture option in dialog window
As this label is being displayed in the window, it is a good idea to make
it translatable to the user's locale.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
d2faac6333 WPrefs: Changed array of strings 'textureOptions' into a struct for explicitness
The parameters for the textures were stored all together in an array
which made its usage error prone; now there a struct to clearly identify
which string is what, so it is clear in the source what's being done.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
aa24e862c4 WPrefs: Changed array of strings 'colorOptions' into a struct for explicitness
The parameters for the theme colors were stored all together in an array
which made its usage error prone; now there a struct to clearly identify
which string is what, so it the source is clearer on what's being done.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
01c7390be1 WPrefs: Use the macro 'wlengthof' to get the number of element in an array
The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
34da09a0a3 WPrefs: Removed unused argument to function 'OpenExtractPanelFor'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:11 -02:00
Christophe CURIS
ce1513f89f WPrefs: Removed unused Screen argument to the 'Init*' functions
The functions that create the different configuration panels were taking
the screen structure as argument, but it turns out that none of them
actually need it.

We just remove the argument to make code simpler and easier to maintain.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:11 -02:00
Christophe CURIS
066d0cdef7 WPrefs: Marked args as unused for compiler in WINGs callback code
The WINGs toolkit dispatch events on widgets using callbacks, which means
having a fixed argument list for the handling function.

It is then correct to not use all the arguments, so this patch adds the
appropriate stuff to avoid a false report from compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:10 -02:00
Christophe CURIS
bc5985e824 WPrefs: Marked args as unused for compiler in event callback code
The WINGs toolkit dispatch events on widgets using callbacks, which means
having a fixed argument list for the handling function.

It is then correct to not use all the arguments, so this patch adds the
appropriate stuff to avoid a false report from compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:10 -02:00
Christophe CURIS
66f6817966 WPrefs: Marked args as unused for compiler in Notification callback code
The mechanism of Notifications in the WINGs toolkit is relying on
callbacks to dispatch notifications, which means having a fixed argument
list for the handling function.

It is then correct to not use all the arguments, so this patch adds the
appropriate stuff to avoid a false report from compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:10 -02:00
Christophe CURIS
5a65dbeb3d WPrefs: Cleaned dangerous function prototype usage
- remove extern declaration in source file, use header instead

- add inclusion of header defining the functions of the file to
get the compiler to cross-check them

- marked static the functions that should not be visible ouside
their file
2013-05-12 01:01:20 +01:00
Christophe CURIS
b5101fc8ae WPrefs: Added 'const' attribute to function parameters 2013-05-12 01:01:19 +01:00
Christophe CURIS
7f6699ffca Changed formula for getting the number of elements in a static array
When using the formula [sizeof(array) / sizeof( x )] to get the number
of element in a static array, it is better to use array[0] for 'x'
instead of the base type of array:
 - in case the base type would change someday;
 - if the compiler were deciding to insert padding somewhere
2013-05-11 00:17:27 +01:00
Tobias Stoeckmann
cc30444dda No need to call memset after wmalloc
memset is the last function call in wmalloc, just before it returns the
newly allocated memory.  Therefore it is not needed to call it again
after wmalloc call.  Although I would prefer to switch wmalloc to a
calloc-based wcalloc function, the compatibility of WINGs for old apps
should be kept.
2012-05-04 18:41:01 -03:00
Brad Jorsch
a06b0673d8 Fix some "'var' may be used uninitialized" warnings
The one in WPrefs.app/Appearance.c is indirect: the function might
be inlined and might return an uninitialized value, which causes gcc to
complain that the caller might use that uninitialized return value.
2011-08-09 23:45:34 +02:00
Tamas TEVESZ
f65b99e615 Remove warnings
* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
  to be tweaked on a per-implementation basis as problems arise)
2011-03-24 16:19:52 +01:00
Andrea Gelmini
7c14c0b14a Remove duplicated #includes 2010-11-29 11:59:22 +01:00
Tamas TEVESZ
3c408fa179 Update local copy of GPLv2 and FSF address in copyrights
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-08 18:13:56 +02:00
Tamas TEVESZ
7859e2d59f Silence a few warnings
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00