This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.
The branch, next has been updated
via 2f0ab97c5795b0912a6a576423c68af4332d0cff (commit)
via d1a4982d64fabf99e70ed1e184506d446168d550 (commit)
via 218ac7adec8b20edbb4582120f26f68bc22586e9 (commit)
via b2e193d36c222dbcfa5b0ccfa3fb5cbc436a06fa (commit)
via 22bbf99201a8c17eb0d36c3914a267382d0ba659 (commit)
via b61141322db2aba56dcf18b748dd45f7dec9dab0 (commit)
via b34a2dd7a0f4f2fe8e402829bf23626c3214fff7 (commit)
via 788383e79ed5972aba62b06ac959b1d506777b34 (commit)
via 8afe58d8ec3f76713ebde080e7b5c3e76258e7c1 (commit)
via 061c7636423a823ab8fa3d210a3c25431db7633b (commit)
via b0a2c9638f33d3b5a55f0a9b50b4987deb60ffef (commit)
via 790d967d3f762b72274fb552d579e294eca08511 (commit)
via c2aff8c51bdc19950a947d6e9a508c5bea302078 (commit)
via 09db9a4f12a451f211f94e9b45dde097f35ff953 (commit)
via 939b72393d81a3248fc6a05aecc3280a7564d7c4 (commit)
via 2dc9d4f4a9d4e35f31dc73e73a1807503a5f9961 (commit)
via 0bbfa2e01ef5eb599b90283c289a634965e3106d (commit)
via 15983dfafe0707d509b5b8bc5b774e51d8d8328f (commit)
via b4544617e3dd5dbda1f96ba06b815ffb652369c2 (commit)
via 703502480b9aaaf4a5599f0d6dd68ee27c310043 (commit)
via 20b76fc3b62a2bc50e9bf73d85fa25711507a3dd (commit)
via 9f4d568eb06753cc7197dbf73422267194af9805 (commit)
via 5eefe41b0a18ac32f1e734330cf2a2d899bf47fc (commit)
from 1e6740b34467cf9de4f7fb41b939bc3f0316e229 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/2f0ab97c5795b0912a6a576423c68af4332d0cff
commit 2f0ab97c5795b0912a6a576423c68af4332d0cff
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:44 2014 +0100
util: remove local constants GLOBAL_DEFAULTS_SUBDIR that are not used
As pointed by gcc, this macro is not used anywhere in the 2 files. Because
the code also suggests that they should be inherited from any other place
anyway, remove them from the file to prevent them from being used in the
future.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/util/getstyle.c b/util/getstyle.c
index da211acb..f0de4c49 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -54,9 +54,6 @@
#include "../src/wconfig.h"
-#ifndef GLOBAL_DEFAULTS_SUBDIR
-#define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
-#endif
/* table of style related options */
static char *options[] = {
diff --git a/util/wmsetbg.c b/util/wmsetbg.c
index aee1b567..7253517e 100644
--- a/util/wmsetbg.c
+++ b/util/wmsetbg.c
@@ -53,9 +53,6 @@
#include "../src/wconfig.h"
-#ifndef GLOBAL_DEFAULTS_SUBDIR
-#define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
-#endif
#include <WINGs/WINGs.h>
#include <wraster.h>
http://repo.or.cz/w/wmaker-crm.git/commit/d1a4982d64fabf99e70ed1e184506d446168d550
commit d1a4982d64fabf99e70ed1e184506d446168d550
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:43 2014 +0100
WPrefs: remove unused constants ICON_TITLE_*FONT
Apparently, there was a time when it was though to add a label below (?)
the icons of the list of panels, but this has never been finished and the
unfinished code to do this was even removed in commit
0e01e6920572b3d3a7a8df2872513144225440a8
So, as it is unlikely that the "feature" will return, and if it did the
font should be handled in a better way, this patch removes the definition
of the constants with the names for the font used for those labels.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WPrefs.app/WPrefs.c b/WPrefs.app/WPrefs.c
index c3274ee3..02b06d0e 100644
--- a/WPrefs.app/WPrefs.c
+++ b/WPrefs.app/WPrefs.c
@@ -29,9 +29,6 @@
#endif
-#define ICON_TITLE_FONT "sans serif:pixelsize=9"
-#define ICON_TITLE_VFONT "sans serif:pixelsize=9:weight=100"
-
#define MAX_SECTIONS 16
typedef struct _WPrefs {
http://repo.or.cz/w/wmaker-crm.git/commit/218ac7adec8b20edbb4582120f26f68bc22586e9
commit 218ac7adec8b20edbb4582120f26f68bc22586e9
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:42 2014 +0100
wmaker: comment out definition of wm-spec constant that we do not use
Include a comment to explain what their aim is, and why WindowMaker is not
making use of them. They are not simply removed because it is informative
for future contributors that we know about them and we purposedly decided
to not use them.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/src/wmspec.c b/src/wmspec.c
index d6bb61c6..89d8fac6 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -217,6 +217,22 @@ static atomitem_t atomNames[] = {
#define _NET_WM_STATE_ADD 1
#define _NET_WM_STATE_TOGGLE 2
+#if 0
+/*
+ * These constant provide information on the kind of window move/resize when
+ * it is initiated by the application instead of by WindowMaker. They are
+ * parameter for the client message _NET_WM_MOVERESIZE, as defined by the
+ * FreeDesktop wm-spec standard:
+ * http://standards.freedesktop.org/wm-spec/1.5/ar01s04.html
+ *
+ * Today, WindowMaker does not support this at all (the corresponding Atom
+ * is not added to the list in setSupportedHints), probably because there is
+ * nothing it needs to do about it, the application is assumed to know what
+ * it is doing, and WindowMaker won't get in the way.
+ *
+ * The definition of the constants (taken from the standard) are disabled to
+ * avoid a spurious warning (-Wunused-macros).
+ */
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
#define _NET_WM_MOVERESIZE_SIZE_TOP 1
#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
@@ -228,6 +244,7 @@ static atomitem_t atomNames[] = {
#define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */
#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */
+#endif
static void observer(void *self, WMNotification *notif);
static void wsobserver(void *self, WMNotification *notif);
http://repo.or.cz/w/wmaker-crm.git/commit/b2e193d36c222dbcfa5b0ccfa3fb5cbc436a06fa
commit b2e193d36c222dbcfa5b0ccfa3fb5cbc436a06fa
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:41 2014 +0100
wmaker: remove parameter 'which' from local function 'restoreMenu'
This parameter is given always the same value, so there is not reason to
keep it. The code is updated to take this value into account, and the
related constants are removed.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/src/menu.c b/src/menu.c
index e573b395..8322dbb1 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -56,10 +56,6 @@
/***** Local Stuff ******/
-#define WSS_ROOTMENU (1<<0)
-#define WSS_SWITCHMENU (1<<1)
-#define WSS_WSMENU (1<<2)
-
static struct {
int steps;
int delay;
@@ -2382,7 +2378,7 @@ static Bool getMenuInfo(WMPropList * info, int *x, int
*y, Bool * lowered)
return True;
}
-static int restoreMenu(WScreen * scr, WMPropList * menu, int which)
+static int restoreMenu(WScreen *scr, WMPropList *menu)
{
int x, y;
Bool lowered = False;
@@ -2394,10 +2390,8 @@ static int restoreMenu(WScreen * scr, WMPropList * menu,
int which)
if (!getMenuInfo(menu, &x, &y, &lowered))
return False;
- if (which & WSS_SWITCHMENU) {
- OpenSwitchMenu(scr, x, y, False);
- pmenu = scr->switch_menu;
- }
+ OpenSwitchMenu(scr, x, y, False);
+ pmenu = scr->switch_menu;
if (pmenu) {
int width = MENUW(pmenu);
@@ -2508,7 +2502,7 @@ void wMenuRestoreState(WScreen * scr)
skey = WMCreatePLString("SwitchMenu");
menu = WMGetFromPLDictionary(menus, skey);
WMReleasePropList(skey);
- restoreMenu(scr, menu, WSS_SWITCHMENU);
+ restoreMenu(scr, menu);
if (!scr->root_menu) {
OpenRootMenu(scr, scr->scr_width * 2, 0, False);
http://repo.or.cz/w/wmaker-crm.git/commit/22bbf99201a8c17eb0d36c3914a267382d0ba659
commit 22bbf99201a8c17eb0d36c3914a267382d0ba659
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:40 2014 +0100
wmaker: remove constants HORIZONTAL and VERTICAL from moveres.c
These 2 constants have been defined at the beginning of the project, but
where never used later. As the use of the associated constants suggests
that they are not bringing anything useful, this patch simply removes them.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/src/moveres.c b/src/moveres.c
index 8640511c..b271f324 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -50,10 +50,8 @@
#define LEFT 1
#define RIGHT 2
-#define HORIZONTAL (LEFT|RIGHT)
#define UP 4
#define DOWN 8
-#define VERTICAL (UP|DOWN)
/* True if window currently has a border. This also includes borderless
* windows which are currently selected
@@ -2268,10 +2266,8 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
#undef LEFT
#undef RIGHT
-#undef HORIZONTAL
#undef UP
#undef DOWN
-#undef VERTICAL
#undef HCONSTRAIN
#undef RESIZEBAR
http://repo.or.cz/w/wmaker-crm.git/commit/b61141322db2aba56dcf18b748dd45f7dec9dab0
commit b61141322db2aba56dcf18b748dd45f7dec9dab0
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:39 2014 +0100
wmaker: add code to explicitly ignore Motif-WM flags we don't want to handle
The goal is to explain the reason why we don't do anything about them, so
people looking at the code in the future will know why it is this way. The
expected side effect is also to silent warnings [-Wunused-macros] from gcc.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/src/motif.c b/src/motif.c
index 5fca916b..f0694626 100644
--- a/src/motif.c
+++ b/src/motif.c
@@ -92,6 +92,14 @@ static void setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
WSETUFLAG(wwin, no_resizable, 0);
}
+ if (mwm_hints->decorations & MWM_DECOR_BORDER) {
+ /*
+ * WindowMaker does not draw extra border around the
window
+ * like many other X window managers, so we don't need
to
+ * hide anything for this flag
+ */
+ }
+
if (mwm_hints->decorations & MWM_DECOR_RESIZEH)
WSETUFLAG(wwin, no_resizebar, 0);
@@ -101,10 +109,26 @@ static void setupMWMHints(WWindow *wwin, MWMHints
*mwm_hints)
WSETUFLAG(wwin, no_closable, 0);
}
+ if (mwm_hints->decorations * MWM_DECOR_MENU) {
+ /*
+ * WindowMaker does not include a button to display the
menu
+ * for windows, this is done using right button on the
title.
+ * As a consequence, we ignore this flag because we have
+ * nothing to hide.
+ */
+ }
+
if (mwm_hints->decorations & MWM_DECOR_MINIMIZE) {
WSETUFLAG(wwin, no_miniaturize_button, 0);
WSETUFLAG(wwin, no_miniaturizable, 0);
}
+
+ if (mwm_hints->decorations & MWM_DECOR_MAXIMIZE) {
+ /*
+ * WindowMaker does not display a button to maximize
windows,
+ * so we don't need to hide anything more for that flag
+ */
+ }
}
if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) {
@@ -120,6 +144,13 @@ static void setupMWMHints(WWindow *wwin, MWMHints
*mwm_hints)
if (mwm_hints->functions & MWM_FUNC_RESIZE)
WSETUFLAG(wwin, no_resizable, 0);
+ if (mwm_hints->functions & MWM_FUNC_MOVE) {
+ /*
+ * WindowMaker does not allow a window to not be moved,
and this
+ * is a good thing, so we explicitly ignore this flag.
+ */
+ }
+
if (mwm_hints->functions & MWM_FUNC_MINIMIZE)
WSETUFLAG(wwin, no_miniaturizable, 0);
http://repo.or.cz/w/wmaker-crm.git/commit/b34a2dd7a0f4f2fe8e402829bf23626c3214fff7
commit b34a2dd7a0f4f2fe8e402829bf23626c3214fff7
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:38 2014 +0100
wmaker: removed unused constant SCROLL_STEPS in the switchpanel code
As pointed by gcc, this constant is not used anywhere in the code. It seems
to have been prepared for a scroll animation when the switchpanel would be
too big to fit the screen, but the code looks like to never have been
activated, and was cleaned away in commit
6d08aa22d824d6abe5edb4c4892bbf9eaec3175b
If the feature were to be re-added, it would be better to use something
proportional to the menu scroll speed parameter that can be configured by
user anyway.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/src/switchpanel.c b/src/switchpanel.c
index f048ac52..b3832f16 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -68,7 +68,6 @@ struct SwitchPanel {
#define ICON_TILE_SIZE 64
#define LABEL_HEIGHT 25
#define SCREEN_BORDER_SPACING 2*20
-#define SCROLL_STEPS (ICON_TILE_SIZE/2)
#define ICON_SELECTED (1<<1)
#define ICON_DIM (1<<2)
http://repo.or.cz/w/wmaker-crm.git/commit/788383e79ed5972aba62b06ac959b1d506777b34
commit 788383e79ed5972aba62b06ac959b1d506777b34
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:37 2014 +0100
wmaker: removed unused macro DBLCLICK_TIME
As pointed by gcc, this macro is not used anywhere, that is probably
because the code have been relying on the function "IsDoubleClick" for a
very long time now.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/src/framewin.c b/src/framewin.c
index d045f63a..4233360d 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -43,8 +43,6 @@
#include "misc.h"
#include "event.h"
-#define DBLCLICK_TIME wPreferences.dblclick_time
-
static void handleExpose(WObjDescriptor * desc, XEvent * event);
static void handleButtonExpose(WObjDescriptor * desc, XEvent * event);
http://repo.or.cz/w/wmaker-crm.git/commit/8afe58d8ec3f76713ebde080e7b5c3e76258e7c1
commit 8afe58d8ec3f76713ebde080e7b5c3e76258e7c1
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:36 2014 +0100
replaced all local definitions of PI by a single one
For code maintainability, it is better to have a single definition of the
constant than many ones dispatched in many places. In addition, we try to
count on the constant M_PI that can be defined by the header <math.h> if
possible because it may have the best accuracy for the platform.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wcolorpanel.c b/WINGs/wcolorpanel.c
index 12d54480..f23c91d2 100644
--- a/WINGs/wcolorpanel.c
+++ b/WINGs/wcolorpanel.c
@@ -265,9 +265,6 @@ enum {
#define COLORWHEEL_PART 1
#define CUSTOMPALETTE_PART 2
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
static char *generateNewFilename(const char *curName);
static void convertCPColor(CPColor * color);
@@ -1951,7 +1948,7 @@ static void wheelInitMatrix(W_ColorPanel * panel)
if (sat < 256) {
if (xcor != 0)
dhue[0] = rint(atan((double)ycor /
(double)xcor) *
- (180.0 / M_PI)) + (xcor
< 0 ? 180.0 : 0.0);
+ (180.0 / WM_PI)) + (xcor
< 0 ? 180.0 : 0.0);
else
dhue[0] = 270;
@@ -2237,7 +2234,7 @@ static void wheelPositionSelectionOutBounds(W_ColorPanel
* panel, int x, int y)
panel->color.hsv.value = 255 -
WMGetSliderValue(panel->wheelBrightnessS);
if (xcor != 0)
- hue = rint(atan(-(double)ycor / (double)xcor) * (180.0 / M_PI));
+ hue = rint(atan(-(double)ycor / (double)xcor) * (180.0 /
WM_PI));
else {
if (ycor < 0)
hue = 90;
@@ -2257,9 +2254,9 @@ static void wheelPositionSelectionOutBounds(W_ColorPanel
* panel, int x, int y)
wheelUndrawSelection(panel);
- panel->colx = 2 + rint((colorWheelSize * (1.0 +
cos(panel->color.hsv.hue * (M_PI / 180.0)))) / 2.0);
+ panel->colx = 2 + rint((colorWheelSize * (1.0 +
cos(panel->color.hsv.hue * (WM_PI / 180.0)))) / 2.0);
/* "+2" because of "colorWheelSize + 4" */
- panel->coly = 2 + rint((colorWheelSize * (1.0 +
sin(-panel->color.hsv.hue * (M_PI / 180.0)))) / 2.0);
+ panel->coly = 2 + rint((colorWheelSize * (1.0 +
sin(-panel->color.hsv.hue * (WM_PI / 180.0)))) / 2.0);
wheelUpdateSelection(panel);
cpColor = panel->color;
@@ -3357,10 +3354,10 @@ static void wheelInit(W_ColorPanel * panel)
panel->colx = 2 + rint((colorWheelSize / 2.0) *
(1 + (panel->color.hsv.saturation / 255.0) *
- cos(panel->color.hsv.hue * M_PI / 180.0)));
+ cos(panel->color.hsv.hue * WM_PI / 180.0)));
panel->coly = 2 + rint((colorWheelSize / 2.0) *
(1 + (panel->color.hsv.saturation / 255.0) *
- sin(-panel->color.hsv.hue * M_PI / 180.0)));
+ sin(-panel->color.hsv.hue * WM_PI / 180.0)));
wheelCalculateValues(panel, panel->color.hsv.value);
diff --git a/m4/wm_libmath.m4 b/m4/wm_libmath.m4
index 8d056a2e..d21493f7 100644
--- a/m4/wm_libmath.m4
+++ b/m4/wm_libmath.m4
@@ -30,5 +30,24 @@ AC_CHECK_FUNC(atan,
[LIBM=-lm],
[AC_MSG_WARN(Could not find Math library, you may experience problems)
LIBM=] )] ) dnl
+AC_CACHE_CHECK([if M_PI is defined in math.h], [wm_cv_libm_pi],
+ [wm_cv_libm_pi="no"
+ wm_save_CFLAGS="$CFLAGS"
+ for wm_arg in dnl
+ "% yes" dnl natively available (Unix98 compliant?)
+ "-D_XOPEN_SOURCE=500" ; dnl Explicit request
+ do
+ AS_IF([wm_fn_lib_try_compile "math.h" "double val;" "val = M_PI" dnl
+ "`echo "$wm_arg" | sed -e 's, *%.*$,,' `"],
+ [wm_cv_libm_pi="`echo "$wm_arg" | sed -e 's,^.*% *,,' `" ; break])
+ done
+ CFLAGS="$wm_save_CFLAGS"])
+AS_IF([test "x$wm_cv_libm_pi" = "xno"],
+ [AC_DEFINE([WM_PI], [(3.14159265358979323846)],
+ [Defines how to access the value of Pi])],
+ [AC_DEFINE([WM_PI], [(M_PI)],
+ [Defines how to access the value of Pi])
+ AS_IF([test "x$wm_cv_libm_pi" != "xyes"],
+ [CFLAGS="$CFLAGS $wm_cv_libm_pi"]) ])
AC_SUBST(LIBM) dnl
])
diff --git a/src/wconfig.h.in b/src/wconfig.h.in
index c1548ee6..2930bcb0 100644
--- a/src/wconfig.h.in
+++ b/src/wconfig.h.in
@@ -334,7 +334,6 @@
/* number of window shortcuts */
#define MAX_WINDOW_SHORTCUTS 10
-#define WM_PI 3.14159265358979323846
#define MIN_TITLEFONT_HEIGHT(h) ((h)>14 ? (h) : 14)
#define TITLEBAR_HEIGHT 18 /* window's titlebar height */
#define RESIZEBAR_HEIGHT 8 /* height of the resizebar */
diff --git a/wrlib/rotate.c b/wrlib/rotate.c
index 84b34b7a..482b3174 100644
--- a/wrlib/rotate.c
+++ b/wrlib/rotate.c
@@ -33,9 +33,6 @@
#include <math.h>
-#ifndef PI
-#define PI 3.14159265358979323846
-#endif
static RImage *rotate_image_90(RImage *source);
static RImage *rotate_image_270(RImage *source);
@@ -347,13 +344,13 @@ static RImage *rotate_image_any(RImage *source, float
angle)
if (angle > 180.0)
angle -= 180.0;
- angle = (angle * PI) / 180.0;
+ angle = (angle * WM_PI) / 180.0;
nwidth = ceil(abs(cos(angle) * image->width))
- + ceil(abs(cos(PI / 2 - angle) * image->width));
+ + ceil(abs(cos(WM_PI / 2 - angle) * image->width));
nheight = ceil(abs(sin(angle) * image->height))
- + ceil(abs(cos(PI / 2 - angle) * image->height));
+ + ceil(abs(cos(WM_PI / 2 - angle) * image->height));
img = RCreateImage(nwidth, nheight, True);
if (!img)
@@ -362,16 +359,16 @@ static RImage *rotate_image_any(RImage *source, float
angle)
src = image->data;
dst = img->data;
- x1 = floor(abs(cos(PI / 2 - angle) * image->width));
+ x1 = floor(abs(cos(WM_PI / 2 - angle) * image->width));
y1 = 0;
x2 = 0;
- y2 = floor(abs(sin(PI / 2 - angle) * image->width));
+ y2 = floor(abs(sin(WM_PI / 2 - angle) * image->width));
xx = floor(abs(cos(angle) * image->height)) - 1;
yy = nheight - 1;
- printf("%ix%i, %i %i %i %i %in", nwidth, nheight, x1, y1, x2, y2,
(int)((angle * 180.0) / PI));
+ printf("%ix%i, %i %i %i %i %in", nwidth, nheight, x1, y1, x2, y2,
(int)((angle * 180.0) / WM_PI));
dx = abs(x2 - x1);
dy = abs(y2 - y1);
@@ -414,8 +411,8 @@ static RImage *rotate_image_any(RImage *source, float angle)
p = dpr - dy;
while (dy-- >= 0) {
- xx = abs(x1 * sin(angle * PI / 180.0));
- yy = abs(y1 * cos(angle * PI / 180.0));
+ xx = abs(x1 * sin(angle * WM_PI / 180.0));
+ yy = abs(y1 * cos(angle * WM_PI / 180.0));
copyLine(x1, y1, xx, yy, nwidth, image->format, dst,
&src);
diff --git a/wrlib/scale.c b/wrlib/scale.c
index eafe40f9..0f5952c8 100644
--- a/wrlib/scale.c
+++ b/wrlib/scale.c
@@ -27,11 +27,6 @@
#include <string.h>
#include <X11/Xlib.h>
#include <math.h>
-
-#ifndef PI
-#define PI 3.14159265358979323846
-#endif
-
#include <assert.h>
#include "wraster.h"
@@ -200,7 +195,7 @@ static double sinc(double x)
* The goal was to avoid a Divide-by-0 error, now we also
* avoid a +/-inf result too
*/
- x *= PI;
+ x *= WM_PI;
if (x > 1.0E-9)
return (sin(x) / x);
return (1.0);
http://repo.or.cz/w/wmaker-crm.git/commit/061c7636423a823ab8fa3d210a3c25431db7633b
commit 061c7636423a823ab8fa3d210a3c25431db7633b
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:35 2014 +0100
remove unused macros defining corner positions
As pointed by gcc, the 4 constant the define the corner positions are not
used anywhere in the code, and it looks like it has always been like this.
As it is a cost for maintainability, get rid of them.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wballoon.c b/WINGs/wballoon.c
index 78fac113..c87b6c9e 100644
--- a/WINGs/wballoon.c
+++ b/WINGs/wballoon.c
@@ -229,11 +229,6 @@ void W_BalloonHandleEnterView(WMView * view)
#define LEFT 0
#define RIGHT 2
-#define TLEFT (TOP|LEFT)
-#define TRIGHT (TOP|RIGHT)
-#define BLEFT (BOTTOM|LEFT)
-#define BRIGHT (BOTTOM|RIGHT)
-
#define SPACE 12
static void drawBalloon(WMScreen * scr, Pixmap bitmap, Pixmap pix, int x, int
y, int w, int h, int side)
diff --git a/src/balloon.c b/src/balloon.c
index c989803e..25998e1f 100644
--- a/src/balloon.c
+++ b/src/balloon.c
@@ -72,11 +72,6 @@ typedef struct _WBalloon {
#define LEFT 0
#define RIGHT 2
-#define TLEFT (TOP|LEFT)
-#define TRIGHT (TOP|RIGHT)
-#define BLEFT (BOTTOM|LEFT)
-#define BRIGHT (BOTTOM|RIGHT)
-
static int countLines(const char *text)
{
const char *p = text;
http://repo.or.cz/w/wmaker-crm.git/commit/b0a2c9638f33d3b5a55f0a9b50b4987deb60ffef
commit b0a2c9638f33d3b5a55f0a9b50b4987deb60ffef
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:34 2014 +0100
remove a few unused constant for size of buffers
As pointed by gcc, a few constants which contain sizes for buffers are not
used anywhere in the code. This is probably due to code cleanup, where
these buffers have been removed or where size is automatically calculated
by using 'sizeof' instead to reduce risk of bugs.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wcolorpanel.c b/WINGs/wcolorpanel.c
index 9cb004e5..12d54480 100644
--- a/WINGs/wcolorpanel.c
+++ b/WINGs/wcolorpanel.c
@@ -264,9 +264,6 @@ enum {
#define COLORWHEEL_PART 1
#define CUSTOMPALETTE_PART 2
-#define BUFSIZE 1024
-
-#define MAX_LENGTH 1024
#ifndef M_PI
#define M_PI 3.14159265358979323846
diff --git a/WINGs/wfontpanel.c b/WINGs/wfontpanel.c
index aede6ddc..2d6f77f7 100644
--- a/WINGs/wfontpanel.c
+++ b/WINGs/wfontpanel.c
@@ -43,8 +43,6 @@ typedef struct W_FontPanel {
#define MIN_UPPER_HEIGHT 20
#define MIN_LOWER_HEIGHT 140
-#define MAX_FONTS_TO_RETRIEVE 2000
-
#define BUTTON_SPACE_HEIGHT 40
#define MIN_WIDTH 250
diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c
index db5b6c18..5f0f0171 100644
--- a/WPrefs.app/Menu.c
+++ b/WPrefs.app/Menu.c
@@ -42,7 +42,6 @@ typedef enum {
} InfoType;
#define MAX_SECTION_SIZE 4
-#define PATH_LEN 256
typedef struct _Panel {
WMBox *box;
diff --git a/src/workspace.c b/src/workspace.c
index 9a820574..380ffec0 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -57,7 +57,6 @@
/* index of the first workspace menu entry */
#define MC_WORKSPACE1 3
-#define MAX_SHORTCUT_LENGTH 32
#define WORKSPACE_NAME_DISPLAY_PADDING 32
static WMPropList *dWorkspaces = NULL;
http://repo.or.cz/w/wmaker-crm.git/commit/790d967d3f762b72274fb552d579e294eca08511
commit 790d967d3f762b72274fb552d579e294eca08511
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:33 2014 +0100
WINGs: reuse GNUstep header instead of duplicating stuff in wwindow.c
There is a header that defines the stucts and constants to support GNUstep
specific things, and it is already used somewhere else in WINGs, so instead
of duplicating locally the stuff we re-use the header, it makes code easier
to maintain.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wwindow.c b/WINGs/wwindow.c
index 23badf5b..503611d0 100644
--- a/WINGs/wwindow.c
+++ b/WINGs/wwindow.c
@@ -3,6 +3,8 @@
#include "WINGsP.h"
+#include "GNUstep.h"
+
#include <X11/Xatom.h>
typedef struct W_Window {
@@ -46,32 +48,6 @@ typedef struct W_Window {
} flags;
} _Window;
-typedef struct {
- CARD32 flags;
- CARD32 window_style;
- CARD32 window_level;
- CARD32 reserved;
- Pixmap miniaturize_pixmap; /* pixmap for miniaturize button */
- Pixmap close_pixmap; /* pixmap for close button */
- Pixmap miniaturize_mask; /* miniaturize pixmap mask */
- Pixmap close_mask; /* close pixmap mask */
- CARD32 extra_flags;
-} GNUstepWMAttributes;
-
-#define GSWindowStyleAttr (1<<0)
-#define GSWindowLevelAttr (1<<1)
-#define GSMiniaturizePixmapAttr (1<<3)
-#define GSClosePixmapAttr (1<<4)
-#define GSMiniaturizeMaskAttr (1<<5)
-#define GSCloseMaskAttr (1<<6)
-#define GSExtraFlagsAttr (1<<7)
-
-/* extra flags */
-#define GSDocumentEditedFlag (1<<0)
-#define GSNoApplicationIconFlag (1<<5)
-
-#define WMFHideOtherApplications 10
-#define WMFHideApplication 12
static void willResizeWindow(W_ViewDelegate *, WMView *, unsigned *, unsigned
*);
http://repo.or.cz/w/wmaker-crm.git/commit/c2aff8c51bdc19950a947d6e9a508c5bea302078
commit c2aff8c51bdc19950a947d6e9a508c5bea302078
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:32 2014 +0100
WINGs: remove internal XDND macros that are not used
The group of XDND_* macro do not bring a lot in term of clarity, so it is
probable that they will get away someday, but at current time as 2 of them
are not used anywhere they get removed to prevent their use in the future.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/dragdestination.c b/WINGs/dragdestination.c
index 2833b886..a3ce8713 100644
--- a/WINGs/dragdestination.c
+++ b/WINGs/dragdestination.c
@@ -19,9 +19,7 @@
#define XDND_REQUIRED_TYPES(dragInfo) dragInfo->destInfo->requiredTypes
#define XDND_SOURCE_ACTION(dragInfo) dragInfo->sourceAction
#define XDND_DEST_ACTION(dragInfo) dragInfo->destinationAction
-#define XDND_SOURCE_OPERATIONS(dragInfo) dragInfo->destInfo->sourceOperations
#define XDND_DROP_DATAS(dragInfo) dragInfo->destInfo->dropDatas
-#define XDND_DROP_DATA_COUNT(dragInfo) dragInfo->destInfo->dropDataCount
#define XDND_DEST_VIEW_IS_REGISTERED(dragInfo) ((dragInfo->destInfo) != NULL)
&& ((dragInfo->destInfo->destView->dragDestinationProcs) != NULL)
http://repo.or.cz/w/wmaker-crm.git/commit/09db9a4f12a451f211f94e9b45dde097f35ff953
commit 09db9a4f12a451f211f94e9b45dde097f35ff953
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:31 2014 +0100
WINGs: remove macro ABS_SHIFT from the wcolorpanel code
This macro was define a *very* long time ago, in commit
d98f1fa645be332b35e8f8d1c2b7ce8ab1231be0
but was not used at that time, and have never been used anywhere since
then.
As the macro does not look like a good idea for performance anyway, get rid
of it before anyone could get tempted to use it.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wcolorpanel.c b/WINGs/wcolorpanel.c
index 0b3fc159..9cb004e5 100644
--- a/WINGs/wcolorpanel.c
+++ b/WINGs/wcolorpanel.c
@@ -3525,9 +3525,6 @@ static void convertCPColor(CPColor * color)
}
}
-#define ABS_SHIFT(val, shift) - (((shift) > 0) ? (val) >> (shift) : (val)
<< -(shift))
-
static RColor ulongToRColor(WMScreen * scr, unsigned long value)
{
RColor color;
http://repo.or.cz/w/wmaker-crm.git/commit/939b72393d81a3248fc6a05aecc3280a7564d7c4
commit 939b72393d81a3248fc6a05aecc3280a7564d7c4
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:30 2014 +0100
WINGs: remove dead code from 'loadPixmaps'
It seems the code had the possibility to load a default icon, probably to
be used on the windows if the main program does not provide any.
This code however have never been enabled, probably because it is better to
not provide an icon and let the window manager use its own.
This patch then removes that dead code, but keeps the image as part of the
WINGs resource for the case where an application would have been using it.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/widgets.c b/WINGs/widgets.c
index 87fa9d62..2cb27b8a 100644
--- a/WINGs/widgets.c
+++ b/WINGs/widgets.c
@@ -363,10 +363,7 @@ static WMPixmap *makePixmap(W_Screen * sPtr, char **data,
int width, int height,
}
#define T_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.tiff"
-#define T_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.tiff"
-
#define X_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.xpm"
-#define X_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.xpm"
static Bool loadPixmaps(WMScreen * scr)
{
@@ -474,16 +471,6 @@ static Bool loadPixmaps(WMScreen * scr)
RReleaseImage(image);
-#if 0
- scr->defaultObjectIcon = WMCreatePixmapFromFile(scr,
T_DEFAULT_OBJECT_ICON_FILE);
- if (!scr->defaultObjectIcon) {
- scr->defaultObjectIcon = WMCreatePixmapFromFile(scr,
X_DEFAULT_OBJECT_ICON_FILE);
- }
- if (!scr->defaultObjectIcon) {
- wwarning("WINGs: could not load default icon file");
- return False;
- }
-#endif
return True;
}
http://repo.or.cz/w/wmaker-crm.git/commit/2dc9d4f4a9d4e35f31dc73e73a1807503a5f9961
commit 2dc9d4f4a9d4e35f31dc73e73a1807503a5f9961
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:29 2014 +0100
WINGs: remove unused macro NFONT in wbutton
As pointed by gcc, this macro is never used in the code; when no font is
defined by user the 'paintButton' code already falls back to the
'normalFont' of the screen, and this code could not need the macro anyway.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wbutton.c b/WINGs/wbutton.c
index c217edd4..8c8e4dce 100644
--- a/WINGs/wbutton.c
+++ b/WINGs/wbutton.c
@@ -98,7 +98,6 @@ static void handleActionEvents(XEvent * event, void *data);
static char *WMPushedRadioNotification = "WMPushedRadioNotification";
-#define NFONT(b) (b)->view->screen->normalFont
WMButton *WMCreateCustomButton(WMWidget * parent, int behaviourMask)
{
http://repo.or.cz/w/wmaker-crm.git/commit/0bbfa2e01ef5eb599b90283c289a634965e3106d
commit 0bbfa2e01ef5eb599b90283c289a634965e3106d
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:28 2014 +0100
WINGs: remove unused constant DEFAULT_BORDER_WIDTH in wcolorwell
As pointed by gcc, this constant is not used anywhere, and it looks like
it have always been the case. As there's no reason to specifically add a
border to this widget, remove the constant.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wcolorwell.c b/WINGs/wcolorwell.c
index 595531c4..a5d1a1da 100644
--- a/WINGs/wcolorwell.c
+++ b/WINGs/wcolorwell.c
@@ -80,7 +80,6 @@ static WMDragDestinationProcs _DragDestinationProcs = {
#define DEFAULT_WIDTH 60
#define DEFAULT_HEIGHT 30
-#define DEFAULT_BORDER_WIDTH 6
#define MIN_WIDTH 16
#define MIN_HEIGHT 8
http://repo.or.cz/w/wmaker-crm.git/commit/15983dfafe0707d509b5b8bc5b774e51d8d8328f
commit 15983dfafe0707d509b5b8bc5b774e51d8d8328f
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:27 2014 +0100
WINGs: remove constants used for default width+height for the widget
As pointed by gcc, the height is never used and the code make use of the
SCROLLER_WIDTH constant anyway, so this patch updates the code to directly
use that constant instead of intermediate values that just adds noise for
code maintainability.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wscroller.c b/WINGs/wscroller.c
index 4a5ae8c4..f1daa3a6 100644
--- a/WINGs/wscroller.c
+++ b/WINGs/wscroller.c
@@ -64,8 +64,6 @@ typedef struct W_Scroller {
} flags;
} Scroller;
-#define DEFAULT_HEIGHT 60
-#define DEFAULT_WIDTH SCROLLER_WIDTH
#define DEFAULT_ARROWS_POSITION WSAMinEnd
#define BUTTON_SIZE ((SCROLLER_WIDTH) - 4)
@@ -108,7 +106,7 @@ WMScroller *WMCreateScroller(WMWidget * parent)
WMCreateEventHandler(sPtr->view, ExposureMask | StructureNotifyMask
| ClientMessageMask, handleEvents, sPtr);
- W_ResizeView(sPtr->view, DEFAULT_WIDTH, DEFAULT_WIDTH);
+ W_ResizeView(sPtr->view, SCROLLER_WIDTH, SCROLLER_WIDTH);
sPtr->flags.arrowsPosition = DEFAULT_ARROWS_POSITION;
WMCreateEventHandler(sPtr->view, ButtonPressMask | ButtonReleaseMask
http://repo.or.cz/w/wmaker-crm.git/commit/b4544617e3dd5dbda1f96ba06b815ffb652369c2
commit b4544617e3dd5dbda1f96ba06b815ffb652369c2
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:26 2014 +0100
WINGs: remove the macro DEFAULT_TITLE because it is not used
As pointed by gcc, the macro is not used, that is probably because it is
totally ok to never provide a title from X point of view, so there is now
reason to fall back to that empty constant.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/WINGs/wwindow.c b/WINGs/wwindow.c
index 28844fb9..23badf5b 100644
--- a/WINGs/wwindow.c
+++ b/WINGs/wwindow.c
@@ -85,7 +85,6 @@ struct W_ViewDelegate _WindowViewDelegate = {
#define DEFAULT_WIDTH 400
#define DEFAULT_HEIGHT 180
-#define DEFAULT_TITLE ""
static void destroyWindow(_Window * win);
http://repo.or.cz/w/wmaker-crm.git/commit/703502480b9aaaf4a5599f0d6dd68ee27c310043
commit 703502480b9aaaf4a5599f0d6dd68ee27c310043
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:25 2014 +0100
configure: make the gcc check for trampolines stronger
Because the use of trampolines can be a lot of problems, this patch changes
the use of the flag to:
- make it an error if possible, so coders are forced to not use them;
- always enable them, not just for debug, so we increase the probability
to get them caught.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/configure.ac b/configure.ac
index 8fc3bd04..4c58b1d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,6 +104,16 @@ AS_IF([test "x$debug" = "xyes"],
AX_CFLAGS_GCC_OPTION(-Wall)
AX_CFLAGS_GCC_OPTION(-Wextra -Wno-sign-compare)
+dnl
+dnl The use of trampolines cause code that can crash on some secured OS, it is
+dnl also known to be a source of crash if not used properly, in a more general
+dnl way it tends to generate binary code that may not be optimal, and it is
+dnl not compatible with the 'nested-func-to-macro' workaround
+WM_CFLAGS_CHECK_FIRST([-Wtrampolines],
+ [-Werror=trampolines dnl try to generate an error if possible
+ -Wtrampolines dnl if not, try to fall back to a simple warning
+ ])
+dnl
AS_IF([test "x$debug" = "xyes"],
[dnl When debug is enabled, we try to activate more checks from
dnl the compiler. They are on independant check because the
@@ -172,11 +182,6 @@ AS_IF([test "x$debug" = "xyes"],
-Wmissing-noreturn dnl clang syntax
])
dnl
- dnl The use of trampolines cause code that can crash on some
- dnl secured OS, and in a more general way generate binary code
- dnl that may not be optimal
- AX_CFLAGS_GCC_OPTION([-Wtrampolines])
- dnl
dnl GCC provides a couple of checks to detect incorrect macro uses
AX_CFLAGS_GCC_OPTION([-Wundef])
WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
http://repo.or.cz/w/wmaker-crm.git/commit/20b76fc3b62a2bc50e9bf73d85fa25711507a3dd
commit 20b76fc3b62a2bc50e9bf73d85fa25711507a3dd
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:24 2014 +0100
configure: add a few warning flags for gcc and clang to help catch bugs
They concern topics like:
- portability;
- dangerous constructs;
- clearer code for maintainability
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/configure.ac b/configure.ac
index d46923eb..8fc3bd04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,17 +111,40 @@ AS_IF([test "x$debug" = "xyes"],
dnl where some options are not supported and we don't want to
dnl loose all of them.
dnl
+ dnl clang, suggest parenthesis on bit operations that could be
+ dnl misunderstood due to C operator precedence
+ AX_CFLAGS_GCC_OPTION([-Wbitwise-op-parentheses])
+ dnl
+ dnl Points at code that gcc thinks is so complicated that gcc
+ dnl gives up trying to optimize, which probably also means it is
+ dnl too complicated to maintain
+ AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization])
+ dnl
dnl Floating-point comparison is not a good idea
AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
dnl
+ dnl clang warns about constants that may have portability issues due
+ dnl to the endianness of the host
+ AX_CFLAGS_GCC_OPTION([-Wfour-char-constants])
+ dnl
+ dnl clang warns about constant that may be too big to be portable
+ AX_CFLAGS_GCC_OPTION([-Wliteral-range])
+ dnl
dnl Try to report misuses of '&' versus '&&' and similar
AX_CFLAGS_GCC_OPTION([-Wlogical-op])
dnl
+ dnl clang, reports cases where the code assumes everyone is an
+ dnl expert in C operator precedence... which is unlikely!
+ AX_CFLAGS_GCC_OPTION([-Wlogical-op-parentheses])
+ dnl
dnl Reports declaration of global things that are done inside
dnl a local environment, instead of using the appropriate
dnl header
AX_CFLAGS_GCC_OPTION([-Wnested-externs])
dnl
+ dnl Warn about constant strings that could pose portability issues
+ AX_CFLAGS_GCC_OPTION([-Woverlength-strings])
+ dnl
dnl Use of 'sizeof()' on inappropriate pointer types
AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
dnl
@@ -129,6 +152,11 @@ AS_IF([test "x$debug" = "xyes"],
dnl more difficult, so try to avoid it
AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
dnl
+ dnl clang, detect some misuses of sizeof. We also count in our code
+ dnl on the use of the macro 'wlength' which contains a check if the
+ dnl compiler support C11's static_assert
+ AX_CFLAGS_GCC_OPTION([-Wsizeof-array-argument])
+ dnl
dnl Prototype of function must be explicit, no deprecated K&R syntax
dnl and no empty argument list which prevents compiler from doing
dnl type checking when using the function
@@ -152,6 +180,9 @@ AS_IF([test "x$debug" = "xyes"],
dnl GCC provides a couple of checks to detect incorrect macro uses
AX_CFLAGS_GCC_OPTION([-Wundef])
WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
+ dnl
+ dnl clang reports stuff marked unused but which is actually used
+ AX_CFLAGS_GCC_OPTION([-Wused-but-marked-unused])
], [dnl
dnl When debug not enabled, we try to avoid some non-necessary
dnl messages from the compiler
http://repo.or.cz/w/wmaker-crm.git/commit/9f4d568eb06753cc7197dbf73422267194af9805
commit 9f4d568eb06753cc7197dbf73422267194af9805
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:23 2014 +0100
configure: add macro to check compiler flag '-Wstrict-prototype'
Strict prototype are better for portability and to avoid bugs because it
makes sure the compiler has the information to properly validate the
arguments given when a function is called.
This flag however need special care when checking for it, because the
declaration for 'main' generated by autoconf cannot be a strict prototype
so the detection would always see the flag as failing.
This patch handles this by creating a dedicated macro for this detection
which uses a good prototype because we're in a case where it is possible,
so the detection will not always fail; it also makes sure to add the flag
to CFLAG only at the end, to avoid falsely crashing any further test done
in the configure script.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/configure.ac b/configure.ac
index cc3e0460..d46923eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,6 +129,11 @@ AS_IF([test "x$debug" = "xyes"],
dnl more difficult, so try to avoid it
AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
dnl
+ dnl Prototype of function must be explicit, no deprecated K&R syntax
+ dnl and no empty argument list which prevents compiler from doing
+ dnl type checking when using the function
+ WM_CFLAGS_GCC_OPTION_STRICTPROTO
+ dnl
dnl Proper attributes helps the compiler to produce better code
WM_CFLAGS_CHECK_FIRST([format attribute suggest],
[-Wsuggest-attribute=format dnl new gcc syntax
diff --git a/m4/wm_cflags_check.m4 b/m4/wm_cflags_check.m4
index 26745b69..b61b16d4 100644
--- a/m4/wm_cflags_check.m4
+++ b/m4/wm_cflags_check.m4
@@ -122,6 +122,44 @@ _ACEOF
])
+# WM_CFLAGS_GCC_OPTION_STRICTPROTO
+# --------------------------------
+#
+# Check if the compiler support '-Wstrict-prototypes'. This would be done
+# traditionally using AX_CFLAGS_GCC_OPTION(...), but in the present case it
+# always fail because the test program generated by autoconf always use a
+# non-compliant prototype (this is needed for portability to avoid possible
+# function declaration mismatch on 'main').
+#
+# This macro works around this by providing a strict prototype for 'main'
+# in this case because we are in a very known case.
+AC_DEFUN([WM_CFLAGS_GCC_OPTION_STRICTPROTO],
+[AC_CACHE_CHECK([CFLAGS for gcc -Wstrict-prototypes],
[wm_cv_c_checks_compopt_Wstrict_prototypes],
+ [AC_LANG_COMPILER_REQUIRE()dnl
+ AC_LANG_PUSH([C])
+ wm_save_CFLAGS="$CFLAGS"
+ CFLAGS="$wm_save_CFLAGS -pedantic -Werror -Wstrict-prototypes"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([dnl
+int
+main(int argc, char **argv)
+{
+ /* to avoid failing on -Wunused-parameter */
+ (void) argc;
+ (void) argv;
+
+ return 0;
+}])],
+ [wm_cv_c_checks_compopt_Wstrict_prototypes="-Wstrict-prototypes"],
+ [wm_cv_c_checks_compopt_Wstrict_prototypes="no"])
+ CFLAGS="$wm_save_CFLAGS"
+ AC_LANG_POP([C]) ])
+# We cannot add this flag now to CFLAGS because it could break all further
+# detections done by configure, the flag will be added at the end by the
+# macro WM_CFLAGS_GCC_OPTION_POSTPONED
+])
+
+
# WM_CFLAGS_GCC_OPTION_POSTPONED
# ------------------------------
#
@@ -133,7 +171,7 @@ _ACEOF
AC_DEFUN_ONCE([WM_CFLAGS_GCC_OPTION_POSTPONED],
[# WM_CFLAGS_GCC_OPTION_POSTPONED: add compiler flags at the end of the
autoconf flow
AS_IF([test "x$debug" = "xyes"],
- [m4_foreach([arg_name], [[Wunused_macros]],
+ [m4_foreach([arg_name], [[Wstrict_prototypes], [Wunused_macros]],
[AS_CASE([$wm_cv_c_checks_compopt_[]arg_name],
[no*], [],
[AS_IF([echo " $CFLAGS " | grep " $wm_cv_c_checks_compopt_[]arg_name "
2>&1 > /dev/null],
http://repo.or.cz/w/wmaker-crm.git/commit/5eefe41b0a18ac32f1e734330cf2a2d899bf47fc
commit 5eefe41b0a18ac32f1e734330cf2a2d899bf47fc
Author: Christophe CURIS <[email protected]>
Date: Mon Dec 8 22:42:22 2014 +0100
configure: rewrote the detection for -Wunused-macro
This flag is always detected as unsupported because every time autoconf is
generating a test program for any feature, it puts at the beginning of the
test source all the '#define' that have been detected so far, which is what
we expect normally.
But for this option, as we cannot reasonably make a dummy use of every
macro, the warning triggers and falsely gets autoconf into thinking it does
not work.
This patch creates a dedicated macro (WM_CFLAGS_GCC_OPTION_UNUSEDMACROS)
for this flag, which works around the problem by having no '#define' in the
test source. It also adds a new macro WM_CFLAGS_GCC_OPTION_POSTPONED
because if the flag works, we still cannot add it to the compilation
command because it could fail all further tests done, so the macro will add
it to CFLAGS only at the end.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/configure.ac b/configure.ac
index 65b12c42..cc3e0460 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,7 +146,7 @@ AS_IF([test "x$debug" = "xyes"],
dnl
dnl GCC provides a couple of checks to detect incorrect macro uses
AX_CFLAGS_GCC_OPTION([-Wundef])
- AX_CFLAGS_GCC_OPTION([-Wunused-macros])
+ WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
], [dnl
dnl When debug not enabled, we try to avoid some non-necessary
dnl messages from the compiler
@@ -845,6 +845,12 @@ fi
gl_LD_VERSION_SCRIPT
+
+dnl Add the post-poned compilation options
+dnl ======================================
+WM_CFLAGS_GCC_OPTION_POSTPONED
+
+
AC_OUTPUT(Makefile po/Makefile util/Makefile util/po/Makefile test/Makefile
WINGs/Makefile WINGs/WINGs/Makefile WINGs/Documentation/Makefile
WINGs/Examples/Makefile WINGs/Resources/Makefile WINGs/Tests/Makefile diff
--git a/m4/wm_cflags_check.m4 b/m4/wm_cflags_check.m4
index d46511a1..26745b69 100644
--- a/m4/wm_cflags_check.m4
+++ b/m4/wm_cflags_check.m4
@@ -75,3 +75,71 @@ wm_fn_c_try_compile_cflag ()
AS_SET_STATUS([$wm_retval])
}
])
+
+
+# WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
+# ---------------------------------
+#
+# Check if the compiler support '-Wunused-macros'. This would be done
+# traditionally using AX_CFLAGS_GCC_OPTION(...), but in the present case it
+# always fail because the test program defines many macro (all the stuff
+# detected so far) so the warning always trigger, the compilation then fail,
+# and the option is then marked as never supported.
+#
+# This macro works around this by using a basic program without any #define
+AC_DEFUN([WM_CFLAGS_GCC_OPTION_UNUSEDMACROS],
+[AC_CACHE_CHECK([CFLAGS for gcc -Wunused-macros],
[wm_cv_c_checks_compopt_Wunused_macros],
+ [AC_LANG_COMPILER_REQUIRE()dnl
+ AC_LANG_PUSH([C])
+ wm_save_CFLAGS="$CFLAGS"
+ CFLAGS="$wm_save_CFLAGS -pedantic -Werror -Wunused-macros"
+ dnl Similar to AC_LANG_CONFTEST(C), except we do not include the
'confdefs.h'
+ dnl directly in the source to avoid an "unused macro" error, but we include
+ dnl it in the same way we will include the "config.h", so we get in the same
+ dnl condition as WindowMaker's source
+ cat <<_ACEOF >conftest.$ac_ext
+@%:@include "confdefs.h"
+
+int
+main(int argc, char **argv)
+{
+ /* to avoid failing on -Wunused-parameter */
+ (void) argc;
+ (void) argv;
+
+ return 0;
+}
+_ACEOF
+ AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_compile "$LINENO"],
+ [wm_cv_c_checks_compopt_Wunused_macros="-Wunused-macros"],
+ [wm_cv_c_checks_compopt_Wunused_macros="no"])
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$wm_save_CFLAGS"
+ AC_LANG_POP([C]) ])
+# We cannot add this flag now to CFLAGS because it could break all further
+# detections done by configure, the flag will be added at the end by the
+# macro WM_CFLAGS_GCC_OPTION_POSTPONED
+])
+
+
+# WM_CFLAGS_GCC_OPTION_POSTPONED
+# ------------------------------
+#
+# Some options cannot be added to the compilation command as soon as they have
+# been detected because they can break the detection done in autoconf, because
+# the template are cannot always be perfect.
+# This macro takes care of making them effective, so it should be called just
+# before AC_OUTPUT.
+AC_DEFUN_ONCE([WM_CFLAGS_GCC_OPTION_POSTPONED],
+[# WM_CFLAGS_GCC_OPTION_POSTPONED: add compiler flags at the end of the
autoconf flow
+AS_IF([test "x$debug" = "xyes"],
+ [m4_foreach([arg_name], [[Wunused_macros]],
+ [AS_CASE([$wm_cv_c_checks_compopt_[]arg_name],
+ [no*], [],
+ [AS_IF([echo " $CFLAGS " | grep " $wm_cv_c_checks_compopt_[]arg_name "
2>&1 > /dev/null],
+ [AC_MSG_WARN([option $wm_cv_c_checks_compopt_[]arg_name already
present in $CFLAGS, not appended])],
+ [CFLAGS="$CFLAGS $wm_cv_c_checks_compopt_[]arg_name"])dnl
+ ])
+ ])dnl
+ ])dnl
+])
-----------------------------------------------------------------------
Summary of changes:
WINGs/dragdestination.c | 2 -
WINGs/wballoon.c | 5 --
WINGs/wbutton.c | 1 -
WINGs/wcolorpanel.c | 21 +++-------
WINGs/wcolorwell.c | 1 -
WINGs/wfontpanel.c | 2 -
WINGs/widgets.c | 13 ------
WINGs/wscroller.c | 4 +-
WINGs/wwindow.c | 29 +------------
WPrefs.app/Menu.c | 1 -
WPrefs.app/WPrefs.c | 3 -
configure.ac | 59 +++++++++++++++++++++++---
m4/wm_cflags_check.m4 | 106 +++++++++++++++++++++++++++++++++++++++++++++++
m4/wm_libmath.m4 | 19 ++++++++
src/balloon.c | 5 --
src/framewin.c | 2 -
src/menu.c | 14 ++----
src/motif.c | 31 ++++++++++++++
src/moveres.c | 4 --
src/switchpanel.c | 1 -
src/wconfig.h.in | 1 -
src/wmspec.c | 17 ++++++++
src/workspace.c | 1 -
util/getstyle.c | 3 -
util/wmsetbg.c | 3 -
wrlib/rotate.c | 19 ++++-----
wrlib/scale.c | 7 +---
27 files changed, 248 insertions(+), 126 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].