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

3887 Commits

Author SHA1 Message Date
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
Torrance, Douglas
75f133285f 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.
2021-06-29 22:32:31 +01:00
Torrance, Douglas
a6ec6a30a3 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.
2021-06-29 22:32:31 +01:00
Christophe CURIS
6afa419b01 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>
2021-06-20 22:28:19 +01:00
Christophe CURIS
a2bf67f54c 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>
2021-06-20 22:28:19 +01:00
Christophe CURIS
351e05dca9 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>
2021-06-05 23:54:15 +01:00
Christophe CURIS
ae78e88eef 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>
2021-05-29 23:55:10 +01:00
Christophe CURIS
f049635fa5 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>
2021-05-29 20:15:09 +01:00
Doug Torrance
4221e30bd2 Convert WPrefs.app/po/README from iso-8859-1 to utf-8 2021-05-25 22:12:23 -04:00
Doug Torrance
71558f4ce3 Convert WindowMaker/README from iso-8859-1 to utf-8 2021-05-25 22:10:15 -04:00
Doug Torrance
4b61081353 Convert po/README from iso-8859-1 to utf-8 2021-05-25 22:05:30 -04:00
Christophe CURIS
4138c57631 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>
2021-05-22 20:00:41 +01:00
Christophe CURIS
0bbb122b94 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>
2021-05-22 20:00:41 +01:00
Christophe CURIS
0e274dc979 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>
2021-05-18 17:50:43 +01:00
Christophe CURIS
4dfb0dd059 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>
2021-05-18 17:49:17 +01:00
Christophe CURIS
bcb53700d6 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>
2021-05-18 17:49:17 +01:00
Christophe CURIS
e5f7ef23a6 WRaster: Made a few messages translatable
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
70f89fd9c5 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>
2021-05-18 17:49:17 +01:00
Christophe CURIS
19202fd2db 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>
2021-05-18 17:49:17 +01:00
Christophe CURIS
aadd694a6b 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>
2021-05-18 17:49:17 +01:00
Christophe CURIS
fbec3a728f 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>
2021-05-18 17:49:17 +01:00
Christophe CURIS
944bb49997 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>
2021-05-18 17:49:17 +01:00
Christophe CURIS
0ac6827a9b 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>
2021-05-18 17:49:17 +01:00