3 weeks agoUndim switchpanel icons when selecting windows directly. master
Iain Patterson [Fri, 24 May 2013 13:14:34 +0000]
Undim switchpanel icons when selecting windows directly.

If one or more icons were dimmed in the switchpanel because the user
used GroupNext/PrevKey, then an icon was selected with the mouse or the
Home or End keys, dimmed icons remained dim.  That could be unintuitive
if the selected window was of a different class.

Instead we now always redraw all icons when highlighting a different
icon.

3 weeks agoDim switchpanel icons when same-class cycling.
Iain Patterson [Thu, 23 May 2013 13:54:35 +0000]
Dim switchpanel icons when same-class cycling.

When cycling through windows in the switchpanel using the GroupNextKey
or GroupPrevKey shortcuts, dim the icons of windows which are of a
different WM_CLASS.

3 weeks agoPrevent crash when switchpanel is not initialised.
Iain Patterson [Thu, 23 May 2013 12:36:57 +0000]
Prevent crash when switchpanel is not initialised.

A while loop in StartWindozeCycle() was checking the value of the panel
pointer and setting a flag to break out of the loop if it were NULL.
The current iteration of the loop was allowed to continue, however, with
the result that the null pointer could be passed to one of the
switchpanel functions and cause a segfault.

To reproduce, close all windows except one.  Open the inspector and set
the window's "Do not show in the switch panel" flag.  Then close the
inspector and press alt-tab to open the switchpanel.  As there is only
one window and it is not allowed to appear in the switchpanel, a null
panel pointer is returned, then later passed to wSwitchPanelSelectNext()
causing wmaker to crash.

The fix is to break out of the loop immediately instead of setting the
done flag.

4 weeks agoenforce requested window position whem maximizing
Renan Traba [Fri, 26 Apr 2013 01:37:58 +0000]
enforce requested window position whem maximizing

4 weeks agoexplicit restore to MAX_MAXIMUS instead of empty flag at handleMaximize
Renan Traba [Wed, 24 Apr 2013 01:37:16 +0000]
explicit restore to MAX_MAXIMUS instead of empty flag at handleMaximize

4 weeks agoWPrefs: added option to configure new viewports
Renan Traba [Mon, 22 Apr 2013 23:54:36 +0000]
WPrefs: added option to configure new viewports

4 weeks agoadded new windows positions
Renan Traba [Mon, 22 Apr 2013 23:28:11 +0000]
added new windows positions

new window positions top left, top right, bottom left and bottom right
these new maximized positions are combinations of left, right, top and
bottom maximized positions

4 weeks agoWPrefs: added option to configure new top and bottom viewports
Renan Traba [Mon, 22 Apr 2013 01:31:39 +0000]
WPrefs: added option to configure new top and bottom viewports

4 weeks agoadded new maximize positions, top and bottom
Renan Traba [Sat, 27 Apr 2013 23:33:16 +0000]
added new maximize positions, top and bottom

these new positions are equal to left and right,
but they are at top and bottom half of screen

4 weeks agosimplified logic of wMaximizeWindow function
Renan Traba [Sat, 27 Apr 2013 22:59:08 +0000]
simplified logic of wMaximizeWindow function

4 weeks agosimplified logic of handleMaximize function
Renan Traba [Sun, 21 Apr 2013 18:01:29 +0000]
simplified logic of handleMaximize function

4 weeks agofix condition to restore window position when unmaximized
Renan Traba [Fri, 19 Apr 2013 20:01:15 +0000]
fix condition to restore window position when unmaximized

if a window was at x=0 or y=0, the original condition return
false and the window is not moved to original position,
but if width or height from old_geometry is set then wmaker
already saved old_geometry, and we can trust x=0 or y=0 is
original position.

5 weeks agoWPrefs: Cleaned dangerous function prototype usage
Christophe CURIS [Sat, 11 May 2013 22:24:54 +0000]
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

5 weeks agoutil: Added a few missing 'static' attributes for functions
Christophe CURIS [Sat, 11 May 2013 22:24:53 +0000]
util: Added a few missing 'static' attributes for functions

5 weeks agowmaker: Cleaned dangerous function prototype usage
Christophe CURIS [Sat, 11 May 2013 22:24:52 +0000]
wmaker: 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

