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

3192 Commits

Author SHA1 Message Date
Christophe CURIS
64a95b73c3 configure: Created new macro to perform the repetitive part of Library check
There are a number of steps in the library check procedure that are a bit
repetitive, and have been placed into the macro WM_LIB_CHECK to make the
code simpler to write.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
da597a4b87 configure: Created new macro to append only once a flag to a variable
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
fbe202f49b configure: made the functions to try lib link+compile more generic
The function can have a wider use, so moved then to a more neutral place
and gave them more generic names.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
6184c955e7 Code refactoring: replaced macro 'SHAPE' by 'USE_XSHAPE' for consistency
The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
0d66173e1f WPrefs: Add case check to fix -Wmaybe-uninitialized warning
The default case should not arise because the tested variable is an enum,
but it the case someone would get a value wrong, we're safer with a little
warning and proper fallback than with unknown behaviour.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
54f9e2e9cc wmaker: Do not create a temporary variable for Xrandr support detection
The other extension detection have the same situation and they already
have a variable for that, do not do differently for Xrandr because it adds
unnecessary complexity in the code.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
f7931ecd02 WRaster: Removed unused variables from Makefile
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
cd501741a1 WINGs: Removed unnecessary type conversion
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
e946ef3ae5 configure: Added m4 check to detect possible non-expanded macros
When autoconf encounters a macro name that it does not know, it assumes
that it is just a standard keyword that needs to end up in the generated
configure script.

This patch teaches m4 about the syntax used for our macros so it can now
that it is supposed to be a macro, and then it can stop and report the
problem.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
a3ee595115 configure: Removed macro that are not used anymore
...and took opportunity to add the traditional copyright notice

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
32342a6428 configure: Replaced deprecated construct with recommended new check
The macro 'AC_ISC_POSIX' is now said to be deprecated, so we use the new
recommended check instead as we make light use of the corresponding
function.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
10bc05170c configure: Enable compiler warnings for trampoline code generation
This attribute reports cases where GCC has to generate special code to
handle some C constructs, for which we'd prefer an explicit code instead
of counting on GCC doing the work.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
12b6120f05 configure: Removed deprecated lines for unused X stuff 2013-12-30 18:11:05 +00:00
Christophe CURIS
330fc85e56 Remove some unnecessary code related to XShape usage
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
bf64058020 WINGs: Do not create variables for trivial things
In the present case, it just led to a compiler warning on unused variable
when the XShape extension is disabled, but in general case it just adds
complexity by duplicating things; this should be reserved for complex
cases.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
f76ed31fa3 wmaker: Do not call XShape function if the server did not say it supports it
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
787036551f wrlib: Added noreturn attribute to appropriate functions
clang is a bit more strict on the attribute usage, so let's comply.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
04f50a0833 WPrefs: Added noreturn attribute to appropriate functions
clang is a bit more strict on the attribute usage, so let's comply.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
f8b6871371 util: Added noreturn attribute to appropriate functions
clang is a bit more strict on the attribute usage, so let's comply.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
7491f5479b util: Removed unused procedure that caused a compilation warning
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
4976d48b6f WINGs: Added attribute 'noreturn' to public function 'WMScreenMainLoop'
As suggested by GCC, this function is a good candidate. There is a little
constraint on how to do it however, as it is part of the public API so we
have to do it in a portable fashion (We can't rely on our "config.h" when
the file will have been installed).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
9e90cebc01 configure: Enable compiler warnings to help add 'noreturn' attribute
This attributes helps the compiler to produce better binary code.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
fc825382d6 configure: Enable compiler warnings to help add 'format' attribute
This attribute helps the compiler checking the type matching between
arguments and the specification in a printf-like format string, to
avoid invalid output. This attribute is optional, but some compilers
can suggest functions that could have it.

This patch adds the appropriate compiler flags if they are supported when
the source is being compiled with DEBUG enabled.

The patch also introduces a new macro WM_CFLAGS_CHECK_FIRST because in some
cases AX_CFLAGS_GCC_OPTION is not really efficient and in present case it
does not fits the job.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Iain Patterson
68a902aa2e Fix arrow keys in switchpanel.
A previous commit broke the behaviour of the left and right arrow keys
in the switchpanel.  Releasing either of the keys would correctly select
a new window but the panel would then close.  The original, and desired,
behaviour is for the panel to remain open after selecting a new window
with the arrow keys.

Reported by Yury Tarasievich.
2013-12-30 18:11:04 +00:00
Amadeusz Sławiński
9c8398c0dc Fix implicit declaration
usermenu.c:257:12: warning: implicit declaration of function ‘GetShortcutString’ [-Wimplicit-function-declaration]

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2013-12-30 18:11:04 +00:00
Amadeusz Sławiński
cf719c2979 take dock into account when not covering icons next to it
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2013-12-30 18:11:04 +00:00
Amadeusz Sławiński
09b28b92f1 make adjustments for dock when calculating area for miniwindows
Fixes bug report:
The 0.80.2 and older versions allowed the miniwindows to lay down in
parallel with wmdock (if one wanted it that way) but newer Windowmaker
versions could only partially simulate such behavior and that includes
to either setting an option NoWindowOverDock to yes or to manually set
the dock to "Keep on Top".

