1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 03:50:30 +01:00

3859 Commits

Author SHA1 Message Date
Torrance, Douglas
ddacfa5d63 Include screen.h in dialog.h for definition of WScreen 2023-01-26 10:15:58 +00:00
Torrance, Douglas
0718297e9a Correctly draw window snapping hints on multi-head systems
Previously, the transparent frames that were drawn prior to snapping a
window assumed that there was only one head, i.e., that the new
position and dimensions of the window would be based on the dimensions
of the entire screen.

However, this is not the case on multi-head systems, and so we now
base the transparent frame's position and dimensions on the current
head of the window.

We also refactor the code so that the new dimensions are computed in
the switch statement and finish with one final call to
drawTransparentFrame.
2023-01-20 11:54:07 +00:00
Torrance, Douglas
9cc16182d3 Use dock to determine whether drawer is on right side when swapping
Previously, we assumed that it always switched from left to right or
vice versa when calling swapDrawer.  However, now we may also call
swapDrawer when changing the value of "KeepDockOnPrimaryHead", which
wouldn't actually switch which side of the screen it's on.

So instead, we determine which side of the screen it should be on
based on the dock.
2023-01-20 10:34:36 +00:00
Torrance, Douglas
f6165d6e80 Use actual x position of dock when saving state
Previously, we either saved it as 0 or -ICON_SIZE, and then adjusted
it depending on the screen width when restoring the state.

But since the introduction of the "KeepDockOnPrimaryHead" option, the
state-restoring code has changed so that the dock will go on the left if the
x-coordinate of the position in WMState is to the left of the midpoint
of the screen and on the right otherwise.  But previously (unless the
user manually set the value in WMState) this would always send the
dock to the left, even if it had been on the right, since the x-coordinate
automatically saved to WMState in this case was negative.

We simplify things by saving the actual x position of the dock to WMState.
2023-01-20 10:34:36 +00:00
Torrance, Douglas
10c36d244e Use dock's position to determine position of dock menu
Previously, we assumed that if the dock was on the right, then the
menu should be on the far right of the entire screen, but this is no
longer the case with "KeepDockOnPrimaryHead" set to "YES".
2023-01-20 10:34:36 +00:00
Torrance, Douglas
515eb652c7 Update the dock position when "KeepDockOnPrimaryHead" is changed 2023-01-18 12:18:03 +00:00
Torrance, Douglas
8ed92efa3c Rename swapDock to wDockSwap and add to dock.h
We'll be calling it from defaults.c.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
cc839f8bc5 Add default value of "KeepDockOnPrimaryHead" to Defaults/WindowMaker 2023-01-18 12:18:03 +00:00
Torrance, Douglas
48d4820dee Support "KeepDockOnPrimaryHead" when restoring state
We use the new helper function getDockXPosition to determine where
to put the dock.  If WMState gives an x-coordinate less than the
center of the screen, we put it on the left, and otherwise we put it
on the right.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
d4f5f3ec7f Support "KeepDockOnPrimaryHead" when initially creating dock
We use the new "getDockXPosition" helper function to find the x
position of the main icon, whose position is used in "wDockCreate" to
get the position of the entire dock.

Previously, "KeepDockOnPrimaryHead" was only taken into account
when *moving* the dock and not when creating it.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
83f7fa43ce Add helper function for computing the dock's x position
Avoid code duplication since we'll need to make this computation in
several places.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
55a816bdbc Keep dock on primary head if KeepDockOnPrimaryHead is YES
This implements a feature request [1] to allow the possibility of
keeping the dock on the primary head on a multi-head system.

In particular, if the new KeepDockOnPrimaryHead option is set to YES,
the dock will either be on the left- or right-hand side of the primary
screen.  If it is NO, then we get the current behavior, i.e., the dock
will either be on the left-hand side of the leftmost head or the
right-hand side of the rightmost head.