5 weeks agoWINGs: Added a few missing 'static' attributes to functions
Christophe CURIS [Sat, 11 May 2013 22:24:51 +0000]
WINGs: Added a few missing 'static' attributes to functions

Some functions are not meant to be visible by user; the use of the
attribute avoid risk of name clash with user functions at link
time.

5 weeks agoWINGs: Added include for header defining the funcion provided by the file
Christophe CURIS [Sat, 11 May 2013 22:24:50 +0000]
WINGs: Added include for header defining the funcion provided by the file

This allows the compiler to warn if the definition in the file is
no in line with what is exposed to the users of the function through
the header definition.

5 weeks agoWINGs: Moved declaration of extern variable to the global header
Christophe CURIS [Sat, 11 May 2013 22:24:49 +0000]
WINGs: Moved declaration of extern variable to the global header

Having local extern declaration is dangerous because the compiler
is not able to cross-check if the type of the variable was defined
consistently.

5 weeks agoWINGs: Place prototype of functions in WINGsP.h instead of local definition
Christophe CURIS [Sat, 11 May 2013 22:24:48 +0000]
WINGs: Place prototype of functions in WINGsP.h instead of local definition

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.

5 weeks agoWINGs: Reorganised the private header
Christophe CURIS [Sat, 11 May 2013 22:24:47 +0000]
WINGs: Reorganised the private header

The declarations have been split by source file, adding the usual
separation mark. Removed these 2 prototypes:
 - W_SetFocusOfToplevel: case typo, the correct prototype already existed
in the file;
 - W_TextWidth: function is not defined anywhere

5 weeks agoWINGs: Removed cast to change function prototype
Christophe CURIS [Sat, 11 May 2013 22:24:46 +0000]
WINGs: Removed cast to change function prototype

When a function is used as a call-back, it is dangerous to have
arguments with a type different than what is expected by the
call-back definition.

This patch sets the argument list to match what is expected by
the call-back prototype and inserts an explicit type conversion
at the beginning of the function.

5 weeks agoWINGs: Added explicit parameter list to function prototypes (Complex case)
Christophe CURIS [Sat, 11 May 2013 22:24:45 +0000]
WINGs: Added explicit parameter list to function prototypes (Complex case)

It is dangerous to let the compiler know about a function without
letting him know the arguments because he won't be able to report
invalid calls.

This patch concern the cases where adding the arguments led to
problems because the functions were used as call-back. As it is
dangerous to have parameter mismatchs in call-back, setup the
args as expected by prototype and added explicit conversion inside
the concerned function, so the compiler will know and be able to
do what may be necessary.

5 weeks agoWINGs: Added explicit parameter list to function prototypes (Simple cases)
Christophe CURIS [Sat, 11 May 2013 22:24:44 +0000]
WINGs: Added explicit parameter list to function prototypes (Simple cases)

It is dangerous to let the compiler know about a function without
letting him know the arguments because he won't be able to report
invalid calls.

This patch concern the cases where adding the arguments did not
need other code change.

5 weeks agoAdded explicit 'void' to function that takes no argument
Christophe CURIS [Sat, 11 May 2013 22:24:43 +0000]
Added explicit 'void' to function that takes no argument

This is the correct way to tell that a function takes no
arguments, because an empty parameter list tells the compiler
that it is not yet defined, and is tolerated only for
compatibility with very old C compilers for whom prototypes
were not yet a defined language element.

5 weeks agosrc/main.c: Moved local prototype for global function to header 'funcs.h'
Christophe CURIS [Sat, 11 May 2013 22:24:42 +0000]
src/main.c: Moved local prototype for global function to header 'funcs.h'

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.

5 weeks agowmaker: Reorganised the header 'funcs.h'
Christophe CURIS [Sat, 11 May 2013 22:24:41 +0000]
wmaker: Reorganised the header 'funcs.h'

The functions are now grouped by source file (groups in alphabetic
order) with the traditional separation mark. This makes the file
easier to work with.

5 weeks agowmaker: Removed deprecated function definition from header
Christophe CURIS [Sat, 11 May 2013 22:24:40 +0000]
wmaker: Removed deprecated function definition from header

These function exists nowhere, so they should not have a prototype
in the header.

5 weeks agoWPrefs: Added 'const' attribute to function parameters
Christophe CURIS [Sat, 11 May 2013 22:24:39 +0000]
WPrefs: Added 'const' attribute to function parameters