Reported-by: Josip Deanovic <djosip+news@linuxpages.net>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2013-12-30 18:11:04 +00:00
Amadeusz Sławiński
952319ae60 move maximization size adjustments to maximization function
now wGetUsableAreaForHead returns better result

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2013-12-30 18:11:04 +00:00
Christophe CURIS
bd4abc5304 wmaker: Do not allocate memory for a short lived string in 'selectSpecification'
It is not only not very efficient, but in present case it also participates
in memory fragmentation.

This patch replaces this with a stack allocated buffer with a buffer which
is way too large.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
8d7db5d744 WPrefs: Make the label internationalised for the texture option in dialog window
As this label is being displayed in the window, it is a good idea to make
it translatable to the user's locale.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
d2faac6333 WPrefs: Changed array of strings 'textureOptions' into a struct for explicitness
The parameters for the textures were stored all together in an array
which made its usage error prone; now there a struct to clearly identify
which string is what, so it is clear in the source what's being done.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
aa24e862c4 WPrefs: Changed array of strings 'colorOptions' into a struct for explicitness
The parameters for the theme colors were stored all together in an array
which made its usage error prone; now there a struct to clearly identify
which string is what, so it the source is clearer on what's being done.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
db9e002ecf wmaker: Created an array to hold the maximize menu entries
The idea is that an array is easier to work with, when it's about to add,
remove or change entries, because all data end up stored in one place
instead of dispatched around the code.

It also makes code smaller as it avoids repetitions.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
1f17fb940c wmaker: Avoid multiple calls to gettext
The original code called gettext twice every time, the new code calls it
only once.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
667bb9191b wmaker: Minor improvements to function 'shade_animate' when empty on purpose
When animations are disabled, we still create the function but we make it
empty to keep the rest of the code simple. This patch does:
 - mark the function inline, to increase the probability that the compiler
will not generate the function at all;
 - mark arguments as unused to avoid some compilation warnings.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
62565b42f6 WINGs: Do not allocate memory for a fixed-size short-lived buffer
Allocating memory with 'malloc' has a cost and participate to memory
fragmentation, so for a temporary buffer that has a fixed size let's
prefer allocating it on the stack.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
d25631016e WINGs: Minor improvments in 'closestListItem' function
The check on length of string before comparing is not necessary
because this will be checked as part of strcmp; the check won't
save time and may actually cost.

As the number of element in the array is not going to change during
the loop, took the call to 'WMGetArrayItemCount' outside the loop
to be faster (and ease compiler's optimisation work).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
10953b3a7e configure: Add check on function prototypes when debug is enabled
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:04 +00:00
Christophe CURIS
324248ecde configure: Minor changes to option parsing for consistency
The idea is to:
 - have a consistent looking file by using autoconf macros
 - provide better feedback on improper option usage

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
f9c1265604 configure: Added a check to try to enable STD C11 if possible
Some compiler support C11 standard by default, some need an explicit
option, and some don't support at all; this new macro only tries to enable
support if possible, the actual feature support being done by other checks
on case-by-case

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
349bc2dda2 configure: Do not keep assertion if debug was not enabled
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
4cf72c990d configure: Less intrusive CFLAGS change when --enable-debug is chosen
The previous code made a dumb change to CFLAGS which would cause user
supplied CFLAGS to be ignored, and possible compiler compatibility issues.

The new code does the same changes in a smoother way, so we do not totally
drop user specified or script detected compiler options.

When debug is enabled, we also include a reminder for the final CFLAGS
value.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
59f5aeeec5 util: Use the macro 'wlengthof' to get the number of element in an array
The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
01c7390be1 WPrefs: Use the macro 'wlengthof' to get the number of element in an array
The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
be022d9623 wmaker: Use the macro 'wlengthof' to get the number of element in an array
The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
a3b6b62049 WINGs: Use the macro 'wlengthof' to get the number of element in an array
The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
fd47650717 WUtil: New macro 'wlengthof' in the public API to get number of elements in an array
The new macro 'wlengthof' returns the number of elements for which a local
array have been defined, which makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

The macro includes a static assertion to stop compilation if it is being
used on a pointer, for which we cannot know the size of the array, to
avoid generating dummy result. This can work only with C11 which
standardised the static assertions.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
c3a132215d wrlib: Renamed image format related files for clarity
This patch makes all files appear together when listing files and
it is more clear about their function.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
f619546af9 wrlib: Marked args as unused for compiler
The two functions require an argument which is used when the libXpm is
used, which means having the same argument list for the builtin code to be
permutable.

This patch adds the appropriate stuff to avoid a false report from the
compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
3b2362662e wrlib: Use a Conditional for XPM in the makefile instead of #if in source
Now that the builtin XPM loading is separated from the saving code, the
use of the conditionals provided by autotools provides a better result
as it avoids unnecessary compilation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00