[1] https://github.com/window-maker/wmaker/issues/24

Closes: #24
2023-01-15 00:18:34 +00:00
Torrance, Douglas
7639fa1c15 Add "KeepDockOnPrimaryHead" checkbox to WPrefs experts panel 2023-01-15 00:18:34 +00:00
Torrance, Douglas
93b411f258 Document "KeepDockOnPrimaryHead" option in NEWS 2023-01-15 00:18:34 +00:00
Torrance, Douglas
326a67e18f Add new "KeepDockOnPrimaryHead" option
Once implemented, this will keep the dock on the primary head (when
there are multiple heads) when YES.  The default value is NO, the
current behavior, i.e., treat all monitors together as one large screen.
2023-01-15 00:18:34 +00:00
Petre Rodan
c089c6aea4 Fix segfault on right-click sweep of menu
bug description: after menu is displayed I get a segfault when trying to hover over the last menu
entry. it looks like under some circumstances menu->entries[] gets accessed past the last valid
value (off by one).

how to reproduce:
right-click desktop to show menu and keep right mouse button pressed
sweep mouse up-down the menu a few times - it crashes all the time between 1-5 sweeps

this commit fixes the unwanted behaviour, in active use since december 2021.
2023-01-06 12:47:22 +00:00
Torrance, Douglas
66b0ee3c4d Add WPrefs to XDG desktop menu
We include a desktop entry file for WPrefs so that it will be included
in XDG-compatible menus.  See the specifications at:

https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
2022-02-17 22:31:18 +00:00
Torrance, Douglas
a6c8577eb4 Include wmaker.desktop in distribution tarball
This fixes a bug where building from a tarball generated by "make
dist" would fail due to the absence of this file.
2022-02-17 22:31:18 +00:00
Doug Torrance
094001a53d Convert Slovak language manpages from ISO-8859-2 to UTF-8 2021-10-10 11:53:29 +01:00
Doug Torrance
deba131857 Convert Czech language manpages from ISO-8859-2 to UTF-8 2021-10-10 11:53:11 +01:00
Doug Torrance
a9bc9751a2 Use quotes around "Window Maker" in translated manpage title headers
This matches the English manpage and also prevents
wrong-manual-section Lintian warnings in the Debian package, as "Maker"
was being interpreted as the section of these manpages.
2021-10-09 13:53:34 +01:00
Torrance, Douglas
58b6728743 Add desktop file for display manager session configuration
Files in /usr/share/xsessions are used by some display managers (e.g.,
LightDM and GDM) to detect available sessions.  Such a file has been
shipped in the Debian Window Maker package for years.
2021-10-09 09:55:40 +01:00
Christophe CURIS
894d096d6e WINGs: in WText, do not re-query Atom value every time they are used
It is resource-consuming to query the server for an Atom, yet the protocol
ensures the values will stay unique, so we'd better ask them once and
retain the values for further use.
2021-09-04 19:03:53 +01:00
Christophe CURIS
a41b0aa21d WINGs: Simplify function wstrconcat
Because we have allocated enough space, it is a waste of time to check the
size after copy and cat; beside the use of plain strxxx functions may allow
compiler to make a better job.
2021-09-04 19:03:53 +01:00
Christophe CURIS
d4cc033379 Util: Rewrite error message generation to avoid potential problem
The call to 'snprintf' may change the value of 'errno', which means that
the 'perror' call would print a wrong error message, not the one from
'fopen'.
2021-09-04 19:03:53 +01:00
Christophe CURIS
308b9f4975 Configure: Fix non-working libbsd usage when explicitly requested
Due to a missing comma, in the AS_IF the action run-if-false is actually
merged with run-if-true action, which means that with_libbsd is always
empty when user provides --with[out]-libbsd.
2021-09-04 19:03:53 +01:00
Christophe CURIS
1d1c904126 Configure: Place the argument checks at the beginning of execution
The autotool provides a simple mechanism which allows us to move ("divert")
the checks we do on the user arguments to the beginning of the script, yet
without needing to scatter the code.

