wmaker-crm.git
14 months agoInfoPanel: fix out of display text
David Maciejak [Mon, 13 Feb 2023 12:29:26 +0000 (13 20:29 +0800)]
InfoPanel: fix out of display text

When debug is enabled, the memory allocated details is supposed to display the free chunks
but as the text length is too long it's getting out of the display area.
This patch is increasing the window width to handle such case.

14 months agoInfo Panel: mallinfo is deprecated use mallinfo2 instead
David Maciejak [Fri, 10 Feb 2023 22:35:09 +0000 (11 06:35 +0800)]
Info Panel: mallinfo is deprecated use mallinfo2 instead

Replacing mallinfo with mallinfo2.

The fields of the mallinfo structure that is returned by the
older mallinfo() function are typed as int.  However, because
some internal bookkeeping values may be of type long, the
reported values may wrap around zero and thus be inaccurate.

14 months agoInfo Panel: use system time to get the current year
David Maciejak [Fri, 10 Feb 2023 21:52:48 +0000 (11 05:52 +0800)]
Info Panel: use system time to get the current year

Use the system date to get the current year to insert inside the copyright line.
So no need to update that string anymore.

14 months agoFix wrong XKeycodeToKeysym index value
David Maciejak [Sat, 11 Feb 2023 02:01:19 +0000 (11 10:01 +0800)]
Fix wrong XKeycodeToKeysym index value