5 weeks agoWPrefs: Moved content of 'double.h' into 'WPrefs.h'
Christophe CURIS [Sat, 11 May 2013 22:24:38 +0000]
WPrefs: Moved content of 'double.h' into 'WPrefs.h'

It is not a good idea to multiply the number of header files,
specially in this case where 'double.h' defined so few things
(and lacked the usual copyright notice / include guards).

5 weeks agoutil: Added 'const' attribute to function parameters
Christophe CURIS [Sat, 11 May 2013 22:24:37 +0000]
util: Added 'const' attribute to function parameters

5 weeks agoutil: Created header to define functions that may be used in more that one place
Christophe CURIS [Sat, 11 May 2013 22:24:36 +0000]
util: Created header to define functions that may be used in more that one place

Using local function prototype redefinition is dangerous, now the
prototype is seen in all concerned files.

5 weeks agoConfigure: Added some -Wxxx checks when debug mode is enabled
Christophe CURIS [Fri, 10 May 2013 22:07:20 +0000]
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.

5 weeks agowmaker: Removed equality comparison on floating point number
Christophe CURIS [Fri, 10 May 2013 22:07:19 +0000]
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.

5 weeks agoWINGs: Changed equality comparison on floating point number
Christophe CURIS [Fri, 10 May 2013 22:07:18 +0000]
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.

5 weeks agoWINGs: Changed the minimum internal knob size of WScroller
Christophe CURIS [Fri, 10 May 2013 22:07:17 +0000]
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.

5 weeks agoWRaster: Changed equality/inequality comparison on floating point number
Christophe CURIS [Fri, 10 May 2013 22:07:16 +0000]
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.

5 weeks agoFixed improper variables definition in header file
Christophe CURIS [Fri, 10 May 2013 22:07:15 +0000]
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 39fdb451ba6ff84430507e327fa01a43f40b7315 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

5 weeks agoWPrefs: Move declaration of function into the common header
Christophe CURIS [Fri, 10 May 2013 22:07:14 +0000]
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.

5 weeks agoUnified usage of the 'inline' attribute for functions
Christophe CURIS [Fri, 10 May 2013 22:07:13 +0000]
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.

5 weeks agoChanged formula for getting the number of elements in a static array
Christophe CURIS [Fri, 10 May 2013 22:07:12 +0000]
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

5 weeks agoConfigure: Fixed usage of CPPFLAGS instead of CFLAGS for some options
Christophe CURIS [Fri, 10 May 2013 22:07:11 +0000]
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.

5 weeks agoRemoved temporary allocation to build a path that is actually a constant
Christophe CURIS [Fri, 10 May 2013 22:07:10 +0000]
Removed temporary allocation to build a path that is actually a constant

This allocation was certainly participating to memory fragmentation.

5 weeks agoAdded missing include guards in a few headers
Christophe CURIS [Fri, 10 May 2013 16:35:45 +0000]
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.

5 weeks agoAdded proper legal notice at beginning of header files
Christophe CURIS [Fri, 10 May 2013 16:35:44 +0000]
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.

5 weeks agoWPrefs: Added a few comments in header file
Christophe CURIS [Fri, 10 May 2013 16:35:43 +0000]
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.

5 weeks agoChanged WM_OSDEP to use Conditional instead of Substitution
Christophe CURIS [Fri, 10 May 2013 16:35:42 +0000]
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.

5 weeks agoConfigure: Changed OS dependant check to use Autoconf's macro
Christophe CURIS [Fri, 10 May 2013 16:35:41 +0000]
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.

5 weeks agoutil: removed deprecated file 'directjpeg.c'
Christophe CURIS [Fri, 10 May 2013 16:35:40 +0000]
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.

5 weeks agoReadme: Removed reference to 'contrib' directory
Christophe CURIS [Fri, 10 May 2013 16:35:39 +0000]
Readme: Removed reference to 'contrib' directory

This directory have been removed long time ago (in 2010 by Tamas
TEVESZ, in commit c960ae622e48477b11cfbd6b2f6b98add3dca242) so we
should not document it.

5 weeks agoReadme: Removed reference to the tutorial
Christophe CURIS [Fri, 10 May 2013 16:35:38 +0000]
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.

5 weeks agoInfoPanel: Added display of memory fragmentation information
Christophe CURIS [Fri, 10 May 2013 10:56:31 +0000]
InfoPanel: Added display of memory fragmentation information