This is good because we can raise errors very fast, user do not have to
wait until many other checks have passed before knowing he has to correct
his argument list; yet on our side we can keep related things together.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-09-04 19:03:53 +01:00
Christophe CURIS
ca4ae5068b WINGs: Simplify wglobaldefaultspathfordomain
The original code was over-complicated, it can be reduced to a one-line
call to a function that does the same thing, with the bonus that it will
behave better in the case where domain == NULL.
2021-08-10 09:42:43 +01:00
Christophe CURIS
26491867a3 WINGs: Fix incomplete prototypes for functions that take no argument 2021-08-10 09:42:43 +01:00
John D Pell
dce34e926b wmaker.inst: remove all modification to ~/.xinitrc
I cannot imagine that modifying an existing ~/.xinitrc is ever wanted, and creating an ~/.xinitrc when none exists is much worse.

If a user created their own ~/.xinitrc, then don't modify it.
The user will modify it if they like.

If the user did not create their own ~/.xinitrc, then creating one will short-circuit X startup as `startx` will *replace* the system's version with the user's version.
Literally ~/.Xresources won't be loaded.
There's no way this is expected behavior.
2021-08-10 09:42:43 +01:00
John D Pell
a0b283a60f WUtil: Be more strict about base directory for wmkdirhier()
The original code refused to create anything not in $WMAKER_USER_ROOT, now
we go one step further and limit creation inside its 'Library' or
'Defaults' sub-directories.
2021-08-10 09:42:43 +01:00
John D Pell
671db45007 WUtil: Be more strict about base directory for wrmdirhier()
The original code refused to delete anything not in $WMAKER_USER_ROOT, now
we go one step further and limit deletion inside 'Library' or 'Defaults'.
2021-08-10 09:42:43 +01:00
John D Pell
0c6ad643c8 Change generation of Data Dir in the global header
It has become common practice in previous patches to use PACKAGE_TARNAME
instead of hard-coding "WindowMaker" when working with paths, so let's be
as consistent in the generated header.
2021-08-10 09:42:43 +01:00
John D Pell
5076b6f496 Default Files: Replace misleading variables 'defsdatadir' in Makefiles
The parameter name 'defsdatadir' was copied in to many sub-Makefiles; for
all of them give a unique name for clarity.
2021-08-10 09:42:43 +01:00
Christophe CURIS
54c8535365 Configure: Add an error message when using deprecated "--with-defsdatadir" 2021-08-10 09:42:43 +01:00
John D Pell
24f5b32469 Configure: Rename setting DEFSDATADIR to PKGCONFDIR
Directory /etc/WindowMaker is for global defaults configuration, it is not
a "data" folder which is $PREFIX/share/WindowMaker.

The name change make it more consistent with other names.
2021-08-10 09:42:43 +01:00
John D Pell
85169642ca WMaker: Store history in $XDG_STATE_HOME if defined
The FreeDesktop XDG standard suggests storing history in the directory
pointed by $XDG_STATE_HOME; so if we find it is defined we prefer to use
it over the default path. If undefined, keep the old behaviour.

This may introduce a loss of history for users that had some in the legacy
place but have the variable, we consider this very unlikely to be a problem
but if user complains we can suggest them to move the legacy file over the
empty new one.
2021-08-10 09:42:43 +01:00
Christophe CURIS
9f9ef6417e Utils: Use the constants added in config-paths.h for paths
Replace hard-coded directory names by the constants that have been
previously added to the common header.
2021-08-10 09:42:43 +01:00
Christophe CURIS
fb2a6d2e61 WPrefs: Use the constants added in config-paths.h for paths
Replace hard-coded directory names by the constants that have been
previously added to the common header.
2021-08-10 09:42:43 +01:00
John D Pell
8219c36488 WINGs: Use the constants added in config-paths.h for paths
Replace hard-coded directory names by the constants that have been
previously added to the common header.
2021-08-10 09:42:43 +01:00
John D Pell
bd38778bef Use wuserdatapath() everytime it is applicable
Replace calls to wusergnusteppath() which just append "/Library" by calls
to wuserdatapath().
Take opportunity to replace hardcoded "/WindowMaker" directories with
the existing PACKAGE_TARNAME macro (which comes from autotools).

