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

2925 Commits

Author SHA1 Message Date
Iain Patterson
dd8d320619 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.
2013-05-24 15:00:24 +01:00
Iain Patterson
89a6476a33 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.
2013-05-23 18:19:45 +01:00
Iain Patterson
bf9e025289 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.
2013-05-23 18:19:45 +01:00
Renan Traba
936a85ce25 enforce requested window position whem maximizing 2013-05-21 11:24:36 +01:00
Renan Traba
05f6a30716 explicit restore to MAX_MAXIMUS instead of empty flag at handleMaximize 2013-05-21 11:24:36 +01:00
Renan Traba
c2188d0793 WPrefs: added option to configure new viewports 2013-05-21 11:24:36 +01:00
Renan Traba
3eb01800e8 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
2013-05-21 11:24:36 +01:00
Renan Traba
e66afb6e18 WPrefs: added option to configure new top and bottom viewports 2013-05-21 11:24:36 +01:00
Renan Traba
d025625df0 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
2013-05-21 11:24:35 +01:00
Renan Traba
e20f45ef3c simplified logic of wMaximizeWindow function 2013-05-21 11:24:35 +01:00
Renan Traba
33343bcd59 simplified logic of handleMaximize function 2013-05-21 11:24:35 +01:00
Renan Traba
f10ec42ba8 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.
2013-05-21 11:24:35 +01: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
549cefc47b util: Added a few missing 'static' attributes for functions 2013-05-12 01:01:20 +01:00
Christophe CURIS
d517d5cac0 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
2013-05-12 01:01:20 +01:00
Christophe CURIS
4b89104aca 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
140249ad0c 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
8a58c8b568 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
5c2a1ae1a1 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
367d1f938d 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
2013-05-12 01:01:20 +01:00
Christophe CURIS
e2d816c7a2 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
bab90b2168 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
708bc27e3f 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
a622197faa 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.
2013-05-12 01:01:20 +01:00
Christophe CURIS
a3281b1e89 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.
2013-05-12 01:01:19 +01:00
Christophe CURIS
017e6a84a0 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.
2013-05-12 01:01:19 +01:00
Christophe CURIS
d01c2a596f wmaker: Removed deprecated function definition from header
These function exists nowhere, so they should not have a prototype
in the header.
2013-05-12 01:01:19 +01:00
Christophe CURIS
b5101fc8ae WPrefs: Added 'const' attribute to function parameters 2013-05-12 01:01:19 +01:00
Christophe CURIS
eb14bca73b 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).
2013-05-12 01:01:19 +01:00
Christophe CURIS
5d03c455fc util: Added 'const' attribute to function parameters 2013-05-12 01:01:19 +01:00
Christophe CURIS
d44aa97243 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.
2013-05-12 01:01:19 +01:00
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