This information is displayed only when debug mode was enabled to
avoid confusing users.

5 weeks agoInfoPanel: Use a more user-friendly separator to display supported image formats
Christophe CURIS [Fri, 10 May 2013 10:56:30 +0000]
InfoPanel: Use a more user-friendly separator to display supported image formats

5 weeks agoInfoPanel: Minor fixes for what must be translated and what does not need to
Christophe CURIS [Fri, 10 May 2013 10:56:29 +0000]
InfoPanel: Minor fixes for what must be translated and what does not need to

5 weeks agoInfoPanel: Added info about XRandR in the info dialog
Rodolfo García Peñas (kix) [Fri, 10 May 2013 11:00:23 +0000]
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.

5 weeks agoWINGs: Updated NEWS file about the API changes in the libraries
Christophe CURIS [Thu, 9 May 2013 16:27:09 +0000]
WINGs: Updated NEWS file about the API changes in the libraries

5 weeks agoWINGs: Fixed incorrect return type for internal function
Christophe CURIS [Thu, 9 May 2013 15:34:13 +0000]
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.

5 weeks agoWINGs: Fixed incorrect allocation size, missing room for '\0'
Christophe CURIS [Thu, 9 May 2013 15:34:12 +0000]
WINGs: Fixed incorrect allocation size, missing room for '\0'

5 weeks agoWPrefs.app: Added const attribute to local string
Christophe CURIS [Thu, 9 May 2013 15:34:10 +0000]
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.

5 weeks agowrlib: Added 'const' attribute to local function in 'context'
Christophe CURIS [Thu, 9 May 2013 15:34:09 +0000]
wrlib: Added 'const' attribute to local function in 'context'

5 weeks agoWINGs: Added 'static' attribute to local functions in wcolorpanel
Christophe CURIS [Thu, 9 May 2013 15:34:08 +0000]
WINGs: Added 'static' attribute to local functions in wcolorpanel

These 4 functions are local to the file so we make this official.

5 weeks agoWINGs: Added 'const' attribute to 'WMCreatePropListFromDescription'
Christophe CURIS [Thu, 9 May 2013 15:34:07 +0000]
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.

5 weeks agoWINGs: Added 'const' attribute to functions in dragdestination, wtext
Christophe CURIS [Thu, 9 May 2013 15:34:06 +0000]
WINGs: Added 'const' attribute to functions in dragdestination, wtext

This makes both the API and local function const-correct on their
input parameters.

5 weeks agoWINGs: Added 'const' attribute to functions in wpanel, wpopupbutton, wtabview
Christophe CURIS [Thu, 9 May 2013 15:34:05 +0000]
WINGs: Added 'const' attribute to functions in wpanel, wpopupbutton, wtabview

This makes both the API and local function const-correct on their
input parameters.

5 weeks agoWINGs: Added 'const' attribute to functions in wballoon, wmenuitem, wmisc, wtextfield
Christophe CURIS [Thu, 9 May 2013 15:34:04 +0000]
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.

5 weeks agoWINGs: Added 'const' attribute to functions in wbrowser, wcolorpanel, wfilepanel...
Christophe CURIS [Thu, 9 May 2013 15:34:03 +0000]
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.

5 weeks agoWINGs: Added 'const' attribute to functions in wbutton, wframe, wlabel, wlist, wwindow
Christophe CURIS [Thu, 9 May 2013 15:34:02 +0000]
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.

5 weeks agoWINGs: Added 'const' attribute to functions in wapplication, wappresource, wcolor...
Christophe CURIS [Thu, 9 May 2013 15:34:01 +0000]
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.

6 weeks agoFixed memory leak due to non-freed property list structure
Christophe CURIS [Wed, 8 May 2013 13:44:12 +0000]
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.

6 weeks agoChanged method to limit the number of History entries loaded
Christophe CURIS [Wed, 8 May 2013 13:44:11 +0000]
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.

6 weeks agoAdded a few 'const' to filename parameters for History functions
Christophe CURIS [Wed, 8 May 2013 13:44:10 +0000]
Added a few 'const' to filename parameters for History functions

Name of file is, as usual, a read-only parameter.

6 weeks agoFixed memory leak due to non-freed temporary PropList
Christophe CURIS [Wed, 8 May 2013 13:44:09 +0000]
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.

