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 f3b40190496760801ff96969a6c18373fc6f9fc1 (commit)
via 22fb246ffb486cda6f051635984518fd2af4c4b9 (commit)
via 5f7364af5a66f06b3eb4f4961d0485689d5c9e55 (commit)
via 0661eca11803537c4a0edf7298829e910394c8ab (commit)
via af081776278ebafea2084624914fa757abb889d8 (commit)
via a51a4036019c498157d180b1eeab4d4d84cd8f2f (commit)
via 059492c7433c630768c4884bb83a43300a9f259a (commit)
via b6d01c3f85abdfdf68dbf64672b0e2c4c4e9830c (commit)
via b72eb6747bf5edb282c636a80fa47765c4a53222 (commit)
via f79c93aeae32bdf70eb7b17fa2daec2198111fb6 (commit)
via 897c8c860a6057ef85f408241df7c5fc12db082f (commit)
via 630b8bb361f56c7363c178f3585d7dc655b3069d (commit)
via b1b688980beaa9e1fe7ec5af224a9d7e733532ad (commit)
via b7a8ff3d4751e73f2e4cc2c098f9c503c393a281 (commit)
via 77a5f9e7be27a144224fd5581615fc2a8c5dcadb (commit)
via c903043043db9e2646badea7739f0b7d94fea9a1 (commit)
from 98d753801d90b4f8293e197d8cb951eb46ac83cb (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/f3b40190496760801ff96969a6c18373fc6f9fc1
commit f3b40190496760801ff96969a6c18373fc6f9fc1
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 23:08:21 2013 +0100
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 <[email protected]>
diff --git a/configure.ac b/configure.ac
index 8f65979..fe92ba7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,7 @@ dnl Checks for programs.
dnl ===================
AC_ISC_POSIX
AC_PROG_CC
+WM_PROG_CC_C11
AC_PROG_LN_S
AC_PROG_GCC_TRADITIONAL
AC_PROG_LIBTOOL
diff --git a/m4/wm_prog_cc_c11.m4 b/m4/wm_prog_cc_c11.m4
new file mode 100644
index 0000000..fbdbffb
--- /dev/null
+++ b/m4/wm_prog_cc_c11.m4
@@ -0,0 +1,48 @@
+# wm_prog_cc_c11.m4 - Macros to see if compiler may support STD C11
+#
+# Copyright (c) 2013 Christophe CURIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# WM_PROG_CC_C11
+# ---------------------
+#
+# Check if the compiler supports C11 standard natively, or if any
+# option may help enabling the support
+# This is (in concept) similar to AC_PROG_CC_C11, which is unfortunately
+# not yet available in autotools; as a side effect we only check for
+# compiler's acknowledgement and a few features instead of full support
+AC_DEFUN_ONCE([WM_PROG_CC_C11],
+[AC_CACHE_CHECK([for C11 standard support], [wm_cv_prog_cc_c11],
+ [wm_cv_prog_cc_c11=no
+ wm_save_CFLAGS="$CFLAGS"
+ for wm_arg in dnl
+"% native" dnl
+"-std=c11"
+ do
+ CFLAGS="$wm_save_CFLAGS `echo $wm_arg | sed -e 's,%.*,,' `"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [dnl
+#if __STDC_VERSION__ < 201112L
+fail_because_stdc_version_is_older_than_C11;
+#endif
+])],
+ [wm_cv_prog_cc_c11="`echo $wm_arg | sed -e 's,.*% *,,' `" ;
break])
+ done
+ CFLAGS="$wm_save_CFLAGS"])
+AS_CASE([$wm_cv_prog_cc_c11],
+ [no|native], [],
+ [CFLAGS="$CFLAGS $wm_cv_prog_cc_c11"])
+])
http://repo.or.cz/w/wmaker-crm.git/commit/22fb246ffb486cda6f051635984518fd2af4c4b9
commit 22fb246ffb486cda6f051635984518fd2af4c4b9
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 23:08:20 2013 +0100
configure: Do not keep assertion if debug was not enabled
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/configure.ac b/configure.ac
index 0415bbc..8f65979 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,10 @@ AS_IF([test "x$debug" = "xyes"],
dnl
dnl Enable internal debug code
CPPFLAGS="$CPPFLAGS -DDEBUG"
+], [dnl
+ dnl When debug is not enabled, the user probably does not wants to keep
+ dnl assertions in the final program
+ CPPFLAGS="$CPPFLAGS -DNDEBUG"
])
http://repo.or.cz/w/wmaker-crm.git/commit/5f7364af5a66f06b3eb4f4961d0485689d5c9e55
commit 5f7364af5a66f06b3eb4f4961d0485689d5c9e55
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 23:08:19 2013 +0100
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 <[email protected]>
diff --git a/configure.ac b/configure.ac
index b46b575..0415bbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,18 @@ AC_ARG_ENABLE(debug,
[AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
[debug=no])
AS_IF([test "x$debug" = "xyes"],
- [CFLAGS="-g -O0" ; CPPFLAGS="$CPPFLAGS -DDEBUG"])
+ [dnl This flag should have already been detected and added, but if user
+ dnl provided an explicit CFLAGS it may not be the case
+ AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
+ [@%:@ Debug symbol already activated],
+ [AX_CFLAGS_GCC_OPTION([-g])])
+ dnl
+ dnl This flag generally makes debugging nightmarish, remove it if present
+ CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
+ dnl
+ dnl Enable internal debug code
+ CPPFLAGS="$CPPFLAGS -DDEBUG"
+])
AX_CFLAGS_GCC_OPTION(-Wall)
@@ -841,7 +852,8 @@ dnl echo "Supported languages beside English : $languages"
if test "x$MOFILES" != "x"; then
echo "Installation path for translations : $NLSDIR" | sed -e
's|$(prefix)|'"$prefix|"
fi
-AS_IF([test "x$debug" = "xyes"], [echo "Debug information enabled :
$debug"])
+AS_IF([test "x$debug" = "xyes"],
+ [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
echo
dnl WM_PRINT_REDCRAP_BUG_STATUS
http://repo.or.cz/w/wmaker-crm.git/commit/0661eca11803537c4a0edf7298829e910394c8ab
commit 0661eca11803537c4a0edf7298829e910394c8ab
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 21:18:23 2013 +0100
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 <[email protected]>
diff --git a/util/fontconv.c b/util/fontconv.c
index 31dde46..8276521 100644
--- a/util/fontconv.c
+++ b/util/fontconv.c
@@ -108,7 +108,7 @@ static char *mapWeightToName(str * weight)
if (weight->len == 0)
return "";
- for (i = 0; i < sizeof(normalNames) / sizeof(normalNames[0]); i++) {
+ for (i = 0; i < wlengthof(normalNames); i++) {
if (strlen(normalNames[i]) == weight->len &&
strncmp(normalNames[i], weight->str, weight->len)) {
return "";
}
http://repo.or.cz/w/wmaker-crm.git/commit/af081776278ebafea2084624914fa757abb889d8
commit af081776278ebafea2084624914fa757abb889d8
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 21:18:22 2013 +0100
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 <[email protected]>
diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
index 1fa9e85..ca4396e 100644
--- a/WPrefs.app/Appearance.c
+++ b/WPrefs.app/Appearance.c
@@ -1111,7 +1111,7 @@ static void previewClick(XEvent * event, void *clientData)
switch (panel->oldTabItem) {
case 0:
- for (i = 0; i < sizeof(previewPositions) /
sizeof(previewPositions[0]); i++) {
+ for (i = 0; i < wlengthof(previewPositions); i++) {
if (event->xbutton.x >= previewPositions[i].pos.x
&& event->xbutton.y >= previewPositions[i].pos.y
&& event->xbutton.x < previewPositions[i].pos.x
diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index 559f8cb..582013e 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -115,11 +115,11 @@ static void createPanel(Panel * p)
WMSetScrollViewHasHorizontalScroller(sv, False);
f = WMCreateFrame(panel->box);
- WMResizeWidget(f, 495, (sizeof(expert_options) /
sizeof(expert_options[0])) * 25 + 8);
+ WMResizeWidget(f, 495, wlengthof(expert_options) * 25 + 8);
WMSetFrameRelief(f, WRFlat);
udb = WMGetStandardUserDefaults();
- for (i = 0; i < sizeof(expert_options) / sizeof(expert_options[0]);
i++) {
+ for (i = 0; i < wlengthof(expert_options); i++) {
panel->swi[i] = WMCreateSwitchButton(f);
WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
WMMoveWidget(panel->swi[i], 5, 5 + i * 25);
@@ -152,7 +152,7 @@ static void storeDefaults(_Panel * panel)
WMUserDefaults *udb = WMGetStandardUserDefaults();
int i;
- for (i = 0; i < sizeof(expert_options) / sizeof(expert_options[0]);
i++) {
+ for (i = 0; i < wlengthof(expert_options); i++) {
switch (expert_options[i].class) {
case OPTION_WMAKER:
SetBoolForKey(WMGetButtonSelected(panel->swi[i]),
expert_options[i].op_name);
diff --git a/WPrefs.app/KeyboardShortcuts.c b/WPrefs.app/KeyboardShortcuts.c
index d71d4bf..19e9905 100644
--- a/WPrefs.app/KeyboardShortcuts.c
+++ b/WPrefs.app/KeyboardShortcuts.c
@@ -509,7 +509,7 @@ static void createPanel(Panel * p)
WMSetListUserDrawProc(panel->actLs, paintItem);
WMHangData(panel->actLs, panel);
- for (i = 0; i < sizeof(keyOptions)/sizeof(keyOptions[0]); i++) {
+ for (i = 0; i < wlengthof(keyOptions); i++) {
WMAddListItem(panel->actLs, _(keyOptions[i].title));
}
WMSetListAction(panel->actLs, listClick, panel);
diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index 5f5f9b5..32886db 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -613,13 +613,13 @@ static void createPanel(Panel * p)
WMResizeWidget(panel->wheelP, 135, 20);
WMMoveWidget(panel->wheelP, 95, 129);
- for (i = 0; i < sizeof(buttonActions) / sizeof(buttonActions[0]); i++) {
+ for (i = 0; i < wlengthof(buttonActions); i++) {
WMAddPopUpButtonItem(panel->button1P, buttonActions[i]);
WMAddPopUpButtonItem(panel->button2P, buttonActions[i]);
WMAddPopUpButtonItem(panel->button3P, buttonActions[i]);
}
- for (i = 0; i < sizeof(wheelActions) / sizeof(wheelActions[0]); i++) {
+ for (i = 0; i < wlengthof(wheelActions); i++) {
WMAddPopUpButtonItem(panel->wheelP, wheelActions[i]);
}
diff --git a/WPrefs.app/Workspace.c b/WPrefs.app/Workspace.c
index 862d2db..7517542 100644
--- a/WPrefs.app/Workspace.c
+++ b/WPrefs.app/Workspace.c
@@ -81,7 +81,7 @@ static void showData(_Panel * panel)
str = "center";
idx = 1; /* center */
- for (i = 0; i < sizeof(WSNamePositions) / sizeof(WSNamePositions[0]);
i++) {
+ for (i = 0; i < wlengthof(WSNamePositions); i++) {
if (strcasecmp(WSNamePositions[i], str) == 0) {
idx = i;
break;
http://repo.or.cz/w/wmaker-crm.git/commit/a51a4036019c498157d180b1eeab4d4d84cd8f2f
commit a51a4036019c498157d180b1eeab4d4d84cd8f2f
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 21:18:21 2013 +0100
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 <[email protected]>
diff --git a/src/defaults.c b/src/defaults.c
index e0f608a..5bf8267 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -772,7 +772,7 @@ static void initDefaults(void)
WMPLSetCaseSensitive(False);
- for (i = 0; i < sizeof(optionList) / sizeof(optionList[0]); i++) {
+ for (i = 0; i < wlengthof(optionList); i++) {
entry = &optionList[i];
entry->plkey = WMCreatePLString(entry->key);
@@ -782,7 +782,7 @@ static void initDefaults(void)
entry->plvalue = NULL;
}
- for (i = 0; i < sizeof(staticOptionList) / sizeof(staticOptionList[0]);
i++) {
+ for (i = 0; i < wlengthof(staticOptionList); i++) {
entry = &staticOptionList[i];
entry->plkey = WMCreatePLString(entry->key);
@@ -937,7 +937,7 @@ void wReadStaticDefaults(WMPropList * dict)
unsigned int i;
void *tdata;
- for (i = 0; i < sizeof(staticOptionList) / sizeof(staticOptionList[0]);
i++) {
+ for (i = 0; i < wlengthof(staticOptionList); i++) {
entry = &staticOptionList[i];
if (dict)
@@ -1094,7 +1094,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
needs_refresh = 0;
- for (i = 0; i < sizeof(optionList) / sizeof(optionList[0]); i++) {
+ for (i = 0; i < wlengthof(optionList); i++) {
entry = &optionList[i];
if (new_dict)
diff --git a/src/startup.c b/src/startup.c
index 8971789..3bd9f99 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -415,7 +415,7 @@ void StartUp(Bool defaultScreenOnly)
#ifdef HAVE_XRANDR
int dummy;
#endif
- Atom atom[sizeof(atomNames) / sizeof(atomNames[0])];
+ Atom atom[wlengthof(atomNames)];
/*
* Ignore CapsLock in modifiers
@@ -437,12 +437,12 @@ void StartUp(Bool defaultScreenOnly)
/* _XA_VERSION = XInternAtom(dpy, "VERSION", False); */
#ifdef HAVE_XINTERNATOMS
- XInternAtoms(dpy, atomNames, sizeof(atomNames) / sizeof(atomNames[0]),
False, atom);
+ XInternAtoms(dpy, atomNames, wlengthof(atomNames), False, atom);
#else
{
int i;
- for (i = 0; i < sizeof(atomNames) / sizeof(atomNames[0]); i++)
+ for (i = 0; i < wlengthof(atomNames); i++)
atom[i] = XInternAtom(dpy, atomNames[i], False);
}
#endif
diff --git a/src/winspector.c b/src/winspector.c
index bd56415..8cb49df 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -831,7 +831,7 @@ static void revertSettings(WMWidget *button, void
*client_data)
wWindowSetupInitialAttributes(wwin, &level, &workspace);
- for (i = 0; i < (sizeof(panel->attrChk) / sizeof(panel->attrChk[0]));
i++) {
+ for (i = 0; i < wlengthof(panel->attrChk); i++) {
int flag = 0;
switch (i) {
@@ -872,7 +872,7 @@ static void revertSettings(WMWidget *button, void
*client_data)
WMSetButtonSelected(panel->attrChk[i], flag);
}
- for (i = 0; i < (sizeof(panel->moreChk) / sizeof(panel->moreChk[0]));
i++) {
+ for (i = 0; i < wlengthof(panel->moreChk); i++) {
int flag = 0;
switch (i) {
@@ -918,7 +918,7 @@ static void revertSettings(WMWidget *button, void
*client_data)
WMSetButtonSelected(panel->moreChk[i], flag);
}
if (panel->appFrm && wapp) {
- for (i = 0; i < (sizeof(panel->appChk) /
sizeof(panel->appChk[0])); i++) {
+ for (i = 0; i < wlengthof(panel->appChk); i++) {
int flag = 0;
switch (i) {
@@ -1318,7 +1318,7 @@ static void create_tab_window_attributes(WWindow *wwin,
InspectorPanel *panel, i
WMMoveWidget(panel->attrFrm, 15, 45);
WMResizeWidget(panel->attrFrm, frame_width, 250);
- for (i = 0; i < (sizeof(panel->attrChk) / sizeof(panel->attrChk[0]));
i++) {
+ for (i = 0; i < wlengthof(panel->attrChk); i++) {
switch (i) {
case 0:
caption = _("Disable titlebar");
@@ -1402,7 +1402,7 @@ static void create_tab_window_advanced(WWindow *wwin,
InspectorPanel *panel, int
WMMoveWidget(panel->moreFrm, 15, 45);
WMResizeWidget(panel->moreFrm, frame_width, 265);
- for (i = 0; i < (sizeof(panel->moreChk) / sizeof(panel->moreChk[0]));
i++) {
+ for (i = 0; i < wlengthof(panel->moreChk); i++) {
switch (i) {
case 0:
caption = _("Do not bind keyboard shortcuts");
@@ -1565,7 +1565,7 @@ static void create_tab_app_specific(WWindow *wwin,
InspectorPanel *panel, int fr
WMMoveWidget(panel->appFrm, 15, 50);
WMResizeWidget(panel->appFrm, frame_width, 240);
- for (i = 0; i < (sizeof(panel->appChk) /
sizeof(panel->appChk[0])); i++) {
+ for (i = 0; i < wlengthof(panel->appChk); i++) {
switch (i) {
case 0:
caption = _("Start hidden");
diff --git a/src/wmspec.c b/src/wmspec.c
index 58c7f9f..d6851d7 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -198,8 +198,6 @@ static atomitem_t atomNames[] = {
{"UTF8_STRING", &utf8_string},
};
-#define atomNr (sizeof(atomNames)/sizeof(atomNames[0]))
-
#define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1
#define _NET_WM_STATE_TOGGLE 2
@@ -235,7 +233,7 @@ typedef struct NetData {
static void setSupportedHints(WScreen *scr)
{
- Atom atom[atomNr];
+ Atom atom[wlengthof(atomNames)];
int i = 0;
/* set supported hints list */
@@ -534,19 +532,19 @@ void wNETWMInitStuff(WScreen *scr)
#ifdef HAVE_XINTERNATOMS
{
- Atom atoms[atomNr];
- char *names[atomNr];
+ Atom atoms[wlengthof(atomNames)];
+ char *names[wlengthof(atomNames)];
- for (i = 0; i < atomNr; ++i)
+ for (i = 0; i < wlengthof(atomNames); ++i)
names[i] = atomNames[i].name;
- XInternAtoms(dpy, &names[0], atomNr, False, atoms);
- for (i = 0; i < atomNr; ++i)
+ XInternAtoms(dpy, &names[0], wlengthof(atomNames), False,
atoms);
+ for (i = 0; i < wlengthof(atomNames); ++i)
*atomNames[i].atom = atoms[i];
}
#else
- for (i = 0; i < atomNr; i++)
+ for (i = 0; i < wlengthof(atomNames); i++)
*atomNames[i].atom = XInternAtom(dpy, atomNames[i].name, False);
#endif
@@ -585,7 +583,7 @@ void wNETWMCleanup(WScreen *scr)
{
int i;
- for (i = 0; i < atomNr; i++)
+ for (i = 0; i < wlengthof(atomNames); i++)
XDeleteProperty(dpy, scr->root_win, *atomNames[i].atom);
}
diff --git a/src/xutil.c b/src/xutil.c
index 3d1e83e..dbac37d 100644
--- a/src/xutil.c
+++ b/src/xutil.c
@@ -168,7 +168,7 @@ void FormatXError(Display * dpy, XErrorEvent * error, char
*buffer, int size)
if (i > size - 100)
return;
buffer += i;
- if (error->request_code >= sizeof(requestCodes) /
sizeof(requestCodes[0])) {
+ if (error->request_code >= wlengthof(requestCodes)) {
sprintf(buffer, "n Request code: %in",
error->request_code);
} else {
sprintf(buffer, "n Request code: %i %sn",
error->request_code,
http://repo.or.cz/w/wmaker-crm.git/commit/059492c7433c630768c4884bb83a43300a9f259a
commit 059492c7433c630768c4884bb83a43300a9f259a
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 21:18:20 2013 +0100
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 <[email protected]>
diff --git a/WINGs/menuparser.c b/WINGs/menuparser.c
index e4f616c..db0225b 100644
--- a/WINGs/menuparser.c
+++ b/WINGs/menuparser.c
@@ -596,7 +596,7 @@ static void menu_parser_condition_ifmacro(WMenuParser
parser, Bool check_exists)
parser->rd++;
/* Add this condition to the stack of conditions */
- if (parser->cond.depth >= sizeof(parser->cond.stack) /
sizeof(parser->cond.stack[0])) {
+ if (parser->cond.depth >= wlengthof(parser->cond.stack)) {
WMenuParserError(parser, _("too many nested #if sequences") );
return;
}
diff --git a/WINGs/menuparser_macros.c b/WINGs/menuparser_macros.c
index 2b093db..5b98ef8 100644
--- a/WINGs/menuparser_macros.c
+++ b/WINGs/menuparser_macros.c
@@ -190,7 +190,7 @@ void menu_parser_define_macro(WMenuParser parser)
}
if (*parser->rd == ')') break;
- if (macro->arg_count >= sizeof(arg_name) /
sizeof(arg_name[0])) {
+ if (macro->arg_count >= wlengthof(arg_name)) {
WMenuParserError(parser, _("too many parameters
for macro "%s" definition"), macro->name);
wfree(macro);
*parser->rd = '0'; // fake end-of-line to avoid
warnings from remaining line content
diff --git a/WINGs/wfontpanel.c b/WINGs/wfontpanel.c
index 3f29051..0c1d3fd 100644
--- a/WINGs/wfontpanel.c
+++ b/WINGs/wfontpanel.c
@@ -442,7 +442,7 @@ static void addSizeToTypeface(Typeface * face, int size)
if (size == 0) {
int j;
- for (j = 0; j < sizeof(scalableFontSizes) /
sizeof(scalableFontSizes[0]); j++) {
+ for (j = 0; j < wlengthof(scalableFontSizes); j++) {
size = scalableFontSizes[j];
if (!WMCountInArray(face->sizes, (void *)(uintptr_t)
size)) {
diff --git a/WINGs/widgets.c b/WINGs/widgets.c
index 7b9ffe8..75b44e7 100644
--- a/WINGs/widgets.c
+++ b/WINGs/widgets.c
@@ -550,7 +550,7 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int
screen, RContext * c
"_NET_WM_ICON_NAME",
"_NET_WM_ICON",
};
- Atom atoms[sizeof(atomNames) / sizeof(atomNames[0])];
+ Atom atoms[wlengthof(atomNames)];
int i;
if (!initialized) {
@@ -801,9 +801,9 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int
screen, RContext * c
}
#ifdef HAVE_XINTERNATOMS
- XInternAtoms(display, atomNames, sizeof(atomNames) /
sizeof(atomNames[0]), False, atoms);
+ XInternAtoms(display, atomNames, wlengthof(atomNames), False, atoms);
#else
- for (i = 0; i < sizeof(atomNames) / sizeof(atomNames[0]); i++) {
+ for (i = 0; i < wlengthof(atomNames); i++) {
atoms[i] = XInternAtom(display, atomNames[i], False);
}
#endif
http://repo.or.cz/w/wmaker-crm.git/commit/b6d01c3f85abdfdf68dbf64672b0e2c4c4e9830c
commit b6d01c3f85abdfdf68dbf64672b0e2c4c4e9830c
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 21:18:19 2013 +0100
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 <[email protected]>
diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index f14af47..ec691f4 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -88,6 +88,27 @@
#endif /* !NDEBUG */
+#ifdef static_assert
+# define _wutil_static_assert(check, message) static_assert(check, message)
+#else
+# ifdef __STDC_VERSION__
+# if __STDC_VERSION__ >= 201112L
+/*
+ * Ideally, we would like to include <assert.h> to have 'static_assert'
+ * properly defined, but as we have to be sure about portability and
+ * because we're a public header we can't count on 'configure' to tell
+ * us about availability, so we use the raw C11 keyword
+ */
+# define _wutil_static_assert(check, message) _Static_assert(check, message)
+# else
+# define _wutil_static_assert(check, message) /**/
+# endif
+# else
+# define _wutil_static_assert(check, message) /**/
+# endif
+#endif
+
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -182,6 +203,16 @@ typedef void WMNotificationObserverAction(void
*observerData,
WMNotification *notification);
+/* ---[ Macros ]---------------------------------------------------------- */
+
+#define wlengthof(array) + ({ +
_wutil_static_assert(sizeof(array) > sizeof(array[0]), +
"the macro 'wlengthof' cannot be used on pointers, only on known
size arrays"); + sizeof(array) / sizeof(array[0]); + })
+
+
/* ---[ WINGs/memory.c ]-------------------------------------------------- */
void* wmalloc(size_t size);
diff --git a/configure.ac b/configure.ac
index 310e679..b46b575 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
AC_SUBST(WINGS_VERSION)
dnl
dnl libWUtil
-WUTIL_CURRENT=3
+WUTIL_CURRENT=4
WUTIL_REVISION=0
WUTIL_AGE=0
WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
http://repo.or.cz/w/wmaker-crm.git/commit/b72eb6747bf5edb282c636a80fa47765c4a53222
commit b72eb6747bf5edb282c636a80fa47765c4a53222
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 18:50:03 2013 +0100
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 <[email protected]>
diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index 910c1f7..617e453 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -36,28 +36,28 @@ libwraster_la_SOURCES = convolve.c
save_xpm.c xutil.c - ppm.c
+ load_ppm.c
if USE_GIF
-libwraster_la_SOURCES += gif.c
+libwraster_la_SOURCES += load_gif.c
endif
if USE_JPEG
-libwraster_la_SOURCES += jpeg.c
+libwraster_la_SOURCES += load_jpeg.c
endif
if USE_PNG
-libwraster_la_SOURCES += png.c
+libwraster_la_SOURCES += load_png.c
endif
if USE_TIFF
-libwraster_la_SOURCES += tiff.c
+libwraster_la_SOURCES += load_tiff.c
endif
if USE_XPM
-libwraster_la_SOURCES += xpm.c
+libwraster_la_SOURCES += load_xpm.c
else
-libwraster_la_SOURCES += nxpm.c
+libwraster_la_SOURCES += load_xpm_normalized.c
endif
LTCOMPILE2=`echo $(LTCOMPILE) | sed -e s/-fomit-frame-pointer//`
diff --git a/wrlib/gif.c b/wrlib/load_gif.c
similarity index 100%
rename from wrlib/gif.c
rename to wrlib/load_gif.c
diff --git a/wrlib/jpeg.c b/wrlib/load_jpeg.c
similarity index 100%
rename from wrlib/jpeg.c
rename to wrlib/load_jpeg.c
diff --git a/wrlib/png.c b/wrlib/load_png.c
similarity index 100%
rename from wrlib/png.c
rename to wrlib/load_png.c
diff --git a/wrlib/ppm.c b/wrlib/load_ppm.c
similarity index 100%
rename from wrlib/ppm.c
rename to wrlib/load_ppm.c
diff --git a/wrlib/tiff.c b/wrlib/load_tiff.c
similarity index 100%
rename from wrlib/tiff.c
rename to wrlib/load_tiff.c
diff --git a/wrlib/xpm.c b/wrlib/load_xpm.c
similarity index 100%
rename from wrlib/xpm.c
rename to wrlib/load_xpm.c
diff --git a/wrlib/nxpm.c b/wrlib/load_xpm_normalized.c
similarity index 100%
rename from wrlib/nxpm.c
rename to wrlib/load_xpm_normalized.c
http://repo.or.cz/w/wmaker-crm.git/commit/f79c93aeae32bdf70eb7b17fa2daec2198111fb6
commit f79c93aeae32bdf70eb7b17fa2daec2198111fb6
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 18:50:02 2013 +0100
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 <[email protected]>
diff --git a/wrlib/nxpm.c b/wrlib/nxpm.c
index 3a14637..09371d1 100644
--- a/wrlib/nxpm.c
+++ b/wrlib/nxpm.c
@@ -80,6 +80,12 @@ RImage *RGetImageFromXPMData(RContext * context, char **data)
int bsize;
int w, h, ccount, csize;
+ /*
+ * When using libXpm we need the context argument but the code here does
+ * not, so tell the compiler to not warn about it
+ */
+ (void) context;
+
if (sscanf(data[line++], "%i %i %i %i", &w, &h, &ccount, &csize) != 4
|| w <= 0 || h <= 0 || ccount <= 0 || csize <= 0)
goto bad_format;
@@ -242,6 +248,12 @@ RImage *RLoadXPM(RContext * context, const char *file)
int w, h, ccount, csize;
FILE *f;
+ /*
+ * When using libXpm we need the context argument but the code here does
+ * not, so tell the compiler to not warn about it
+ */
+ (void) context;
+
f = fopen(file, "rb");
if (!f) {
RErrorCode = RERR_OPEN;
http://repo.or.cz/w/wmaker-crm.git/commit/897c8c860a6057ef85f408241df7c5fc12db082f
commit 897c8c860a6057ef85f408241df7c5fc12db082f
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 18:50:01 2013 +0100
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 <[email protected]>
diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index e98e028..910c1f7 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -34,7 +34,6 @@ libwraster_la_SOURCES = scale.c
rotate.c convolve.c - nxpm.c
save_xpm.c xutil.c ppm.c
@@ -57,6 +56,8 @@ endif
if USE_XPM
libwraster_la_SOURCES += xpm.c
+else
+libwraster_la_SOURCES += nxpm.c
endif
LTCOMPILE2=`echo $(LTCOMPILE) | sed -e s/-fomit-frame-pointer//`
diff --git a/wrlib/nxpm.c b/wrlib/nxpm.c
index 0d0e5f5..3a14637 100644
--- a/wrlib/nxpm.c
+++ b/wrlib/nxpm.c
@@ -52,7 +52,6 @@
#define LINEWIDTH 64
-#ifndef USE_XPM
static void free_color_symbol_table(unsigned char *color_table[],
unsigned short *symbol_table)
@@ -444,5 +443,3 @@ RImage *RLoadXPM(RContext * context, const char *file)
RReleaseImage(image);
return NULL;
}
-
-#endif
http://repo.or.cz/w/wmaker-crm.git/commit/630b8bb361f56c7363c178f3585d7dc655b3069d
commit 630b8bb361f56c7363c178f3585d7dc655b3069d
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 18:50:00 2013 +0100
wrlib: separated the code to save to XPM from the builtin XPM loading
Big files are harder to work with, so split load and save, which
happen to already be independent anyway.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index ded558e..e98e028 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -35,6 +35,7 @@ libwraster_la_SOURCES = rotate.c
convolve.c nxpm.c + save_xpm.c xutil.c
ppm.c
diff --git a/wrlib/nxpm.c b/wrlib/nxpm.c
index 37a48e8..0d0e5f5 100644
--- a/wrlib/nxpm.c
+++ b/wrlib/nxpm.c
@@ -446,235 +446,3 @@ RImage *RLoadXPM(RContext * context, const char *file)
}
#endif
-
-typedef struct XPMColor {
- unsigned char red;
- unsigned char green;
- unsigned char blue;
- int index;
- struct XPMColor *next;
-} XPMColor;
-
-#define I2CHAR(i) ((i)<12 ? (i)+'0' : ((i)<38 ? (i)+'A'-12 : (i)+'a'-38))
-#define CINDEX(xpmc)
(((unsigned)(xpmc)->red)<<16|((unsigned)(xpmc)->green)<<8|((unsigned)(xpmc)->blue))
-
-static XPMColor *lookfor(XPMColor * list, int index)
-{
- if (!list)
- return NULL;
-
- for (; list != NULL; list = list->next) {
- if (CINDEX(list) == index)
- return list;
- }
- return NULL;
-}
-
-/*
- * Looks for the color in the colormap and inserts if it is not found.
- *
- * list is a binary search list. The unbalancing problem is just ignored.
- *
- * Returns False on error
- */
-static Bool addcolor(XPMColor ** list, unsigned r, unsigned g, unsigned b, int
*colors)
-{
- XPMColor *tmpc;
- XPMColor *newc;
- int index;
-
- index = r << 16 | g << 8 | b;
- tmpc = *list;
-
- tmpc = lookfor(*list, index);
-
- if (tmpc)
- return True;
-
- newc = malloc(sizeof(XPMColor));
-
- if (!newc) {
-
- RErrorCode = RERR_NOMEMORY;
-
- return False;
- }
-
- newc->red = r;
- newc->green = g;
- newc->blue = b;
- newc->next = *list;
- *list = newc;
-
- (*colors)++;
-
- return True;
-}
-
-static char *index2str(char *buffer, int index, int charsPerPixel)
-{
- int i;
-
- for (i = 0; i < charsPerPixel; i++) {
- buffer[i] = I2CHAR(index & 63);
- index >>= 6;
- }
- buffer[i] = 0;
-
- return buffer;
-}
-
-static void outputcolormap(FILE * file, XPMColor * colormap, int charsPerPixel)
-{
- int index;
- char buf[128];
-
- if (!colormap)
- return;
-
- for (index = 0; colormap != NULL; colormap = colormap->next, index++) {
- colormap->index = index;
- fprintf(file, ""%s c #%02x%02x%02x",n",
- index2str(buf, index, charsPerPixel), colormap->red,
colormap->green, colormap->blue);
- }
-}
-
-static void freecolormap(XPMColor * colormap)
-{
- XPMColor *tmp;
-
- while (colormap) {
- tmp = colormap->next;
- free(colormap);
- colormap = tmp;
- }
-}
-
-/* save routine is common to internal support and library support */
-Bool RSaveXPM(RImage * image, const char *filename)
-{
- FILE *file;
- int x, y;
- int colorCount = 0;
- int charsPerPixel;
- XPMColor *colormap = NULL;
- XPMColor *tmpc;
- int i;
- int ok = 0;
- unsigned char *r, *g, *b, *a;
- char transp[16];
- char buf[128];
-
- file = fopen(filename, "wb+");
- if (!file) {
- RErrorCode = RERR_OPEN;
- return False;
- }
-
- fprintf(file, "/* XPM */n");
-
- fprintf(file, "static char *image[] = {n");
-
- r = image->data;
- g = image->data + 1;
- b = image->data + 2;
- if (image->format == RRGBAFormat)
- a = image->data + 3;
- else
- a = NULL;
-
- /* first pass: make colormap for the image */
- if (a)
- colorCount = 1;
- for (y = 0; y < image->height; y++) {
- for (x = 0; x < image->width; x++) {
- if (!a || *a > 127) {
- if (!addcolor(&colormap, *r, *g, *b,
&colorCount)) {
- goto uhoh;
- }
- }
- if (a) {
- r += 4;
- g += 4;
- b += 4;
- a += 4;
- } else {
- r += 3;
- g += 3;
- b += 3;
- }
- }
- }
-
- charsPerPixel = 1;
- while ((1 << charsPerPixel * 6) < colorCount)
- charsPerPixel++;
-
- /* write header info */
- fprintf(file, ""%i %i %i %i",n", image->width, image->height,
colorCount, charsPerPixel);
-
- /* write colormap data */
- if (a) {
- for (i = 0; i < charsPerPixel; i++)
- transp[i] = ' ';
- transp[i] = 0;
-
- fprintf(file, ""%s c None",n", transp);
- }
-
- i = 0;
- outputcolormap(file, colormap, charsPerPixel);
-
- r = image->data;
- g = image->data + 1;
- b = image->data + 2;
- if (image->format == RRGBAFormat)
- a = image->data + 3;
- else
- a = NULL;
-
- /* write data */
- for (y = 0; y < image->height; y++) {
-
- fprintf(file, """);
-
- for (x = 0; x < image->width; x++) {
-
- if (!a || *a > 127) {
- tmpc = lookfor(colormap, (unsigned)*r << 16 |
(unsigned)*g << 8 | (unsigned)*b);
-
- fprintf(file, "%s", index2str(buf, tmpc->index,
charsPerPixel));
- } else {
- fprintf(file, "%s", transp);
- }
-
- if (a) {
- r += 4;
- g += 4;
- b += 4;
- a += 4;
- } else {
- r += 3;
- g += 3;
- b += 3;
- }
- }
-
- if (y < image->height - 1)
- fprintf(file, "",n");
- else
- fprintf(file, ""};n");
- }
-
- ok = 1;
- uhoh:
- errno = 0;
- fclose(file);
- if (ok && errno == ENOSPC) {
- RErrorCode = RERR_WRITE;
- }
-
- freecolormap(colormap);
-
- return ok ? True : False;
-}
diff --git a/wrlib/save_xpm.c b/wrlib/save_xpm.c
new file mode 100644
index 0000000..3e6c976
--- /dev/null
+++ b/wrlib/save_xpm.c
@@ -0,0 +1,283 @@
+/* nxpm.c - load "normalized" XPM image
+ *
+ * Raster graphics library
+ *
+ * Copyright (c) 1997-2003 Alfredo K. Kojima
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <errno.h>
+
+#include "wraster.h"
+#include "imgformat.h"
+
+/*
+ * Restricted support for XPM images.
+ *
+ * The images must be in the following "normalized" format:
+ *
+ *
+ * line content
+ * 1 signature comment
+ * 2 ignored ( normally "static char *xpm[] = {" )
+ * 3 "width height color_count chars" where chars is 1 or 2
+ * 4 color definitions. Only c values with #rrggbb or #rrrrggggbbb
+ * format OR None
+ * n data
+ *
+ * - no comments or blank lines are allowed, except for the signature
+ * - all lines must have at most 256 characters
+ * - no white spaces allowed at left of each line
+ */
+
+typedef struct XPMColor {
+ unsigned char red;
+ unsigned char green;
+ unsigned char blue;
+ int index;
+ struct XPMColor *next;
+} XPMColor;
+
+#define I2CHAR(i) ((i)<12 ? (i)+'0' : ((i)<38 ? (i)+'A'-12 : (i)+'a'-38))
+#define CINDEX(xpmc)
(((unsigned)(xpmc)->red)<<16|((unsigned)(xpmc)->green)<<8|((unsigned)(xpmc)->blue))
+
+static XPMColor *lookfor(XPMColor * list, int index)
+{
+ if (!list)
+ return NULL;
+
+ for (; list != NULL; list = list->next) {
+ if (CINDEX(list) == index)
+ return list;
+ }
+ return NULL;
+}
+
+/*
+ * Looks for the color in the colormap and inserts if it is not found.
+ *
+ * list is a binary search list. The unbalancing problem is just ignored.
+ *
+ * Returns False on error
+ */
+static Bool addcolor(XPMColor ** list, unsigned r, unsigned g, unsigned b, int
*colors)
+{
+ XPMColor *tmpc;
+ XPMColor *newc;
+ int index;
+
+ index = r << 16 | g << 8 | b;
+ tmpc = *list;
+
+ tmpc = lookfor(*list, index);
+
+ if (tmpc)
+ return True;
+
+ newc = malloc(sizeof(XPMColor));
+
+ if (!newc) {
+
+ RErrorCode = RERR_NOMEMORY;
+
+ return False;
+ }
+
+ newc->red = r;
+ newc->green = g;
+ newc->blue = b;
+ newc->next = *list;
+ *list = newc;
+
+ (*colors)++;
+
+ return True;
+}
+
+static char *index2str(char *buffer, int index, int charsPerPixel)
+{
+ int i;
+
+ for (i = 0; i < charsPerPixel; i++) {
+ buffer[i] = I2CHAR(index & 63);
+ index >>= 6;
+ }
+ buffer[i] = 0;
+
+ return buffer;
+}
+
+static void outputcolormap(FILE * file, XPMColor * colormap, int charsPerPixel)
+{
+ int index;
+ char buf[128];
+
+ if (!colormap)
+ return;
+
+ for (index = 0; colormap != NULL; colormap = colormap->next, index++) {
+ colormap->index = index;
+ fprintf(file, ""%s c #%02x%02x%02x",n",
+ index2str(buf, index, charsPerPixel), colormap->red,
colormap->green, colormap->blue);
+ }
+}
+
+static void freecolormap(XPMColor * colormap)
+{
+ XPMColor *tmp;
+
+ while (colormap) {
+ tmp = colormap->next;
+ free(colormap);
+ colormap = tmp;
+ }
+}
+
+/* save routine is common to internal support and library support */
+Bool RSaveXPM(RImage * image, const char *filename)
+{
+ FILE *file;
+ int x, y;
+ int colorCount = 0;
+ int charsPerPixel;
+ XPMColor *colormap = NULL;
+ XPMColor *tmpc;
+ int i;
+ int ok = 0;
+ unsigned char *r, *g, *b, *a;
+ char transp[16];
+ char buf[128];
+
+ file = fopen(filename, "wb+");
+ if (!file) {
+ RErrorCode = RERR_OPEN;
+ return False;
+ }
+
+ fprintf(file, "/* XPM */n");
+
+ fprintf(file, "static char *image[] = {n");
+
+ r = image->data;
+ g = image->data + 1;
+ b = image->data + 2;
+ if (image->format == RRGBAFormat)
+ a = image->data + 3;
+ else
+ a = NULL;
+
+ /* first pass: make colormap for the image */
+ if (a)
+ colorCount = 1;
+ for (y = 0; y < image->height; y++) {
+ for (x = 0; x < image->width; x++) {
+ if (!a || *a > 127) {
+ if (!addcolor(&colormap, *r, *g, *b,
&colorCount)) {
+ goto uhoh;
+ }
+ }
+ if (a) {
+ r += 4;
+ g += 4;
+ b += 4;
+ a += 4;
+ } else {
+ r += 3;
+ g += 3;
+ b += 3;
+ }
+ }
+ }
+
+ charsPerPixel = 1;
+ while ((1 << charsPerPixel * 6) < colorCount)
+ charsPerPixel++;
+
+ /* write header info */
+ fprintf(file, ""%i %i %i %i",n", image->width, image->height,
colorCount, charsPerPixel);
+
+ /* write colormap data */
+ if (a) {
+ for (i = 0; i < charsPerPixel; i++)
+ transp[i] = ' ';
+ transp[i] = 0;
+
+ fprintf(file, ""%s c None",n", transp);
+ }
+
+ i = 0;
+ outputcolormap(file, colormap, charsPerPixel);
+
+ r = image->data;
+ g = image->data + 1;
+ b = image->data + 2;
+ if (image->format == RRGBAFormat)
+ a = image->data + 3;
+ else
+ a = NULL;
+
+ /* write data */
+ for (y = 0; y < image->height; y++) {
+
+ fprintf(file, """);
+
+ for (x = 0; x < image->width; x++) {
+
+ if (!a || *a > 127) {
+ tmpc = lookfor(colormap, (unsigned)*r << 16 |
(unsigned)*g << 8 | (unsigned)*b);
+
+ fprintf(file, "%s", index2str(buf, tmpc->index,
charsPerPixel));
+ } else {
+ fprintf(file, "%s", transp);
+ }
+
+ if (a) {
+ r += 4;
+ g += 4;
+ b += 4;
+ a += 4;
+ } else {
+ r += 3;
+ g += 3;
+ b += 3;
+ }
+ }
+
+ if (y < image->height - 1)
+ fprintf(file, "",n");
+ else
+ fprintf(file, ""};n");
+ }
+
+ ok = 1;
+ uhoh:
+ errno = 0;
+ fclose(file);
+ if (ok && errno == ENOSPC) {
+ RErrorCode = RERR_WRITE;
+ }
+
+ freecolormap(colormap);
+
+ return ok ? True : False;
+}
http://repo.or.cz/w/wmaker-crm.git/commit/b1b688980beaa9e1fe7ec5af224a9d7e733532ad
commit b1b688980beaa9e1fe7ec5af224a9d7e733532ad
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 18:49:59 2013 +0100
configure: Moved PPM image format handling to a consistent place
Even if there is nothing to do for PPM at current time (all builtin
code), for consistency it is better placed with the other image
format checks.
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/configure.ac b/configure.ac
index bdc1bbe..310e679 100644
--- a/configure.ac
+++ b/configure.ac
@@ -690,6 +690,13 @@ AC_ARG_ENABLE([tiff],
WM_IMGFMT_CHECK_TIFF
+dnl PPM Support
+dnl ===========
+# The PPM format is always enabled because we have built-in support for the
format
+# We are not using any external library like libppm
+supported_gfx="$supported_gfx builtin-PPM"
+
+
# Choice of the default format for icons
AS_IF([test "x$enable_tiff" != "xno"],
[ICONEXT="tiff"],
@@ -805,8 +812,6 @@ dnl
dnl Spit out the configuration
dnl ==========================
-supported_gfx="$supported_gfx builtin-PPM"
-
if test "x$MOFILES" = "x"; then
mof=None
else
http://repo.or.cz/w/wmaker-crm.git/commit/b7a8ff3d4751e73f2e4cc2c098f9c503c393a281
commit b7a8ff3d4751e73f2e4cc2c098f9c503c393a281
Author: Christophe CURIS <[email protected]>
Date: Fri Nov 8 18:49:58 2013 +0100
wrlib: Moved configure's detection of XPM support to a dedicated macro
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.
The new macro:
- uses as much as possible autoconf macros for portability and code
consistency;
- provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
- makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
- uses an automake conditional to avoid compiling the file is support is
not enabled
Signed-off-by: Christophe CURIS <[email protected]>
diff --git a/configure.ac b/configure.ac
index 605bc8f..bdc1bbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,7 @@ AS_IF([test "x$debug" = "xyes"],
dnl Tracking on what is detected for final status
dnl =============================================
unsupported=""
+supported_gfx=""
dnl Platform-specific Makefile setup
@@ -625,24 +626,14 @@ dnl ==============================================
dnl XPM Support
dnl ===========
-xpm=yes
-AC_ARG_ENABLE(xpm, AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps
through libXpm]),
- xpm=$enableval, xpm=yes)
-
-if test "$xpm" = yes; then
- WM_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [$XLFLAGS $XLIBS])
-
- if test "x$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = xyes; then
- WM_CHECK_HEADER(X11/xpm.h)
- if test "x$ac_cv_header_X11_xpm_h" = xyes; then
- GFXLIBS="$GFXLIBS -lXpm"
- supported_gfx="XPM"
- AC_DEFINE(USE_XPM, 1, [define if XPM libraries are available
(set by configure)])
- else
- supported_gfx="builtin-XPM"
- fi
- fi
-fi
+AC_ARG_ENABLE([xpm],
+ [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through
libXpm])],
+ [AS_CASE(["$enableval"],
+ [yes|no], [],
+ [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
+ [enable_xpm=auto])
+WM_IMGFMT_CHECK_XPM
+
# for wmlib
AC_SUBST(XCFLAGS)
@@ -835,7 +826,7 @@ echo "Installation path prefix : $prefix"
echo "Installation path for binaries : $_bindir"
echo "Installation path for libraries : $libdir"
echo "Installation path for WPrefs.app : $wprefs_base_dir" | sed -e
's|${prefix}|'"$prefix|"
-echo "Supported graphic format libraries : $supported_gfx"
+echo "Supported graphic format libraries :$supported_gfx"
echo "Unsupported features :$unsupported"
echo "Antialiased text support in WINGs : $xft"
echo "Xinerama extension support : $xinerama"
diff --git a/m4/wm_imgfmt_check.m4 b/m4/wm_imgfmt_check.m4
index 2ab9a17..cd276b0 100644
--- a/m4/wm_imgfmt_check.m4
+++ b/m4/wm_imgfmt_check.m4
@@ -248,6 +248,55 @@ AM_CONDITIONAL([USE_TIFF], [test "x$enable_tiff" !=
"xno"])dnl
]) dnl AC_DEFUN
+# WM_IMGFMT_CHECK_XPM
+# -------------------
+#
+# Check for XPM file support through 'libXpm'
+# The check depends on variable 'enable_xpm' being either:
+# yes - detect, fail if not found
+# no - do not detect, use internal support
+# auto - detect, use internal if not found
+#
+# When found, append appropriate stuff in GFXLIBS, and append info to
+# the variable 'supported_gfx'
+AC_DEFUN_ONCE([WM_IMGFMT_CHECK_XPM],
+[AC_REQUIRE([_WM_IMGFMT_CHECK_FUNCTS])
+AS_IF([test "x$enable_xpm" = "xno"],
+ [supported_gfx="$supported_gfx builtin-XPM"],
+ [AC_CACHE_CHECK([for XPM support library], [wm_cv_imgfmt_xpm],
+ [wm_cv_imgfmt_xpm=no
+ dnl
+ dnl We check first if one of the known libraries is available
+ wm_save_LIBS="$LIBS"
+ AS_IF([wm_fn_imgfmt_try_link "XpmCreatePixmapFromData" "$XLFLAGS
$XLIBS -lXpm"],
+ [wm_cv_imgfmt_xpm="-lXpm" ; break])
+ LIBS="$wm_save_LIBS"
+ AS_IF([test "x$enable_xpm$wm_cv_imgfmt_xpm" = "xyesno"],
+ [AC_MSG_ERROR([explicit libXpm support requested but no library
found])])
+ AS_IF([test "x$wm_cv_imgfmt_xpm" != "xno"],
+ [dnl
+ dnl A library was found, now check for the appropriate header
+ wm_save_CFLAGS="$CFLAGS"
+ AS_IF([wm_fn_imgfmt_try_compile "X11/xpm.h" "return 0" "$XCFLAGS"],
+ [],
+ [AC_MSG_ERROR([found $wm_cv_imgfmt_xpm but could not find
appropriate header - are you missing libXpm-dev package?])])
+ AS_IF([wm_fn_imgfmt_try_compile "X11/xpm.h"
'XpmReadFileToXpmImage((char *)filename, NULL, NULL)' "$XCFLAGS"],
+ [],
+ [AC_MSG_ERROR([found $wm_cv_imgfmt_xpm and header, but cannot
compile - unsupported version?])])
+ CFLAGS="$wm_save_CFLAGS"])
+ ])
+ AS_IF([test "x$wm_cv_imgfmt_xpm" = "xno"],
+ [supported_gfx="$supported_gfx builtin-XPM"
+ enable_xpm="no"],
+ [supported_gfx="$supported_gfx XPM"
+ GFXLIBS="$GFXLIBS $wm_cv_imgfmt_xpm"
+ AC_DEFINE([USE_XPM], [1],
+ [defined when valid XPM library with header was found])])
+ ])
+AM_CONDITIONAL([USE_XPM], [test "x$enable_xpm" != "xno"])dnl
+]) dnl AC_DEFUN
+
+
# _WM_IMGFMT_CHECK_FUNCTS
# -----------------------
# (internal shell functions)
diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index 5f4946a..ded558e 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -35,7 +35,6 @@ libwraster_la_SOURCES = rotate.c
convolve.c nxpm.c - xpm.c xutil.c
ppm.c
@@ -55,6 +54,10 @@ if USE_TIFF
libwraster_la_SOURCES += tiff.c
endif
+if USE_XPM
+libwraster_la_SOURCES += xpm.c
+endif
+
LTCOMPILE2=`echo $(LTCOMPILE) | sed -e s/-fomit-frame-pointer//`
COMPILE2=`echo $(COMPILE) | sed -e s/-fomit-frame-pointer//`
diff --git a/wrlib/xpm.c b/wrlib/xpm.c
index 12aadc6..441d957 100644
--- a/wrlib/xpm.c
+++ b/wrlib/xpm.c
@@ -1,4 +1,4 @@
-/* xpm.c - load XPM image from file
+/* xpm.c - load XPM image from file using libXpm
*
* Raster graphics library
*
@@ -22,8 +22,6 @@
#include <config.h>
-#ifdef USE_XPM
-
#include <X11/Xlib.h>
#include <stdlib.h>
#include <stdio.h>
@@ -271,5 +269,3 @@ RImage *RLoadXPM(RContext * context, const char *file)
XpmFreeXpmImage(&xpm);
return image;
}
-
-#endif /* USE_XPM */
http://repo.or.cz/w/wmaker-crm.git/commit/77a5f9e7be27a144224fd5581615fc2a8c5dcadb
commit 77a5f9e7be27a144224fd5581615fc2a8c5dcadb
Author: Amadeusz SÅawiÅski <[email protected]>
Date: Mon Nov 4 22:07:55 2013 +0100
Raise fullscreened window
Make sure that fullscreened window covers all normal windows
diff --git a/src/actions.c b/src/actions.c
index 36a0ca1..2087953 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -702,6 +702,7 @@ void wFullscreenWindow(WWindow *wwin)
wWindowConfigureBorders(wwin);
ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
+ wRaiseFrame(wwin->frame->core);
wwin->bfs_geometry.x = wwin->frame_x;
wwin->bfs_geometry.y = wwin->frame_y;
http://repo.or.cz/w/wmaker-crm.git/commit/c903043043db9e2646badea7739f0b7d94fea9a1
commit c903043043db9e2646badea7739f0b7d94fea9a1
Author: Amadeusz SÅawiÅski <[email protected]>
Date: Mon Nov 4 22:07:54 2013 +0100
Remove WMFullscreenLevel
Make fullscreen windows be on the same level as normal ones.
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index f4fa5b8..543f2e3 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -58,7 +58,6 @@ enum {
WMSubmenuLevel = 15,
WMMainMenuLevel = 20,
WMStatusLevel = 21,
- WMFullscreenLevel = 50,
WMModalLevel = 100,
WMPopUpLevel = 101,
WMScreensaverLevel = 1000,
diff --git a/src/actions.c b/src/actions.c
index 17dc965..36a0ca1 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -701,7 +701,7 @@ void wFullscreenWindow(WWindow *wwin)
wWindowConfigureBorders(wwin);
- ChangeStackingLevel(wwin->frame->core, WMFullscreenLevel);
+ ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
wwin->bfs_geometry.x = wwin->frame_x;
wwin->bfs_geometry.y = wwin->frame_y;
@@ -725,14 +725,10 @@ void wUnfullscreenWindow(WWindow *wwin)
wwin->flags.fullscreen = False;
- if (wwin->frame->core->stacking->window_level == WMFullscreenLevel) {
- if (WFLAGP(wwin, sunken)) {
- ChangeStackingLevel(wwin->frame->core, WMSunkenLevel);
- } else if (WFLAGP(wwin, floating)) {
- ChangeStackingLevel(wwin->frame->core, WMFloatingLevel);
- } else {
- ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
- }
+ if (WFLAGP(wwin, sunken)) {
+ ChangeStackingLevel(wwin->frame->core, WMSunkenLevel);
+ } else if (WFLAGP(wwin, floating)) {
+ ChangeStackingLevel(wwin->frame->core, WMFloatingLevel);
}
wWindowConfigure(wwin, wwin->bfs_geometry.x, wwin->bfs_geometry.y,
diff --git a/src/wmspec.c b/src/wmspec.c
index b4a8cfa..58c7f9f 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -927,7 +927,7 @@ static int getWindowLayer(WWindow *wwin)
if (wwin->transient_for) {
WWindow *parent = wWindowFor(wwin->transient_for);
if (parent && parent->flags.fullscreen)
- layer = WMFullscreenLevel;
+ layer = WMNormalLevel;
}
/* //layer = WMPopUpLevel; // this seems a bad idea -Dan */
} else if (wwin->type == net_wm_window_type_normal) {
-----------------------------------------------------------------------
Summary of changes:
WINGs/WINGs/WUtil.h | 31 ++++
WINGs/menuparser.c | 2 +-
WINGs/menuparser_macros.c | 2 +-
WINGs/wfontpanel.c | 2 +-
WINGs/widgets.c | 6 +-
WPrefs.app/Appearance.c | 2 +-
WPrefs.app/Expert.c | 6 +-
WPrefs.app/KeyboardShortcuts.c | 2 +-
WPrefs.app/MouseSettings.c | 4 +-
WPrefs.app/Workspace.c | 2 +-
configure.ac | 61 ++++---
m4/wm_imgfmt_check.m4 | 49 ++++++
m4/wm_prog_cc_c11.m4 | 48 ++++++
src/WindowMaker.h | 1 -
src/actions.c | 15 +-
src/defaults.c | 8 +-
src/startup.c | 6 +-
src/winspector.c | 12 +-
src/wmspec.c | 20 +--
src/xutil.c | 2 +-
util/fontconv.c | 2 +-
wrlib/Makefile.am | 19 ++-
wrlib/{gif.c => load_gif.c} | 0
wrlib/{jpeg.c => load_jpeg.c} | 0
wrlib/{png.c => load_png.c} | 0
wrlib/{ppm.c => load_ppm.c} | 0
wrlib/{tiff.c => load_tiff.c} | 0
wrlib/{xpm.c => load_xpm.c} | 6 +-
wrlib/{nxpm.c => load_xpm_normalized.c} | 247 ++-------------------------
wrlib/save_xpm.c | 283 +++++++++++++++++++++++++++++++
30 files changed, 517 insertions(+), 321 deletions(-)
create mode 100644 m4/wm_prog_cc_c11.m4
rename wrlib/{gif.c => load_gif.c} (100%)
rename wrlib/{jpeg.c => load_jpeg.c} (100%)
rename wrlib/{png.c => load_png.c} (100%)
rename wrlib/{ppm.c => load_ppm.c} (100%)
rename wrlib/{tiff.c => load_tiff.c} (100%)
rename wrlib/{xpm.c => load_xpm.c} (98%)
rename wrlib/{nxpm.c => load_xpm_normalized.c} (69%)
create mode 100644 wrlib/save_xpm.c
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].