The choice of 'TARNAME' is because it meant to be used in filename, thus
less likely to have problematic characters than PACKAGE_NAME (meant for
display purpose) and PACKAGE which is there for historical reason.
2021-08-10 09:42:43 +01:00
John D Pell
1e45ff2305 WUtil: New function wuserdatapath() to get path for application data
Returns the path in the user's GNUstep library: ~/GNUstep/Library
2021-08-10 09:42:43 +01:00
John D Pell
7e1cdf2d59 Add definition of directory names used for building paths in common header
The organisation of the file tree for storing application files depends on
a number of directories with a specific name.
This patch puts these names in the generated "config-paths.h" so they can
be shared between WINGs and WindowMaker, and could be user-configured in
the future.
2021-08-10 09:42:43 +01:00
Christophe CURIS
43f0474013 WINGs: Properly mark 'const' more 'char*' in the public API
Because the previous patch brought a (welcome) change in the public API,
seize the opportunity to go further in the improvement.
2021-08-10 09:42:43 +01:00
John D Pell
a079544647 WINGs: Properly mark 'const' some 'char*' in the public API
Update all the callers in our code to deal with the const qualifier
where the compiler reports an issue.
2021-08-10 09:42:43 +01:00
John D Pell
03ec24502d WMaker: Fix logical-not operator in framewin.c
As reported by clang, (!wPreferences.new_style == TS_NEW) inverts the
"wPreferences.new_style" and not the whole expression. Use the appropriate
comparison operator to avoid misunderstanding.
2021-08-10 09:42:43 +01:00
John D Pell
5c90ed9d2d WPrefs: Use wdefaultspathfordomain() to build path to the root menu file
For the Menu edition tab, when building the path to the file that contains
the menu data, rely on wdefaultspathfordomain instead of constructing the
path with many hard-coded names.
2021-08-10 09:42:43 +01:00
John D Pell
735651df55 WMaker: Use wdefaultspathfordomain() to get path for Defaults directory
Instead of constructing path to user's defaults directory with hard-coded
names, just query wdefaultspathfordomain with a blank domain: this returns
the equivalent of "~/GNUstep/Defaults/", yet avoiding problems related to
duplicating strings.
2021-08-10 09:42:43 +01:00
John D Pell
bfab769065 WINGs: Improve search path logic in WMPathForResourceOfType
The man page says environment variables are used, and if they don't exist
it falls back to defaults, yet this was not true in WINGS.

This changes implements the checks for the default paths used when the env
variables are not defined; these default paths have been fixed (+lib) to
match the GNUstep layout ('fhs'), expect for the very last path which keeps
the legacy layout.

For the user Apps folder, rely on wusergnusteppath() (~/GNUstep) to build
the path.

The previous code was only partially functional as the hard-coded paths
did not exist in any of GNUstep standard file system layout and the
GNUSTEP_*_ROOT environment variables were not provided by GNUstep for a
while. This means it would never work no matter how environment variables
were set when using layouts: 'debian', 'fhs', 'next', 'Apple', 'mac',
'fhs-system', or 'standalone'.
2021-08-10 09:42:43 +01:00
John D Pell
c060477d57 WINGs: Simplify use of HAVE_SECURE_GETENV
Define the macro GETENV(x) instead of sprinkling code with #ifdef HAVE_SECURE_GETENV
everytime we want to use it.
2021-08-10 09:42:43 +01:00