6 weeks agoWPrefs: Added const attribute to statically stored strings
Christophe CURIS [Wed, 8 May 2013 13:44:08 +0000]
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.

6 weeks agoWPrefs: Added the proper 'const' attribute to the dictionnary functions
Christophe CURIS [Wed, 8 May 2013 13:44:07 +0000]
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.

6 weeks agoDocumentation on the new switchpanel behaviour.
Iain Patterson [Mon, 22 Apr 2013 14:14:09 +0000]
Documentation on the new switchpanel behaviour.

Describe Group*Key and StrictWindozeCycling in the NEWS file.

6 weeks agoWUtil: Increased version number for the library
Christophe CURIS [Sat, 4 May 2013 13:43:32 +0000]
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.

6 weeks agoWUtil: Rewrote 'wusergnusteppath' to be more efficient
Christophe CURIS [Sat, 4 May 2013 13:43:31 +0000]
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.

6 weeks agoFixed const correctness in functions using 'wusergnusteppath'
Christophe CURIS [Sat, 4 May 2013 13:43:30 +0000]
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.

6 weeks agoWUtil: Changed declaration of 'wusergnusteppath' to return a CONST string
Christophe CURIS [Sat, 4 May 2013 13:43:29 +0000]
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.

6 weeks agoWUtil: Fixed risky code for de-escaping of strings
Christophe CURIS [Sat, 4 May 2013 13:43:28 +0000]
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.

6 weeks agoWUtil: Fixed wrong type recast
Christophe CURIS [Sat, 4 May 2013 13:43:27 +0000]
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.

6 weeks agoWUtil: Avoid unnecessary strdup + free
Christophe CURIS [Sat, 4 May 2013 13:43:26 +0000]
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.

6 weeks agoWUtil: Added comment about values returned by API functions
Christophe CURIS [Sat, 4 May 2013 13:43:25 +0000]
WUtil: Added comment about values returned by API functions

This is mainly to be consistent with what's done in the rest of
the file, but it is better to have it there that nowhere at all
anyway...

6 weeks agoWUtil: Added 'const' attribute to all remaining functions where applicable
Christophe CURIS [Sat, 4 May 2013 13:43:24 +0000]
WUtil: Added 'const' attribute to all remaining functions where applicable

This makes the WUtil API as much const-correct as possible for
the arguments being given to its functions.

This does not make it totally correct as it does not changes the
const-ness on returned values because the goal of this patch is
to make no visible change to existing program that would use this
library.

6 weeks agoWUtil: Added 'const' attribute to the filename on WM(Read|Write)PropList*
Christophe CURIS [Sat, 4 May 2013 13:43:23 +0000]
WUtil: Added 'const' attribute to the filename on WM(Read|Write)PropList*

Note that the argument is also stored as-is in the PLData structure
but only for debugging purpose (warning display to user), hence the
choice to not duplicate it. As a side effect, it was 'const'-ified
too to reflect that.

6 weeks agoWUtil: Added 'const' attribute to parameters for file related API
Christophe CURIS [Sat, 4 May 2013 13:43:22 +0000]
WUtil: Added 'const' attribute to parameters for file related API

As a side note, in 'wfindfileinlist' the first argument should be:
  const char * const *path_list

However, due to limited support for const in plain C, that would
introduce warnings in user code. For compatibility issues, this
was not implemented.

6 weeks agoWUtil: Added 'const' attribute on non-modified arguments to functions
Christophe CURIS [Sat, 4 May 2013 13:43:21 +0000]
WUtil: Added 'const' attribute on non-modified arguments to functions

A number of functions do not actually modify the strings given as
parameter, but only read or duplicate it. In this case it is a good
practice to mark that parameter as pointer-to-const to let the
compiler known about it, to be able to perform appropriate
optimisations.

6 weeks agoWRaster: Bugfix, added missing 'const' to RLoad* functions
Christophe CURIS [Fri, 3 May 2013 06:50:51 +0000]
WRaster: Bugfix, added missing 'const' to RLoad* functions

Prototype of function changed in commit
  d1e1c13fa3bd60ba6c33011f58bbeb664e175198
but two of them were not updated in the source.

Thanks to Rodolfo García Peñas for taking the time to test and report.