XKeycodeToKeysym was deprecated some time ago and wmaker code was patched to use the definition from XKBlib instead.
(https://repo.or.cz/wmaker-crm.git?a=commit;h=0382dd5dd7ecae2112a0c6366eaf9e6ab68ad354)

Before being deprecated,  XKeycodeToKeysym was prototyped at X11/Xlib.h as
KeySym XKeycodeToKeysym(display, keycode, index)

Now it's available in X11/XKBlib.h as
KeySym XkbKeycodeToKeysym(display, keycode, group, level)

Basically level now which is the 4th parameter is our old index variable (3rd parameter).

On systems which don't have xkb supported the value set for index is wrong.
As seen in old patch at https://repo.or.cz/wmaker-crm.git/blobdiff/139f912e618870cc7fd908099f203450547eb658..43c3526d2120712f72579398b73ef92283d9078b:/WPrefs.app/MouseSettings.c
we should pass the l value to old XKeycodeToKeysym function and not the 0 value which is used for the group in the new XkbKeycodeToKeysym definition.

14 months agoFix icon.c unused variable compiler warning
David Maciejak [Sat, 11 Feb 2023 00:38:33 +0000 (11 08:38 +0800)]
Fix icon.c unused variable compiler warning

Just to please the compiler as it's reporting:
icon.c: In function 'get_icon_cache_path':
icon.c:425:13: warning: unused variable 'len' [-Wunused-variable]

14 months agoSwitchPanel: make sure WMRetainColor and WMReleaseColor calls are even
David Maciejak [Fri, 10 Feb 2023 11:00:00 +0000 (10 19:00 +0800)]
SwitchPanel: make sure WMRetainColor and WMReleaseColor calls are even

The number of calls to WMRetainColor for a color in use should the same as the number of calls to WMReleaseColor
to free that color. In case of discrepancy, random crashes can happen and memory is not freed properly.
To debug that issue I checked the retained colors when the switchpanel is opened and then checked if those colors are properly released once the panel is closed.

This patch fixes the issue mentioned at https://github.com/window-maker/wmaker/issues/22

14 months agoWINGs: Fix incorrect findCloseColor exact flag value
David Maciejak [Fri, 10 Feb 2023 11:04:34 +0000 (10 19:04 +0800)]
WINGs: Fix incorrect findCloseColor exact flag value

In case the color cannot be allocated exactly by createRGBAColor function,
the findCloseColor function is used as a failover function to find a color close to the requested color.
By definition that color is then not exact.
createRGBAColor exact flag should be 1 while findCloseColor exact flag should be 0

14 months agoFix missing linefeed on the error message
David Maciejak [Tue, 7 Feb 2023 23:51:34 +0000 (8 07:51 +0800)]
Fix missing linefeed on the error message

Just to display the error message properly in case there is no display.

15 months agoInclude screen.h in dialog.h for definition of WScreennext
Torrance, Douglas [Thu, 26 Jan 2023 06:44:38 +0000 (26 06:44 +0000)]
Include screen.h in dialog.h for definition of WScreen

15 months agoCorrectly draw window snapping hints on multi-head systems
Torrance, Douglas [Fri, 20 Jan 2023 11:30:52 +0000 (20 11:30 +0000)]
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.

15 months agoUse dock to determine whether drawer is on right side when swapping
Torrance, Douglas [Fri, 20 Jan 2023 02:45:56 +0000 (20 02:45 +0000)]
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.

15 months agoUse actual x position of dock when saving state
Torrance, Douglas [Fri, 20 Jan 2023 02:45:56 +0000 (20 02:45 +0000)]
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.

15 months agoUse dock's position to determine position of dock menu
Torrance, Douglas [Thu, 19 Jan 2023 02:55:00 +0000 (19 02:55 +0000)]
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".

15 months agoUpdate the dock position when "KeepDockOnPrimaryHead" is changed
Torrance, Douglas [Wed, 18 Jan 2023 11:42:59 +0000 (18 11:42 +0000)]
Update the dock position when "KeepDockOnPrimaryHead" is changed

15 months agoRename swapDock to wDockSwap and add to dock.h
Torrance, Douglas [Wed, 18 Jan 2023 11:42:58 +0000 (18 11:42 +0000)]
Rename swapDock to wDockSwap and add to dock.h

We'll be calling it from defaults.c.

15 months agoAdd default value of "KeepDockOnPrimaryHead" to Defaults/WindowMaker
Torrance, Douglas [Wed, 18 Jan 2023 11:42:58 +0000 (18 11:42 +0000)]
Add default value of "KeepDockOnPrimaryHead" to Defaults/WindowMaker

15 months agoSupport "KeepDockOnPrimaryHead" when restoring state
Torrance, Douglas [Wed, 18 Jan 2023 11:42:57 +0000 (18 11:42 +0000)]
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.

15 months agoSupport "KeepDockOnPrimaryHead" when initially creating dock
Torrance, Douglas [Wed, 18 Jan 2023 11:42:57 +0000 (18 11:42 +0000)]
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.

15 months agoAdd helper function for computing the dock's x position
Torrance, Douglas [Wed, 18 Jan 2023 11:42:57 +0000 (18 11:42 +0000)]
Add helper function for computing the dock's x position

Avoid code duplication since we'll need to make this computation in
several places.

15 months agoKeep dock on primary head if KeepDockOnPrimaryHead is YES
Torrance, Douglas [Sat, 14 Jan 2023 22:22:39 +0000 (14 22:22 +0000)]
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

15 months agoAdd "KeepDockOnPrimaryHead" checkbox to WPrefs experts panel
Torrance, Douglas [Sat, 14 Jan 2023 22:22:39 +0000 (14 22:22 +0000)]
Add "KeepDockOnPrimaryHead" checkbox to WPrefs experts panel

15 months agoDocument "KeepDockOnPrimaryHead" option in NEWS
Torrance, Douglas [Sat, 14 Jan 2023 22:22:39 +0000 (14 22:22 +0000)]
Document "KeepDockOnPrimaryHead" option in NEWS

15 months agoAdd new "KeepDockOnPrimaryHead" option
Torrance, Douglas [Sat, 14 Jan 2023 22:22:38 +0000 (14 22:22 +0000)]
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.

15 months agoFix segfault on right-click sweep of menu
Petre Rodan [Fri, 6 Jan 2023 04:58:11 +0000 (6 06:58 +0200)]
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.

2 years agoAdd WPrefs to XDG desktop menu
Torrance, Douglas [Thu, 17 Feb 2022 21:57:17 +0000 (17 21:57 +0000)]
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

2 years agoInclude wmaker.desktop in distribution tarball
Torrance, Douglas [Thu, 17 Feb 2022 21:57:16 +0000 (17 21:57 +0000)]
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.

2 years agoConvert Slovak language manpages from ISO-8859-2 to UTF-8
Doug Torrance [Sat, 9 Oct 2021 15:58:17 +0000 (9 11:58 -0400)]
Convert Slovak language manpages from ISO-8859-2 to UTF-8

2 years agoConvert Czech language manpages from ISO-8859-2 to UTF-8
Doug Torrance [Sat, 9 Oct 2021 15:56:33 +0000 (9 11:56 -0400)]
Convert Czech language manpages from ISO-8859-2 to UTF-8

2 years agoUse quotes around "Window Maker" in translated manpage title headers
Doug Torrance [Sat, 9 Oct 2021 01:19:05 +0000 (8 21:19 -0400)]
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.

2 years agoAdd desktop file for display manager session configuration
Torrance, Douglas [Sat, 9 Oct 2021 02:56:27 +0000 (9 02:56 +0000)]
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.

2 years agoWINGs: in WText, do not re-query Atom value every time they are used
Christophe CURIS [Sat, 4 Sep 2021 17:05:27 +0000 (4 19:05 +0200)]
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.

2 years agoWINGs: Simplify function wstrconcat
Christophe CURIS [Sat, 4 Sep 2021 17:05:26 +0000 (4 19:05 +0200)]
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.

2 years agoUtil: Rewrite error message generation to avoid potential problem
Christophe CURIS [Sat, 4 Sep 2021 17:05:25 +0000 (4 19:05 +0200)]
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'.

2 years agoConfigure: Fix non-working libbsd usage when explicitly requested
Christophe CURIS [Sat, 4 Sep 2021 17:05:24 +0000 (4 19:05 +0200)]
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.

2 years agoConfigure: Place the argument checks at the beginning of execution
Christophe CURIS [Sat, 4 Sep 2021 17:05:23 +0000 (4 19:05 +0200)]
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>
2 years agoWINGs: Simplify wglobaldefaultspathfordomain
Christophe CURIS [Sun, 8 Aug 2021 07:36:31 +0000 (8 09:36 +0200)]
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.

2 years agoWINGs: Fix incomplete prototypes for functions that take no argument
Christophe CURIS [Sun, 8 Aug 2021 07:36:30 +0000 (8 09:36 +0200)]
WINGs: Fix incomplete prototypes for functions that take no argument

2 years agowmaker.inst: remove all modification to ~/.xinitrc
John D Pell [Sun, 8 Aug 2021 07:36:29 +0000 (8 09:36 +0200)]
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.

2 years agoWUtil: Be more strict about base directory for wmkdirhier()
John D Pell [Sun, 8 Aug 2021 07:36:28 +0000 (8 09:36 +0200)]
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.

2 years agoWUtil: Be more strict about base directory for wrmdirhier()
John D Pell [Sun, 8 Aug 2021 07:36:27 +0000 (8 09:36 +0200)]
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'.

2 years agoChange generation of Data Dir in the global header
John D Pell [Sun, 8 Aug 2021 07:36:26 +0000 (8 09:36 +0200)]
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.

2 years agoDefault Files: Replace misleading variables 'defsdatadir' in Makefiles
John D Pell [Sun, 8 Aug 2021 08:02:25 +0000 (8 10:02 +0200)]
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.

2 years agoConfigure: Add an error message when using deprecated "--with-defsdatadir"
Christophe CURIS [Sun, 8 Aug 2021 07:58:45 +0000 (8 09:58 +0200)]
Configure: Add an error message when using deprecated "--with-defsdatadir"

2 years agoConfigure: Rename setting DEFSDATADIR to PKGCONFDIR
John D Pell [Sun, 8 Aug 2021 07:36:23 +0000 (8 09:36 +0200)]
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.

2 years agoWMaker: Store history in $XDG_STATE_HOME if defined
John D Pell [Sun, 8 Aug 2021 07:36:22 +0000 (8 09:36 +0200)]
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.

2 years agoUtils: Use the constants added in config-paths.h for paths
Christophe CURIS [Sun, 8 Aug 2021 07:36:21 +0000 (8 09:36 +0200)]
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.

2 years agoWPrefs: Use the constants added in config-paths.h for paths
Christophe CURIS [Sun, 8 Aug 2021 07:36:20 +0000 (8 09:36 +0200)]
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.

2 years agoWINGs: Use the constants added in config-paths.h for paths
John D Pell [Sun, 8 Aug 2021 07:36:19 +0000 (8 09:36 +0200)]
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.

2 years agoUse wuserdatapath() everytime it is applicable
John D Pell [Sun, 8 Aug 2021 07:36:18 +0000 (8 09:36 +0200)]
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.

2 years agoWUtil: New function wuserdatapath() to get path for application data
John D Pell [Sun, 8 Aug 2021 07:36:17 +0000 (8 09:36 +0200)]
WUtil: New function wuserdatapath() to get path for application data

Returns the path in the user's GNUstep library: ~/GNUstep/Library

2 years agoAdd definition of directory names used for building paths in common header
John D Pell [Sun, 8 Aug 2021 07:36:16 +0000 (8 09:36 +0200)]
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.

2 years agoWINGs: Properly mark 'const' more 'char*' in the public API
Christophe CURIS [Sun, 8 Aug 2021 07:36:15 +0000 (8 09:36 +0200)]
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.

2 years agoWINGs: Properly mark 'const' some 'char*' in the public API
John D Pell [Sun, 8 Aug 2021 07:36:14 +0000 (8 09:36 +0200)]
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.

2 years agoWMaker: Fix logical-not operator in framewin.c
John D Pell [Sun, 8 Aug 2021 07:36:13 +0000 (8 09:36 +0200)]
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.

2 years agoWPrefs: Use wdefaultspathfordomain() to build path to the root menu file
John D Pell [Sun, 8 Aug 2021 07:36:12 +0000 (8 09:36 +0200)]
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.

2 years agoWMaker: Use wdefaultspathfordomain() to get path for Defaults directory
John D Pell [Sun, 8 Aug 2021 07:36:11 +0000 (8 09:36 +0200)]
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.

2 years agoWINGs: Improve search path logic in WMPathForResourceOfType
John D Pell [Sun, 8 Aug 2021 07:36:10 +0000 (8 09:36 +0200)]
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'.

2 years agoWINGs: Simplify use of HAVE_SECURE_GETENV
John D Pell [Sun, 8 Aug 2021 07:36:09 +0000 (8 09:36 +0200)]
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.

2 years agoFix segfault in color picker
Torrance, Douglas [Tue, 29 Jun 2021 19:21:32 +0000 (29 19:21 +0000)]
Fix segfault in color picker

Previously, we released the color well's color even if it was the same
as the new color.  This eventually resulted in a segfault when calling
WMPaintColorSwatch because we tried calling XFillRectangle with no
display.

We fix this by only releasing/updating the color well's if it differs
from the new color.

2 years agoUse wmkdirhier instead of mkdir to create color config directory
Torrance, Douglas [Tue, 29 Jun 2021 19:21:31 +0000 (29 19:21 +0000)]
Use wmkdirhier instead of mkdir to create color config directory

Otherwise, if ~/GNUstep/Library doesn't already exist, then creating
~/GNUstep/Library/Colors will fail.

2 years agoWebsite: Create script to update the list of man pages in the index
Christophe CURIS [Sun, 20 Jun 2021 20:59:53 +0000 (20 22:59 +0200)]
Website: Create script to update the list of man pages in the index

It is a good idea to have an Index web page with the list of the man pages
available, but there is a risk to have it outdated, so there is a script to
take care of this for us.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWebsite: Create script to generate the HTML version of the man pages
Christophe CURIS [Sun, 20 Jun 2021 20:59:52 +0000 (20 22:59 +0200)]
Website: Create script to generate the HTML version of the man pages

When running the 'make website' command, it will call groff to convert the
man pages into HTML and post-process them to get them in the style of the
site, then place them in the Website Git Repository.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoConfigure: Add a maintainer option to prepare generation of HTML for the website
Christophe CURIS [Sat, 5 Jun 2021 16:19:37 +0000 (5 18:19 +0200)]
Configure: Add a maintainer option to prepare generation of HTML for the website

When the new configure option '--with-web-repo' is used, the new target
'make website' becomes available and will generate HTML pages to be placed
in the Homepage Repository.

This patch does not generate any content yet but it prepares the skeleton
to handle everything.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoRepair compilation when Pango support is enabled
Christophe CURIS [Sat, 29 May 2021 21:02:37 +0000 (29 23:02 +0200)]
Repair compilation when Pango support is enabled

It seems there have been changes in the way Pango's header files are
installed in recent versions, probably to allow having multiple versions
together on a system.

Because one public header from WINGs has to include Pango's header, we must
include the search path provided by Pango into our WINGs search path that
are returned by pkg-config (the .pc file).

They are then also added to WindowMaker and WPrefs which use the header but
can't rely on the path from the .pc file which has not been installed yet.

Reported-by: Carlos R. Mafra <crmafra@gmail.com>
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoConfigure: Rewrite the detection for Pango library
Christophe CURIS [Sat, 29 May 2021 16:59:24 +0000 (29 18:59 +0200)]
Configure: Rewrite the detection for Pango library

Make use of the standard macro for PKG_CONFIG; the default behaviour is now
to use Pango if present, instead of requiring explicit user request, yet
still not making it mandatory.

The detection code was moved to a macro to keep the configure.ac script
(relatively) small, and consistent with what is done for most other libs.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoConvert WPrefs.app/po/README from iso-8859-1 to utf-8
Doug Torrance [Wed, 26 May 2021 02:12:23 +0000 (25 22:12 -0400)]
Convert WPrefs.app/po/README from iso-8859-1 to utf-8

2 years agoConvert WindowMaker/README from iso-8859-1 to utf-8
Doug Torrance [Wed, 26 May 2021 02:10:15 +0000 (25 22:10 -0400)]
Convert WindowMaker/README from iso-8859-1 to utf-8

2 years agoConvert po/README from iso-8859-1 to utf-8
Doug Torrance [Wed, 26 May 2021 02:05:30 +0000 (25 22:05 -0400)]
Convert po/README from iso-8859-1 to utf-8

2 years agoConfigure: Rewrite the macro for checking Xft2 version
Christophe CURIS [Sat, 22 May 2021 14:39:08 +0000 (22 16:39 +0200)]
Configure: Rewrite the macro for checking Xft2 version

The original macro used over-complicated things, like:
 - useless uses of 'eval',
 - split AC_CACHE_CHECK construct (AC_MSG_CHECKING + AC_CACHE_VAL +
AC_MSG_RESULT)
 - dubious variable name (CPPFLAGS_old, which is not the "old" value but
the "saved" value for a temporary change)
 - variable CPPFLAGS was changed at wrong hierarchy level
 - calculate the integer value for XFT_VERSION in m4 instead generating
shell commands that had to do it on user side
 - indentation was missing

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoConfigure: Rewrite detection for Xft2 to properly use PKG_CONFIG macro
Christophe CURIS [Sat, 22 May 2021 14:39:07 +0000 (22 16:39 +0200)]
Configure: Rewrite detection for Xft2 to properly use PKG_CONFIG macro

The goal is to use standard macros, which make code easier to maintain
(smaller, more consistent). We still keep the legacy "xfg-config" method
because we don't want to drop support for old hardware/software.

A side effect is the change in the name of the variables for the makefile,
but this goes in favour of consistency.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Fix incorrect use of macro USE_XSHM in installed header
Christophe CURIS [Tue, 18 May 2021 16:13:19 +0000 (18 18:13 +0200)]
WRaster: Fix incorrect use of macro USE_XSHM in installed header

The header "wraster.h" needs different behaviour depending on whether the
support for X Shared Memory extension was enabled or not; but the related
macro USE_XSHM is defined by WindowMaker's configure. After this header
have been installed, the macro is no more useable.

This patch makes the "wraster.h" a generated file, so it will be different
depending on USE_XSHM, but will not make use of the macro itself.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Create french translation to have at least one
Christophe CURIS [Mon, 17 May 2021 14:32:16 +0000 (17 16:32 +0200)]
WRaster: Create french translation to have at least one

The translation check would complain because it does not find any '.po'
files, so I am providing one translation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Improve error messages to provide useful information to user
Christophe CURIS [Mon, 17 May 2021 14:32:15 +0000 (17 16:32 +0200)]
WRaster: Improve error messages to provide useful information to user

The original error messages tended to be a bit sparse, now they try to be
a little bit more helpful, and translatable in user's language.

In xutil.c:122, took opportunity fix a problem because calling 'perror'
after other function which are likely to have changed the errno is likely
to provide a wrong error string.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Made a few messages translatable
Christophe CURIS [Mon, 17 May 2021 14:32:14 +0000 (17 16:32 +0200)]
WRaster: Made a few messages translatable

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Add initialisation for locale support
Christophe CURIS [Mon, 17 May 2021 14:32:13 +0000 (17 16:32 +0200)]
WRaster: Add initialisation for locale support

Because the library does not have an initialisation function, we need to
rely on an automatic called-on-load mechanism, which is provided through
a compiler attribute 'constructor'.

However, as the project aims to still compile on old hard/software, we
include a check in 'configure' to ensure it works, and if not use the
legacy solution.

Note: Because we introduce a new DEFINE, the 'config.h.in' needs to be
regenerated, otherwise you may get a compilation error in wrlib. This is
done by re-running './autogen.sh'

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Create header for i18n helper functions
Christophe CURIS [Mon, 17 May 2021 14:32:12 +0000 (17 16:32 +0200)]
WRaster: Create header for i18n helper functions

This patch is just adding a single header, but because it also modifies
all the C files to add the #include, it was made as a patch on its own to
ease review.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Create structure to make the library translatable
Christophe CURIS [Mon, 17 May 2021 14:32:10 +0000 (17 16:32 +0200)]
WRaster: Create structure to make the library translatable

The library did not propose the mechanisms to be translated, this patch is
creating the structure in autoconf/automake and the translation directory
so its messages can be also translated.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agowmaker: Do not allocate memory for a temporary string for the Window Shortcut menu
Christophe CURIS [Sun, 16 May 2021 13:47:16 +0000 (16 15:47 +0200)]
wmaker: Do not allocate memory for a temporary string for the Window Shortcut menu

When creating the list of possible shortcut for windows to populate the
window menu, a temporary buffer was allocated to hold that string.

As this allocation participates to memory fragmentation, this patch makes
use of storage on the stack instead which is also faster.

Took opportunity to include the shortcut number (%i) in the string to be
translated, because it is unlikely that adding that number at the end of
the string is right in all languages. Updated french translation because
it is the only one I am confident with.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agowrlib: Add compiler attributes to the API functions
Christophe CURIS [Sun, 16 May 2021 13:47:15 +0000 (16 15:47 +0200)]
wrlib: Add compiler attributes to the API functions

With proper attributes, the compiler is able to do some extra checks on
user side to make code safer and/or better optimised.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agowmmenugen: Fix memory leaks when parsing menu in wmconfig format
Christophe CURIS [Sun, 16 May 2021 13:47:14 +0000 (16 15:47 +0200)]
wmmenugen: Fix memory leaks when parsing menu in wmconfig format

As reported by Coverity (CID #50181, #50182 and #50183) the strings allocated by parse_wmconfig_line were not freed after use.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agowmmenugen: Fix memory leaks in XDG menu generation when getting locale-dependant...
Christophe CURIS [Sun, 16 May 2021 13:47:13 +0000 (16 15:47 +0200)]
wmmenugen: Fix memory leaks in XDG menu generation when getting locale-dependant name

As reported by Coverity as CID #50142, #50143, #50144 and #50145, all the
strings allocated by 'parse_locale' were never freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agowmmenugen: Fix memory leak when parsing names for menus in XDG format
Christophe CURIS [Sun, 16 May 2021 13:47:12 +0000 (16 15:47 +0200)]
wmmenugen: Fix memory leak when parsing names for menus in XDG format

As reported by Coverity (CID #50146), if the function getLocalizedStringValue
returns without matching the entry, the storage for the entry's locale was
leaked.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agowmmenugen: Fix memory leak when parsing categories in an XDG menu
Christophe CURIS [Sun, 16 May 2021 13:47:11 +0000 (16 15:47 +0200)]
wmmenugen: Fix memory leak when parsing categories in an XDG menu

Reported by Coverity (CID #50147)

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Properly set file's mtime in the cache when loading an image
Christophe CURIS [Sun, 16 May 2021 13:47:10 +0000 (16 15:47 +0200)]
WRaster: Properly set file's mtime in the cache when loading an image

The library maintains a cache to not reload a file that was previously
loaded. In order to still reload an image in case its file would have
changed in the meantime, the cache saves the file's modification time.

As reported by Coverity (CID #331576) the 'stat' function was not on the
execution path the first time an image is loaded, which means the cache
information is populated with junk data. This could lead to an image not
being reloaded for example.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWRaster: Stop parsing number in PPM file if invalid syntax is found
Christophe CURIS [Sun, 16 May 2021 13:47:08 +0000 (16 15:47 +0200)]
WRaster: Stop parsing number in PPM file if invalid syntax is found

When the function 'pm_getuint' is reading a number, it prints an error
message if it encounters a non-digit number, yet it still enters the
processing loop which will cause an invalid number to be calculated.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWPrefs: Add check for invalid OPEN_MENU/EXEC in PL-Menu to avoid potential crash
Christophe CURIS [Sun, 16 May 2021 13:47:07 +0000 (16 15:47 +0200)]
WPrefs: Add check for invalid OPEN_MENU/EXEC in PL-Menu to avoid potential crash

As reported by Coverity (CID #50047, #50048), if the proplist is incorrect
and has an OPEN_MENU or (SH)EXEC command without its arguments, we did
dereference a NULL pointer.
Now we simply return the NULL value, appropriate to have the caller of the
function issue a message.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWPrefs: Provide fall-back colour in the case of colour name not found
Christophe CURIS [Sun, 16 May 2021 13:47:06 +0000 (16 15:47 +0200)]
WPrefs: Provide fall-back colour in the case of colour name not found

As reported by Coverity (CID #331571), we did not check the return value of
the call to XParseColor. If the function is given a colour name that it
does not know, we would return an uninitialised colour.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWUtil: Make sure wmalloc/wrealloc won't fail because of the abort handler
Christophe CURIS [Sun, 16 May 2021 13:47:05 +0000 (16 15:47 +0200)]
WUtil: Make sure wmalloc/wrealloc won't fail because of the abort handler

As pointed by Coverity (#50074), despite the expected behaviour that
'wmalloc' should never return NULL, it may still happen if an abort handler
set by user (with wsetabort) does not call exit() as expected. In such
case we make sure the NULL pointer dereference does not happen inside
WINGs code because we assume it is a known user choice.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWUtil: Fix non-closed file handle in WMWritePropListToFile
Christophe CURIS [Sun, 16 May 2021 13:47:04 +0000 (16 15:47 +0200)]
WUtil: Fix non-closed file handle in WMWritePropListToFile

As reported by Coverity (CID #50129), in case of error during the write
operation, the failure path does include close of the file handle. In
addition to the resource leak, this may be a problem if the application
were to make a second try on the same file.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWPrefs: Fix memory leak in Expert tab
Christophe CURIS [Fri, 14 May 2021 18:24:51 +0000 (14 20:24 +0200)]
WPrefs: Fix memory leak in Expert tab

As reported by Coverity (CID #331553), we leak the allocated string
returned by 'WMGetTextFieldText'

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWPrefs: Fix memory leak in the Menu tab
Christophe CURIS [Fri, 14 May 2021 18:17:04 +0000 (14 20:17 +0200)]
WPrefs: Fix memory leak in the Menu tab

As reported by Coverity (CID #331559), the call to 'wfindfile' replaces
the value for variable 'path' but we did not free its previous content.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoFix use-after-free error in wIconStore reported by Coverity
Christophe CURIS [Fri, 14 May 2021 17:45:56 +0000 (14 19:45 +0200)]
Fix use-after-free error in wIconStore reported by Coverity

The function always returns the filename where the icon have been saved,
but in the case where the save operation failed we would free the memory
for that file name, yet still return this pointer like if it were valid.

Took opportunity to remove redundant free(path) which is done a couple
lines later, because redundancy is a source of problem for code
maintenance.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoFix memory leak reported by Coverity
Christophe CURIS [Fri, 14 May 2021 17:36:33 +0000 (14 19:36 +0200)]
Fix memory leak reported by Coverity

As reported in CID #331577, we re-use the variable 'tmp' without freeing
the previously allocated pointer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWPrefs: fix memory leak and potential buffer overflow
Christophe CURIS [Fri, 14 May 2021 17:06:43 +0000 (14 19:06 +0200)]
WPrefs: fix memory leak and potential buffer overflow

Coverity pointed that the "text" returned by WMGetTextFieldText was never
freed (CID #331578, because WMSetTextFieldText does its own copy, it does
not take the pointer as-is).

By looking at the code, there is also a potential buffer overflow because
the buffer alloc'd for "value" is sized for the exact number of digits
before increase, but the +delta can make the number use more digits so we
may write past the end of original buffer.
We write to a stack-allocated one, so it does not cost anything and does
not participates to memory fragmentation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWINGs: Fix invalid handling of Blue in the HSV conversion in ColorPanel widget
Christophe CURIS [Fri, 14 May 2021 16:50:56 +0000 (14 18:50 +0200)]
WINGs: Fix invalid handling of Blue in the HSV conversion in ColorPanel widget

Because of a minor bug, when pure blue was chosen in RGB in the ColorPanel,
the conversion to HSV would mistreat it as white and resets its hue,
leading to possible user annoyance.

2 years agoWINGs: increase temporary buffer to silence a gcc warning
Christophe CURIS [Fri, 14 May 2021 16:10:20 +0000 (14 18:10 +0200)]
WINGs: increase temporary buffer to silence a gcc warning

The code limits the integer number to 0..359 so we need 4 bytes to store
that, but that require too complex flow processing for compilers to deduce
it.

It does not cost to increase the temporary buffer to the minimum size
requested by GCC, so let's do this, because spurious warnings can
potentially divert us from more important ones.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agowraster: Remove duplicate code
Christophe CURIS [Thu, 13 May 2021 16:47:38 +0000 (13 18:47 +0200)]
wraster: Remove duplicate code

Duplicating things makes maintenance error-prone, which is not a good idea.
In case the abort procedure would need an update, it would be easy then
to forget some place, leading to leaks, if not worse.

Beside, goto is not as bad as academics would like people to believe, when
it is used correctly (and this case is one of them).
The name for the label was given an explicit meaning to make code easy to
understand.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoFix usage of float constant reported by gcc
Christophe CURIS [Thu, 13 May 2021 15:28:02 +0000 (13 17:28 +0200)]
Fix usage of float constant reported by gcc

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoWINGs: Fix incorrect use of macro USE_PANGO in installed header
Christophe CURIS [Thu, 13 May 2021 15:20:24 +0000 (13 17:20 +0200)]
WINGs: Fix incorrect use of macro USE_PANGO in installed header

The header "WINGsP.h" needs different behaviour depending on whether the
support for Pango was enabled or not. But the related macro USE_PANGO is
defined by WindowMaker's configure, and after this header have been
installed the macro is no more valid.

This patch makes the "WINGsP.h" a generated file, so it will be different
depending on USE_PANGO, but will not make use of the macro itself.

As a side effect of being now generated, the include paths in the makefile
have been updated to include build-dir too, because for users doing an
out-of-tree build the generated file (that is used during compilation) is
placed in the build-dir.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2 years agoMake dock dots scalable
Xander [Fri, 7 May 2021 15:20:55 +0000 (7 15:20 +0000)]
Make dock dots scalable

This patch makes the three dots in the dock change their size when bigger icon size is used.
The logic here is such that the dots are scaled only when a certain icon size is reached;
for instance, the dots will remain unchanged if icon size is less than 128x128 px, and will
be twice as big if it's set to a value from 128x128 to 184x184 px. The get_dot_mult() func
calculates and returns the scale multiplier. In the draw_dot() func, XDrawLine() and
XDrawPoint() were replaced with XFillRectangle() because those funcs do not allow their
result to be scalable. This patch does not require additional icon size values (those bigger
than 96x96 px) to exist, but makes no use without them.