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

2594 Commits

Author SHA1 Message Date
Christophe CURIS
f2824647f3 Configure: Added some -Wxxx checks when debug mode is enabled
We probably don't want our users to have to endure them, so they
are enabled only when Debug is activated, because they tend to
help keeping the code safe.
2013-05-11 00:17:27 +01:00
Christophe CURIS
1da498ff3b wmaker: Removed equality comparison on floating point number
The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. In the current case
the offending operation can be done with integers directly.
2013-05-11 00:17:27 +01:00
Christophe CURIS
0e41122680 WINGs: Changed equality comparison on floating point number
The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. This patch changes
all the cases which try to do this to a safer check.
2013-05-11 00:17:27 +01:00
Christophe CURIS
dcfd7a4b5e WINGs: Changed the minimum internal knob size of WScroller
The original code allowed to have 0.0, but this can generate
division by zero in WScrollView. As a value of 0.0 is not realistic
anyway, use a minimum constant instead.
2013-05-11 00:17:27 +01:00
Christophe CURIS
8ef38e9910 WRaster: Changed equality/inequality comparison on floating point number
The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. This patch changes
all the cases which try to do this to a safer check.
2013-05-11 00:17:27 +01:00
Christophe CURIS
80a59696e5 Fixed improper variables definition in header file
Some header were creating variable, this is a bad practice which
is likely to not behave as expected. This creates one distinct
variable in each object file that used the header, and:

 - on well behaved compiler, this ends up in a link error (see
commit 39fdb451ba for an example)

 - on bad behaving compiler, this can be linked as multiple local
variable, thus having strange effects when running program

 - on insouciant compiler (who said gcc?) the variables are
silently merged, hiding portability issues
2013-05-11 00:17:27 +01:00
Christophe CURIS
8238e4681a WPrefs: Move declaration of function into the common header
It is a bad idea to declare the prototype of an external function
in a file as it won't allow the compiler to cross-check it.
2013-05-11 00:17:27 +01:00
Christophe CURIS
90d24a1648 Unified usage of the 'inline' attribute for functions
Autoconf provides the necessary stuff to detect if inline keyword
is supported, and to detect special syntaxes, so let's use this
and remove the multiple local definitions, this makes code simpler.
2013-05-11 00:17:27 +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
Christophe CURIS
e17a197bc4 Configure: Fixed usage of CPPFLAGS instead of CFLAGS for some options
Some compilation options are actually targetting the preprocessor
instead of the compiler; using the wrong variable can have some
subtile side effects, so let's get things right.
2013-05-11 00:17:27 +01:00
Christophe CURIS
f73ccae798 Removed temporary allocation to build a path that is actually a constant
This allocation was certainly participating to memory fragmentation.
2013-05-11 00:17:27 +01:00
Christophe CURIS
7c320447fb Added missing include guards in a few headers
Considering the number of headers we have, it is a good idea to
avoid possible problems. For details, you may read:
  http://en.wikipedia.org/wiki/Include_guard