6 weeks agoAdded missing headers to the list of source files of the project
Christophe CURIS [Thu, 2 May 2013 21:55:00 +0000]
Added missing headers to the list of source files of the project

This is needed in order to have all the expected files in the
archive of sources when using:
  make dist

6 weeks agoIncreased library's revision to reflect API updates
Christophe CURIS [Wed, 1 May 2013 18:26:36 +0000]
Increased library's revision to reflect API updates

The addition of 'const' to parameters of library's functions is an
API change, although this will break neither the binary interface
nor the compilation of program using the library; the other changes
also have no impact on the compiled library object.

6 weeks agoAdded the last missing 'const' attributes to function parameters
Christophe CURIS [Wed, 1 May 2013 18:26:35 +0000]
Added the last missing 'const' attributes to function parameters

6 weeks agoAdded 'const' attribute on non-modified arguments for color handling functions
Christophe CURIS [Wed, 1 May 2013 18:26:34 +0000]
Added 'const' attribute on non-modified arguments for color handling functions

These functions have both an input and an output color, marked the
input color as const to help distinguish.

6 weeks agoAdded 'const' attribute on non-modified arguments for drawing functions
Christophe CURIS [Wed, 1 May 2013 18:26:33 +0000]
Added 'const' attribute on non-modified arguments for drawing functions

All these functions expects agruments like color or list-of-points
that should not be modified (and are not) by the function; added
the corresponding qualifier to reflect that.

6 weeks agoAdded 'const' attribute to the file name parameter to load/save
Christophe CURIS [Wed, 1 May 2013 18:26:32 +0000]
Added 'const' attribute to the file name parameter to load/save

This name is not modified by the callee functions (and it should
not be anyway), so let's make it official in the internal functions

6 weeks agoConverted #define into an Enum for image format number
Christophe CURIS [Wed, 1 May 2013 18:26:31 +0000]
Converted #define into an Enum for image format number

An enum is always a better idea as it allows the compiler to do
some checks, and as this info is internal only to the WRLib it
will not change the API.

6 weeks agoMoved the function to Save image also into the internal header
Christophe CURIS [Wed, 1 May 2013 18:26:30 +0000]
Moved the function to Save image also into the internal header

6 weeks agoMoved declaration of format-specific image Load functions to dedicated header
Christophe CURIS [Wed, 1 May 2013 18:26:29 +0000]
Moved declaration of format-specific image Load functions to dedicated header

The functions are declared in different files but they were called
in another file which re-declared the prototypes. This is dangerous
as it can lead to misaligned prototypes when functions changes.

They are now grouped in the library internal header 'imgformat.h'

6 weeks agoMove the list of keyboard shortcut texts into the array of their config keyword
Christophe CURIS [Sun, 28 Apr 2013 13:37:53 +0000]
Move the list of keyboard shortcut texts into the array of their config keyword

The config-file-keyword was defined in an array, but the user displayed
string was defined at another place, thus requiring special care when
modifying the list, to keep the same number of entries, in the same
order, ...

This was an open call for subtle bugs, so the keyword and user string
are now at a single place, making updates on the list easier and the
GUI generation code smaller.

6 weeks agoSupport for same-class cycling in open switchpanel.
Iain Patterson [Mon, 22 Apr 2013 13:03:14 +0000]
Support for same-class cycling in open switchpanel.

If the switchpanel was opened with either FocusNextKey or FocusPrevKey
shortcut, and the user presses GroupNextKey or GroupPrevKey, skip over
windows of a different class when cycling through windows in the
switchpanel.

In the case where the switchpanel was opened with FocusNextKey or
FocusPrevKey initially, the check can be skipped because all the
available choices are necessarily of the same class already.

6 weeks agoCorrect check for modifier in class-specific cycle.
Iain Patterson [Mon, 22 Apr 2013 12:41:46 +0000]
Correct check for modifier in class-specific cycle.

The hasModifier flag was set if the FocusNextKey or FocusPrevKey
shortcuts had modifiers, depending on which shortcut was used to open
the switchpanel.

The switchpanel can also be opened with the GroupNextKey or GroupPrevKey
shortcuts, so we should account for those when setting hasModifier.

6 weeks agoAdded sameWindowClass().
Iain Patterson [Mon, 22 Apr 2013 12:46:22 +0000]
Added sameWindowClass().

Avoid code duplication by moving check for windows of the same WM_CLASS
to the new function sameWindowClass().