1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 12:58:08 +01:00
Commit Graph

2713 Commits

Author SHA1 Message Date
Christophe CURIS
95ee539d6d Configure: Added explicit check for math library header
Compilation will not work if the header is missing, so make sure
it is present and compilable first. This can highligh sooner if
a user forgot to install the corresponding dev package.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-17 01:54:06 +01:00
Christophe CURIS
f68ec6c913 Configure: Moved check for Math lib to a dedicated M4 macro
Took the opportunity to rewrite the check using autoconf macros
to generate a more compatible configure script.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-17 01:16:51 +01:00
Christophe CURIS
a6410d61e5 wmaker: Added 'const' attribute to local variables
A number of these variable are not meant to be modified, so we
show this to the compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
c9b816de75 wmaker: Added 'const' attribute to remaining functions
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
c7ab9d34f7 wmaker: Added 'const' attribute to function 'wWindowUpdateName'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
9b5db31d95 wmaker: Added 'const' attribute to most global functions
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
f0c1dc9fc3 wmaker: Added 'const' attribute to most local functions
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
69b6848187 wmaker: Added 'const' attribute to function 'wDefaultsInitDomain'
This has a few side effects which are properly handled by this patch

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
062ff99fac wmaker: Added 'const' attribute to function 'GetShortcutString'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
1c4ad880d1 wmaker: Added 'const' attribute to local function 'drawMultiLineString'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
a092d8848a wmaker: Added 'const' attribute to local function 'getMaxStringWidth'
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
f429055b4f wmaker: Added 'const' attribute to function 'ShrinkString'
The function contained an internal statement that would have
discarded the const attribute, but as this statement is actually
useless it have been simply removed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:32:23 +01:00
Christophe CURIS
a61f6c2484 Hide some compiler warning that are known and accepted
Because we have to use some X functions marked as deprecated to
ensure portability, we prefer to hide the warnings from standard
users, and keep them only for dev team.

[crm: Add -Wno-deprecated-declarations too]

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 19:03:24 +01:00
Christophe CURIS
39ecbc1084 WPrefs: Added XKeycodeToKeysym work-around to all other usage places
To ensure proper behaviour with X servers that do not support the
Xkb extension, implemented call to the fall-back legacy function
to the other places where it is being used, to ensure proper
behaviour in any case.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 18:53:05 +01:00
Christophe CURIS
0382dd5dd7 WPrefs: Fixed empty list of Mouse Grab Modifier problem
The original code was assuming that the Xkb extension is available
everywhere, which is not the case. This resulted in all modifiers
to be seen as NoSymbol, thus the empty list.

Now we initialize properly the Xkb extension at the start of the
program, and provide a work-around with the historical function in
the case the ext would not be available.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 18:53:05 +01:00
Christophe CURIS
5d2fb4ec97 WPrefs: Fix crash when switching to mouse settings panel
Apparently, there is some exceptional case when the 'Mouse Grab
Modifier' list can be empty, in which case the program would
crash.

This patch makes sure the program will not crash (that's a bad
behaviour), but does not solve the empty list case

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-16 15:02:55 +01:00
Christophe CURIS
ebac6e7c83 Fixed incorrect format specifier
As reported by clang, the format used was %hi which is expecting
a short-typed argument, but the parameters are actually defined
as ints in the structure, so use only %i.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-11 08:22:47 +01:00
Christophe CURIS
1e76a78604 Fixed structure declaration syntax
As reported by Iain Patterson, the clang compiler is (by default)
strictier on having clean C syntax. A few structure definition
did not comply, now they do.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-10 22:34:59 +01:00
Christophe CURIS
528955c447 Added explicit prototype for callback function and fixed code accordingly
Using an unspecified prototype function for a callback is calling
for problem. Added an explicit prototype for the 2 callback
functions in WDefaultEntry, and fixed the functions used to match
it. The new code should be a lot safer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-09 22:20:57 +01:00
Christophe CURIS
6dda67bc51 wmaker: Added attribute 'noreturn' to appropriate functions
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-09 18:46:56 +01:00
Christophe CURIS
34089d7661 Configure: Added check for compiler attribute 'noreturn'
This attribute for functions was not standard until recently, so
there are a few different possible syntax. With this patch, the
configure script will search for the proper syntax, and define what
is needed to have the attribute compile correctly.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-09 18:46:56 +01:00
Christophe CURIS
3c2fc82b6e WUtil: Avoid memory leak and misbehaviour on internal function 'getuserhomedir'
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>
2013-06-09 16:51:16 +01:00
Christophe CURIS
7889c50c36 Configure: Use automake's conditional to handle icon installation
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>
2013-06-09 13:52:26 +01:00
Iain Patterson
587a37dc60 Maximization regression
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.
2013-06-09 13:52:06 +01:00
Iain Patterson
70909f4d5d funcs.h regression
funcs.h was previously removed.  Unfortunately usermenu.c still
attempted to #include it.
2013-06-09 13:51:53 +01:00
Iain Patterson
ae91ee4b0a Handle Return in switchpanel.
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.
2013-06-07 19:54:07 +01:00
Iain Patterson
a6b1833b41 Preference to open the switchpanel without selecting a window.
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
2013-06-07 19:53:10 +01:00
Iain Patterson
4c7d0025dd Compiler food.
WMArray elements are stored as pointers.  We only need to store chars
for switchpanel flags.
2013-06-07 19:52:53 +01:00
Iain Patterson
420fcb2819 Avoid unnecessary switchpanel icon redraws.
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.
2013-06-07 18:43:21 +01:00
Carlos R. Mafra
ed115929f3 Fix workspace renaming with Ctrl+left click
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).
2013-06-07 14:32:07 +01:00
Rodolfo García Peñas (kix)
5455a585dc funcs.h removed
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>
2013-05-26 19:48:00 +01:00
Rodolfo García Peñas (kix)
ed80a9bf5c New header file switchmenu.h
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>
2013-05-26 19:48:00 +01:00
Rodolfo García Peñas (kix)
9ededf6cb2 New header file winmenu.h
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>
2013-05-26 19:48:00 +01:00
Rodolfo García Peñas (kix)
20a695f70f New header file monitor.h
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>
2013-05-26 19:48:00 +01:00
Rodolfo García Peñas (kix)
8aca1b816f getWVisualID prototype moved to main.h
The prototype getWVisualID is moved to the file main.h, because
is implemented in main.c

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2013-05-26 19:48:00 +01:00
Rodolfo García Peñas (kix)
157209a035 New header file event.h
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>
2013-05-26 19:48:00 +01:00
Rodolfo García Peñas (kix)
583235bb36 New header file cycling.h
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>
2013-05-26 19:48:00 +01:00
Rodolfo García Peñas (kix)
68cdba0e29 New header file startup.h
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>
2013-05-26 19:48:00 +01:00
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