All headers should be ok now.
2013-05-10 19:37:47 +01:00
Christophe CURIS
7c98f7cfc4 Added proper legal notice at beginning of header files
Some header were missing the notice; used git blame to find the
original date and author (without guarantee.
2013-05-10 19:37:47 +01:00
Christophe CURIS
fc262124cd WPrefs: Added a few comments in header file
Nothing really interresting, just separators to group definitions
by theme, using the same syntax that can be found in other headers.
2013-05-10 19:37:47 +01:00
Christophe CURIS
664ab79add Changed WM_OSDEP to use Conditional instead of Substitution
The automake documentation states that using substitution inside the
list of SOURCES will not work and calls for not doing it. The use
of 'EXTRA_xxx' made things look like they worked but is probably not
enough for corner cases.

This patches switches to the conditional method which will be safe.
2013-05-10 19:37:47 +01:00
Christophe CURIS
7e424bf232 Configure: Changed OS dependant check to use Autoconf's macro
The macro provided by Autoconf will generate a similar code but
with better portability, and the source file is more consistent.
2013-05-10 19:37:47 +01:00
Christophe CURIS
e7c2a3dc69 util: removed deprecated file 'directjpeg.c'
The content is not used anywhere, and this is probably mostly due
to the fact that the behaviour is provided by the WRaster library
in a better way.
2013-05-10 19:37:47 +01:00
Christophe CURIS
c15da2e406 Readme: Removed reference to 'contrib' directory
This directory have been removed long time ago (in 2010 by Tamas
TEVESZ, in commit c960ae622e) so we
should not document it.
2013-05-10 19:37:47 +01:00
Christophe CURIS
35f2b667db Readme: Removed reference to the tutorial
This page does not exist anymore, and may have been outdated anyway
as it appears to be like 10 years old contribution.
2013-05-10 19:37:47 +01:00
Christophe CURIS
f29fba2c83 InfoPanel: Added display of memory fragmentation information
This information is displayed only when debug mode was enabled to
avoid confusing users.
2013-05-10 15:48:33 +01:00
Christophe CURIS
c253c5a7c7 InfoPanel: Use a more user-friendly separator to display supported image formats 2013-05-10 15:48:33 +01:00
Christophe CURIS
441145cfc0 InfoPanel: Minor fixes for what must be translated and what does not need to 2013-05-10 15:48:33 +01:00
Rodolfo García Peñas (kix)
aa5be46e94 InfoPanel: Added info about XRandR in the info dialog
This patch includes info about XRandR extension in the info panel
dialog. If wmaker was compiled with xrandr support, then the dialog
show the XRandR info. The info includes if the X-Server supports or not
XRandR (wmaker could be compiled with XRandR support, but the X Server
may not include XRandR extension).

The string was separated in two by Christophe Curis to allow translation,
as suggested by Alexey I. Froloff.
2013-05-10 15:48:33 +01:00
Christophe CURIS
1a8316d4c9 WINGs: Updated NEWS file about the API changes in the libraries 2013-05-09 18:08:36 +01:00
Christophe CURIS
52b8aabccc WINGs: Fixed incorrect return type for internal function
The function did return a boolean actually as would be expectable
from such function, but its prototype did not use the proper type.
2013-05-09 18:08:12 +01:00
Christophe CURIS
05a3eadd65 WINGs: Fixed incorrect allocation size, missing room for '\0' 2013-05-09 18:08:12 +01:00
Christophe CURIS
a4395c5764 WPrefs.app: Added const attribute to local string
Now that the WINGs functions are const-correct, it is possible to
set the attribute on the strings to help the compiler.
2013-05-09 16:56:28 +01:00
Christophe CURIS
591dc5cd4d wrlib: Added 'const' attribute to local function in 'context' 2013-05-09 16:56:28 +01:00
Christophe CURIS
fb3d9e65a6 WINGs: Added 'static' attribute to local functions in wcolorpanel
These 4 functions are local to the file so we make this official.
2013-05-09 16:56:28 +01:00
Christophe CURIS
28e6bde782 WINGs: Added 'const' attribute to 'WMCreatePropListFromDescription'
To be able to do this in a clean way, it was necessary to add the
attribute also in PLData's ptr field, which is actually right
because none of the function changes its content.

The function that fills it from a file/pipe however needed small
changes to respect the const-ness of the field.
2013-05-09 16:56:28 +01:00
Christophe CURIS
75a0beffeb WINGs: Added 'const' attribute to functions in dragdestination, wtext
This makes both the API and local function const-correct on their
input parameters.
2013-05-09 16:56:28 +01:00
Christophe CURIS
72108875aa WINGs: Added 'const' attribute to functions in wpanel, wpopupbutton, wtabview
This makes both the API and local function const-correct on their
input parameters.
2013-05-09 16:56:28 +01:00
Christophe CURIS
6616323088 WINGs: Added 'const' attribute to functions in wballoon, wmenuitem, wmisc, wtextfield
This makes both the API and local function const-correct on their
input parameters.
2013-05-09 16:56:28 +01:00
Christophe CURIS
a1119f8dd3 WINGs: Added 'const' attribute to functions in wbrowser, wcolorpanel, wfilepanel and wfontpanel
This makes both the API and local function const-correct on their
input parameters.
2013-05-09 16:56:28 +01:00
Christophe CURIS
c89e8df33f WINGs: Added 'const' attribute to functions in wbutton, wframe, wlabel, wlist, wwindow
This makes both the API and local function const-correct on their
input parameters.
2013-05-09 16:56:28 +01:00
Christophe CURIS
e7c8ac76ea WINGs: Added 'const' attribute to functions in wapplication, wappresource, wcolor, wfont, wpixmap
This makes both the API and local function const-correct on their
input parameters.
2013-05-09 16:56:28 +01:00
Christophe CURIS
af403073f0 Fixed memory leak due to non-freed property list structure
The history is actually loaded from a file into a property list that
is then converted to an array. The intermediate property list was
not freed, which led to memory leak.

It looks like it was a tentative of optimisation to avoid duplicating
an already allocated string and re-use the pointer instead, but this
means it is not possible to free the original container as it would
free the string too.

There is a better way to do this, but it requires an API change on the
WUtil library so it is left for a future improvment.
2013-05-08 15:05:00 +01:00
Christophe CURIS
5a5216ffb9 Changed method to limit the number of History entries loaded
The previous code limited the number of entries that were read into
the history array, but the user is expecting a maximum on the
number of entries displayed. This can make a little difference in
two cases:
 - if there are duplicate entries (dups are checked for and removed)
 - if some entries are not strings (unlikely, but not impossible)

The new code just stops adding history entries when the user
specified count is reached.
2013-05-08 15:05:00 +01:00
Christophe CURIS
bcee010082 Added a few 'const' to filename parameters for History functions
Name of file is, as usual, a read-only parameter.
2013-05-08 15:05:00 +01:00
Christophe CURIS
ea19294b70 Fixed memory leak due to non-freed temporary PropList
When menus are read in the PropList format, they are loaded into a
temporary PropList object, which is parsed into the internal menu
structure, and the PropList object is no more used. There were two
cases where this temp object was not freed.
2013-05-08 15:05:00 +01:00
Christophe CURIS
0004d38ef8 WPrefs: Added const attribute to statically stored strings
Now that the function handling the configuration dictionnary are
const correct, the key stored in static array can be given the const
attribute.
2013-05-08 15:05:00 +01:00
Christophe CURIS
8517f3dcef WPrefs: Added the proper 'const' attribute to the dictionnary functions
A common argument to all these functions is the name of the key to
operate on, and this name is never modified by the functions. Marking
it as const reflects this, and can allow compiler to generate better
results thanks to this info.
2013-05-08 15:05:00 +01:00
Iain Patterson
022421e879 Documentation on the new switchpanel behaviour.
Describe Group*Key and StrictWindozeCycling in the NEWS file.
2013-05-08 14:57:23 +01:00
Christophe CURIS
9ab6368b33 WUtil: Increased version number for the library
The addition of the const attributes is actually an API change, so
we have to reflect this for the next official release.

Because the change on 'wusergnusteppath' may impact users of the API,
we won't only change REVISION like it was done for WRaster lib.
2013-05-04 16:25:44 +01:00
Christophe CURIS
033e3eaa54 WUtil: Rewrote 'wusergnusteppath' to be more efficient
The first optimisation is to compute only once the path, and then
always re-use the value which did not change anyway.
The second optimisation is to avoid a lot of excessive function
calls, including alloc+free that are not necessary and participate
in memory fragmentation.
2013-05-04 16:25:44 +01:00
Christophe CURIS
a18fd7cd69 Fixed const correctness in functions using 'wusergnusteppath'
The change introduced in previous commit for const correctness has
a small impact on WindowMaker's code, this patch fixes all the new
warnings.
2013-05-04 16:25:44 +01:00
Christophe CURIS
cd1c55d63c WUtil: Changed declaration of 'wusergnusteppath' to return a CONST string
According to the way its value is being used everywhere, that is
what would be expected, so let's make it official.

Please note that this may introduce warnings on user code using
this function ("...discard const...") but that's an opportunity
for them to check that their code is not doing anything wrong.
2013-05-04 16:25:44 +01:00
Christophe CURIS
fd02f5f083 WUtil: Fixed risky code for de-escaping of strings
The internal function 'unescapestr' is used to transform strings which
may contain escape sequences (\x) into their plain representation.

There are a few cases where the function can misbehave (typically parse
after the end of string, thus writing past the end of the reserved
result area) which can be a source of problem later. The new code
should be safer.
2013-05-04 16:25:44 +01:00
Christophe CURIS
f386e34d29 WUtil: Fixed wrong type recast
The previous syntax used an explicit cast to remove the CONST
attribute, but the right way is to keep the attribute and store
the result in a variable which is defined properly.
2013-05-04 16:25:44 +01:00
Christophe CURIS
32ecd4ee58 WUtil: Avoid unnecessary strdup + free
It is not good for memory fragmentation to duplicate a string and
then free the original; changed code to only keep originaly allocated
string.
2013-05-04 16:25:44 +01:00