If the function was called more than once with different usernames
it would always return the path for the user on the first call,
which is not what would be expected.
Furthermore, if the function succeeds it allocated memory to save
this path but it was never freed.
The good thing is that the use case for this function is so rare
that it is improbable it was ever called, which explains why it
was never seen.
The new code always behaves as expected, and does not allocate
memory anymore to avoid wasting time and memory for such small
things, which is acceptable because this function is local.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The previous method was to use a custom install procedure, which
is a bit complex when automake can handle this for us, and as a
side effect it made 'distcheck' fail on uninstall procedure check.
The new method is to use a simple conditional and autoconf/automake
will do all the work for us.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
wMaximizeWindow() was previously rewritten and simplified.
Unfortunately the rewrite introduced a regression with windows which
were horizontally maximized or Maximusized, whereby they would be too
small after the maximization.
The bug is easy to see by opening a standard 80x24 terminal and hitting
the maximize horizontally shortcut. The terminal shrinks to 21 lines.
Pressing the shortcut key again correctly restores it to 80x24.
The fix is to refrain from shrinking the final window height, which is
done to account for its frame border and titlebar, for the affected
maximization styles.
Explicitly match a Return keypress in the switchpanel, so that the
currently selected window is focused without the keypress event being
handled elsewhere.
Pressing Return to commit the window selection is intuitive but other
shortcuts may bind Return. Any keypress not explicitly handled in the
switchpanel code will be passed through to other shortcut processing.
If, for example, alt+return were mapped to Select Window and the
switchpanel is open, pressing return while holding alt would both commit
the window change AND select the window, which is not intuitive.
If the new preference SwitchPanelOnlyOpen is set to YES, pressing
alt-tab or similar shortcut will only open the panel without
automatically switching to the next window. Shortcuts will continue to
function normally once the panel is open.
Users can enable the new preference if they find themselves regularly
opening the switchpanel just to visualise which windows are open, or to
initiate same-class cycling.
The default value of the new preference is NO. Behaviour is unchanged
unless the preference is explicitly enabled with the following command:
$ wdwrite WindowMaker SwitchPanelOnlyOpen YES
Keep an array of flags to remember if icons are supposed to be selected
and/or dimmed, and don't redraw any which are already in the correct
state.
Originally I didn't think the benefit of doing this was worth the effort
but future commits will call changeImage() more often so cutting down on
unnecessary redraws suddenly became more useful.
The Workspaces entry in the main menu allows to rename workspaces by
clicking on the workspace name while pressing the Ctrl key.
However since commit 63219247c6 ("Added shortcut to switch to last used workspace")
there is one more entry before the workspace name list, and that leads to
picking a wrong name to rename -- clicking on the first workspace asks to
rename the second workspace and so forth. Trying to rename the last workspace
leads to a segfault.
This happens because there is an explicit offset in the current code (- 2)
to account for the "non-workspace" entries in the menu. If one adds one
more entry that offset should be changed too (this is a prime example
of fragile code leading to bugs).
The file funcs.h is removed. A new file osdep.h is created to hold
the definition for all osdep_*c files.
The files .c has been adjusted to include the right header files,
removing funcs.h, including osdep.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The file switchmenu.h includes the function prototypes for switchmenu.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The file winmenu.h includes the function prototypes for winmenu.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The file monitor.h includes the function prototypes for monitor.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The file event.h includes the function prototypes for event.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The file cycling.h includes the function prototypes for cycling.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
The file startup.h includes the function prototypes for startup.c.
The prototypes included were moved from funcs.h.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
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.
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.
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.
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
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.
- 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
- 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
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.
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
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.
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.
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.
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.
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.
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).
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.
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.