[PATCH] Fixed xinerama detection

2014-02-12 Thread David Maciejak
This patch fixes xinerama configure script auto detection when the
libs are setup but the headers are missing.
Without it, configure script is stopping on my system with the msg:
"found no but cannot compile with the header".


0001-Fixed-xinerama-detection.patch
Description: Binary data


[PATCH] Removed refs to connect and server examples

2014-02-12 Thread David Maciejak
This patch is used to remove references to missing code files.


0001-Removed-refs-to-connect-and-server-examples.patch
Description: Binary data


Re: [PATCH] Removed refs to connect and server examples

2014-02-12 Thread David Maciejak
sure, thanks.

On Wed, Feb 12, 2014 at 10:20 PM, Carlos R. Mafra  wrote:
> On Wed, 12 Feb 2014 at 22:04:36 +0800, David Maciejak wrote:
>> This patch is used to remove references to missing code files.
>
> Thanks for the patches!
>
> In the future please consider inlining the patch in the email
> body. That simplifies considerably the discussion (if the need
> arises) because we can quote parts of the patch by hitting
> "reply".
>
> Take a look at The-perfect-Window-Maker-patch.txt in the
> toplevel dir of the wmaker source if you have the time.
>
> Thanks a lot!
>
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] Fixed label display truncated for 'delays in ms for autocollapsing clips'

2014-02-12 Thread David Maciejak
This patch is fixing some label truncated in WPrefs.app

---
 WPrefs.app/Docks.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/WPrefs.app/Docks.c b/WPrefs.app/Docks.c
index 91fa338..e85f5df 100644
--- a/WPrefs.app/Docks.c
+++ b/WPrefs.app/Docks.c
@@ -169,7 +169,7 @@ static void createPanel(Panel *p)
  for (k = 0; k < 2; k++)
  {
  panel->autoDelayF[k] = WMCreateFrame(panel->box);
- WMResizeWidget(panel->autoDelayF[k], 365, 100);
+ WMResizeWidget(panel->autoDelayF[k], 370, 100);
  WMMoveWidget(panel->autoDelayF[k], 15, 10 + k * 110);
  if (k == 0)
  WMSetFrameTitle(panel->autoDelayF[k], _("Delays in milliseconds for
autocollapsing clips"));
@@ -179,7 +179,7 @@ static void createPanel(Panel *p)
  for (i = 0; i < 2; i++)
  {
  panel->autoDelayL[i + k * 2] = WMCreateLabel(panel->autoDelayF[k]);
- WMResizeWidget(panel->autoDelayL[i + k * 2], 165, 20);
+ WMResizeWidget(panel->autoDelayL[i + k * 2], 175, 20);
  WMMoveWidget(panel->autoDelayL[i + k * 2], 10, 27 + 40 * i);
  WMSetLabelText(panel->autoDelayL[i + k * 2], _(auto_delay[i + k * 2].string));
  WMSetLabelTextAlignment(panel->autoDelayL[i + k * 2], WARight);
@@ -188,7 +188,7 @@ static void createPanel(Panel *p)
  {
  panel->autoDelayB[i + k * 2][j] =
WMCreateCustomButton(panel->autoDelayF[k], WBBStateChangeMask);
  WMResizeWidget(panel->autoDelayB[i + k * 2][j], 25, 25);
- WMMoveWidget(panel->autoDelayB[i + k * 2][j], 175 + (25 * j), 25 + 40 * i);
+ WMMoveWidget(panel->autoDelayB[i + k * 2][j], 185 + (25 * j), 25 + 40 * i);
  WMSetButtonBordered(panel->autoDelayB[i + k * 2][j], False);
  WMSetButtonImagePosition(panel->autoDelayB[i + k * 2][j], WIPImageOnly);
  WMSetButtonAction(panel->autoDelayB[i + k * 2][j],
pushAutoDelayButton, panel);
@@ -213,8 +213,8 @@ static void createPanel(Panel *p)
  }

  panel->autoDelayT[i + k * 2] = WMCreateTextField(panel->autoDelayF[k]);
- WMResizeWidget(panel->autoDelayT[i + k * 2], 36, 20);
- WMMoveWidget(panel->autoDelayT[i + k * 2], 310, 27 + 40 * i);
+ WMResizeWidget(panel->autoDelayT[i + k * 2], 40, 20);
+ WMMoveWidget(panel->autoDelayT[i + k * 2], 315, 27 + 40 * i);
  WMAddNotificationObserver(autoDelayChanged, panel,
WMTextDidChangeNotification, panel->autoDelayT[i + k * 2]);
  }

-- 
1.7.10.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] Fixed label display truncated for 'delays in ms for autocollapsing clips'

2014-02-12 Thread David Maciejak
please find enclosed the patch

regards,
david

On Thu, Feb 13, 2014 at 12:12 AM, Carlos R. Mafra  wrote:
> Thanks for the inlined patch, but it seems your mail client
> screwed up the patch (it does not apply).
>
>>   WMMoveWidget(panel->autoDelayF[k], 15, 10 + k * 110);
>>   if (k == 0)
>>   WMSetFrameTitle(panel->autoDelayF[k], _("Delays in milliseconds for
>> autocollapsing clips"));
>> @@ -179,7 +179,7 @@ static void createPanel(Panel *p)
>>   for (i = 0; i < 2; i++)
>
> See how the line was word-wrapped...
>
> I'm sorry about this, but could you also take a look at the
> file email-clients.txt in the toplevel dir?
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


0001-Fixed-label-display-truncated-for-delays-in-ms-for-a.patch
Description: Binary data


Re: [PATCH] Fixed xinerama detection

2014-02-12 Thread David Maciejak
On Thursday, February 13, 2014, Christophe  wrote:

> From: Christophe CURIS >
>
> The proper behaviour that was expected is to accept silently that
> libXinerama may not be missing, and only stop compilation when the lib
> is present but not its header.


Yes, in fact I did want to change that behaviour as on my Ubuntu system lib
and header come with 2 packages and by default seems I only got lib setup.

That's why I thought it's ok to check xinerama in auto but the configure
should not stop as it forced me to pass the -- disable_xinemara option to
configure script.
Btw I don't think everybody use multiple displays.

Any thoughts ?


Regards,
David







>  m4/wm_xext_check.m4 | 31 +--
>  1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/m4/wm_xext_check.m4 b/m4/wm_xext_check.m4
> index 51da16f..9b50a0e 100644
> --- a/m4/wm_xext_check.m4
> +++ b/m4/wm_xext_check.m4
> @@ -145,20 +145,23 @@ sed -e 's,^[[^%]]*% *,,' | sed -e 's, *%.*$,,' `" dnl
>break])
>   done
>   LIBS="$wm_save_LIBS"
> - AS_IF([test "x$enable_xinerama$wm_cv_xext_xinerama" = "xyesno"],
> -[AC_MSG_ERROR([explicit Xinerama support requested but no
> library found])])
> - dnl
> - dnl A library was found, check if header is available and compile
> - wm_save_CFLAGS="$CFLAGS"
> - AS_CASE([`echo "$wm_cv_xext_xinerama" | sed -e 's,^[[^%]]*,,' `],
> - [*solaris*], [wm_header="X11/extensions/xinerama.h" ;
> wm_fct="XineramaGetInfo(NULL, 0, NULL, NULL, &intval)"],
> - [wm_header="X11/extensions/Xinerama.h" ;
> wm_fct="XineramaQueryScreens(NULL, &intval)"])
> - AS_IF([wm_fn_lib_try_compile "$wm_header" "int intval;"
> "$wm_fct" ""],
> - [],
> - [AC_MSG_ERROR([found $wm_cv_xext_xinerama but cannot compile
> with the header])])
> - AS_UNSET([wm_header])
> - AS_UNSET([wm_fct])
> - CFLAGS="$wm_save_CFLAGS"])
> + AS_IF([test "x$wm_cv_xext_xinerama" = "xno"],
> + [AS_IF([test "x$enable_xinerama" = "xyesno"],
> + [AC_MSG_ERROR([explicit Xinerama support requested but
> no library found])])],
> + [dnl
> +  dnl A library was found, check if header is available and
> compiles
> +  wm_save_CFLAGS="$CFLAGS"
> +  AS_CASE([`echo "$wm_cv_xext_xinerama" | sed -e
> 's,^[[^%]]*,,' `],
> +  [*solaris*], [wm_header="X11/extensions/xinerama.h" ;
> wm_fct="XineramaGetInfo(NULL, 0, NULL, NULL, &intval)"],
> +  [wm_header="X11/extensions/Xinerama.h" ;
> wm_fct="XineramaQueryScreens(NULL, &intval)"])
> +  AS_IF([wm_fn_lib_try_compile "$wm_header" "int intval;"
> "$wm_fct" ""],
> +  [],
> +  [AC_MSG_ERROR([found $wm_cv_xext_xinerama but cannot
> compile with the header])])
> +  AS_UNSET([wm_header])
> +  AS_UNSET([wm_fct])
> +  CFLAGS="$wm_save_CFLAGS" dnl
> + ]) dnl
> + ])
>   AS_IF([test "x$wm_cv_xext_xinerama" = "xno"],
>  [unsupported="$unsupported Xinerama"
>   enable_xinerama="no"],
> --
> 1.8.5.3
>
>
> --
> To unsubscribe, send mail to 
> wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


[PATCH] WINGs: Added support for syslog msg

2014-02-13 Thread David Maciejak
This patch is used to add support for syslog messaging implemented in
WINGs lib directly, so available from the lib itself and wmaker too.
I believe it will in a first time help to get some logging info
centralized in one point, and in a second time maybe add some info
level messages like wmaker is starting, stopping, restarting and else.
For now, it's built by default when the syslog support is found, maybe
we could also disable it by default.

Patch is inlined and enclosed.

---
 WINGs/WINGs/WUtil.h |  3 +++
 WINGs/error.c   | 65 ++---
 configure.ac|  5 +
 src/startup.c   |  5 +
 4 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 246ef2d..b2e76ab 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -243,6 +243,9 @@ enum {
 void __wmessage(const char *func, const char *file, int line, int
type, const char *msg, ...)
  __attribute__((__format__(printf,5,6)));

+void syslog_shutdown(void);
+
+
 /* ---[ WINGs/findfile.c ] */

 /* For the 4 function below, you have to free the returned string
when you no longer need it */
diff --git a/WINGs/error.c b/WINGs/error.c
index 2d5a588..d966d99 100644
--- a/WINGs/error.c
+++ b/WINGs/error.c
@@ -30,6 +30,46 @@
 #include 
 #include 

+#ifdef HAVE_SYSLOG_H
+#include 
+static Bool syslog_initialized = False;
+#endif
+
+void syslog_open(char *prog_name)
+{
+#ifdef HAVE_SYSLOG
+ int options;
+
+ if (!prog_name)
+ prog_name = "WINGs";
+
+ options = LOG_PID;
+ openlog(prog_name, options, LOG_DAEMON);
+ syslog_initialized = True;
+#endif
+}
+
+void syslog_message(int prio, char *prog_name, char *msg)
+{
+#ifdef HAVE_SYSLOG
+ if (!syslog_initialized)
+ syslog_open(prog_name);
+
+ //jump other the program name cause syslog is already displaying it
+ syslog(prio, "%s", msg+strlen(prog_name));
+#endif
+}
+
+void syslog_shutdown(void)
+{
+#ifdef HAVE_SYSLOG
+ if (syslog_initialized)
+ {
+ closelog();
+ syslog_initialized = False;
+ }
+#endif
+}

 void __wmessage(const char *func, const char *file, int line, int
type, const char *msg, ...)
 {
@@ -37,6 +77,10 @@ void __wmessage(const char *func, const char *file,
int line, int type, const ch
  char *buf;
  static int linemax = 0;
  int truncated = 0;
+#ifdef HAVE_SYSLOG
+ int syslog_priority = LOG_INFO;
+ const char *syslog_prefix = "INFO";
+#endif

  if (linemax == 0) {
 #ifdef HAVE_SYSCONF
@@ -65,13 +109,25 @@ void __wmessage(const char *func, const char
*file, int line, int type, const ch

  switch (type) {
  case WMESSAGE_TYPE_FATAL:
- strncat(buf, _("fatal error: "), linemax - 1 - strlen(buf));
+ strncat(buf, _("FATAL: "), linemax - 1 - strlen(buf));
+#ifdef HAVE_SYSLOG
+ syslog_priority = LOG_CRIT;
+ syslog_prefix = "FATAL";
+#endif
  break;
  case WMESSAGE_TYPE_ERROR:
- strncat(buf, _("error: "), linemax - 1 - strlen(buf));
+ strncat(buf, _("ERROR: "), linemax - 1 - strlen(buf));
+#ifdef HAVE_SYSLOG
+ syslog_priority = LOG_ERR;
+ syslog_prefix = "ERROR";
+#endif
  break;
  case WMESSAGE_TYPE_WARNING:
- strncat(buf, _("warning: "), linemax - 1 - strlen(buf));
+ strncat(buf, _("WARN: "), linemax - 1 - strlen(buf));
+#ifdef HAVE_SYSLOG
+ syslog_priority = LOG_WARNING;
+ syslog_prefix = "WARNING";
+#endif
  break;
  case WMESSAGE_TYPE_MESSAGE:
  /* FALLTHROUGH */
@@ -86,6 +142,9 @@ void __wmessage(const char *func, const char *file,
int line, int type, const ch
  va_end(args);

  fputs(buf, stderr);
+#ifdef HAVE_SYSLOG
+ syslog_message(syslog_priority, _WINGS_progname ? _WINGS_progname :
"WINGs", buf);
+#endif

  if (truncated)
  fputs("*** message truncated ***", stderr);
diff --git a/configure.ac b/configure.ac
index aa6b5b5..d642489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -293,6 +293,11 @@ dnl =
 AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))


+dnl Check for syslog
+dnl =
+AC_CHECK_HEADERS(syslog.h, AC_DEFINE(HAVE_SYSLOG, 1, Check for syslog))
+
+
 dnl Checks for header files.
 dnl ===
 AC_HEADER_SYS_WAIT
diff --git a/src/startup.c b/src/startup.c
index 6ede6f5..34e3635 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -160,6 +160,11 @@ static RETSIGTYPE handleExitSig(int sig)
  }

  sigprocmask(SIG_UNBLOCK, &sigs, NULL);
+
+#ifdef HAVE_SYSLOG
+ syslog_shutdown();
+#endif
+
  DispatchEvent(NULL); /* Dispatch events imediately. */
 }

-- 
1.8.3.2


0001-Added-support-for-syslog-msg.patch
Description: Binary data


[REQUEST] info/legal panel not closing using shortcut

2014-02-13 Thread David Maciejak
Hi,

I will need some help on updating some code in src/dialog.c

I am trying to modify the infoPanel and legalPanel to let them
handle close window event shortcut i configured from WPrefs.app.

Seems at least both of them do not handle correctly the destroy event
that is sent, even if i add a call to WMSetWindowCloseAction function
it's not working. So to close the window, we have to press the cross
button on the right.

Any ideas ?

thanks,
david


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] WINGs: Added support for syslog msg

2014-02-13 Thread David Maciejak
>I think it's better to use the lower case prefix. There's no need
>to scream...

yes you can change this, but at least we should rename "fatal error" to "fatal"
The original log will be the same.

for syslog it's the code below:

+ options = LOG_PID;
+ openlog(prog_name, options, LOG_DAEMON);

so syslog log will contain "wmaker[pid]:" followed by the msg from the
original log


regards,
david

On Thu, Feb 13, 2014 at 8:19 PM, Carlos R. Mafra  wrote:
> On Thu, 13 Feb 2014 at 19:04:41 +0800, David Maciejak wrote:
>> This patch is used to add support for syslog messaging implemented in
>> WINGs lib directly, so available from the lib itself and wmaker too.
>> I believe it will in a first time help to get some logging info
>> centralized in one point, and in a second time maybe add some info
>> level messages like wmaker is starting, stopping, restarting and else.
>> For now, it's built by default when the syslog support is found, maybe
>> we could also disable it by default.
>
> The idea is very nice and welcome, thanks a lot for doing this!
>
>>   switch (type) {
>>   case WMESSAGE_TYPE_FATAL:
>> - strncat(buf, _("fatal error: "), linemax - 1 - strlen(buf));
>> + strncat(buf, _("FATAL: "), linemax - 1 - strlen(buf));
>
> I think it's better to use the lower case prefix. There's no need
> to scream...
>
> I assume there will be an overall "wmaker" prefix too in the log,
> is that the case?
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] WINGs: Removed warning msgs from compiler

2014-02-13 Thread David Maciejak
This patch contains some cleanup for compiler warnings and a comment typo fix

---
 WINGs/error.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/WINGs/error.c b/WINGs/error.c
index e129eee..61c3cc0 100644
--- a/WINGs/error.c
+++ b/WINGs/error.c
@@ -46,6 +46,8 @@ void syslog_open(char *prog_name)
  options = LOG_PID;
  openlog(prog_name, options, LOG_DAEMON);
  syslog_initialized = True;
+#else
+ (void) prog_name;
 #endif
 }

@@ -55,8 +57,12 @@ void syslog_message(int prio, char *prog_name, char *msg)
  if (!syslog_initialized)
  syslog_open(prog_name);

- //jump other the program name cause syslog is already displaying it
+ //jump over the program name cause syslog is already displaying it
  syslog(prio, "%s", msg+strlen(prog_name));
+#else
+ (void) prio;
+ (void) prog_name;
+ (void) msg;
 #endif
 }

-- 
1.8.3.2


0001-Removed-warning-msgs-from-compiler.patch
Description: Binary data


[PATCH] wrlib: Improved NETPBM support, file format detection and fixed test compilation

2014-02-15 Thread David Maciejak
Hi,

I know some of you will say that patch is not sexy :)
It's my first look into wrlib. I will provide more.

The patch is working on that:

1) the tests examples were not compiling cause of a missing X11 lib call
2) load.c is used to identify the file format, i rebased the checks on
what is provided
from mime package, it will be faster
3) according to that checks i was able to see that some netpbm support
type are missing (exactly: ascii graymap (PGM files) and pixmap (PPM)
and ascii/binary bitmap (PBM))

See the link below for more details.
http://en.wikipedia.org/wiki/Netpbm_format

inlined & enclosed

regards,
david

---
 wrlib/load.c|   18 ++--
 wrlib/load_ppm.c|  270 +++
 wrlib/tests/Makefile.am |2 +-
 wrlib/tests/testdraw.c  |1 +
 wrlib/tests/view.c  |6 +-
 5 files changed, 240 insertions(+), 57 deletions(-)

diff --git a/wrlib/load.c b/wrlib/load.c
index 94ef564..061a50d 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -78,8 +78,8 @@ char **RSupportedFileFormats(void)

  /* built-in */
  tmp[i++] = "XPM";
- /* built-in */
- tmp[i++] = "PPM";
+ /* built-in PNM here refers to anymap format: PPM, PGM, PBM */
+ tmp[i++] = "PNM";
 #ifdef USE_TIFF
  tmp[i++] = "TIFF";
 #endif
@@ -275,7 +275,7 @@ char *RGetImageFileFormat(const char *file)
 static WRImgFormat identFile(const char *path)
 {
  FILE *file;
- unsigned char buffer[32];
+ unsigned char buffer[7];
  size_t nread;

  assert(path != NULL);
@@ -295,7 +295,7 @@ static WRImgFormat identFile(const char *path)
  RETRY( fclose(file) )

  /* check for XPM */
- if (strncmp((char *)buffer, "/* XPM */", 9) == 0)
+ if (strncmp((char *)buffer, "/* XPM", 6) == 0)
  return IM_XPM;

  /* check for TIFF */
@@ -303,14 +303,12 @@ static WRImgFormat identFile(const char *path)
 || (buffer[0] == 'M' && buffer[1] == 'M' && buffer[2] == 0 &&
buffer[3] == '*'))
  return IM_TIFF;

-#ifdef USE_PNG
  /* check for PNG */
- if (!png_sig_cmp(buffer, 0, 8))
+ if (buffer[0] == 0x89 && buffer[1] == 'P' && buffer[2] == 'N' &&
buffer[3] == 'G')
  return IM_PNG;
-#endif

- /* check for raw PPM or PGM */
- if (buffer[0] == 'P' && (buffer[1] == '5' || buffer[1] == '6'))
+ /* check for PBM or PGM or PPM */
+ if (buffer[0] == 'P' && (buffer[1] > '0' && buffer[1] < '7') &&
(buffer[2] == 0x0a || buffer[2] == 0x20 || buffer[2] == 0x09 ||
buffer[2] == 0x0d))
  return IM_PPM;

  /* check for JPEG */
@@ -318,7 +316,7 @@ static WRImgFormat identFile(const char *path)
  return IM_JPEG;

  /* check for GIF */
- if (buffer[0] == 'G' && buffer[1] == 'I' && buffer[2] == 'F')
+ if (buffer[0] == 'G' && buffer[1] == 'I' && buffer[2] == 'F' &&
buffer[3] == '8')
  return IM_GIF;

  return IM_UNKNOWN;
diff --git a/wrlib/load_ppm.c b/wrlib/load_ppm.c
index 49c10db..b45d0f0 100644
--- a/wrlib/load_ppm.c
+++ b/wrlib/load_ppm.c
@@ -3,6 +3,7 @@
  * Raster graphics library
  *
  * Copyright (c) 1997-2003 Alfredo K. Kojima
+ * Copyright (c) 2014 Window Maker Team
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
@@ -26,79 +27,248 @@
 #include 
 #include 
 #include 
+#include 

 #include "wraster.h"
 #include "imgformat.h"

-static RImage *load_graymap(FILE *file, int w, int h, int max, int raw)
+/* fileio.c - routines to read elements based on Netpbm
+**
+** Copyright (C) 1988 by Jef Poskanzer.
+*/
+
+char pm_getc(FILE * const fileP)
+{
+ int ich;
+ char ch;
+
+ ich = getc(fileP);
+ if (ich == EOF)
+ fprintf(stderr, "EOF / read error reading a byte\n");
+ ch = (char)ich;
+
+ if (ch == '#') {
+ do {
+ ich = getc(fileP);
+ if (ich == EOF)
+ fprintf(stderr, "EOF / read error reading a byte\n");
+ ch = (char)ich;
+ } while (ch != '\n' && ch != '\r');
+ }
+ return ch;
+}
+
+unsigned char pm_getrawbyte(FILE * const file)
+{
+ int iby;
+
+ iby = getc(file);
+ if (iby == EOF)
+ fprintf(stderr, "EOF / read error reading a one-byte sample\n");
+ return (unsigned char)iby;
+}
+
+int pm_getuint(FILE * const ifP)
+{
+ char ch;
+ unsigned int i;
+
+ do {
+ ch = pm_getc(ifP);
+ } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
+
+ if (ch < '0' || ch > '9')
+ fprintf(stderr, "junk in file where an unsigned integer should be\n");
+
+ i = 0;
+ do {
+ unsigned int const digitVal = ch - '0';
+
+ if (i > INT_MAX / 10) {
+ fprintf(stderr, "ASCII decimal integer in file is too large to be
processed\n");
+ return -1;
+ }
+
+ i *= 10;
+
+ if (i > INT_MAX - digitVal) {
+ fprintf(stderr, "ASCII decimal integer in file is too large to be
processed\n");
+ return -1;
+ }
+
+ i += digitVal;
+
+ ch = pm_getc(ifP);
+ } while (ch >= '0' && ch <= '9');
+
+ return i;
+}
+/**/
+
+/* PGM: support for portable graymap ascii and binary encoding */
+static RImage *load_graymap(FILE * file, int w, int h, int max, int raw)
 {
  RImage *image;
  unsigned char *ptr;
- char *buf;
  int x,

[PATCH] wrlib: Added support for webp image

2014-02-17 Thread David Maciejak
Hi,

this patch is adding support for google webp image format, if you
don't know it a quick recap is to say that according to their tests
it's better than png and jpeg.

Follow the link below for some more details:
https://developers.google.com/speed/webp/

patch inlined and enclosed.

ps: next target is svg support

Enjoy!
david

---
 configure.ac  |   10 +++-
 m4/wm_imgfmt_check.m4 |   20 
 wrlib/Makefile.am |4 ++
 wrlib/imgformat.h |3 +-
 wrlib/load.c  |   44 +++-
 wrlib/load_webp.c |  137 +
 6 files changed, 215 insertions(+), 3 deletions(-)
 create mode 100644 wrlib/load_webp.c

diff --git a/configure.ac b/configure.ac
index d642489..6c06dcb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -678,6 +678,15 @@ AC_ARG_ENABLE([tiff],
 [enable_tiff=auto])
 WM_IMGFMT_CHECK_TIFF

+dnl WEBP Support
+dnl ===
+AC_ARG_ENABLE([webp],
+[AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
+[AS_CASE(["$enableval"],
+[yes|no], [],
+[AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
+[enable_webp=auto])
+WM_IMGFMT_CHECK_WEBP

 dnl PPM Support
 dnl ===
@@ -685,7 +694,6 @@ dnl ===
 # 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"],
diff --git a/m4/wm_imgfmt_check.m4 b/m4/wm_imgfmt_check.m4
index 02245d2..0881cdd 100644
--- a/m4/wm_imgfmt_check.m4
+++ b/m4/wm_imgfmt_check.m4
@@ -221,3 +221,23 @@ AS_IF([test "x$enable_xpm" = "xno"],
 ])
 AM_CONDITIONAL([USE_XPM], [test "x$enable_xpm" != "xno"])dnl
 ]) dnl AC_DEFUN
+
+# WM_IMGFMT_CHECK_WEBP
+# ---
+#
+# Check for WEBP file support through 'libwebp'
+# The check depends on variable 'enable_webp' being either:
+#   yes  - detect, fail if not found
+#   no   - do not detect, disable support
+#   auto - detect, disable if not found
+#
+# When not found, append info to variable 'unsupported'
+AC_DEFUN_ONCE([WM_IMGFMT_CHECK_WEBP],
+[WM_LIB_CHECK([WEBP], ["-lwebp"], [VP8DecodeLayer], [$XLFLAGS $XLIBS],
+[wm_save_CFLAGS="$CFLAGS"
+ AS_IF([wm_fn_lib_try_compile "webp/decode.h" "" "return 0" ""],
+ [],
+ [AC_MSG_ERROR([found $CACHEVAR but could not find
appropriate header - are you missing libwebp-dev package?])])
+ CFLAGS="$wm_save_CFLAGS"],
+[supported_gfx], [GFXLIBS])dnl
+]) dnl AC_DEFUN
diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index db766ae..48af352 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -60,6 +60,10 @@ else
 libwraster_la_SOURCES += load_xpm_normalized.c
 endif

+if USE_WEBP
+libwraster_la_SOURCES += load_webp.c
+endif
+
 AM_CPPFLAGS = $(DFLAGS) @HEADER_SEARCH_PATH@

 libwraster_la_LIBADD = @LIBRARY_SEARCH_PATH@ @GFXLIBS@ @XLIBS@ @LIBXMU@ -lm
diff --git a/wrlib/imgformat.h b/wrlib/imgformat.h
index 07b021a..98e8c3d 100644
--- a/wrlib/imgformat.h
+++ b/wrlib/imgformat.h
@@ -38,7 +38,8 @@ typedef enum {
  IM_PNG =  3,
  IM_PPM =  4,
  IM_JPEG=  5,
- IM_GIF =  6
+ IM_GIF =  6,
+ IM_WEBP=  7
 } WRImgFormat;

 /* How many image types we have. */
diff --git a/wrlib/load.c b/wrlib/load.c
index 061a50d..e834c9e 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -3,6 +3,7 @@
  * Raster graphics library
  *
  * Copyright (c) 1997-2003 Alfredo K. Kojima
+ * Copyright (c) 2014 Window Maker Team
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
@@ -37,6 +38,10 @@
 #include 
 #endif

+#ifdef USE_WEBP
+#include 
+#endif
+
 #include "wraster.h"
 #include "imgformat.h"

@@ -92,6 +97,9 @@ char **RSupportedFileFormats(void)
 #ifdef USE_GIF
  tmp[i++] = "GIF";
 #endif
+#ifdef USE_WEBP
+ tmp[i++] = "WEBP";
+#endif
  tmp[i] = NULL;

  return tmp;
@@ -190,6 +198,12 @@ RImage *RLoadImage(RContext * context, const char
*file, int index)
  break;
 #endif /* USE_GIF */

+#ifdef USE_WEBP
+ case IM_WEBP:
+ image = RLoadWEBP(file, index);
+ break;
+#endif /* USE_WEBP */
+
  case IM_PPM:
  image = RLoadPPM(file);
  break;
@@ -264,6 +278,11 @@ char *RGetImageFileFormat(const char *file)
  return "GIF";
 #endif /* USE_GIF */

+#ifdef USE_WEBP
+ case IM_WEBP:
+ return "WEBP";
+#endif /* USE_WEBP */
+
  case IM_PPM:
  return "PPM";

@@ -275,7 +294,7 @@ char *RGetImageFileFormat(const char *file)
 static WRImgFormat identFile(const char *path)
 {
  FILE *file;
- unsigned char buffer[7];
+ unsigned char buffer[17];
  size_t nread;

  assert(path != NULL);
@@ -319,5 +338,28 @@ static WRImgFormat identFile(const char *path)
  if (buffer[0] == 'G' && buffer[1] == 'I' && buffer[2] == 'F' &&
buffer[3] == '8')
  return IM_GIF;

+#ifdef USE_WEBP
+ /* check for WEBP */
+ if (buffer[ 0] == 'R' &&
+ buffer[ 1] == 'I' &&
+ buffer[ 2] == 'F' &&
+  

Re: Re : [PATCH] wrlib: Improved NETPBM support, file format detection and fixed test compilation

2014-02-23 Thread David Maciejak
On Sun, Feb 23, 2014 at 12:24 PM, Christophe  wrote:
>
> - David Maciejak  a écrit :
>> Hi,
>>
>> I know some of you will say that patch is not sexy :)
>> It's my first look into wrlib. I will provide more.
>>
>> The patch is working on that:
>>
>> 1) the tests examples were not compiling cause of a missing X11 lib call
>> 2) load.c is used to identify the file format, i rebased the checks on
>> what is provided
>> from mime package, it will be faster
>> 3) according to that checks i was able to see that some netpbm support
>> type are missing (exactly: ascii graymap (PGM files) and pixmap (PPM)
>> and ascii/binary bitmap (PBM))
>>
>> See the link below for more details.
>> http://en.wikipedia.org/wiki/Netpbm_format
>>
>> inlined & enclosed
>>
>> regards,
>> david
>>
>> ---
>>  wrlib/load.c|   18 ++--
>>  wrlib/load_ppm.c|  270 
>> +++
>>  wrlib/tests/Makefile.am |2 +-
>>  wrlib/tests/testdraw.c  |1 +
>>  wrlib/tests/view.c  |6 +-
>>  5 files changed, 240 insertions(+), 57 deletions(-)
>>
>> diff --git a/wrlib/load.c b/wrlib/load.c
>> @@ -78,8 +78,8 @@ char **RSupportedFileFormats(void)
>>
>>   /* built-in */
>>   tmp[i++] = "XPM";
>> - /* built-in */
>> - tmp[i++] = "PPM";
>
> I think it is an error to remove PPM from the list, as:
>  - it is still supported;
>  - it might break compatibility with apps using the WRaster library
>

we are not removing PPM here, we are renaming it.
+   /* built-in PNM here refers to anymap format: PPM, PGM, PBM */
+   tmp[i++] = "PNM";

PPM is part of PNM formats


> It is ok to just add PNM to the list as one more format (taking care of the 
> size of the array).
>
>
>
>> @@ -295,7 +295,7 @@ static WRImgFormat identFile(const char *path)
>>   RETRY( fclose(file) )
>>
>>   /* check for XPM */
>> - if (strncmp((char *)buffer, "/* XPM */", 9) == 0)
>> + if (strncmp((char *)buffer, "/* XPM", 6) == 0)
>
> I'm not sure it is a good idea to shorten the compare string, the description 
> of the format does not seem leave that much liberty here.

all the changes were based on the tests mime package is doing. So i am
expecting that to be pretty safe.


>
>
>> @@ -318,7 +316,7 @@ static WRImgFormat identFile(const char *path)
>>
>>   /* check for GIF */
>> - if (buffer[0] == 'G' && buffer[1] == 'I' && buffer[2] == 'F')
>> + if (buffer[0] == 'G' && buffer[1] == 'I' && buffer[2] == 'F' &&
>> buffer[3] == '8')
>
> If you're up to making this detection more correct, you can also make one 
> step further:
>  - buffer[4] is always either '7' or '9'
>  - buffer[5] is always 'a' (yes, lowercase)
>
>
>> diff --git a/wrlib/load_ppm.c b/wrlib/load_ppm.c
>> +static RImage *load_graymap(FILE * file, int w, int h, int max, int raw)
>> [...]
>>
>> - if (!raw)
>> + if (raw != '2' && raw != '5')
>>   return image;
>
> Some historic stuff here, but shouldn't the proper behaviour be to set 
> RErrorCode to >RERR_BADFORMAT, release the image and return NULL, instead of 
> returning an empty ?>image unrelated to what was in the file?

Agree with your suggestions, feel free to go ahead and to provide a patch.


regards,
david


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Re : [PATCH] WINGs: Added support for syslog msg

2014-02-23 Thread David Maciejak
thx Christophe for the comments, as i said previously, that's draft
code I mean it works well but can be enhanced will the suggestions of
everybody.

It could be great if you could implement your suggestions in a patch.

regards,
david

On Sun, Feb 23, 2014 at 11:51 AM, Christophe  wrote:
> Hi,
>
> Sorry to bring those suggestions below a bit late...
>
>
> - David Maciejak  a écrit :
>> [...]
>>
>> diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
>> index 246ef2d..b2e76ab 100644
>> --- a/WINGs/WINGs/WUtil.h
>> +++ b/WINGs/WINGs/WUtil.h
>> @@ -243,6 +243,9 @@ enum {
>>
>> +void syslog_shutdown(void);
>
> The file WUtil.h contains a public API, so it should be changed with care, 
> especially concerning the consistency in function names. May I suggest:
>  - to start the function name with a 'w' like the other functions?
>  - to not make a reference to 'syslog', as I feel the WUtil library should be 
> hiding these internals to end users?
>
> I would propose something like "wfinish" or "wshutdown" which are more 
> neutral and could include more things in the future if we need to.
>
>
>> diff --git a/WINGs/error.c b/WINGs/error.c
>> index 2d5a588..d966d99 100644
>> --- a/WINGs/error.c
>> +++ b/WINGs/error.c
>> @@ -30,6 +30,46 @@
>
>> +void syslog_open(char *prog_name)
>> +void syslog_message(int prio, char *prog_name, char *msg)
>
> Shouldn't these be 'static' ? it's not part of the API but local to that 
> file, right?
>
> Also, as they are called only when HAVE_SYSLOG is defined, you should 
> probably enclose the complete functions in #ifdef, not just their bodies, it 
> would make the code shorter.
>
>
>> @@ -86,6 +142,9 @@ void __wmessage(const char *func, const char *file,
>> int line, int type, const ch
>>   va_end(args);
>>
>>   fputs(buf, stderr);
>> +#ifdef HAVE_SYSLOG
>> + syslog_message(syslog_priority, _WINGS_progname ? _WINGS_progname :
>> "WINGs", buf);
>> +#endif
>
> It looks like the message is always printed in stderr and in syslog; I don't 
> what the traditional behaviour is but shouldn't we propose an environment 
> variable to allow dynamic choice for either stderr or syslog or both?
>
>
>> diff --git a/src/startup.c b/src/startup.c
>> @@ -160,6 +160,11 @@ static RETSIGTYPE handleExitSig(int sig)
>>
>>   sigprocmask(SIG_UNBLOCK, &sigs, NULL);
>> +
>> +#ifdef HAVE_SYSLOG
>> + syslog_shutdown();
>> +#endif
>> +
>
> Considering the function is defined as empty when HAVE_SYSLOG is not defined, 
> I would suggest to always call it here (unconditionally) and let the function 
> do nothing when syslog is not used. And linked to the remark at the 
> beginning, this could be useful in the future.
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] Added webp return error code

2014-02-24 Thread David Maciejak
Based on the feedback from Christophe, this patch is adding some error
code report for webp module.

Patch is inlined and enclosed.

regards,
david

---
 wrlib/load_webp.c |   18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/wrlib/load_webp.c b/wrlib/load_webp.c
index d69a107..9364332 100644
--- a/wrlib/load_webp.c
+++ b/wrlib/load_webp.c
@@ -58,7 +58,6 @@ RLoadWEBP(const char *file_name)
  return NULL;
  }

-
  if (!(buffer[0] == 'R' &&
   buffer[1] == 'I' &&
   buffer[2] == 'F' &&
@@ -78,12 +77,12 @@ RLoadWEBP(const char *file_name)
  return NULL;
  }

-
  fseek(file, 0, SEEK_END);
  raw_data_size = ftell(file);

  if (raw_data_size <= 0) {
  fprintf(stderr, "Failed to find the WEBP image size\n");
+ RErrorCode = RERR_BADIMAGEFILE;
  return NULL;
  }

@@ -92,7 +91,8 @@ RLoadWEBP(const char *file_name)
  raw_data = (uint8_t *) malloc(raw_data_size);

  if (!raw_data) {
- fprintf(stderr, "Failed to allocate enought buffer for WEBP\n");
+ fprintf(stderr, "Failed to allocate enough buffer for WEBP\n");
+ RErrorCode = RERR_NOMEMORY;
  return NULL;
  }

@@ -100,27 +100,33 @@ RLoadWEBP(const char *file_name)

  if (r != raw_data_size) {
  fprintf(stderr, "Failed to read WEBP\n");
+ RErrorCode = RERR_READ;
  return NULL;
  }

  if (WebPGetFeatures(raw_data, raw_data_size, &features) !=
 VP8_STATUS_OK) {
  fprintf(stderr, "WebPGetFeatures has failed\n");
+ RErrorCode = RERR_BADIMAGEFILE;
  return NULL;
  }

  if (features.has_alpha) {
  image = RCreateImage(features.width, features.height, True);
- if (!image)
+ if (!image) {
+ RErrorCode = RERR_NOMEMORY;
  return NULL;
+ }
  ret =
 WebPDecodeRGBAInto(raw_data, raw_data_size, image->data,
features.width * features.height * 4,
features.width * 4);
  } else {
  image = RCreateImage(features.width, features.height, False);
- if (!image)
+ if (!image) {
+ RErrorCode = RERR_NOMEMORY;
  return NULL;
+ }
  ret =
 WebPDecodeRGBInto(raw_data, raw_data_size, image->data,
   features.width * features.height * 3,
@@ -129,6 +135,8 @@ RLoadWEBP(const char *file_name)

  if (!ret) {
  fprintf(stderr, "Failed to decode WEBP\n");
+ RErrorCode = RERR_BADIMAGEFILE;
+ RReleaseImage(image);
  return NULL;
  }

-- 
1.7.10.4


0001-Added-support-for-webp-image.patch
Description: Binary data


Re: [PATCH] Added webp return error code

2014-02-24 Thread David Maciejak
oops sorry, please see the one enclosed

On Mon, Feb 24, 2014 at 10:03 PM, Carlos R. Mafra  wrote:
> On Mon, 24 Feb 2014 at 20:37:09 +0800, David Maciejak wrote:
>> Based on the feedback from Christophe, this patch is adding some error
>> code report for webp module.
>>
>> Patch is inlined and enclosed.
>
> Thanks, but the attached patch does not correspond to the inlined
> version...
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


0001-Added-webp-return-error-code.patch
Description: Binary data


[PATCH] Added ppm return error code

2014-02-24 Thread David Maciejak
This patch is adding some more error code return value for ppm module.


---
 wrlib/load_ppm.c | 46 +-
 1 file changed, 33 insertions(+), 13 deletions(-)

diff --git a/wrlib/load_ppm.c b/wrlib/load_ppm.c
index b45d0f0..e8e1ab3 100644
--- a/wrlib/load_ppm.c
+++ b/wrlib/load_ppm.c
@@ -112,12 +112,16 @@ static RImage *load_graymap(FILE * file, int w,
int h, int max, int raw)
  unsigned char *ptr;
  int x, y;

- image = RCreateImage(w, h, 0);
- if (!image)
+ if (raw != '2' && raw != '5') {
+ RErrorCode = RERR_BADFORMAT;
  return NULL;
+ }

- if (raw != '2' && raw != '5')
- return image;
+ image = RCreateImage(w, h, 0);
+ if (!image) {
+ RErrorCode = RERR_NOMEMORY;
+ return NULL;
+ }

  if (max < 256) {
  ptr = image->data;
@@ -129,6 +133,7 @@ static RImage *load_graymap(FILE * file, int w,
int h, int max, int raw)

  if (val > max || val < 0) {
  RErrorCode = RERR_BADIMAGEFILE;
+ RReleaseImage(image);
  return NULL;
  }

@@ -142,12 +147,16 @@ static RImage *load_graymap(FILE * file, int w,
int h, int max, int raw)
  if (raw == '5') {
  char *buf;
  buf = malloc(w + 1);
- if (!buf)
+ if (!buf) {
+ RErrorCode = RERR_NOMEMORY;
+ RReleaseImage(image);
  return NULL;
+ }
  for (y = 0; y < h; y++) {
  if (!fread(buf, w, 1, file)) {
  free(buf);
  RErrorCode = RERR_BADIMAGEFILE;
+ RReleaseImage(image);
  return NULL;
  }

@@ -171,12 +180,16 @@ static RImage *load_pixmap(FILE * file, int w,
int h, int max, int raw)
  unsigned char *ptr;
  int i = 0;

- image = RCreateImage(w, h, 0);
- if (!image)
+ if (raw != '3' && raw != '6') {
+ RErrorCode = RERR_BADFORMAT;
  return NULL;
+ }

- if (raw != '3' && raw != '6')
- return image;
+ image = RCreateImage(w, h, 0);
+ if (!image) {
+ RErrorCode = RERR_NOMEMORY;
+ return NULL;
+ }

  ptr = image->data;
  if (max < 256) {
@@ -189,6 +202,7 @@ static RImage *load_pixmap(FILE * file, int w, int
h, int max, int raw)

  if (val > max || val < 0) {
  RErrorCode = RERR_BADIMAGEFILE;
+ RReleaseImage(image);
  return NULL;
  }

@@ -202,6 +216,7 @@ static RImage *load_pixmap(FILE * file, int w, int
h, int max, int raw)
  while (i < w * h) {
  if (fread(buf, 1, 3, file) != 3) {
  RErrorCode = RERR_BADIMAGEFILE;
+ RReleaseImage(image);
  return NULL;
  }

@@ -222,12 +237,16 @@ static RImage *load_bitmap(FILE * file, int w,
int h, int max, int raw)
  int val;
  unsigned char *ptr;

- image = RCreateImage(w, h, 0);
- if (!image)
+ if (raw != '1' && raw != '4') {
+ RErrorCode = RERR_BADFORMAT;
  return NULL;
+ }

- if (raw != '1' && raw != '4')
- return image;
+ image = RCreateImage(w, h, 0);
+ if (!image) {
+ RErrorCode = RERR_NOMEMORY;
+ return NULL;
+ }

  ptr = image->data;
  if (raw == '1') {
@@ -237,6 +256,7 @@ static RImage *load_bitmap(FILE * file, int w, int
h, int max, int raw)

  if (val > max || val < 0) {
  RErrorCode = RERR_BADIMAGEFILE;
+ RReleaseImage(image);
  return NULL;
  }

-- 
1.8.3.2


0001-Added-ppm-return-error-code.patch
Description: Binary data


[PATCH] Fixed WEBP image detection

2014-02-26 Thread David Maciejak
This patch is used to fix the return statement which is not at the
good place and add the function synopsis in the header.


---
 wrlib/imgformat.h | 4 
 wrlib/load.c  | 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/wrlib/imgformat.h b/wrlib/imgformat.h
index 29ad413..9e739d8 100644
--- a/wrlib/imgformat.h
+++ b/wrlib/imgformat.h
@@ -69,6 +69,10 @@ RImage *RLoadJPEG(const char *file);
 RImage *RLoadGIF(const char *file, int index);
 #endif

+#ifdef USE_WEBP
+RImage *RLoadWEBP(const char *file, int index);
+#endif
+
 /*
  * Function for Saving in a specific format
  */
diff --git a/wrlib/load.c b/wrlib/load.c
index e834c9e..6ad2a3d 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -356,10 +356,8 @@ static WRImgFormat identFile(const char *path)
 #else
  (buffer[15] == ' ' || buffer[15] == 'X' || buffer[15] == 'L'))
 #endif
+ return IM_WEBP;
 #endif

- return IM_WEBP;
-
-
  return IM_UNKNOWN;
 }
-- 
1.8.3.2


0001-Fixed-WEBP-image-detection.patch
Description: Binary data


Re: [PATCH] Fixed WEBP image detection

2014-02-27 Thread David Maciejak
Sure, do at your convenience.

thanks,
david

On Thu, Feb 27, 2014 at 5:05 PM, Carlos R. Mafra  wrote:
> On Thu, 27 Feb 2014 at 13:24:29 +0800, David Maciejak wrote:
>> This patch is used to fix the return statement which is not at the
>> good place and add the function synopsis in the header.
>
> Thanks.
>
> I think I will rebase all your later fixes into the original
> patch. Do you agree with that?


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] Updated copyright date

2014-02-27 Thread David Maciejak
This patch is just updating the year in the copyright.

---
 src/dialog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dialog.c b/src/dialog.c
index 43f12fc..69fd31d 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -1106,7 +1106,7 @@ typedef struct {
 #define COPYRIGHT_TEXT  \
 "Copyright \xc2\xa9 1997-2006 Alfredo K. Kojima\n"\
 "Copyright \xc2\xa9 1998-2006 Dan Pascu\n"\
-"Copyright \xc2\xa9 2013 Window Maker Developers Team"
+"Copyright \xc2\xa9 2013-2014 Window Maker Developers Team"

 static InfoPanel *thePanel = NULL;

-- 
1.8.3.2


0001-Updated-copyright-date.patch
Description: Binary data


[PATCH] Fixed compiler warnings in WPrefs

2014-02-27 Thread David Maciejak
This patch is used to catch some return function value, to make the
compiler happy.

---
 WPrefs.app/Appearance.c| 15 +++
 WPrefs.app/MouseSettings.c |  4 ++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
index 3bd571a..500cbdd 100644
--- a/WPrefs.app/Appearance.c
+++ b/WPrefs.app/Appearance.c
@@ -1261,17 +1261,24 @@ static Pixmap loadRImage(WMScreen * scr, const
char *path)
 {
  FILE *f;
  RImage *image;
- int w, h, d;
+ int w, h, d, cnt;
  Pixmap pixmap;

  f = fopen(path, "rb");
  if (!f)
  return None;

- fscanf(f, "%02x%02x%1x", &w, &h, &d);
-
+ cnt = fscanf(f, "%02x%02x%1x", &w, &h, &d);
+ if (cnt != 3) {
+ fclose(f);
+ return None;
+ }
  image = RCreateImage(w, h, d == 4);
- fread(image->data, 1, w * h * d, f);
+ cnt = w * h * d;
+ if (fread(image->data, 1, cnt, f) != cnt) {
+ fclose(f);
+ return None;
+ }
  fclose(f);

  RConvertImage(WMScreenRContext(scr), image, &pixmap);
diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index 2aa500b..f83ec3a 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -714,8 +714,8 @@ static void storeCommandInScript(const char *cmd,
const char *line)
  wfree(tmppath);
  }
  sprintf(buffer, "chmod u+x %s", path);
- system(buffer);
-
+ if (system(buffer) == -1)
+ werror(_("could not execute command"));
  end:
  wfree(path);
  if (f) {
-- 
1.8.3.2


0001-Fixed-compiler-warnings.patch
Description: Binary data


[PATCH] wrlib: WEBP header fixes

2014-03-06 Thread David Maciejak
Again, a patch to clean-up webp code.


---
 wrlib/imgformat.h | 2 +-
 wrlib/load.c  | 2 +-
 wrlib/load_webp.c | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/wrlib/imgformat.h b/wrlib/imgformat.h
index 9e739d8..43df3ec 100644
--- a/wrlib/imgformat.h
+++ b/wrlib/imgformat.h
@@ -70,7 +70,7 @@ RImage *RLoadGIF(const char *file, int index);
 #endif

 #ifdef USE_WEBP
-RImage *RLoadWEBP(const char *file, int index);
+RImage *RLoadWEBP(const char *file);
 #endif

 /*
diff --git a/wrlib/load.c b/wrlib/load.c
index 6ad2a3d..fb785d7 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -200,7 +200,7 @@ RImage *RLoadImage(RContext * context, const char
*file, int index)

 #ifdef USE_WEBP
  case IM_WEBP:
- image = RLoadWEBP(file, index);
+ image = RLoadWEBP(file);
  break;
 #endif /* USE_WEBP */

diff --git a/wrlib/load_webp.c b/wrlib/load_webp.c
index 9364332..47aaa53 100644
--- a/wrlib/load_webp.c
+++ b/wrlib/load_webp.c
@@ -32,8 +32,7 @@
 #include "wraster.h"
 #include "imgformat.h"

-RImage *
-RLoadWEBP(const char *file_name)
+RImage *RLoadWEBP(const char *file_name)
 {
  FILE *file;
  RImage *image = NULL;
-- 
1.8.3.2


0001-wrlib-WEBP-header-fixes.patch
Description: Binary data


[PATCH] Scale image to fit in preview panel

2014-03-06 Thread David Maciejak
This patch is used to scale image to fit in the icon preview panel.

Moreover, i encountered a bug in the preview icon list that I am currently
trying to resolve. Hopefully i will send another patch for that.


---
 WINGs/WINGs/WINGs.h|2 +-
 WINGs/wpixmap.c|   16 +---
 WPrefs.app/MouseSettings.c |2 +-
 WPrefs.app/WPrefs.c|4 ++--
 src/dialog.c   |9 -
 src/dockedapp.c|2 +-
 6 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h
index d3b4f28..aa95844 100644
--- a/WINGs/WINGs/WINGs.h
+++ b/WINGs/WINGs/WINGs.h
@@ -839,7 +839,7 @@ WMPixmap* WMCreateBlendedPixmapFromRImage(WMScreen
*scrPtr, RImage *image,
   const RColor *color);

 WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, const char *fileName,
-const RColor *color);
+const RColor *color, unsigned
wHeight, unsigned wWidth);

 void WMDrawPixmap(WMPixmap *pixmap, Drawable d, int x, int y);

diff --git a/WINGs/wpixmap.c b/WINGs/wpixmap.c
index 55c457b..5511a13 100644
--- a/WINGs/wpixmap.c
+++ b/WINGs/wpixmap.c
@@ -117,7 +117,8 @@ WMPixmap *WMCreateBlendedPixmapFromRImage(WMScreen
* scrPtr, RImage * image, con
  return pixPtr;
 }

-WMPixmap *WMCreateBlendedPixmapFromFile(WMScreen * scrPtr, const char
*fileName, const RColor * color)
+WMPixmap *WMCreateBlendedPixmapFromFile(WMScreen * scrPtr, const char
*fileName, const RColor * color,
+ unsigned wHeight, unsigned wWidth)
 {
  WMPixmap *pixPtr;
  RImage *image;
@@ -126,10 +127,19 @@ WMPixmap *WMCreateBlendedPixmapFromFile(WMScreen
* scrPtr, const char *fileName,
  if (!image)
  return NULL;

- RCombineImageWithColor(image, color);
+ /* scale it if requested to fit in the widget */
+ if (wHeight > 0 && wWidth > 0 && (image->height > wHeight ||
image->width > wWidth)) {
+ RImage *tmp;
+ tmp = image;
+ if (image->width > image->height)
+ image = RScaleImage(tmp, wWidth, image->height * wHeight / image->width);
+ else
+ image = RScaleImage(tmp, image->width * wWidth / image->height, wHeight);
+ RReleaseImage(tmp);
+ }

+ RCombineImageWithColor(image, color);
  pixPtr = WMCreatePixmapFromRImage(scrPtr, image, 0);
-
  RReleaseImage(image);

  return pixPtr;
diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index f83ec3a..7978f72 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -446,7 +446,7 @@ static void createPanel(Panel * p)
  WMSetLabelImagePosition(panel->speedL, WIPImageOnly);
  path = LocateImage(SPEED_ICON_FILE);
  if (path) {
- icon = WMCreateBlendedPixmapFromFile(scr, path, &color);
+ icon = WMCreateBlendedPixmapFromFile(scr, path, &color, 0, 0);
  if (icon) {
  WMSetLabelImage(panel->speedL, icon);
  WMReleasePixmap(icon);
diff --git a/WPrefs.app/WPrefs.c b/WPrefs.app/WPrefs.c
index 31192aa..b80e099 100644
--- a/WPrefs.app/WPrefs.c
+++ b/WPrefs.app/WPrefs.c
@@ -456,7 +456,7 @@ void SetButtonAlphaImage(WMScreen *scr, WMButton
*bPtr, const char *file)
  color.blue = 0xae;
  color.alpha = 0;
  if (iconPath) {
- icon = WMCreateBlendedPixmapFromFile(scr, iconPath, &color);
+ icon = WMCreateBlendedPixmapFromFile(scr, iconPath, &color, 0, 0);
  if (!icon)
  wwarning(_("could not load icon file %s"), iconPath);
  } else {
@@ -470,7 +470,7 @@ void SetButtonAlphaImage(WMScreen *scr, WMButton
*bPtr, const char *file)
  color.blue = 0xff;
  color.alpha = 0;
  if (iconPath) {
- icon = WMCreateBlendedPixmapFromFile(scr, iconPath, &color);
+ icon = WMCreateBlendedPixmapFromFile(scr, iconPath, &color, 0, 0);
  if (!icon)
  wwarning(_("could not load icon file %s"), iconPath);
  } else {
diff --git a/src/dialog.c b/src/dialog.c
index 69fd31d..5218866 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -619,7 +619,8 @@ static void setViewedImage(IconPanel *panel, const
char *file)
  color.green = 0xaa;
  color.blue = 0xae;
  color.alpha = 0;
- pixmap = WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel->win),
file, &color);
+ pixmap = WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel->win),
file, &color, 75, 75);
+
  if (!pixmap) {
  WMSetButtonEnabled(panel->okButton, False);

@@ -649,9 +650,7 @@ static void listCallback(void *self, void *data)
  path = item->text;

  WMSetTextFieldText(panel->fileField, path);
-
  WMSetLabelImage(panel->iconView, NULL);
-
  WMSetButtonEnabled(panel->okButton, False);

  WMClearList(panel->iconList);
@@ -742,7 +741,7 @@ static void drawIconProc(WMList * lPtr, int index,
Drawable d, char *text, int s
  color.blue = WMBlueComponentOfColor(back) >> 8;
  color.alpha = WMGetColorAlpha(back) >> 8;

- pixmap = WMCreateBlendedPixmapFromFile(wmscr, file, &color);
+ pixmap = WMCreateBlendedPixmapFromFile(wmscr, file, &color, 0, 0);
  wfree(file);

  if (!pixmap) {
@@ -1524,7 +1523,7 @@ static WMPixmap *getWindowMakerIconImage(WMScreen *scr)
  gray.blue = 0xae;
  gray.alpha = 0;

- pix = W

Re: [PATCH] Scale image to fit in preview panel

2014-03-07 Thread David Maciejak
On Fri, Mar 7, 2014 at 7:13 PM, Carlos R. Mafra  wrote:
> On Fri,  7 Mar 2014 at  8:46:33 +0800, David Maciejak wrote:
>> This patch is used to scale image to fit in the icon preview panel.
>>
>
> Thanks for the patch, I think I once noticed this problem when setting
> a high-res icon to be used.
>
> That leads to my small request :-)
>
> Can you be a little more verbose in your commit message? Just one
> paragraph is enough, most of the times.
>
> What I usually require from contributors (though this is not mandatory
> people are kind enough to comply) is to invest a few minutes trying
> to explain what led you to make the patch.
>
> Do not assume that everybody is an expert in wmaker, try to explain
> what was the behaviour you noticed (icon does not fit in the 64x64 square)
> when trying to do something (eg setting an icon image through the
> Inspector panel from the Attributes menu). Just plain words that people
> can immediately relate to. The motivation for the patch is very important!
>
> Furthermore, I notice that the patch you attach does not have a commit
> message at all. So far I've been applying it and doing a 'git commit --amend'
> to insert some words (that I usually copy & paste from your email). That
> does not scale though.
>


i am usually using -m, but ok i will try to add longer msg.

regards,
david


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] Fixed unknown image format detection in Icon Chooser preview mode

2014-03-07 Thread David Maciejak
When pressing the Preview button from Icon chooser, a list of preview
icons is displayed. When a unknown image format is encountered the
list is showing duplicated entries. That patch is correcting that issue
and adding rescale feature to that preview show.

---
 src/dialog.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/dialog.c b/src/dialog.c
index 5218866..221f6ac 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -741,11 +741,12 @@ static void drawIconProc(WMList * lPtr, int
index, Drawable d, char *text, int s
  color.blue = WMBlueComponentOfColor(back) >> 8;
  color.alpha = WMGetColorAlpha(back) >> 8;

- pixmap = WMCreateBlendedPixmapFromFile(wmscr, file, &color, 0, 0);
+ pixmap = WMCreateBlendedPixmapFromFile(wmscr, file, &color, 64, 100);
  wfree(file);

  if (!pixmap) {
- /*WMRemoveListItem(lPtr, index); */
+ /* if unknow image format, just remove the entry from the preview list */
+ WMRemoveListItem(lPtr, index);
  return;
  }

@@ -758,10 +759,9 @@ static void drawIconProc(WMList * lPtr, int
index, Drawable d, char *text, int s
  size = WMGetPixmapSize(pixmap);

  XSetClipMask(dpy, copygc, WMGetPixmapMaskXID(pixmap));
- XSetClipOrigin(dpy, copygc, x + (width - size.width) / 2, y + 2);
- XCopyArea(dpy, WMGetPixmapXID(pixmap), d, copygc, 0, 0,
-  size.width > 100 ? 100 : size.width, size.height > 64 ? 64 : size.height,
-  x + (width - size.width) / 2, y + 2);
+ /* the icon is centered */
+ XSetClipOrigin(dpy, copygc, x + (width - size.width) / 2, y +
(height - size.height) / 2);
+ XCopyArea(dpy, WMGetPixmapXID(pixmap), d, copygc, 0, 0, size.width,
size.height, x + (width - size.width) / 2, y + (height - size.height)
/ 2);

  {
  int i, j;
-- 
1.7.10.4


0001-Fixed-unknown-image-format-detection-in-Icon-Chooser.patch
Description: Binary data


[PATCH] wrlib: added support for imagemagick third-party lib

2014-03-07 Thread David Maciejak
This patch is providing support for some common image format
like SVG, BMP, PICT, ...

Please test !

---
 configure.ac  |   27 +++
 m4/wm_imgfmt_check.m4 |   20 +++
 src/dialog.c  |8 +++--
 src/main.c|1 +
 wrlib/Makefile.am |4 +++
 wrlib/imgformat.h |9 +++--
 wrlib/libwraster.map  |1 +
 wrlib/load.c  |   15 +
 wrlib/load_magick.c   |   89 +
 wrlib/wraster.h   |4 +++
 10 files changed, 174 insertions(+), 4 deletions(-)
 create mode 100644 wrlib/load_magick.c

diff --git a/configure.ac b/configure.ac
index 8c29211..edc4b77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -322,6 +322,11 @@ dnl ==
 dnl AC_ARG_VAR(PKGCONFIG, [pkg-config command])
 AC_CHECK_PROG(PKGCONFIG, pkg-config, pkg-config)

+dnl Magick-config
+dnl ==
+dnl AC_ARG_VAR(MAGICKCONFIG, [Magick-config command])
+AC_CHECK_PROG(MAGICKCONFIG, Magick-config, Magick-config)
+
 dnl gettext
 dnl ===

@@ -559,6 +564,18 @@ else
 fi
 AC_SUBST(FCLIBS)

+dnl
+dnl libMagickWand
+dnl
+AC_MSG_CHECKING([for libmagickwand header])
+IMFLAGS=`$MAGICKCONFIG --cflags`
+if test "x$IMFLAGS" = "x" ; then
+AC_MSG_RESULT([not found])
+else
+AC_MSG_RESULT([found])
+fi
+AC_SUBST(IMFLAGS)
+

 dnl Xft2 antialiased font support
 dnl =
@@ -688,6 +705,16 @@ AC_ARG_ENABLE([webp],
 [enable_webp=auto])
 WM_IMGFMT_CHECK_WEBP

+dnl MAGICK Support
+dnl ===
+AC_ARG_ENABLE([magick],
+[AS_HELP_STRING([--disable-magick], [disable MAGICK support
through libMagickWand])],
+[AS_CASE(["$enableval"],
+[yes|no], [],
+[AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
+[enable_magick=auto])
+WM_IMGFMT_CHECK_MAGICK
+
 dnl PPM Support
 dnl ===
 # The PPM format is always enabled because we have built-in support
for the format
diff --git a/m4/wm_imgfmt_check.m4 b/m4/wm_imgfmt_check.m4
index 0881cdd..b5f6eee 100644
--- a/m4/wm_imgfmt_check.m4
+++ b/m4/wm_imgfmt_check.m4
@@ -241,3 +241,23 @@ AC_DEFUN_ONCE([WM_IMGFMT_CHECK_WEBP],
  CFLAGS="$wm_save_CFLAGS"],
 [supported_gfx], [GFXLIBS])dnl
 ]) dnl AC_DEFUN
+
+# WM_IMGFMT_CHECK_MAGICK
+# ---
+#
+# Check for MAGICK file support through 'libMagickWand'
+# The check depends on variable 'enable_magick' being either:
+#   yes  - detect, fail if not found
+#   no   - do not detect, disable support
+#   auto - detect, disable if not found
+#
+# When not found, append info to variable 'unsupported'
+AC_DEFUN_ONCE([WM_IMGFMT_CHECK_MAGICK],
+[WM_LIB_CHECK([MAGICK], ["-lMagickWand"], [MagickGetImagePixels],
[$XLFLAGS $XLIBS],
+[wm_save_CFLAGS="$CFLAGS $IMFLAGS"
+ AS_IF([wm_fn_lib_try_compile "wand/magick_wand.h" "" "return 0" ""],
+ [],
+ [AC_MSG_ERROR([found $CACHEVAR but could not find
appropriate header - are you missing libmagickwand package?])])
+ CFLAGS="$wm_save_CFLAGS"],
+[supported_gfx], [GFXLIBS])dnl
+]) dnl AC_DEFUN
diff --git a/src/dialog.c b/src/dialog.c
index 221f6ac..6d5d21a 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -1278,7 +1278,7 @@ void wShowInfoPanel(WScreen *scr)
  }
 #endif

- strbuf = wstrappend(strbuf, _("Supported image formats: "));
+ strbuf = wstrappend(strbuf, _("Image formats: "));
  strl = RSupportedFileFormats();
  separator = NULL;
  for (i = 0; strl[i] != NULL; i++) {
@@ -1303,6 +1303,10 @@ void wShowInfoPanel(WScreen *scr)
  strbuf = wstrappend(strbuf, ", MWM");
 #endif

+#ifdef USE_MAGICK
+ strbuf = wstrappend(strbuf, ", ImageMagick");
+#endif
+
 #ifdef USE_XINERAMA
  strbuf = wstrappend(strbuf, _("\n"));
 #ifdef SOLARIS_XINERAMA
@@ -1311,7 +1315,7 @@ void wShowInfoPanel(WScreen *scr)
  strbuf = wstrappend(strbuf, _("Xinerama: "));
  {
  char tmp[128];
- snprintf(tmp, sizeof(tmp) - 1, _("%d heads found."), scr->xine_info.count);
+ snprintf(tmp, sizeof(tmp) - 1, _("%d head(s) found."), scr->xine_info.count);
  strbuf = wstrappend(strbuf, tmp);
  }
 #endif
diff --git a/src/main.c b/src/main.c
index a21290e..bc14721 100644
--- a/src/main.c
+++ b/src/main.c
@@ -201,6 +201,7 @@ noreturn void Exit(int status)
  if (dpy)
  XCloseDisplay(dpy);

+ RShutdown(); /* wrlib clean exit */
  wutil_shutdown();  /* WUtil clean-up */

  exit(status);
diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index 48af352..daf4a1f 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -64,6 +64,10 @@ if USE_WEBP
 libwraster_la_SOURCES += load_webp.c
 endif

+if USE_MAGICK
+libwraster_la_SOURCES += load_magick.c
+endif
+
 AM_CPPFLAGS = $(DFLAGS) @HEADER_SEARCH_PATH@

 libwraster_la_LIBADD = @LIBRARY_SEARCH_PATH@ @GFXLIBS@ @XLIBS@ @LIBXMU@ -lm
diff --git a/wrlib/imgformat.h b/wrlib/imgformat.h
index 43df3ec..0a44009 100644
--- a/wrlib/imgformat.h
+++ b/wrlib/imgformat.h
@@ -39,12 +39,13 @@ typedef enum {
  IM_PPM =  4,
  IM_JPEG=  5,
  IM_GIF =  6,
- IM_WEBP=  7
+ IM_WEBP=  7,
+ IM_MAGICK  =  8
 } WRImgForm

[PATCH] Better ImageMagick lib detection

2014-03-09 Thread David Maciejak
On some systems the library name is not common,
now we use the config program to find the right libs
to use.

---
 configure.ac  |   16 
 m4/wm_imgfmt_check.m4 |2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index edc4b77..fa4b897 100644
--- a/configure.ac
+++ b/configure.ac
@@ -322,10 +322,10 @@ dnl ==
 dnl AC_ARG_VAR(PKGCONFIG, [pkg-config command])
 AC_CHECK_PROG(PKGCONFIG, pkg-config, pkg-config)

-dnl Magick-config
+dnl MagickWand-config
 dnl ==
-dnl AC_ARG_VAR(MAGICKCONFIG, [Magick-config command])
-AC_CHECK_PROG(MAGICKCONFIG, Magick-config, Magick-config)
+dnl AC_ARG_VAR(MAGICKWCONFIG, [MagickWand-config command])
+AC_CHECK_PROG(MAGICKWCONFIG, MagickWand-config, MagickWand-config)

 dnl gettext
 dnl ===
@@ -568,7 +568,7 @@ dnl
 dnl libMagickWand
 dnl
 AC_MSG_CHECKING([for libmagickwand header])
-IMFLAGS=`$MAGICKCONFIG --cflags`
+IMFLAGS=`$MAGICKWCONFIG --cflags`
 if test "x$IMFLAGS" = "x" ; then
 AC_MSG_RESULT([not found])
 else
@@ -576,6 +576,14 @@ else
 fi
 AC_SUBST(IMFLAGS)

+AC_MSG_CHECKING([for libmagickwand library])
+IMLIBS=`$MAGICKWCONFIG --ldflags`
+if test "x$IMLIBS" = "x" ; then
+AC_MSG_RESULT([not found])
+else
+AC_MSG_RESULT([found])
+fi
+AC_SUBST(IMLIBS)

 dnl Xft2 antialiased font support
 dnl =
diff --git a/m4/wm_imgfmt_check.m4 b/m4/wm_imgfmt_check.m4
index b5f6eee..00d75fc 100644
--- a/m4/wm_imgfmt_check.m4
+++ b/m4/wm_imgfmt_check.m4
@@ -253,7 +253,7 @@ AC_DEFUN_ONCE([WM_IMGFMT_CHECK_WEBP],
 #
 # When not found, append info to variable 'unsupported'
 AC_DEFUN_ONCE([WM_IMGFMT_CHECK_MAGICK],
-[WM_LIB_CHECK([MAGICK], ["-lMagickWand"], [MagickGetImagePixels],
[$XLFLAGS $XLIBS],
+[WM_LIB_CHECK([MAGICK], ["$IMLIBS"], [MagickGetImagePixels], [$XLFLAGS $XLIBS],
 [wm_save_CFLAGS="$CFLAGS $IMFLAGS"
  AS_IF([wm_fn_lib_try_compile "wand/magick_wand.h" "" "return 0" ""],
  [],
-- 
1.7.10.4


0001-Better-ImageMagick-lib-detection.patch
Description: Binary data


[PATCH] RandR misc.

2014-03-13 Thread David Maciejak
This patch is replacing XRandR naming to RandR,
as XRandR is the name of the tool (and the lib) used in X11 and RandR
is the technology WMaker wants to support and to show to the end user.
I had to update the info panel too, when many features are
activated not all of them can be displayed properly.


---
 configure.ac|   10 +-
 m4/wm_xext_check.m4 |4 ++--
 src/WindowMaker.h   |2 +-
 src/dialog.c|   22 --
 src/event.c |6 +++---
 src/screen.c|4 ++--
 src/startup.c   |4 ++--
 7 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac
index 98f5805..f5e020a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -536,14 +536,14 @@ AC_ARG_ENABLE([xinerama],
 [enable_xinerama=auto])
 WM_XEXT_CHECK_XINERAMA

-dnl XRandR support
+dnl RandR support
 dnl ==
-AC_ARG_ENABLE([xrandr],
-[AS_HELP_STRING([--enable-xrandr], [enable XRandR extension
support (NOT recommended, buggy)])],
+AC_ARG_ENABLE([randr],
+[AS_HELP_STRING([--enable-randr], [enable RandR extension support
(NOT recommended, buggy)])],
 [AS_CASE(["$enableval"],
 [yes|no], [],
-[AC_MSG_ERROR([bad value $enableval for --enable-xrandr]) ]) ],
-[enable_xrandr=no])
+[AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
+[enable_randr=no])
 WM_XEXT_CHECK_XRANDR

 dnl
diff --git a/m4/wm_xext_check.m4 b/m4/wm_xext_check.m4
index 9b50a0e..cf6c70f 100644
--- a/m4/wm_xext_check.m4
+++ b/m4/wm_xext_check.m4
@@ -181,7 +181,7 @@ AC_SUBST(LIBXINERAMA)dnl
 # 
 #
 # Check for the X RandR (Resize-and-Rotate) extension
-# The check depends on variable 'enable_xrandr' being either:
+# The check depends on variable 'enable_randr' being either:
 #   yes  - detect, fail if not found
 #   no   - do not detect, disable support
 #   auto - detect, disable if not found
@@ -190,7 +190,7 @@ AC_SUBST(LIBXINERAMA)dnl
 # the variable 'supported_xext'
 # When not found, append info to variable 'unsupported'
 AC_DEFUN_ONCE([WM_XEXT_CHECK_XRANDR],
-[WM_LIB_CHECK([XRandR], [-lXrandr], [XRRQueryExtension], [$XLIBS],
+[WM_LIB_CHECK([RandR], [-lXrandr], [XRRQueryExtension], [$XLIBS],
 [wm_save_CFLAGS="$CFLAGS"
  AS_IF([wm_fn_lib_try_compile "X11/extensions/Xrandr.h" "Display
*dpy;" "XRRQueryExtension(dpy, NULL, NULL)" ""],
 [],
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index f11dab6..012c98c 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -600,7 +600,7 @@ extern struct wmaker_global_variables {
  } xkb;
 #endif

-#ifdef USE_XRANDR
+#ifdef USE_RANDR
  struct {
  Bool supported;
  int event_base;
diff --git a/src/dialog.c b/src/dialog.c
index 6d5d21a..842ca35 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -1220,7 +1220,7 @@ void wShowInfoPanel(WScreen *scr)

  panel->copyrL = WMCreateLabel(panel->win);
  WMResizeWidget(panel->copyrL, 360, 60);
- WMMoveWidget(panel->copyrL, 15, 185);
+ WMMoveWidget(panel->copyrL, 15, 190);
  WMSetLabelTextAlignment(panel->copyrL, WALeft);
  WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
  font = WMSystemFontOfSize(scr->wmscreen, 11);
@@ -1291,14 +1291,6 @@ void wShowInfoPanel(WScreen *scr)
  strbuf = wstrappend(strbuf, _("\nAdditional support for: "));
  strbuf = wstrappend(strbuf, "WMSPEC");

-#ifdef USE_XRANDR
- strbuf = wstrappend(strbuf, ", XRandR ");
- if (w_global.xext.randr.supported)
- strbuf = wstrappend(strbuf, _("(Supported)"));
- else
- strbuf = wstrappend(strbuf, _("(Unsupported)"));
-#endif
-
 #ifdef MWM_HINTS
  strbuf = wstrappend(strbuf, ", MWM");
 #endif
@@ -1320,8 +1312,18 @@ void wShowInfoPanel(WScreen *scr)
  }
 #endif

+#ifdef USE_RANDR
+ strbuf = wstrappend(strbuf, _("\n"));
+ strbuf = wstrappend(strbuf, "RandR: ");
+ if (w_global.xext.randr.supported)
+ strbuf = wstrappend(strbuf, _("supported"));
+ else
+ strbuf = wstrappend(strbuf, _("unsupported"));
+ strbuf = wstrappend(strbuf, ".");
+#endif
+
  panel->infoL = WMCreateLabel(panel->win);
- WMResizeWidget(panel->infoL, 350, 75);
+ WMResizeWidget(panel->infoL, 350, 80);
  WMMoveWidget(panel->infoL, 15, 115);
  WMSetLabelText(panel->infoL, strbuf);
  font = WMSystemFontOfSize(scr->wmscreen, 11);
diff --git a/src/event.c b/src/event.c
index acb7e1f..73614cf 100644
--- a/src/event.c
+++ b/src/event.c
@@ -42,7 +42,7 @@
 #include "xdnd.h"
 #endif

-#ifdef USE_XRANDR
+#ifdef USE_RANDR
 #include 
 #endif

@@ -265,7 +265,7 @@ void DispatchEvent(XEvent * event)
  break;

  case ConfigureNotify:
-#ifdef USE_XRANDR
+#ifdef USE_RANDR
  if (event->xconfigure.window == DefaultRootWindow(dpy))
  XRRUpdateConfiguration(event);
 #endif
@@ -557,7 +557,7 @@ static void handleExtensions(XEvent * event)
  handleXkbIndicatorStateNotify(event);
  }
 #endif /*KEEP_XKB_LOCK_STATUS */
-#ifdef USE_XRANDR
+#ifdef USE_RANDR
  if (w_global.xext.randr.supported && event->type ==
(w_global.xext.randr.event_base + RRScreenChangeNotify)) {
  /* From xrandr man page: "Clients must call back in

[PATCH] Cleaned releasing application

2014-03-22 Thread David Maciejak
When an application is created with WMInitializeApplication,
it's never destroyed properly.
The patch is adding some functions to free the memory and taking as
example 'wmsetbg'.
Moreover, in wmsetbg.c I also corrected 2 compiler warnings and a
possible buffer overflow.

Next step is to track down other WMInitializeApplication calls.
Below are the valgrind reports.

###
before:

# valgrind wmsetbg
==9646== Memcheck, a memory error detector
==9646== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==9646== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==9646== Command: wmsetbg
==9646==
wmsetbg: you must specify a image file name or a texture
Try 'wmsetbg --help' for more information
==9646==
==9646== HEAP SUMMARY:
==9646== in use at exit: 760 bytes in 10 blocks
==9646==   total heap usage: 38 allocs, 28 frees, 4,397 bytes allocated
==9646==
==9646== LEAK SUMMARY:
==9646==definitely lost: 0 bytes in 0 blocks
==9646==indirectly lost: 0 bytes in 0 blocks
==9646==  possibly lost: 0 bytes in 0 blocks
==9646==still reachable: 760 bytes in 10 blocks
==9646== suppressed: 0 bytes in 0 blocks
==9646== Rerun with --leak-check=full to see details of leaked memory



###
after:

# valgrind wmsetbg
==10670== Memcheck, a memory error detector
==10670== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==10670== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==10670== Command: wmsetbg
==10670==

wmsetbg: you must specify a image file name or a texture
Try 'wmsetbg --help' for more information
==10670==
==10670== HEAP SUMMARY:
==10670== in use at exit: 0 bytes in 0 blocks
==10670==   total heap usage: 38 allocs, 38 frees, 4,397 bytes allocated
==10670==
==10670== All heap blocks were freed -- no leaks are possible


Patch is below and enclosed.

---
 WINGs/WINGs/WINGs.h   |  3 ++-
 WINGs/notification.c  | 12 +++
 WINGs/wapplication.c  | 11 ++
 WPrefs.app/TexturePanel.c |  1 +
 util/wmsetbg.c| 54 ---
 5 files changed, 58 insertions(+), 23 deletions(-)

diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h
index aa95844..6597504 100644
--- a/WINGs/WINGs/WINGs.h
+++ b/WINGs/WINGs/WINGs.h
@@ -642,9 +642,10 @@ WMRect wmkrect(int x, int y, unsigned int width,
unsigned int height);
 /* ---[ WINGs/wapplication.c ] */


-
 void WMInitializeApplication(const char *applicationName, int *argc,
char **argv);

+void WMReleaseApplication();
+
 void WMSetResourcePath(const char *path);

 /* don't free the returned string */
diff --git a/WINGs/notification.c b/WINGs/notification.c
index ada942f..ebb05ec 100644
--- a/WINGs/notification.c
+++ b/WINGs/notification.c
@@ -94,6 +94,18 @@ void W_InitNotificationCenter(void)
  notificationCenter->observerTable = WMCreateHashTable(WMIntHashCallbacks);
 }

+void WMReleaseNotificationCenter()
+{
+ if (notificationCenter->nameTable)
+ WMFreeHashTable(notificationCenter->nameTable);
+ if (notificationCenter->objectTable)
+ WMFreeHashTable(notificationCenter->objectTable);
+ if (notificationCenter->observerTable)
+ WMFreeHashTable(notificationCenter->observerTable);
+ if (notificationCenter)
+ wfree(notificationCenter);
+}
+
 void
 WMAddNotificationObserver(WMNotificationObserverAction * observerAction,
   void *observer, const char *name, void *object)
diff --git a/WINGs/wapplication.c b/WINGs/wapplication.c
index a0aec2e..84ede06 100644
--- a/WINGs/wapplication.c
+++ b/WINGs/wapplication.c
@@ -48,6 +48,17 @@ void WMInitializeApplication(const char
*applicationName, int *argc, char **argv
  W_InitNotificationCenter();
 }

+void WMReleaseApplication() {
+ int i =0;
+ if (WMApplication.applicationName)
+ wfree(WMApplication.applicationName);
+ for (i = 0; i < WMApplication.argc; i++)
+ wfree(WMApplication.argv[i]);
+ if (WMApplication.argv)
+ wfree(WMApplication.argv);
+ WMReleaseNotificationCenter();
+}
+
 void WMSetResourcePath(const char *path)
 {
  if (WMApplication.resourcePath)
diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c
index 9f2b86a..530c124 100644
--- a/WPrefs.app/TexturePanel.c
+++ b/WPrefs.app/TexturePanel.c
@@ -1527,6 +1527,7 @@ int main(int argc, char **argv)
  ShowTexturePanel(panel);

  WMScreenMainLoop(scr);
+ WMReleaseApplication();
  return 0;
 }
 #endif
diff --git a/util/wmsetbg.c b/util/wmsetbg.c
index 644c85d..d85eb43 100644
--- a/util/wmsetbg.c
+++ b/util/wmsetbg.c
@@ -100,6 +100,12 @@ typedef struct BackgroundTexture {
  int height;
 } BackgroundTexture;

+static void quit(int rcode)
+{
+ WMReleaseApplication();
+ exit(rcode);
+}
+
 static void initXinerama(void)
 {
  xineInfo.screens = NULL;
@@ -903,7 +909,7 @@ static noreturn void helperLoop(RContext * rc)
  errcount--;
  if (errcount == 0) {
  wfatal("quitting");
- exit(1)

Re: [PATCH] Cleaned releasing application

2014-03-28 Thread David Maciejak
No problem, thanks Carlos for your feedback.

I will do the patch splitting but first i want to see if i can also
patch some similar issues.


Stay tuned.

regards,
david

On Fri, Mar 28, 2014 at 9:58 PM, Carlos R. Mafra  wrote:
> Sorry for the delay, I was sick and then I forgot seeing the patch.
>
> On Sat, 22 Mar 2014 at 20:25:42 +0800, David Maciejak wrote:
>> When an application is created with WMInitializeApplication,
>> it's never destroyed properly.
>> The patch is adding some functions to free the memory and taking as
>> example 'wmsetbg'.
>
> I think it will be better to split the patch into three:
>
> 1. Add WINGs functions
> 2. Make wmsetbg use 1.
> 3. Make WPrefs use 1.
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Xinerama related bugs

2014-03-28 Thread David Maciejak
Hi Josip,

it's more or less a known *issue* as xinerama had been deprecated
since years and randr support has never been fully implemented in
wmaker.


regards,
david

On Thu, Mar 27, 2014 at 9:19 PM, Josip Deanovic
 wrote:
> On Thursday 2014-03-27, Josip Deanovic wrote:
>> Greetings!
>>
>> There are several xinerama related bugs.
>> I'll start with the one that makes windowmaker hard to use.
>
> [...]
>> Description of the issue:
>> - if the wmdock is placed on the primary monitor on the left side
>> everything seems to work fine unless I try to move the dock to the right
>> side using mouse pointer. In that case wmdock would disappear on the
>> right side and could not be used any more until windowmaker is
>> restarted.
>> - if the wmdock is placed on the right side on the primary monitor it's
>> not visible and cannot be used.
>> - if the wmdock is placed on either side on the above konitor (secondary
>>   monitor) wmdock is visible and usable.
>>
>> Note that the primary monitor (the one integrated into the laptop) have a
>> a smaller resolution (1600x900) than the secondary (external VGA) monitor
>> (1680x1050).
>>
>> Also, note that the placement of the wmdock is incorrectly calculated
>> in case you disconnect the secondary monitor and restart the X server.
>>
>> Is there any chance to solve the above issues?
>>
>> Kind regards
>
> In addition to the issue described above I have found that I am unable
> to switch workspace in the primary (laptop's) monitor while dragging a
> window to the border on the right.
> A workspace successfully changes when I use the border on the left.
>
> When I use secondary (external VGA) monitor and try to drag a window over
> left or right borders a workspace successfully change as expected.
>
>
> Regards
>
> --
> Josip Deanovic
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 0/3] Added some clean function

2014-03-31 Thread David Maciejak
When an application is created with WMInitializeApplication,
it's never destroyed properly.

The 3 patches are adding some functions to free the
memory and taking as example 'wmsetbg'. Moreover, in wmsetbg.c I also
corrected 2 compiler warnings and a possible buffer overflow.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/3] Added cleaned function in wings

2014-03-31 Thread David Maciejak
---
 WINGs/WINGs/WINGs.h  |  3 ++-
 WINGs/notification.c | 12 
 WINGs/wapplication.c | 11 +++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h
index aa95844..6597504 100644
--- a/WINGs/WINGs/WINGs.h
+++ b/WINGs/WINGs/WINGs.h
@@ -642,9 +642,10 @@ WMRect wmkrect(int x, int y, unsigned int width,
unsigned int height);
 /* ---[ WINGs/wapplication.c ] */


-
 void WMInitializeApplication(const char *applicationName, int *argc,
char **argv);

+void WMReleaseApplication();
+
 void WMSetResourcePath(const char *path);

 /* don't free the returned string */
diff --git a/WINGs/notification.c b/WINGs/notification.c
index ada942f..ebb05ec 100644
--- a/WINGs/notification.c
+++ b/WINGs/notification.c
@@ -94,6 +94,18 @@ void W_InitNotificationCenter(void)
  notificationCenter->observerTable = WMCreateHashTable(WMIntHashCallbacks);
 }

+void WMReleaseNotificationCenter()
+{
+ if (notificationCenter->nameTable)
+ WMFreeHashTable(notificationCenter->nameTable);
+ if (notificationCenter->objectTable)
+ WMFreeHashTable(notificationCenter->objectTable);
+ if (notificationCenter->observerTable)
+ WMFreeHashTable(notificationCenter->observerTable);
+ if (notificationCenter)
+ wfree(notificationCenter);
+}
+
 void
 WMAddNotificationObserver(WMNotificationObserverAction * observerAction,
   void *observer, const char *name, void *object)
diff --git a/WINGs/wapplication.c b/WINGs/wapplication.c
index a0aec2e..84ede06 100644
--- a/WINGs/wapplication.c
+++ b/WINGs/wapplication.c
@@ -48,6 +48,17 @@ void WMInitializeApplication(const char
*applicationName, int *argc, char **argv
  W_InitNotificationCenter();
 }

+void WMReleaseApplication() {
+ int i =0;
+ if (WMApplication.applicationName)
+ wfree(WMApplication.applicationName);
+ for (i = 0; i < WMApplication.argc; i++)
+ wfree(WMApplication.argv[i]);
+ if (WMApplication.argv)
+ wfree(WMApplication.argv);
+ WMReleaseNotificationCenter();
+}
+
 void WMSetResourcePath(const char *path)
 {
  if (WMApplication.resourcePath)
-- 
1.8.3.2


0001-Added-cleaned-function-in-wings.patch
Description: Binary data


[PATCH 2/3] Modified commented code to call clean fcts

2014-03-31 Thread David Maciejak
---
 WPrefs.app/TexturePanel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c
index 9f2b86a..530c124 100644
--- a/WPrefs.app/TexturePanel.c
+++ b/WPrefs.app/TexturePanel.c
@@ -1527,6 +1527,7 @@ int main(int argc, char **argv)
  ShowTexturePanel(panel);

  WMScreenMainLoop(scr);
+ WMReleaseApplication();
  return 0;
 }
 #endif
-- 
1.8.3.2


0002-Modified-commented-code-to-call-clean-fcts.patch
Description: Binary data


[PATCH 3/3] Cleaned and fixed sprintf call

2014-03-31 Thread David Maciejak
---
 util/wmsetbg.c | 54 --
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/util/wmsetbg.c b/util/wmsetbg.c
index 644c85d..d85eb43 100644
--- a/util/wmsetbg.c
+++ b/util/wmsetbg.c
@@ -100,6 +100,12 @@ typedef struct BackgroundTexture {
  int height;
 } BackgroundTexture;

+static void quit(int rcode)
+{
+ WMReleaseApplication();
+ exit(rcode);
+}
+
 static void initXinerama(void)
 {
  xineInfo.screens = NULL;
@@ -903,7 +909,7 @@ static noreturn void helperLoop(RContext * rc)
  errcount--;
  if (errcount == 0) {
  wfatal("quitting");
- exit(1);
+ quit(1);
  }
  continue;
  }
@@ -917,7 +923,7 @@ static noreturn void helperLoop(RContext * rc)
  errcount--;
  if (errcount == 0) {
  wfatal("quitting");
- exit(1);
+ quit(1);
  }
  continue;
  }
@@ -973,7 +979,7 @@ static noreturn void helperLoop(RContext * rc)
 #ifdef DEBUG
  printf("exit command\n");
 #endif
- exit(0);
+ quit(0);

  default:
  wwarning("unknown message received");
@@ -987,9 +993,11 @@ static void updateDomain(const char *domain,
const char *key, const char *textur
  char *program = "wdwrite";

  /* here is a mem leak */
- system(wstrconcat("wdwrite ",
+ int result = system(wstrconcat("wdwrite ",
   wstrconcat(domain, smooth ? " SmoothWorkspaceBack YES" : "
SmoothWorkspaceBack NO")));

+ if (result == -1)
+ werror("error executing system command");
  execlp(program, program, domain, key, texture, NULL);
  wwarning("warning could not run \"%s\"", program);
 }
@@ -1228,7 +1236,7 @@ int main(int argc, char **argv)
  i++;
  if (i >= argc) {
  wfatal("too few arguments for %s", argv[i - 1]);
- exit(1);
+ quit(1);
  }
  display = argv[i];
  } else if (strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--scale") == 0) {
@@ -1260,61 +1268,61 @@ int main(int argc, char **argv)
  i++;
  if (i >= argc) {
  wfatal("too few arguments for %s", argv[i - 1]);
- exit(1);
+ quit(1);
  }
  domain = wstrdup(argv[i]);
  } else if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--colors") == 0) {
  i++;
  if (i >= argc) {
  wfatal("too few arguments for %s", argv[i - 1]);
- exit(1);
+ quit(1);
  }
  if (sscanf(argv[i], "%i", &cpc) != 1) {
  wfatal("bad value for colors per channel: \"%s\"", argv[i]);
- exit(1);
+ quit(1);
  }
  } else if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i],
"--back-color") == 0) {
  i++;
  if (i >= argc) {
  wfatal("too few arguments for %s", argv[i - 1]);
- exit(1);
+ quit(1);
  }
  back_color = argv[i];
  } else if (strcmp(argv[i], "-p") == 0 || strcmp(argv[i], "--parse") == 0) {
  i++;
  if (i >= argc) {
  wfatal("too few arguments for %s", argv[i - 1]);
- exit(1);
+ quit(1);
  }
  texture = argv[i];
  } else if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i],
"--workspace") == 0) {
  i++;
  if (i >= argc) {
  wfatal("too few arguments for %s", argv[i - 1]);
- exit(1);
+ quit(1);
  }
  if (sscanf(argv[i], "%i", &workspace) != 1) {
  wfatal("bad value for workspace number: \"%s\"", argv[i]);
- exit(1);
+ quit(1);
  }
  } else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) {
  printf("%s (Window Maker %s)\n", __progname, VERSION);
- exit(0);
+ quit(0);
  } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
  print_help();
- exit(0);
+ quit(0);
  } else if (argv[i][0] != '-') {
  image_name = argv[i];
  } else {
  printf("%s: invalid argument '%s'\n", __progname, argv[i]);
  printf("Try '%s --help' for more information\n", __progname);
- exit(1);
+ quit(1);
  }
  }
  if (!image_name && !texture && !helperMode) {
  printf("%s: you must specify a image file name or a texture\n", __progname);
  printf("Try '%s --help' for more information\n", __progname);
- exit(1);
+ quit(1);
  }

  PixmapPath = getPixmapPath(domain);
@@ -1334,7 +1342,7 @@ int main(int argc, char **argv)
  dpy = XOpenDisplay(display);
  if (!dpy) {
  wfatal("could not open display");
- exit(1);
+ quit(1);
  }
 #if 0
  XSynchronize(dpy, 1);
@@ -1367,12 +1375,14 @@ int main(int argc, char **argv)

  if (!rc) {
  wfatal("could not initialize wrlib: %s", RMessageForError(RErrorCode));
- exit(1);
+ quit(1);
  }

  if (helperMode) {
  /* lower priority, so that it wont use all the CPU */
- nice(15);
+ int result = nice(15);
+ if (result == -1)
+ werror("error could not nice process");

  helperLoop(rc);
  } else {
@@ -1381,8 +1391,7 @@ int main(int argc, char **argv)

  if (!texture) {
  char *image_path = getFullPixmapPath(image_name);
-
- sprintf(buffer, "(%s, \"%s\", %s)", style, image_path, back_color);
+ snprintf(buffer, sizeof(buffer), "(%s, \"%s\", %s)", style,
image_path, back_color);
  wfree(image_path);
  texture = (char *)buffer;
  }
@@ -1393,7 +1402,7 @@ int main(int argc, char **argv)

  tex = parseTexture(rc, texture);
  if (!tex)
- exit(1);
+ quit(1);

  if (workspace < 0)
  changeTexture(tex);
@@ -1403,5 +1412,6 @@ int main(int argc, char **argv)
  }
  }

+ WMReleaseApplication();
  return 0;
 }
-- 
1.8.3.2


0003-Cleaned-and-fixed-sprintf-call.patch
Descriptio

[PATCH] Added clean functions to wrlib

2014-03-31 Thread David Maciejak
Same as previous patches but this time to add some functions
to wrlib to release all memory allocated.
The apps using wrlib have to call the cleaning functions before leaving.


---
 wrlib/context.c  | 11 +++
 wrlib/convert.c  | 27 ++-
 wrlib/libwraster.map |  1 +
 wrlib/load.c | 17 +
 wrlib/wraster.h  |  7 +++
 5 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/wrlib/context.c b/wrlib/context.c
index b6794d0..04228ed 100644
--- a/wrlib/context.c
+++ b/wrlib/context.c
@@ -688,6 +688,17 @@ RContext *RCreateContext(Display * dpy, int
screen_number, const RContextAttribu
  return context;
 }

+void RDestroyContext(RContext * context)
+{
+ if (context) {
+ if (context && context->attribs)
+ free(context->attribs);
+ if (context && context->copy_gc)
+ XFreeGC(context->dpy, context->copy_gc);
+ free(context);
+ }
+}
+
 static Bool bestContext(Display * dpy, int screen_number, RContext * context)
 {
  XVisualInfo *vinfo = NULL, rvinfo;
diff --git a/wrlib/convert.c b/wrlib/convert.c
index f3c9a49..867a3d8 100644
--- a/wrlib/convert.c
+++ b/wrlib/convert.c
@@ -62,6 +62,32 @@ typedef struct RStdConversionTable {
 static RConversionTable *conversionTable = NULL;
 static RStdConversionTable *stdConversionTable = NULL;

+static void release_conversion_table()
+{
+ RConversionTable *tmp = conversionTable;
+ while (tmp) {
+ RConversionTable *tmp_to_delete = tmp;
+ tmp = tmp->next;
+ free(tmp_to_delete);
+ }
+}
+
+static void release_std_conversion_table()
+{
+ RStdConversionTable *tmp = stdConversionTable;
+ while (tmp) {
+ RStdConversionTable *tmp_to_delete = tmp;
+ tmp = tmp->next;
+ free(tmp_to_delete);
+ }
+}
+
+void RDestroyConvertTables()
+{
+ release_conversion_table();
+ release_std_conversion_table();
+}
+
 static unsigned short *computeTable(unsigned short mask)
 {
  RConversionTable *tmp = conversionTable;
@@ -356,7 +382,6 @@ static RXImage *image2TrueColor(RContext * ctx,
RImage * image)
  }

  }
-
  return ximg;
 }

diff --git a/wrlib/libwraster.map b/wrlib/libwraster.map
index 6e165ef..422af75 100644
--- a/wrlib/libwraster.map
+++ b/wrlib/libwraster.map
@@ -33,6 +33,7 @@ LIBWRASTER3
 RConvertImageMask;
 RCopyArea;
 RCreateContext;
+RDestroyContext;
 RCreateImage;
 RCreateImageFromDrawable;
 RCreateImageFromXImage;
diff --git a/wrlib/load.c b/wrlib/load.c
index 8e0d34d..5e0e8cb 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -105,11 +105,28 @@ char **RSupportedFileFormats(void)
  return tmp;
 }

+static void destroy_cache(void)
+{
+ if (RImageCacheSize > 0) {
+ for (int i = 0; i < RImageCacheSize; i++) {
+ if (RImageCache[i].file) {
+ free(RImageCache[i].file);
+ RImageCache[i].file = NULL;
+ RReleaseImage(RImageCache[i].image);
+ }
+
+ }
+ free(RImageCache);
+ }
+}
+
 /* cleaning third-party libs at shutdown */
 void RShutdown() {
 #ifdef USE_MAGICK
  MagickWandTerminus();
 #endif
+ destroy_cache();
+ RDestroyConvertTables();
 }

 static void init_cache(void)
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index c4ed231..a87eb1c 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -461,11 +461,18 @@ void RPutXImage(RContext *context, Drawable d,
GC gc, RXImage *ximage,
 int src_x, int src_y, int dest_x, int dest_y,
 unsigned width, unsigned height);

+void RDestroyConvertTables();
+
 /* do not free the returned string! */
 const char *RMessageForError(int errorCode);

 int RBlurImage(RImage *image);

+
+#ifdef USE_MAGICK
+ extern void MagickWandTerminus();
+#endif
+
 /** Global Variables ***/

 extern int RErrorCode;
-- 
1.8.3.2


0001-Added-clean-functions-to-wrlib.patch
Description: Binary data


Re: [PATCH 0/3] Changes in NetPBM support

2014-04-05 Thread David Maciejak
Great Christophe,

quite a bunch of changes, don't know how you tested your modifications
for non regression, from my side i used the files at
https://git.gnome.org/browse/gdk-pixbuf/tree/tests/test-images even if
i remember well not all the file types are provided.

regards,
david

On Sun, Apr 6, 2014 at 4:32 AM, Christophe  wrote:
> From: Christophe CURIS 
>
> Hello,
>
> These 4 patches implements the suggestion I made concerning the
> netPBM support that was brought by David:
>
>  - patch * diff: show all the changes versus original patch, for ease
> of review;
>
>  - patch 1 to 3 replace: I have split David's commit in 3 and included
> my changes; these 3 patches are supposed to replace the commit
> 3c531e4878c1a4b8201dc9f71dd942c799c16503
>
> Regards,
> Christophe.
>
>
>  wrlib/load.c|  34 --
>  wrlib/load_ppm.c| 313 
> 
>  wrlib/tests/Makefile.am |   2 +-
>  wrlib/tests/testdraw.c  |   2 +
>  wrlib/tests/view.c  |   6 +-
>  5 files changed, 292 insertions(+), 65 deletions(-)
>
> --
> 1.8.5.3
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] Removed unused second switch panel background

2014-04-15 Thread David Maciejak
Still don't know why the switch panel background has to be blue,
but anyway i believe we don't need to have the second background file
in the repo which is not used and btw can be tweaked from the config file.


--

diff --git a/WindowMaker/Pixmaps/Makefile.am b/WindowMaker/Pixmaps/Makefile.am
index b3ee504..f970ea4 100644
--- a/WindowMaker/Pixmaps/Makefile.am
+++ b/WindowMaker/Pixmaps/Makefile.am
@@ -4,7 +4,6 @@ defsdatadir = $(pkgdatadir)/Pixmaps
 defsdata_DATA = tile.tiff \
  tile.xpm \
  swtile.png \
- swback.png \
- swback2.png
+ swback.png

 EXTRA_DIST = $(defsdata_DATA)
diff --git a/WindowMaker/Pixmaps/swback2.png b/WindowMaker/Pixmaps/swback2.png
deleted file mode 100644
index 
c4b267d33a9ac90c83e76165c46532275b241ebd..
GIT binary patch
literal 0
HcmV?d1

literal 4298
zcmV;*5H;_KP)WFU8GbZ8({Xk{QrNlj4iWF>9@01z%oL_t(|+SOcpjMdc<
z{^ssg6a<9r0DV>
ziV>~6);8J}5XAZb2^EWrudI|^+;t&f6$=ELpxopaqhLanIA6JLZ;P1T;|I5$3x~IM4-Gi(59(aGz;;UvH
z{!|ZadGwhPt($hN?C3f05r58p9X$s=YTdYFWy_be}{QcDpS5H4>R{60NZ+`ESTbF)k*3=uA8T0O0jnyx{
z7LQJ=DwPMx@JH<&Cn*5>e@?o3Z{KfMS1(@qS1-PC&Lo_AV#7%zXIwhqiPm5Lts;Py
z6&r_Kf5DWsg9aQ$cdvaOzxeYO-{$Z!2A9}=mE+{x%NfJvoGb6YX6K%FF=)V1n9=k_
ze7Ui{dEgmeyMNt^-@R7=fC(dq{k~zyz(RXxFBUFeUs74_|GTX2EWUu{dGwzztET+B
zaxeGIJ{iX=?=#*5@rTg=Zq{St_-~G%xp4VWLo-^qW
zLyjF#xbeOxuyaqZ;d05CLMXo=2TZZeN?X;_$I=w!^Q)*23sYjDBCOxt?<)c`cE5WN
z*UXrV`oYIe7<}d>cNIq+f83JB;e(5B_Z-05ExW|Kr0t83V0L1XaEekO(urw*0_7-4
z-U|Ss?}JSH69OW{8cJ-;T>t>A-LeaB_Z+~OhM~n#LkBG>G@UT~S^#)p!}h*#r&Tg&
z)il(T8T}xk^e0F)M0%e*r`0#~eS80XhG|H%lVgv84Qwb@Gt+~!t)3(X&QPieg%G7?N%W|+uA&to9tXqLvdVz~aOqnCOdMT5
zy4W~;a2)__duy*D>2kacacr#&qO77K{&I+gCS$wSqVl~GXCTBT0d=nY-bffMOh`YI
z@dqIWV*q;JJ5>31F&=<;3X}2C8KlBeW7xiq#r@2FoR`{R37s>zBv9-Gb<~QSY$Aa2
z%(G#Z6i0$c;=&{(9Cig5#7Ambl^#lLL*25VNqrPb@1zj>E*KF(462xjk`1Y{P;Yi1
zLB(;A^2ACv*_k@l0yRucYAM4H!^wE!P$-WT-zl6x!FK9g3ONF(
zMByvM_RLa-T0MinG8|)qB(I2ZPvoCizgOoBA;JFf^I@EeG=L2upgPplnqs93#LjG!
z^FfLOi0)B&0vmY)b0%wz4;K9pBN-qvu3?+Z&|a5wIh7Q$Qg2q_nT*(1@lo367=Dax
zQz@F#C&XDDBntzT7?H{ZjSr7(Qb~dYf`kZhI+SWq7G;whN01~yuuCAs0wC=?f`GC?
zF}{{c3Nz5COlNx50HY6W
zC?~@PS;NXd=yR0LOq3!k;p&K?ndbyPv&v}{o9$>vG0&)SMvd8LtrB%t&J3`_A7|9s
z5{i`+vG5uCTFUwWj*(W5k!25mBS}47IGnY2&(An8nN+678GohzUv$-&ow^t6;sg7G
zCn)kl43H@fw;GT!8N7fB#pRQMZS&H?XUYH}ZQBv1*NFvZxOq*D8M8qOLhF;HsdY+8
z*CfHpC2icF<}0-VIN(m0itAp;JnTdVLI3EgABR
ziM?`}MPQOrKQ_`@axzSZ_;BI3o;ZuNB{L1TSz%Izj3m`$MO1QJ-;?T1O6@F&o0t>Z
z)ETo$Mnys=rS@c@R~HF})NVQ0c1=b-Fd;uJo7IA*7z>!BOgUYyp$@J?E2|=k4}_c;
zpL>bS>Lk{;>@7OZ277B2H?&4@L@&BoUK9=F7}E(hpfKW=7C3c1ixy|600JXZiyWdy
zWsy^rGFU1igQkPcasf3mLe*H7sMCv;z^K1S!MSn{_octO&}kwZ73&jtYxD>Kc3+cQ
z7$JxA1E*wY799$8qhKT}ia9pvYuI%_ZR_L^H<~;(dNd3lpyDxG>SbhoW`yLFhGNUk
z4KlO*pTIU@O4Zq(Z8a7be-RCc_AUl50#DXOr?V5;#?|qfEUqn+<9;lWdD7K{&$_lZwgK{d$&&9aafx
zRhXgF8crdXvUSIzKhtd38>g_=stCbIXGtSN@*5vWm9;gPio#s*Y90m&N>vIYm08VX
zR;&dP4CscmUB)9?EK=XBAhQ9nVE`=89A%yos%3+0GF2(>XK`^lkugFgWqJT|ag8i^
zOm_O46jW3=b%Brzd8tYr-%DXBtq!weCT8+(uu8!KRFq+*iNZUnvfKkj;~C+95T?`@?TX83aFw1
zCJCw~XEiEStIJz7mF5am`OGY8Ncvo7subr2fKRm88bB#=X%#*FnwUXnvG38?sziGY
zR+MUoN!&QpozpdRy&XxhQyCdrKwBD5gaHQF5KlEh!1B_#o
zDS&F?Ggr>$T*=!>xvO@O)p&olN66~tPC}r!;6bT&1fdb9+U62E&iDo>)<=7Or!hJK
zeyV}nMuHCNvk)4wAt2*gT{mO{U700x?R43x8tDW~5epF!8~cl*oi6F(rdPM;Oo7z8
z&S-g~QYviG+7=+v9AS`?K|V)Gwqq{3_D^j44MI)*cQHaVt|9#_N|(Br^#S;60jQRq
z1#&2{YV2=?qC&bRz^X4&X5Afo3o+T~$R%e+4Ui*i2T8%DCJnF%N6MG1HA;k2kObMK
zZ3r@htgKL+BX%GzJ9R`D4O_Kzic*cxw5kbYfJ@M*%yWQ%+aF}D5b@?jqxx(z#K;s%
zv$<@Q>r^2ms@Wr@vU02Kt;no>gIDhr&n@@_f+7(s3{i;1$Q}p@usb0Yxmi*3kP@9i
z@tD!dRA)u2L43x9X|>v5QqW|h;v!%%X^0w9{0&wqw1doKYp$$LMNva8?bFq0UEB#V
zfTC<=h|LxfTSE*Li%41H{=mi(S=c4FS~gDb7G5y&(WyEkBxjXu!Zca0ud6$MM?E8k&}d3-Kf=eoJdR{>E;S4O~o+ONwuIcXSjVG0SuFqWUHQ8vzNdr
zh;W8^_I-ed`nY;07!1LXAuuZ)W+Nw{0DB)2_UnU@w+}YG?x(|?CunPldR|YUbLl2S`-dNftGT`Wt)CLI1)gt5i;z>lCYP#Tg*@5LmcQvR4+L@4*T&vV-?wEV{7jl5)Ku>+u+Sg;a#d
z#-1Ym_ty^{)GvTNJ^PLT!08jmiN%Q$^6JG=2GnHsNs@})v#>w8>w_L}a5%h>S!}`S
z#IOa9`i`GIaU1|(PtU$1g$|(Y-LwB-XgaA8OK+ZUcwuWNC&bH8teu?99j8bw
zsOCKXkmUb{{hQi{WYdSGKbViElN#~-#9S!pr@;jxESNnDcYOD1j6d-N
z0KlsC&%JQ@h38h^QnUQKcf}J+uexZ)Z4JYQ7RrLSf8|ryy7P5xZ+{Ej`wu!)E&CK~
zw#-B}zGt;%j#JDXG5mN;Z5oGZlg8u5D=w~lc+dU=;jzDNUUu`muP^-AO4M@SLnB(-
z)~)R5>i+y~tJ~H6QES_}l`Z!@^vSl>Re~svsvovw>

0001-Removed-unused-second-switch-panel-background.patch
Description: Binary data


Re: wmaker-dev emails landing of SPAM folder (was Re: [PATCH 0/2] wrlib: changes in MagickWand implementation)

2014-04-16 Thread David Maciejak
hum Carlos, not sure you saw that email:

Subject: [PATCH] Added clean functions to wrlib
Newsgroups: gmane.compw.window-managers.windowmaker.devel
Date: 2014-03-31 15:43:17 GMT (2 weeks, 1 day, 18 hours and 22 minutes ago)

see:
http://news.gmane.org/gmane.compw.window-managers.windowmaker.devel

regards,
david

On Wed, Apr 16, 2014 at 4:05 PM, Carlos R. Mafra  wrote:
> On Sat, 12 Apr 2014 at 18:04:52 +0200, Christophe wrote:
>>
>> - Carlos R. Mafra  a écrit :
>> > On Sat, 12 Apr 2014 at 16:34:35 +0200, Christophe wrote:
>> > > Carlos,
>> > >
>> > > As this series of replace-patches may be a little bit to replace
>> > > because of conflicts created by dependancies, would it make your like
>> > > easier if I'd send a tgz with all patches on #next after 4e70bdb5 ?
>> >
>> > I confess I'm still confused by your previous series with many
>> > diff- and replace- versions and I'm not sure what to do.
>> >
>> > To be honest, I prefer to apply the diffs and rebase the tree myself
>> > in case the diff is small enough to merge into the original patch.
>>
>> I would tend to prefer this method too, the limit I had being that I was not 
>> certain of my method for generating the diffs. Now that I have a simple and 
>> clean way, I can re-propose cleanly generated diffs. Please note that 
>> there's still the case on commits split in 2/3 (manageable with multiple 
>> patchs) and some conflits that will arise while applying them (for example 
>> because magick, webp and ppm improvements touches same files)
>>
>>
>> > When the diff is not small, I think it's ok to have both the original
>> > patch and the fix. That is more "honest" from the point of view
>> > of authorship. In fact, I can only praise your efforts to improve
>> > those patches and suggest them to be rebased.
>> >
>> > But from a pratical point of view, I prefer if you just send the
>> > diffs and let me rebase (if you state it's ok to do so). Would that
>> > be ok to you? Would it mean less or more work from your reference
>> > frame?
>>
>> I will submit a new set of rebasable diffs, but not all at once to make sure 
>> I do not skip any info about what you're to expect when applying them.
>
> Oh man! I've just checked my spam folder in gmail and just now
> I've seen your email. Somehow gmail decided that most of emails
> to the wmaker-dev list starting from around beginning of April
> were spam. Sigh!
>
> Sorry about that. I never had problems of gmail tagging legitimate
> emails as spam before, so I didn't have the habit of checking
> that folder.
>
> In any case, I will try to go through the old emails and see if
> I can make sense of them. It might take a while.
>
> Sorry for the trouble!!!
>
> PS: If somebody else sent patches to wmaker-dev and got no response,
> please send them again.
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] Added clean functions to wrlib

2014-04-16 Thread David Maciejak
As far as I can see with the image viewer (wmiv) I am working on and which
is using wrlib, without that patch some memory are lost.

Thx,
David

On Wednesday, April 16, 2014, Carlos R. Mafra  wrote:

> On Mon, 31 Mar 2014 at 23:43:17 +0800, David Maciejak wrote:
> > Same as previous patches but this time to add some functions
> > to wrlib to release all memory allocated.
>
> But it should be pointed out that if you don't call these functions
> the memory is freed anyway by the operating system once the application
> is closed. But unless someone objects I will apply this anyway.
>
> > The apps using wrlib have to call the cleaning functions before leaving.
>
>
>
> >
> >
> > ---
> >  wrlib/context.c  | 11 +++
> >  wrlib/convert.c  | 27 ++-
> >  wrlib/libwraster.map |  1 +
> >  wrlib/load.c | 17 +
> >  wrlib/wraster.h  |  7 +++
> >  5 files changed, 62 insertions(+), 1 deletion(-)
> >
> > diff --git a/wrlib/context.c b/wrlib/context.c
> > index b6794d0..04228ed 100644
> > --- a/wrlib/context.c
> > +++ b/wrlib/context.c
> > @@ -688,6 +688,17 @@ RContext *RCreateContext(Display * dpy, int
> > screen_number, const RContextAttribu
> >   return context;
> >  }
> >
> > +void RDestroyContext(RContext * context)
> > +{
> > + if (context) {
> > + if (context && context->attribs)
> > + free(context->attribs);
> > + if (context && context->copy_gc)
> > + XFreeGC(context->dpy, context->copy_gc);
> > + free(context);
> > + }
> > +}
> > +
> >  static Bool bestContext(Display * dpy, int screen_number, RContext *
> context)
> >  {
> >   XVisualInfo *vinfo = NULL, rvinfo;
> > diff --git a/wrlib/convert.c b/wrlib/convert.c
> > index f3c9a49..867a3d8 100644
> > --- a/wrlib/convert.c
> > +++ b/wrlib/convert.c
> > @@ -62,6 +62,32 @@ typedef struct RStdConversionTable {
> >  static RConversionTable *conversionTable = NULL;
> >  static RStdConversionTable *stdConversionTable = NULL;
> >
> > +static void release_conversion_table()
> > +{
> > + RConversionTable *tmp = conversionTable;
> > + while (tmp) {
> > + RConversionTable *tmp_to_delete = tmp;
> > + tmp = tmp->next;
> > + free(tmp_to_delete);
> > + }
> > +}
> > +
> > +static void release_std_conversion_table()
> > +{
> > + RStdConversionTable *tmp = stdConversionTable;
> > + while (tmp) {
> > + RStdConversionTable *tmp_to_delete = tmp;
> > + tmp = tmp->next;
> > + free(tmp_to_delete);
> > + }
> > +}
> > +
> > +void RDestroyConvertTables()
> > +{
> > + release_conversion_table();
> > + release_std_conversion_table();
> > +}
> > +
> >  static unsigned short *computeTable(unsigned short mask)
> >  {
> >   RConversionTable *tmp = conversionTable;
> > @@ -356,7 +382,6 @@ static RXImage *image2TrueColor(RContext * ctx,
> > RImage * image)
> >   }
> >
> >   }
> > -
> >   return ximg;
> >  }
> >
> > diff --git a/wrlib/libwraster.map b/wrlib/libwraster.map
> > index 6e165ef..422af75 100644
> > --- a/wrlib/libwraster.map
> > +++ b/wrlib/libwraster.map
> > @@ -33,6 +33,7 @@ LIBWRASTER3
> >  RConvertImageMask;
> >  RCopyArea;
> >  RCreateContext;
> > +RDestroyContext;
> >  RCreateImage;
> >  RCreateImageFromDrawable;
> >  RCreateImageFromXImage;
> > diff --git a/wrlib/load.c b/wrlib/load.c
> > index 8e0d34d..5e0e8cb 100644
> > --- a/wrlib/load.c
> > +++ b/wrlib/load.c
> > @@ -105,11 +105,28 @@ char **RSupportedFileFormats(void)
> >   return tmp;
> >  }
> >
> > +static void destroy_cache(void)
> > +{
> > + if (RImageCacheSize > 0) {
> > + for (int i = 0; i < RImageCacheSize; i++) {
> > + if (RImageCache[i].file) {
> > + free(RImageCache[i].file);
> > + RImageCache[i].file = NULL;
> > + RReleaseImage(RImageCache[i].image);
> > + }
> > +
> > + }
> > + free(RImageCache);
> > + }
> > +}
> > +
> >  /* cleaning third-party libs at shutdown */
> >  void RShutdown() {
> >  #ifdef USE_MAGICK
> >   MagickWandTerminus();
> >  #endif
> > + destroy_cache();
> > + RDestroyConvertTables();
> >  }
> >
> >  static void init_cache(void)
> > diff --git a/wrlib/wraster.h b/wrlib/wraster.h
> > index c4ed231..a87eb1c 100644
> > --- a/wrlib/wraster.h
> > +++ b/wrlib/wraster.h
> > @@ -461,11 +461,18 @@ void RPutXImage(RContext *context, Drawable d,
> > GC gc, RXImage *ximage,
> >  int src_x, int src_y, int dest_x, int dest_y,
> >   --
> To unsubscribe, send mail to 
> wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


[PATCH] wrlib: added missing call to deallocate magick pixelwand

2014-04-21 Thread David Maciejak
add the missing call to deallocate the image background

---
 wrlib/load_magick.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/wrlib/load_magick.c b/wrlib/load_magick.c
index d9ecb2d..b08e591 100644
--- a/wrlib/load_magick.c
+++ b/wrlib/load_magick.c
@@ -80,6 +80,7 @@ RImage * RLoadMagick(const char *file_name)

 bye:
  /* Tidy up */
+ DestroyPixelWand(bg_wand);
  MagickClearException(m_wand);
  m_wand = DestroyMagickWand(m_wand);
  /* destroy is called when exiting wmaker */
-- 
1.8.3.2


0001-wrlib-added-missing-call-to-deallocate-magick-pixelw.patch
Description: Binary data


Re: Major surgery on #next (was Re: [PATCH 0/7] Improvements to NetPBM support commit)

2014-04-24 Thread David Maciejak
> So a lot of things have been done. I still have patches I think were not
> addressed and still need to be added again:
>
> 0003-wrlib-WEBP-header-fixes.patch
> 0005-Fixed-unknown-image-format-detection-in-Icon-Chooser.patch
> 0006-wrlib-added-support-for-imagemagick-third-party-lib.patch
> 0007-wrlib-Added-clean-functions-to-wrlib.patch
>

+ these 2:

2014-04-21: 0001-wrlib-added-missing-call-to-deallocate-magick-pixelw.patch
2014-04-16: 0001-Removed-unused-second-switch-panel-background.patch


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Major surgery on #next (was Re: [PATCH 0/7] Improvements to NetPBM support commit)

2014-04-27 Thread David Maciejak
On Monday, April 28, 2014, Carlos R. Mafra  wrote:

> On Sun, 27 Apr 2014 at 19:19:14 +0200, Christophe wrote:
> >
> > The patch '0007-wrlib-Added-clean-functions-to-wrlib' would deserve
> > some feedback too (that means: expect a diff patch if you import it in
> > #next, or ask for an alternate version now, or if David prefers I can
> > make the comments and let him propose the new version of the patch);
>
> If you have a patch ready already I guess you can send it now.


Please go ahead guys,I am in holidays this week with very limited internet
access.

Regards,
David



>
> > As raised by David, there's also the case of
> > '0001-wrlib-added-missing-call-to-deallocate-magick-pixelw' which I
> > think would gain from being amended to the ImageMagick patch.
>
> Done.
>
> Thanks!
>
>
> --
> To unsubscribe, send mail to 
> wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


Re: [PATCH 4/4] Removed unused second switch panel background

2014-05-08 Thread David Maciejak
On Friday, May 9, 2014, Carlos R. Mafra  wrote:

> On Thu,  8 May 2014 at 23:57:04 +0200, Christophe wrote:
> > From: David Maciejak >
> >
> > the second one is not used, so i removed it.
> > btw, user can change it from the config file
>
> So I don't think we should remove. There might be users
> out there customizing their configs to use this.
>
>
If they really want to customize they have to provide their own
panel background img, for example we are not providing desktop background
img, should we too ?


[PATCH] wrlib: add a function to draw rectangles

2014-05-10 Thread David Maciejak
It appears that such kind of function was missing from the lib.
It will be required for upcoming wmiv image viewer tool.

diff --git a/wrlib/draw.c b/wrlib/draw.c
index 350837c..aa8588d 100644
--- a/wrlib/draw.c
+++ b/wrlib/draw.c
@@ -463,6 +463,13 @@ void ROperateLines(RImage * image, int operation,
const RPoint * points, int npo
  genericLine(image, x1, y1, x2, y2, color, operation, i);
 }

+void ROperateRectangle(RImage * image, int operation, int x0, int y0,
int x1, int y1, const RColor * color)
+{
+ for (int y=y0; y<=y1; y++) {
+ genericLine(image, x0, y, x1, y, color, operation, False);
+ }
+}
+
 void RDrawSegments(RImage * image, const RSegment * segs, int nsegs,
const RColor * color)
 {
  register int i;
diff --git a/wrlib/libwraster.map b/wrlib/libwraster.map
index 422af75..ffa64a7 100644
--- a/wrlib/libwraster.map
+++ b/wrlib/libwraster.map
@@ -41,6 +41,7 @@ LIBWRASTER3
 RDestroyXImage;
 RDrawLine;
 RDrawLines;
+ROperateRectangle;
 RDrawSegments;
 RErrorCode;
 RFillImage;
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index 88f3a72..2003869 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -403,6 +403,8 @@ void RDrawLines(RImage *image, const RPoint
*points, int npoints, int mode,
 void ROperateLines(RImage *image, int operation, const RPoint
*points, int npoints,
int mode, const RColor *color);

+void ROperateRectangle(RImage *image, int operation, int x0, int y0,
int x1, int y1, const RColor *color);
+
 void RDrawSegments(RImage *image, const RSegment *segs, int nsegs,
const RColor *color);

 void ROperateSegments(RImage *image, int operation, const RSegment
*segs, int nsegs,
-- 
1.8.3.2


0001-wrlib-add-a-function-to-draw-rectangles.patch
Description: Binary data


Re: [PATCH] wrlib: add a function to draw rectangles

2014-05-10 Thread David Maciejak
enclosed the updated version

On Sat, May 10, 2014 at 8:28 PM, Carlos R. Mafra  wrote:
> On Sat, 10 May 2014 at 19:43:42 +0800, David Maciejak wrote:
>> It appears that such kind of function was missing from the lib.
>> It will be required for upcoming wmiv image viewer tool.
>
> I guess it's better to send this patch together with the ones
> that require it.
>
>> diff --git a/wrlib/draw.c b/wrlib/draw.c
>> index 350837c..aa8588d 100644
>> --- a/wrlib/draw.c
>> +++ b/wrlib/draw.c
>> @@ -463,6 +463,13 @@ void ROperateLines(RImage * image, int operation,
>> const RPoint * points, int npo
>>   genericLine(image, x1, y1, x2, y2, color, operation, i);
>>  }
>>
>> +void ROperateRectangle(RImage * image, int operation, int x0, int y0,
>
> Just a nitpick, "RImage *image" is preferred.
>
> All instances of such "* stuff" in function arguments in the repository
> is my fault when converting the coding style to the linux kernel conventions
> with indent a few years ago. 'indent' didn't screw this up when the type
> is well-known (e.g. char, int etc), but considered it as a multiplication
> otherwise.
>
> It should be possible to fix this with a script.
>
>> int x1, int y1, const RColor * color)
>> +{
>> + for (int y=y0; y<=y1; y++) {
>
> But here there's no excuse :-)
> It must be "y = y0; y <= 1;
>
>> diff --git a/wrlib/wraster.h b/wrlib/wraster.h
>> index 88f3a72..2003869 100644
>> --- a/wrlib/wraster.h
>> +++ b/wrlib/wraster.h
>> @@ -403,6 +403,8 @@ void RDrawLines(RImage *image, const RPoint
>> *points, int npoints, int mode,
>>  void ROperateLines(RImage *image, int operation, const RPoint
>> *points, int npoints,
>> int mode, const RColor *color);
>>
>> +void ROperateRectangle(RImage *image, int operation, int x0, int y0,
>
> Here you have it "right", so fixing the instance I mentioned above
> will lead to a consistent patch :-)
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


0001-wrlib-add-a-function-to-draw-rectangles.patch
Description: Binary data


Re: [PATCH] util/wmiv: an image viewer using wrlib

2014-05-10 Thread David Maciejak
On Sat, May 10, 2014 at 10:10 PM, Carlos R. Mafra  wrote:
> On Sat, 10 May 2014 at 21:37:51 +0800, David Maciejak wrote:
>> I am enclosing here a patch that brings wmiv, a fast image viewer
>> which uses wrlib. I tested it over the last weeks, i can just say it
>> working well (at least for me).
>>
>> note: it requires the previous patch
>> 0001-wrlib-add-a-function-to-draw-rectangles.patch
>
> Even after adding the patch above, I get these compilation errors:
>
> Making all in po
>   CC   wmiv.o
> wmiv.c:68:17: warning: initialization makes integer from pointer without a 
> cast [enabled by default]
>   CCLD wmiv
> /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: 
> wmiv.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
> /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: 
> note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 
> so try adding it to the linker command line
> /lib64/libpthread.so.0: could not read symbols: Invalid operation
> collect2: error: ld returned 1 exit status
> make[3]: *** [wmiv] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
>

hum did not try it on Suse, is your command line contains -pthread ?


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] util/wmiv: an image viewer using wrlib

2014-05-10 Thread David Maciejak
On Sunday, May 11, 2014, Carlos R. Mafra  wrote:

> On Sun, 11 May 2014 at  1:09:23 +0800, David Maciejak wrote:
> > On Sat, May 10, 2014 at 10:10 PM, Carlos R. Mafra 
> > >
> wrote:
> > > On Sat, 10 May 2014 at 21:37:51 +0800, David Maciejak wrote:
> > >> I am enclosing here a patch that brings wmiv, a fast image viewer
> > >> which uses wrlib. I tested it over the last weeks, i can just say it
> > >> working well (at least for me).
> > >>
> > >> note: it requires the previous patch
> > >> 0001-wrlib-add-a-function-to-draw-rectangles.patch
> > >
> > > Even after adding the patch above, I get these compilation errors:
> > >
> > > Making all in po
> > >   CC   wmiv.o
> > > wmiv.c:68:17: warning: initialization makes integer from pointer
> without a cast [enabled by default]
> > >   CCLD wmiv
> > >
> /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
> wmiv.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
> > >
> /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
> note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO
> /lib64/libpthread.so.0 so try adding it to the linker command line
> > > /lib64/libpthread.so.0: could not read symbols: Invalid operation
> > > collect2: error: ld returned 1 exit status
> > > make[3]: *** [wmiv] Error 1
> > > make[2]: *** [all-recursive] Error 1
> > > make[1]: *** [all-recursive] Error 1
> > > make: *** [all] Error 2
> > >
> >
> > hum did not try it on Suse, is your command line contains -pthread ?
>
> No. But adding it manually in the Makefile.am
>
> wmiv_LDADD = \
> $(top_builddir)/wrlib/libwraster.la \
> @XLFLAGS@ @XLIBS@ \
> @GFXLIBS@ -lpthread
>
> makes it compile. But there must be a better way.
>
>
>
Ok I will try to reproduce it and let you know.

Thanks,
David




> --
> To unsubscribe, send mail to 
> wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


Re: [PATCH] util/wmiv: an image viewer using wrlib

2014-05-12 Thread David Maciejak
On Tuesday, May 13, 2014, Carlos R. Mafra  wrote:

> On Mon, 12 May 2014 at 13:13:02 +0800, David Maciejak wrote:
> > ok got it, pthread cmd line was added only with magickwand support
> compilation.
> > I added posix thread checks in configure file and recreate the patch I
> enclosed
>
> Thanks.
>
> > (sorry I can't use git send-email cmd).
>
> Why not? You can clearly do more advanced stuff like coding wmiv.
> Setting up git send-email is much more basic than that :-)



Thanks guys, let me make it more clear.
It's not a configuration issue but a policy issue.


Regards,
David



>
> Some time ago I copied this answer which helped me. Perhaps you will
> find it useful too.
>
> From: Giuseppe Bilotta  gmail.com>
> Subject: Re: [Q] submitting patches from gmail
> Newsgroups: gmane.comp.version-control.git
> Date: 2008-10-18 12:50:51 GMT (2 days, 8 hours and 6 minutes ago)
>
> On Saturday 18 October 2008 14:08, Leo Razoumov wrote:
>
> > Hi Everyone,
> > I wonder what is the preferred way to submit patches from a gmail
> account.
> > Google mail auto wraps long lines and there is no way to change this
> setting.
> > Safe way would be to use attachments. Are they allowed on git mailing
> list?
>
> I've been sending patches from gmail for a while without problems. It took
> me
> a while to find a working configruation, but I finally managed to do it
> using
> msmtp. I have
>
> [sendemail]
> smtpserver = /usr/bin/msmtp
>
> in my ~/.gitconfig
>
> and the following ~/.msmtprc
>
> ==
> # Example for a user configuration file
>
> # Set default values for all following accounts.
> defaults
> tls on
> tls_trust_file /etc/pki/tls/certs/ca-bundle.crt
> logfile ~/.msmtp.log
>
> # My email service
> account gmail
> host smtp.gmail.com
> from yourgmailusername  gmail.com
> auth on
> user yourgmailusername
> password yourgmailpassword
>
> # Set a default account
> account default : gmail
> =
>
> And to send patches I just use something like
>
> git send-email --compose --to "git  vger.kernel.org" --cc "whoever"
> 00*
>
> diffstat:
> git diff --stat HEAD~8..HEAD
>
>
> --
> To unsubscribe, send mail to 
> wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


[PATCH] clean wDockFindFreeSlot function

2014-05-13 Thread David Maciejak
it appears that a sx var is set but not used


--- a/src/dock.c
+++ b/src/dock.c
@@ -2719,7 +2719,7 @@ Bool wDockFindFreeSlot(WDock *dock, int *x_pos,
int *y_pos)
  int x, y;
  int i, done = False;
  int corner;
- int sx = 0, ex = scr->scr_width, ey = scr->scr_height;
+ int ex = scr->scr_width, ey = scr->scr_height;
  int extra_count = 0;

  if (dock->type == WM_DRAWER) {
@@ -2738,17 +2738,12 @@ Bool wDockFindFreeSlot(WDock *dock, int
*x_pos, int *y_pos)
  if (dock->icon_count + extra_count >= dock->max_icons)
  return False;

- if (!wPreferences.flags.nodock && scr->dock) {
- if (scr->dock->on_right_side)
- ex -= ICON_SIZE + DOCK_EXTRA_SPACE;
- else
- sx += ICON_SIZE + DOCK_EXTRA_SPACE;
+ if (!wPreferences.flags.nodock && scr->dock && scr->dock->on_right_side) {
+ ex -= ICON_SIZE + DOCK_EXTRA_SPACE;
  }

  if (ex < dock->x_pos)
  ex = dock->x_pos;
- if (sx > dock->x_pos + ICON_SIZE)
- sx = dock->x_pos + ICON_SIZE;
 #define C_NONE 0
 #define C_NW 1
 #define C_NE 2
-- 
1.8.3.2


0001-clean-wDockFindFreeSlot-function.patch
Description: Binary data


Re: Re : [PATCH] clang analyzer fixes

2014-05-17 Thread David Maciejak
great !

i did run cppcheck on my side too some days ago, i was about to report
some patches in the coming minutes/hours to correct some of the
problems reported.

regards,
david

On Sat, May 17, 2014 at 10:43 PM, Christophe  wrote:
>
> - Amadeusz Sławiński  a écrit :
>> Hey,
>> I've decided to try running clang-analyzer against Window Maker source
>> (http://clang-analyzer.llvm.org/scan-build.html).
>> Following patches are the result of this.
>>
>> Not to say that I patched everything, there is still around 100 things 
>> reported.
>>
>> Amadeusz
>
> Hi,
> On a similar topic, I gave a try some week ago into Coverity  
> (https://scan.coverity.com/ ) for similar problem highlights. So far it 
> reported 244 points and I already have ~60 patches for some of them which I 
> wanted to reorganise a little bit before submitting (soon).
>
> Christophe.
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/6] src/appicon.c: updated paint_app_icon

2014-05-17 Thread David Maciejak
moving scr initialization after WApplication existing test
to prevent crashing in case wapp is null

---
 src/appicon.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/appicon.c b/src/appicon.c
index f61ae0e..bbf1455 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -197,15 +197,16 @@ void unpaint_app_icon(WApplication *wapp)
 void paint_app_icon(WApplication *wapp)
 {
  WIcon *icon;
- WScreen *scr = wapp->main_window_desc->screen_ptr;
+ WScreen *scr;
  WDock *attracting_dock;
  int x = 0, y = 0;
  Bool update_icon = False;

- if (!wapp || !wapp->app_icon)
+ if (!wapp || !wapp->app_icon || !wapp->main_window_desc)
  return;

  icon = wapp->app_icon->icon;
+ scr = wapp->main_window_desc->screen_ptr;
  wapp->app_icon->main_window = wapp->main_window;

  /* If the icon is docked, don't continue */
-- 
1.8.3.2


0001-moving-scr-initialization-after-WApplication-existin.patch
Description: Binary data


[PATCH 2/6] src/defaults.c: updated readGlobalDomain

2014-05-17 Thread David Maciejak
set default path init value to remove some cppcheck warning

---
 src/defaults.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/defaults.c b/src/defaults.c
index 7d66372..c6748d5 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -798,7 +798,7 @@ static void initDefaults(void)
 static WMPropList *readGlobalDomain(const char *domainName, Bool
requireDictionary)
 {
  WMPropList *globalDict = NULL;
- char path[PATH_MAX];
+ char path[PATH_MAX] = "";
  struct stat stbuf;

  snprintf(path, sizeof(path), "%s/%s/%s", SYSCONFDIR,
GLOBAL_DEFAULTS_SUBDIR, domainName);
-- 
1.8.3.2


0002-set-path-init-value-to-remove-some-cppcheck-warning.patch
Description: Binary data


[PATCH 4/6] src/misc.c: updated GetShortcutString

2014-05-17 Thread David Maciejak
remove unused var and remove some commented code too

---
 src/misc.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/src/misc.c b/src/misc.c
index 92c1534..4d008a3 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -736,7 +736,6 @@ char *GetShortcutString(const char *shortcut)
 {
  char *buffer = NULL;
  char *k;
- int modmask = 0;
  /*KeySym ksym; */
  int control = 0;
  char *tmp, *text;
@@ -753,8 +752,6 @@ char *GetShortcutString(const char *shortcut)
  return wstrdup("bug");
  }

- modmask |= mod;
-
  if (strcasecmp(text, "Meta") == 0) {
  buffer = wstrappend(buffer, "M+");
  } else if (strcasecmp(text, "Alt") == 0) {
@@ -783,13 +780,6 @@ char *GetShortcutString(const char *shortcut)
  buffer = wstrappend(buffer, "^");
  }
  buffer = wstrappend(buffer, text);
-
- /* get key */
- /*ksym = XStringToKeysym(text);
-   tmp = keysymToString(ksym, modmask);
-   puts(tmp);
-   buffer = wstrappend(buffer, tmp);
- */
  wfree(tmp);

  return buffer;
-- 
1.8.3.2


0004-remove-unused-var-and-remove-some-commented-code-too.patch
Description: Binary data


[PATCH 3/6] src/dialog.c: updated keyPressHandler

2014-05-17 Thread David Maciejak
wmalloc is already taking care of the memory allocation return value,
and i replace strcpy to strncpy

---
 src/dialog.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/dialog.c b/src/dialog.c
index da126ae..d0d9179 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -899,7 +899,7 @@ static void keyPressHandler(XEvent * event, void *data)

 Bool wIconChooserDialog(WScreen *scr, char **file, const char
*instance, const char *class)
 {
- WWindow *wwin;
+ WWindow *wwin = NULL;
  Window parent;
  IconPanel *panel;
  WMColor *color;
@@ -1018,10 +1018,10 @@ Bool wIconChooserDialog(WScreen *scr, char
**file, const char *instance, const c

  tmp = wmalloc(len);

- if (tmp && (instance || class))
+ if (instance || class)
  snprintf(tmp, len, "%s [%s.%s]", _("Icon Chooser"), instance, class);
  else
- strcpy(tmp, _("Icon Chooser"));
+ strncpy(tmp, _("Icon Chooser"), len);

  center = getCenter(scr, 450, 280);

-- 
1.8.3.2


0003-wmalloc-is-already-taking-care-of-the-memory-allocat.patch
Description: Binary data


[PATCH 5/6] src/usermenu.c: updated wUserMenuRefreshInstances

2014-05-17 Thread David Maciejak
remove unused var and move wwin check

---
 src/usermenu.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/usermenu.c b/src/usermenu.c
index 4a669c9..c349810 100644
--- a/src/usermenu.c
+++ b/src/usermenu.c
@@ -279,7 +279,6 @@ static WMenu *configureUserMenu(WScreen * scr,
WMPropList * plum)

 void wUserMenuRefreshInstances(WMenu * menu, WWindow * wwin)
 {
- WMenuEntry *entry;
  int i, j, count, paintflag;

  paintflag = 0;
@@ -335,7 +334,7 @@ WMenu *wUserMenuGet(WScreen * scr, WWindow * wwin)
  WMenu *menu = NULL;
  char *path = NULL;
  char *tmp;
- if (wwin->wm_instance && wwin->wm_class) {
+ if (wwin && wwin->wm_instance && wwin->wm_class) {
  int len = strlen(wwin->wm_instance) + strlen(wwin->wm_class) + 7;
  tmp = wmalloc(len);
  snprintf(tmp, len, "%s.%s.menu", wwin->wm_instance, wwin->wm_class);
@@ -345,9 +344,7 @@ WMenu *wUserMenuGet(WScreen * scr, WWindow * wwin)
  if (!path)
  return NULL;

- if (wwin)
- menu = readUserMenuFile(scr, path);
-
+ menu = readUserMenuFile(scr, path);
  wfree(path);
  }
  return menu;
-- 
1.8.3.2


0005-remove-unused-var-and-move-wwin-check.patch
Description: Binary data


[PATCH 6/6] src/winmenu.c: updated prepare_menu_position

2014-05-17 Thread David Maciejak
did some change as prepare_menu_position never updated x and y values

---
 src/winmenu.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/winmenu.c b/src/winmenu.c
index 5fa4886..d8b3f4f 100644
--- a/src/winmenu.c
+++ b/src/winmenu.c
@@ -729,16 +729,16 @@ static WMenu *open_window_menu_core(WWindow *wwin)
  return menu;
 }

-static void prepare_menu_position(WMenu *menu, int x, int y)
+static void prepare_menu_position(WMenu *menu, int *x, int *y)
 {
  WMRect rect;

  rect = wGetRectForHead(menu->frame->screen_ptr,
wGetHeadForPointerLocation(menu->frame->screen_ptr));
- if (x < rect.pos.x - menu->frame->core->width / 2)
- x = rect.pos.x - menu->frame->core->width / 2;
- if (y < rect.pos.y)
- y = rect.pos.y;
+ if (*x < rect.pos.x - menu->frame->core->width / 2)
+ *x = rect.pos.x - menu->frame->core->width / 2;
+ if (*y < rect.pos.y)
+ *y = rect.pos.y;
 }

 void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard)
@@ -757,7 +757,7 @@ void OpenWindowMenu(WWindow *wwin, int x, int y,
int keyboard)
  x = wwin->frame_x;

  /* Common menu position */
- prepare_menu_position(menu, x, y);
+ prepare_menu_position(menu, &x, &y);

  if (!wwin->flags.internal_window)
  wMenuMapAt(menu, x, y, keyboard);
@@ -781,7 +781,7 @@ void OpenWindowMenu2(WWindow *wwin, int x, int y,
int keyboard)
  x -= menu->frame->core->width / 2;

  /* Common menu position */
- prepare_menu_position(menu, x, y);
+ prepare_menu_position(menu, &x, &y);

  if (!wwin->flags.internal_window)
  wMenuMapAt(menu, x, y, keyboard);
-- 
1.8.3.2


0006-did-some-change-as-prepare_menu_position-never-updat.patch
Description: Binary data


Re: [PATCH 2/6] src/defaults.c: updated readGlobalDomain

2014-05-17 Thread David Maciejak
Sure, as you may come with a better idea i am ok with that.
btw i believe coverity reported the same kind of problems.
So it's just to be sure we can handle them.

regards,
david

On Sun, May 18, 2014 at 12:52 AM, Christophe  wrote:
>
> May I suggest to not get this patch? This is not the correct way to fix the 
> problem reported by cppcheck.
>
>
> - David Maciejak  a écrit :
>> set default path init value to remove some cppcheck warning
>>
>> ---
>>  src/defaults.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/defaults.c b/src/defaults.c
>> index 7d66372..c6748d5 100644
>> --- a/src/defaults.c
>> +++ b/src/defaults.c
>> @@ -798,7 +798,7 @@ static void initDefaults(void)
>>  static WMPropList *readGlobalDomain(const char *domainName, Bool
>> requireDictionary)
>>  {
>>   WMPropList *globalDict = NULL;
>> - char path[PATH_MAX];
>> + char path[PATH_MAX] = "";
>>   struct stat stbuf;
>>
>>   snprintf(path, sizeof(path), "%s/%s/%s", SYSCONFDIR,
>> GLOBAL_DEFAULTS_SUBDIR, domainName);
>> --
>> 1.8.3.2
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 3/6] src/dialog.c: updated keyPressHandler

2014-05-17 Thread David Maciejak
On Sun, May 18, 2014 at 1:03 AM, Christophe  wrote:
> May I vote against this patch?
> Comments below...
>
>
> - David Maciejak  a écrit :
>> [...]
>>
>> diff --git a/src/dialog.c b/src/dialog.c
>> index da126ae..d0d9179 100644
>> --- a/src/dialog.c
>> +++ b/src/dialog.c
>> @@ -899,7 +899,7 @@ static void keyPressHandler(XEvent * event, void *data)
>>
>>  Bool wIconChooserDialog(WScreen *scr, char **file, const char
>> *instance, const char *class)
>>  {
>> - WWindow *wwin;
>> + WWindow *wwin = NULL;
>
> Looking at the code, wwin is always assigned something at this line (1028 on 
> my side):
> wwin = wManageInternalWindow(scr, parent, None, tmp, 
> center.x, center.y, 450, 280);
>
> so adding an initializer does not look like it has some effect. I don't know 
> what cppchecks complaints about, but adding some default value is generally 
> not a good idea because it hides some problems that the compiler (or 
> checkers) can detect otherwise.
>
>
>>   Window parent;
>>   IconPanel *panel;
>>   WMColor *color;
>> @@ -1018,10 +1018,10 @@ Bool wIconChooserDialog(WScreen *scr, char
>> **file, const char *instance, const c
>>
>>   tmp = wmalloc(len);
>>
>> - if (tmp && (instance || class))
>> + if (instance || class)
>>   snprintf(tmp, len, "%s [%s.%s]", _("Icon Chooser"), instance, class);
>>   else
>> - strcpy(tmp, _("Icon Chooser"));
>> + strncpy(tmp, _("Icon Chooser"), len);
>>
>
> Temporary fixing code that is otherwise all wrong may not be enough, I would 
> suggest to take the opportunity to fix:
>  - if either 'instance' or 'class' is NULL but not the other, the 'snprintf' 
> can crash due to NULL pointer dereference;
>
>  - strncpy copies at most 'len' bytes... excluding addition of a final '\0'. 
> so it should be called with 'len - 1' and then explicitly add final '\0'. Or 
> use WUtil's wstrlcpy which was meant for that purpose?
>

i did not know that function, but i completely agree we should use
buildin functions when possible.


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 6/6] src/winmenu.c: updated prepare_menu_position

2014-05-17 Thread David Maciejak
On Sunday, May 18, 2014, Christophe  wrote:

> Signed-off-by: Christophe CURIS >
>
> Not pointed by Coverity either. (that's a funny one)
>
>
Yes quite funny ..
So the good thing when using multiple tools is that we were able to find
more issues !



> - David Maciejak > a écrit :
> > did some change as prepare_menu_position never updated x and y values
> >
> > ---
> >  src/winmenu.c | 14 +++---
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/winmenu.c b/src/winmenu.c
> > index 5fa4886..d8b3f4f 100644
> > --- a/src/winmenu.c
> > +++ b/src/winmenu.c
> > @@ -729,16 +729,16 @@ static WMenu *open_window_menu_core(WWindow *wwin)
> >   return menu;
> >  }
> >
> > -static void prepare_menu_position(WMenu *menu, int x, int y)
> > +static void prepare_menu_position(WMenu *menu, int *x, int *y)
> >  {
> >   WMRect rect;
> >
> >   rect = wGetRectForHead(menu->frame->screen_ptr,
> > wGetHeadForPointerLocation(menu->frame->screen_ptr));
> > - if (x < rect.pos.x - menu->frame->core->width / 2)
> > - x = rect.pos.x - menu->frame->core->width / 2;
> > - if (y < rect.pos.y)
> > - y = rect.pos.y;
> > + if (*x < rect.pos.x - menu->frame->core->width / 2)
> > + *x = rect.pos.x - menu->frame->core->width / 2;
> > + if (*y < rect.pos.y)
> > + *y = rect.pos.y;
> >  }
> >
> >  void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard)
> > @@ -757,7 +757,7 @@ void OpenWindowMenu(WWindow *wwin, int x, int y,
> > int keyboard)
> >   x = wwin->frame_x;
> >
> >   /* Common menu position */
> > - prepare_menu_position(menu, x, y);
> > + prepare_menu_position(menu, &x, &y);
> >
> >   if (!wwin->flags.internal_window)
> >   wMenuMapAt(menu, x, y, keyboard);
> > @@ -781,7 +781,7 @@ void OpenWindowMenu2(WWindow *wwin, int x, int y,
> > int keyboard)
> >   x -= menu->frame->core->width / 2;
> >
> >   /* Common menu position */
> > - prepare_menu_position(menu, x, y);
> > + prepare_menu_position(menu, &x, &y);
> >
> >   if (!wwin->flags.internal_window)
> >   wMenuMapAt(menu, x, y, keyboard);
> > --
> > 1.8.3.2
>
>
> --
> To unsubscribe, send mail to 
> wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


Re: [PATCH 2/6] src/defaults.c: updated readGlobalDomain

2014-05-17 Thread David Maciejak
No, i dont think you missed something.

It's just one of the many false positive reported by cppcheck.
I tested replacing the PATH_MAX value by a static value and the
reported error disappeared...

On Sun, May 18, 2014 at 1:34 AM, Christophe  wrote:
> I checked, Coverity did not report anything.
>
> The more I look at the code, the less I understand what cppcheck is 
> complaining about.
> The first thing done is to snprintf into that buffer (path), so it gets 
> initialised, and it does not care what was in previously. The only reason we 
> could have a problem is when sizeof(path) <= 0 (then the behaviour of 
> snprintf is undefined), which I believe is a bit unlikely.
>
> Did I miss something?
>
>
> - David Maciejak  a écrit :
>> Sure, as you may come with a better idea i am ok with that.
>> btw i believe coverity reported the same kind of problems.
>> So it's just to be sure we can handle them.
>>
>> regards,
>> david
>>
>> On Sun, May 18, 2014 at 12:52 AM, Christophe  
>> wrote:
>> >
>> > May I suggest to not get this patch? This is not the correct way to fix 
>> > the problem reported by cppcheck.
>> >
>> >
>> > - David Maciejak  a écrit :
>> >> set default path init value to remove some cppcheck warning
>> >>
>> >> ---
>> >>  src/defaults.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/src/defaults.c b/src/defaults.c
>> >> index 7d66372..c6748d5 100644
>> >> --- a/src/defaults.c
>> >> +++ b/src/defaults.c
>> >> @@ -798,7 +798,7 @@ static void initDefaults(void)
>> >>  static WMPropList *readGlobalDomain(const char *domainName, Bool
>> >> requireDictionary)
>> >>  {
>> >>   WMPropList *globalDict = NULL;
>> >> - char path[PATH_MAX];
>> >> + char path[PATH_MAX] = "";
>> >>   struct stat stbuf;
>> >>
>> >>   snprintf(path, sizeof(path), "%s/%s/%s", SYSCONFDIR,
>> >> GLOBAL_DEFAULTS_SUBDIR, domainName);
>> >> --
>> >> 1.8.3.2
>> >
>> >
>> > --
>> > To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] WMaker: rewrote generation of title for the Icon Chooser to avoid problems

2014-05-17 Thread David Maciejak
It looks good, thx Christophe !

On Sunday, May 18, 2014, Christophe  wrote:

> From: Christophe CURIS >
>
> The original code did have a few weaknesses, including:
>  - possible buffer overflow, if the translation was too long;
>  - possible crash, if either instance or class is NULL but not both
>
> Now the appropriate length is calculated (not counting on a margin) and the
> string is generated with the available elements.
>
> As a side note, the variable was renamed from 'tmp' to 'title' for clarity.
>
> This was highlighted by cppcheck (thanks to David Maciejak) and by
> Coverity (bug #50078).
>
> Signed-off-by: Christophe CURIS >
> ---
>  src/dialog.c | 40 +---
>  1 file changed, 29 insertions(+), 11 deletions(-)
>
> diff --git a/src/dialog.c b/src/dialog.c
> index da126ae..1102747 100644
> --- a/src/dialog.c
> +++ b/src/dialog.c
> @@ -1011,22 +1011,40 @@ Bool wIconChooserDialog(WScreen *scr, char **file,
> const char *instance, const c
> XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0);
>
> {
> -   char *tmp;
> -   int len = (instance ? strlen(instance) : 0)
> -   + (class ? strlen(class) : 0) + 32;
> +   static const char *prefix = NULL;
> +   char *title;
> +   int len;
> WMPoint center;
>
> -   tmp = wmalloc(len);
> -
> -   if (tmp && (instance || class))
> -   snprintf(tmp, len, "%s [%s.%s]", _("Icon
> Chooser"), instance, class);
> -   else
> -   strcpy(tmp, _("Icon Chooser"));
> +   if (prefix == NULL)
> +   prefix = _("Icon Chooser");
> +
> +   len = strlen(prefix)
> +   + 2 // " ["
> +   + (instance ? strlen(instance) : 0)
> +   + 1 // "."
> +   + (class ? strlen(class) : 0)
> +   + 1 // "]"
> +   + 1;// final NUL
> +
> +   title = wmalloc(len);
> +   strcpy(title, prefix);
> +
> +   if (instance || class) {
> +   strcat(title, " [");
> +   if (instance != NULL)
> +   strcat(title, instance);
> +   if (instance && class)
> +   strcat(title, ".");
> +   if (class != NULL)
> +   strcat(title, class);
> +   strcat(title, "]");
> +   }
>
> center = getCenter(scr, 450, 280);
>
> -   wwin = wManageInternalWindow(scr, parent, None, tmp,
> center.x, center.y, 450, 280);
> -   wfree(tmp);
> +   wwin = wManageInternalWindow(scr, parent, None, title,
> center.x, center.y, 450, 280);
> +   wfree(title);
> }
>
> /* put icon paths in the list */
> --
> 1.9.2
>
>
> --
> To unsubscribe, send mail to 
> wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


[PATCH] wrlib: RRotateImage function not fully implemented

2014-05-20 Thread David Maciejak
when the rotation angle value passed to RRotateImage is a modulo of 90,
the function is working well but in other cases the rotateImage()
function is called. That last function is half implemented but
the half already implemented part is also segfaulting (use the testrot.c
to replay the crash).
So the patch is moving the 'not implemented' msg to disable the whole
rotateImage() function and comment it out.


@@ -212,7 +212,7 @@ RImage *RRotateImage(RImage * image, float angle)
  * increment pixel location from source
  *
  */
-
+/*
 static void
 copyLine(int x1, int y1, int x2, int y2, int nwidth, int format,
unsigned char *dst, unsigned char **src)
 {
@@ -241,7 +241,7 @@ copyLine(int x1, int y1, int x2, int y2, int
nwidth, int format, unsigned char *
  p = dpr - dx;

  while (dx-- >= 0) {
- /* fetch and draw the pixel */
+ // fetch and draw the pixel
  offset = (x1 + y1 * nwidth) << 2;
  dst[offset++] = *s++;
  dst[offset++] = *s++;
@@ -251,7 +251,7 @@ copyLine(int x1, int y1, int x2, int y2, int
nwidth, int format, unsigned char *
  else
  dst[offset++] = 255;

- /* calc next step */
+ // calc next step
  if (p > 0) {
  x1 += xi;
  y1 += yi;
@@ -268,7 +268,7 @@ copyLine(int x1, int y1, int x2, int y2, int
nwidth, int format, unsigned char *
  p = dpr - dy;

  while (dy-- >= 0) {
- /* fetch and draw the pixel */
+ // fetch and draw the pixel
  offset = (x1 + y1 * nwidth) << 2;
  dst[offset++] = *s++;
  dst[offset++] = *s++;
@@ -278,7 +278,7 @@ copyLine(int x1, int y1, int x2, int y2, int
nwidth, int format, unsigned char *
  else
  dst[offset++] = 255;

- /* calc next step */
+ // calc next step
  if (p > 0) {
  x1 += xi;
  y1 += yi;
@@ -292,9 +292,14 @@ copyLine(int x1, int y1, int x2, int y2, int
nwidth, int format, unsigned char *

  *src = s;
 }
+*/

 static RImage *rotateImage(RImage * image, float angle)
 {
+ (void) angle;
+ puts("NOT FULLY IMPLEMENTED");
+ return RCloneImage(image);
+/*
  RImage *img;
  int nwidth, nheight;
  int x1, y1;
@@ -305,7 +310,7 @@ static RImage *rotateImage(RImage * image, float angle)
  unsigned char *src, *dst;
  int dpr, dpru, p;

- /* only 180o for now */
+ // only 180o for now
  if (angle > 180.0)
  angle -= 180.0;

@@ -356,7 +361,7 @@ static RImage *rotateImage(RImage * image, float angle)

  copyLine(x1, y1, xx, yy, nwidth, image->format, dst, &src);

- /* calc next step */
+ // calc next step

  if (p > 0) {
  x1 += xi;
@@ -371,8 +376,6 @@ static RImage *rotateImage(RImage * image, float angle)
  }
  }
  } else {
- puts("NOT IMPLEMTENED");
- return img;
  dpr = dx << 1;
  dpru = dpr - (dy << 1);
  p = dpr - dy;
@@ -383,7 +386,7 @@ static RImage *rotateImage(RImage * image, float angle)

  copyLine(x1, y1, xx, yy, nwidth, image->format, dst, &src);

- /* calc next step */
+ // calc next step
  if (p > 0) {
  x1 += xi;
  y1 += yi;
@@ -396,4 +399,5 @@ static RImage *rotateImage(RImage * image, float angle)
  }

  return img;
+*/
 }
-- 
1.8.3.2


0001-wrlib-RRotateImage-function-not-fully-implemented.patch
Description: Binary data


[PATCH] wrlib: add image flip functions

2014-05-20 Thread David Maciejak
This patch adds RVerticalFlipImage and RHorizontalFlipImage functions.


0001-wrlib-add-image-flip-functions.patch
Description: Binary data


Re: [PATCH] wrlib: add image flip functions

2014-05-21 Thread David Maciejak
> 0001-wrlib-add-image-flip-functions.patch has style problems, please review.

you mean the braces ?


> and it would be better to remove the braces (even though that's just a
> warning, it's a style I've been trying to enforce and many parts of
> the code follow it).

ok, feel free to remove them.

thx,
david


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] wrlib: add image flip functions

2014-05-21 Thread David Maciejak
yeah i understand. Thank you Carlos !

On Wed, May 21, 2014 at 5:25 PM, Carlos R. Mafra  wrote:
> On Wed, 21 May 2014 at 17:09:19 +0800, David Maciejak wrote:
>> > 0001-wrlib-add-image-flip-functions.patch has style problems, please 
>> > review.
>>
>> you mean the braces ?
>
> Yes.
>
>> > and it would be better to remove the braces (even though that's just a
>> > warning, it's a style I've been trying to enforce and many parts of
>> > the code follow it).
>>
>> ok, feel free to remove them.
>
> I will do this, but _only_ this time since now you've been told
> directly :-)
>
> The point about checkpatch.pl is to save my time. I'd like contributors
> to use it on their patches before submitting so that I don't need to
> reply to these trivial matters and waste everyone's time.
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] wrlib: RRotateImage function not fully implemented

2014-05-21 Thread David Maciejak
right, i will resubmit it.

On Wed, May 21, 2014 at 5:29 PM, Carlos R. Mafra  wrote:
> On Wed, 21 May 2014 at 12:49:44 +0800, David Maciejak wrote:
>> when the rotation angle value passed to RRotateImage is a modulo of 90,
>> the function is working well but in other cases the rotateImage()
>> function is called. That last function is half implemented but
>> the half already implemented part is also segfaulting (use the testrot.c
>> to replay the crash).
>> So the patch is moving the 'not implemented' msg to disable the whole
>> rotateImage() function and comment it out.
>>
>>
>> @@ -212,7 +212,7 @@ RImage *RRotateImage(RImage * image, float angle)
>>   * increment pixel location from source
>>   *
>>   */
>> -
>> +/*
>>  static void
>>  copyLine(int x1, int y1, int x2, int y2, int nwidth, int format,
>
> Btw, it's better to comment out huge blocks of code with
>
> #if 0
> ...
> #endif
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] util/wmiv: correct errors and warnings

2014-05-21 Thread David Maciejak
This patch is correcting all errors and almost all warnings reported
by checkpatch against wmiv.c.

I also added a check to test if _GNU_SOURCE is set already to remove a
compiler warning.



diff --git a/util/wmiv.c b/util/wmiv.c
index 8c382c9..2eab5d3 100755
--- a/util/wmiv.c
+++ b/util/wmiv.c
@@ -18,7 +18,9 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */

+#if !defined(_GNU_SOURCE)
 #define _GNU_SOURCE
+#endif
 #include 
 #include 
 #include 
@@ -38,8 +40,8 @@

 #ifdef USE_XPM
 extern int XpmCreatePixmapFromData(Display *, Drawable, char **,
Pixmap *, Pixmap *, void *);
-/* this is the icon from eog project
-   git.gnome.org/browse/eog
+/* this is the icon from eog project
+ git.gnome.org/browse/eog
 */
 #include "wmiv.h"
 #endif
@@ -82,7 +84,7 @@ RColor red;

 typedef struct link link_t;
 struct link {
- const void * data;
+ const void *data;
  link_t *prev;
  link_t *next;
 };
@@ -100,7 +102,8 @@ link_t *current_link;
  change_title: used to change window title
  return EXIT_SUCCESS on success, 1 on failure
 */
-int change_title(XTextProperty *prop, char *filename) {
+int change_title(XTextProperty *prop, char *filename)
+{
  char *combined_title = NULL;
  if (!asprintf(&combined_title, "%s - %u/%u - %s", APPNAME,
current_index, max_index, filename))
  if (!asprintf(&combined_title, "%s - %u/%u", APPNAME, current_index,
max_index))
@@ -117,7 +120,8 @@ int change_title(XTextProperty *prop, char *filename) {
  rescale_image: used to rescale the current image based on the screen size
  return EXIT_SUCCESS on success
 */
-int rescale_image() {
+int rescale_image(void)
+{
  long final_width = img->width;
  long final_height = img->height;

@@ -168,9 +172,11 @@ int rescale_image() {
  maximize_image: find the best image size for the current display
  return EXIT_SUCCESS on success
 */
-int maximize_image() {
+int maximize_image(void)
+{
  rescale_image();
- XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, img->width,
img->height, max_width/2-img->width/2, max_height/2-img->height/2);
+ XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0,
+ img->width, img->height, max_width/2-img->width/2,
max_height/2-img->height/2);
  return EXIT_SUCCESS;
 }

@@ -178,22 +184,23 @@ int maximize_image() {
  merge_with_background: merge the current image with with a
checkboard background
  return EXIT_SUCCESS on success, 1 on failure
 */
-int merge_with_background(RImage *i) {
+int merge_with_background(RImage *i)
+{
  if (i) {
  RImage *back;
  back = RCreateImage(i->width, i->height, True);
  if (back) {
  int opaq = 255;
- int x=0, y=0;
+ int x = 0, y = 0;

  RFillImage(back, &lightGray);
- for (x=0; x <= i->width; x+=8) {
+ for (x = 0; x <= i->width; x += 8) {
  if (x/8 % 2)
  y = 8;
  else
  y = 0;
- for (; y <= i->height; y+=16)
- ROperateRectangle(back, RAddOperation, x,y,x+8,y+8, &darkGray);
+ for (; y <= i->height; y += 16)
+ ROperateRectangle(back, RAddOperation, x, y, x+8, y+8, &darkGray);
  }

  RCombineImagesWithOpaqueness(i, back, opaq);
@@ -209,15 +216,15 @@ int merge_with_background(RImage *i) {
  return the image on success, NULL on failure

 */
-RImage* draw_failed_image() {
+RImage *draw_failed_image(void)
+{
  RImage *failed_image = NULL;
  XWindowAttributes attr;

- if (win && (XGetWindowAttributes(dpy, win, &attr) >= 0)) {
+ if (win && (XGetWindowAttributes(dpy, win, &attr) >= 0))
  failed_image = RCreateImage(attr.width, attr.height, False);
- } else {
+ else
  failed_image = RCreateImage(50, 50, False);
- }
  if (!failed_image)
  return NULL;

@@ -232,7 +239,8 @@ RImage* draw_failed_image() {
  full_screen: sending event to the window manager to switch from/to
full screen mode
  return EXIT_SUCCESS on success, 1 on failure
 */
-int full_screen() {
+int full_screen(void)
+{
  XEvent xev;

  Atom wm_state = XInternAtom(dpy, "_NET_WM_STATE", True);
@@ -268,7 +276,8 @@ int full_screen() {
  arg: 1 to zoom in, 0 to zoom out
  return EXIT_SUCCESS on success, 1 on failure
 */
-int zoom_in_out(int z) {
+int zoom_in_out(int z)
+{
  RImage *old_img = img;
  RImage *tmp = RLoadImage(ctx, current_link->data, 0);
  if (!tmp)
@@ -276,7 +285,8 @@ int zoom_in_out(int z) {

  if (z) {
  zoom_factor += 0.2;
- img = RScaleImage(tmp, tmp->width + (int)(tmp->width * zoom_factor),
tmp->height + (int)(tmp->height * zoom_factor));
+ img = RScaleImage(tmp, tmp->width + (int)(tmp->width * zoom_factor),
+ tmp->height + (int)(tmp->height * zoom_factor));
  if (!img) {
  img = old_img;
  return EXIT_FAILURE;
@@ -313,7 +323,8 @@ int zoom_in_out(int z) {
  zoom_in: transitional fct used to call zoom_in_out with zoom in flag
  return EXIT_SUCCESS on success, 1 on failure
 */
-int zoom_in() {
+int zoom_in(void)
+{
  return zoom_in_out(1);
 }

@@ -321,7 +332,8 @@ int zoom_in() {
  zoom_out: transitional fct used to call zoom_in_out with zoom out flag
  return EXIT_SUCCESS on success, 1 on failure
 */
-int zoom_out() {
+int zoom_out(void)
+{
  return zoom_in_out(0);
 }

@@ -330,7 +342,8 @@ int zoom_out() {
  arg: way which

Re: [PATCH] wrlib: RRotateImage function not fully implemented

2014-05-21 Thread David Maciejak
This version looks much better. Please check.


diff --git a/wrlib/rotate.c b/wrlib/rotate.c
index fead8ae..09e8a0a 100644
--- a/wrlib/rotate.c
+++ b/wrlib/rotate.c
@@ -213,6 +213,7 @@ RImage *RRotateImage(RImage * image, float angle)
  *
  */

+#if 0
 static void
 copyLine(int x1, int y1, int x2, int y2, int nwidth, int format,
unsigned char *dst, unsigned char **src)
 {
@@ -292,9 +293,14 @@ copyLine(int x1, int y1, int x2, int y2, int
nwidth, int format, unsigned char *

  *src = s;
 }
+#endif

 static RImage *rotateImage(RImage * image, float angle)
 {
+ (void) angle;
+ puts("NOT FULLY IMPLEMENTED");
+ return RCloneImage(image);
+#if 0
  RImage *img;
  int nwidth, nheight;
  int x1, y1;
@@ -371,8 +377,6 @@ static RImage *rotateImage(RImage * image, float angle)
  }
  }
  } else {
- puts("NOT IMPLEMTENED");
- return img;
  dpr = dx << 1;
  dpru = dpr - (dy << 1);
  p = dpr - dy;
@@ -396,4 +400,5 @@ static RImage *rotateImage(RImage * image, float angle)
  }

  return img;
+#endif
 }
-- 
1.8.3.2

On Wed, May 21, 2014 at 5:43 PM, David Maciejak
 wrote:
> right, i will resubmit it.
>
> On Wed, May 21, 2014 at 5:29 PM, Carlos R. Mafra  wrote:
>> On Wed, 21 May 2014 at 12:49:44 +0800, David Maciejak wrote:
>>> when the rotation angle value passed to RRotateImage is a modulo of 90,
>>> the function is working well but in other cases the rotateImage()
>>> function is called. That last function is half implemented but
>>> the half already implemented part is also segfaulting (use the testrot.c
>>> to replay the crash).
>>> So the patch is moving the 'not implemented' msg to disable the whole
>>> rotateImage() function and comment it out.
>>>
>>>
>>> @@ -212,7 +212,7 @@ RImage *RRotateImage(RImage * image, float angle)
>>>   * increment pixel location from source
>>>   *
>>>   */
>>> -
>>> +/*
>>>  static void
>>>  copyLine(int x1, int y1, int x2, int y2, int nwidth, int format,
>>
>> Btw, it's better to comment out huge blocks of code with
>>
>> #if 0
>> ...
>> #endif
>>
>>
>> --
>> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


0001-wrlib-RRotateImage-function-not-fully-implemented.patch
Description: Binary data


Re: [PATCH] wrlib: add image flip functions

2014-05-21 Thread David Maciejak
i am working on some new feature that will autorotate the img (at
least jpeg) based on the exif orientation tag. The code is almost done
on my side. For example i added a RLoadOrientedImage fct.
i will add it for wmiv and need further discussion to know if it could
be useful when setting background image.

regards,
david


On Wed, May 21, 2014 at 8:10 PM, Carlos R. Mafra  wrote:
> On Wed, 21 May 2014 at 13:05:02 +0800, David Maciejak wrote:
>> This patch adds RVerticalFlipImage and RHorizontalFlipImage functions.
>
> Do you have some application in mind? Otherwise we are just adding
> unused functions...
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] wrlib: add image flip functions

2014-05-24 Thread David Maciejak
Sorry dont know what happen to flip.c indentation, but seems it's broken.
I will send you a fix later, btw the last days i was testing the
rotate function .. and I can say that the mod 90 rotations are not all
working (it also mirrors the img), I am trying to fix that.

regards,
david

On Wed, May 21, 2014 at 10:02 PM, David Maciejak
 wrote:
> i am working on some new feature that will autorotate the img (at
> least jpeg) based on the exif orientation tag. The code is almost done
> on my side. For example i added a RLoadOrientedImage fct.
> i will add it for wmiv and need further discussion to know if it could
> be useful when setting background image.
>
> regards,
> david
>
>
> On Wed, May 21, 2014 at 8:10 PM, Carlos R. Mafra  wrote:
>> On Wed, 21 May 2014 at 13:05:02 +0800, David Maciejak wrote:
>>> This patch adds RVerticalFlipImage and RHorizontalFlipImage functions.
>>
>> Do you have some application in mind? Otherwise we are just adding
>> unused functions...
>>
>>
>> --
>> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] Fix issues with alt-tab

2014-05-26 Thread David Maciejak
>
> Most of the people probably don't even know how to turn off the
> switchpanel. I have always wondered why there is no option in the
> WPrefs for disable/enable switchpanel.
>

i would like to see that feature too ;)


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] wrlib: fixed transformation functions

2014-05-26 Thread David Maciejak
Here the patch i was talking about some days ago.

With a valid set of exif images available at
https://github.com/recurser/exif-orientation-examples

i was able to detect that the flip functions was shifting the image by 1px.

The 90 and 270 degrees rotation were not working as expected as
the functions were also mirroring the img.

The patch is also fixing the C style based on checkpatch.


diff --git a/wrlib/flip.c b/wrlib/flip.c
index 6801783..f49bfd9 100644
--- a/wrlib/flip.c
+++ b/wrlib/flip.c
@@ -43,42 +43,42 @@ RImage *RVerticalFlipImage(RImage *image)
  return NULL;

  if (bpp == 3) {
- unsigned char *optr, *nptr;
-
- optr = image->data;
- nptr = img->data + 4 * (nwidth * nheight - nwidth - 1);
-
- for (y = 0; y < nheight; y++) {
- for (x = 0; x < nwidth; x++) {
- nptr[0] = optr[0];
- nptr[1] = optr[1];
- nptr[2] = optr[2];
- nptr[3] = 255;
-
- optr += 3;
- nptr += 4;
- }
- nptr -= nwidth*8;
+ unsigned char *optr, *nptr;
+
+ optr = image->data;
+ nptr = img->data + 4 * (nwidth * nheight - nwidth);
+
+ for (y = 0; y < nheight; y++) {
+ for (x = 0; x < nwidth; x++) {
+ nptr[0] = optr[0];
+ nptr[1] = optr[1];
+ nptr[2] = optr[2];
+ nptr[3] = 255;
+
+ optr += 3;
+ nptr += 4;
  }
- } else {
- unsigned char *optr, *nptr;
-
- optr = image->data;
- nptr = img->data + 4 * (nwidth * nheight - nwidth - 1);
-
- for (y = 0; y < nheight; y++) {
- for (x = 0; x < nwidth; x++) {
- nptr[0] = optr[0];
- nptr[1] = optr[1];
- nptr[2] = optr[2];
- nptr[3] = optr[3];
-
- optr += 4;
- nptr += 4;
- }
- nptr -= nwidth*8;
+ nptr -= nwidth*8;
+ }
+ } else {
+ unsigned char *optr, *nptr;
+
+ optr = image->data;
+ nptr = img->data + 4 * (nwidth * nheight - nwidth);
+
+ for (y = 0; y < nheight; y++) {
+ for (x = 0; x < nwidth; x++) {
+ nptr[0] = optr[0];
+ nptr[1] = optr[1];
+ nptr[2] = optr[2];
+ nptr[3] = optr[3];
+
+ optr += 4;
+ nptr += 4;
  }
+ nptr -= nwidth * 8;
  }
+ }
  return img;
 }

@@ -97,37 +97,41 @@ RImage *RHorizontalFlipImage(RImage *image)
  return NULL;

  if (bpp == 3) {
- unsigned char *optr, *nptr;
+ unsigned char *optr, *nptr;

- nptr = img->data + nwidth * nheight * 4 - 4;
- for (y = nheight; y; y--) {
- for (x = 0; x < nwidth; x++) {
- optr = image->data + (y*nwidth + x) * 3;
+ optr = image->data;
+ nptr = img->data + 4 * (nwidth - 1);

- nptr[0] = optr[0];
- nptr[1] = optr[1];
- nptr[2] = optr[2];
- nptr[3] = 255;
+ for (y = nheight; y; y--) {
+ for (x = 0; x < nwidth; x++) {
+ nptr[0] = optr[0];
+ nptr[1] = optr[1];
+ nptr[2] = optr[2];
+ nptr[3] = 255;

- nptr -= 4;
- }
+ optr += 3;
+ nptr -= 4;
  }
- } else {
- unsigned char *optr, *nptr;
+ nptr += 8 * nwidth;
+ }
+ } else {
+ unsigned char *optr, *nptr;

- nptr = img->data + nwidth * nheight * 4 - 4;
- for (y = nheight; y; y--) {
- for (x = 0; x < nwidth; x++) {
- optr = image->data + (y*nwidth + x) * 4;
+ optr = image->data;
+ nptr = img->data + 4 * (nwidth - 1);

- nptr[0] = optr[0];
- nptr[1] = optr[1];
- nptr[2] = optr[2];
- nptr[3] = optr[3];
+ for (y = nheight; y; y--) {
+ for (x = 0; x < nwidth; x++) {
+ nptr[0] = optr[0];
+ nptr[1] = optr[1];
+ nptr[2] = optr[2];
+ nptr[3] = optr[3];

- nptr -= 4;
- }
+ optr += 4;
+ nptr -= 4;
  }
+ nptr += 8 * nwidth;
  }
+ }
  return img;
 }
diff --git a/wrlib/rotate.c b/wrlib/rotate.c
index 09e8a0a..f2f92b9 100644
--- a/wrlib/rotate.c
+++ b/wrlib/rotate.c
@@ -34,9 +34,9 @@
 #define PI 3.14159265358979323846
 #endif

-static RImage *rotateImage(RImage * image, float angle);
+static RImage *rotateImage(RImage *image, float angle);

-RImage *RRotateImage(RImage * image, float angle)
+RImage *RRotateImage(RImage *image, float angle)
 {
  RImage *img;
  int nwidth, nheight;
@@ -66,40 +66,41 @@ RImage *RRotateImage(RImage * image, float angle)
  nheight = image->width;

  img = RCreateImage(nwidth, nheight, True);
- if (!img) {
+ if (!img)
  return NULL;
- }

  if (bpp == 3) {
  unsigned char *optr, *nptr;
- unsigned offs;
-
- offs = nwidth * 4;

  optr = image->data;
+ nptr = img->data;

- for (x = 0; x < nwidth; x++) {
- nptr = img->data + x * 4;
+ for (x = nwidth; x; x--) {
+ nptr = img->data + 4 * (x - 1);
  for (y = nheight; y; y--) {
  nptr[0] = *optr++;
  nptr[1] = *optr++;
  nptr[2] = *optr++;
  nptr[3] = 255;

- nptr += offs;
+ nptr += 4 * nwidth;
  }
  }
  } else {
- unsigned *optr, *nptr;
- unsigned *p;
+ unsigned char *optr, *nptr;

- optr = (unsigned *)image->data;
- p = (unsigned *)img->data;
- for (x = 0; x < nwidth; x++) {
- nptr = p++;
+ optr = image->data;
+ nptr = img->data;
+
+ for (x = nwidth; x; x--) {
+ nptr = img->data + 4 * (x - 1);
  for (y = nheight; y; y--) {
- *nptr = *optr++;
- nptr += nwidth;
+ nptr[0] = *optr++;
+ nptr[1] = *optr++;
+ nptr[2] = *optr++;
+ nptr[3] = *optr++;
+
+ nptr += 4 * nwidth;
  }
  }
  }
@@ -109,9 +110,8 @@ RImage *RRotateImage(RImage * image, float angle)
  nwidth = image->width;
  nheight = image->height;
  img = RCreateImage(nwidth, nheight, True);
- if (!img) {
+ if (!img)
  return NULL;
- }

  if (bpp == 3) {
  unsigned char *optr, *nptr;
@@ -148,40 +

[PATCH] WINGs: fix duplicate if/else branch in W_LookupString

2014-05-27 Thread David Maciejak
cppcheck is reporting the msg below:

[../WINGs/winputmethod.c:215] -> [../WINGs/winputmethod.c:209]:
(style) Found duplicate branches for 'if' and 'else'.

The patch is fixing it by setting a default return call.



diff --git a/WINGs/winputmethod.c b/WINGs/winputmethod.c
index 7d3aae0..26bc4a1 100644
--- a/WINGs/winputmethod.c
+++ b/WINGs/winputmethod.c
@@ -199,20 +199,15 @@ void W_SetPreeditPositon(W_View * view, int x, int y)
  }
 }

-int
-W_LookupString(W_View * view, XKeyPressedEvent * event, char *buffer,
int buflen, KeySym * keysym, Status * status)
+int W_LookupString(W_View * view, XKeyPressedEvent * event, char
*buffer, int buflen, KeySym * keysym, Status * status)
 {
  WMScreen *scr = W_VIEW_SCREEN(view);

  XSetInputFocus(scr->display, view->window, RevertToParent, CurrentTime);

- if (view->xic) {
 #ifdef X_HAVE_UTF8_STRING
+ if (view->xic)
  return Xutf8LookupString(view->xic, event, buffer, buflen, keysym, status);
-#else
- return XLookupString(event, buffer, buflen, keysym, (XComposeStatus
*) status);
 #endif
- } else {
- return XLookupString(event, buffer, buflen, keysym, (XComposeStatus
*) status);
- }
+ return XLookupString(event, buffer, buflen, keysym, (XComposeStatus
*) status);
 }
-- 
1.8.3.2


0001-WINGs-fix-duplicate-if-else-branch.patch
Description: Binary data


[PATCH 0/2] EXIF orientation feature

2014-05-29 Thread David Maciejak
These patches (one for the lib, one for the viewer tool) are bringing
EXIF orientation support in wrlib.
Most popular display libs and tools are providing such kind of
features these days (eog, gimp, ...).
I ported the code from jpegexiforient to be able to extract the tag value,
and as said in some previous emails ran tests using
examples at http://github.com/recurser/exif-orientation-examples
(it resulted in some already merged patches).

Now the question is: should it be used to load default bg image too ?

0001-wrlib-add-EXIF-orientation-feature
0002-util-wmiv-add-image-auto-orientation-detection


regards,
david


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 2/2] util/wmiv: add image auto orientation detection

2014-05-29 Thread David Maciejak
Based on wrlib EXIF orientation feature, this patch
is adding orientation detection and provides 2 more shortcuts
for live right/left rotation. Internal version was increased to 0.7.


---
 util/wmiv.c | 103 +++-
 1 file changed, 89 insertions(+), 14 deletions(-)

diff --git a/util/wmiv.c b/util/wmiv.c
index 2eab5d3..92032f2 100755
--- a/util/wmiv.c
+++ b/util/wmiv.c
@@ -57,7 +57,7 @@ Pixmap pix;

 const char *APPNAME = "wmiv";
 int APPVERSION_MAJOR = 0;
-int APPVERSION_MINOR = 6;
+int APPVERSION_MINOR = 7;
 int NEXT = 0;
 int PREV = 1;
 float zoom_factor = 0;
@@ -66,6 +66,7 @@ int max_height = 0;

 Bool fullscreen_flag = False;
 Bool focus = False;
+Bool back_from_fullscreen = False;

 #ifdef HAVE_PTHREAD
 Bool diaporama_flag = False;
@@ -212,6 +213,59 @@ int merge_with_background(RImage *i)
 }

 /*
+ turn_image: rotate the image by the angle passed
+ return EXIT_SUCCESS on success, EXIT_FAILURE on failure
+*/
+int turn_image(float angle)
+{
+ RImage *tmp;
+
+ if (!img)
+ return EXIT_FAILURE;
+
+ tmp = RRotateImage(img, angle);
+ if (!tmp)
+ return EXIT_FAILURE;
+
+ if (!fullscreen_flag) {
+ if (img->width != tmp->width || img->height != tmp->height)
+ XResizeWindow(dpy, win, tmp->width, tmp->height);
+ }
+
+ RReleaseImage(img);
+ img = tmp;
+
+ rescale_image();
+ if (!fullscreen_flag) {
+ XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, img->width, img->height, 0, 0);
+ } else {
+ XClearWindow(dpy, win);
+ XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0,
+ img->width, img->height, max_width/2-img->width/2,
max_height/2-img->height/2);
+ }
+
+ return EXIT_SUCCESS;
+}
+
+/*
+ turn_image_right: rotate the image by 90 degree
+ return EXIT_SUCCESS on success, EXIT_FAILURE on failure
+*/
+int turn_image_right(void)
+{
+ return turn_image(90.0);
+}
+
+/*
+ turn_image_left: rotate the image by -90 degree
+ return EXIT_SUCCESS on success, 1 on failure
+*/
+int turn_image_left(void)
+{
+ return turn_image(-90.0);
+}
+
+/*
  draw_failed_image: create a red crossed image to indicate an error
loading file
  return the image on success, NULL on failure

@@ -250,6 +304,7 @@ int full_screen(void)
  if (fullscreen_flag) {
  fullscreen_flag = False;
  zoom_factor = 0;
+ back_from_fullscreen = True;
  } else {
  fullscreen_flag = True;
  zoom_factor = 1000;
@@ -279,7 +334,7 @@ int full_screen(void)
 int zoom_in_out(int z)
 {
  RImage *old_img = img;
- RImage *tmp = RLoadImage(ctx, current_link->data, 0);
+ RImage *tmp = RLoadOrientedImage(ctx, current_link->data, 0);
  if (!tmp)
  return EXIT_FAILURE;

@@ -368,7 +423,7 @@ int change_image(int way)
  }
  if (DEBUG)
  fprintf(stderr, "current file is> %s\n", (char *)current_link->data);
- img = RLoadImage(ctx, current_link->data, 0);
+ img = RLoadOrientedImage(ctx, current_link->data, 0);

  if (!img) {
  fprintf(stderr, "Error: %s %s\n", (char *)current_link->data,
@@ -453,7 +508,7 @@ int linked_list_add(linked_list_t *list, const void *data)
  /* calloc sets the "next" field to zero. */
  link = calloc(1, sizeof(link_t));
  if (!link) {
- fprintf(stderr, "calloc failed.\n");
+ fprintf(stderr, "Error: memory allocation failed\n");
  return EXIT_FAILURE;
  }
  link->data = data;
@@ -572,7 +627,9 @@ int main(int argc, char **argv)
 #ifdef HAVE_PTHREAD
  "d: launch diaporama mode\n"
 #endif
+ "l: rotate image on the left\n"
  "q: quit\n"
+ "r: rotate image on the right\n"
  "right: next image\n"
  "left: previous image\n"
  "up: first image\n"
@@ -618,7 +675,7 @@ int main(int argc, char **argv)
  }
  }

- img = RLoadImage(ctx, reading_filename, 0);
+ img = RLoadOrientedImage(ctx, reading_filename, 0);

  if (!img) {
  fprintf(stderr, "Error: %s %s\n", reading_filename,
RMessageForError(RErrorCode));
@@ -703,21 +760,33 @@ int main(int argc, char **argv)
  XConfigureEvent xce = e.xconfigure;
  if (xce.width != img->width || xce.height != img->height) {
  RImage *old_img = img;
- img = RLoadImage(ctx, current_link->data, 0);
+ img = RLoadOrientedImage(ctx, current_link->data, 0);
  if (!img) {
  /* keep the old img and window size */
  img = old_img;
  XResizeWindow(dpy, win, img->width, img->height);
  } else {
- img = RScaleImage(img, xce.width, xce.height);
- if (!img) {
- img = old_img;
- XResizeWindow(dpy, win, img->width, img->height);
- } else {
- merge_with_background(img);
- if (RConvertImage(ctx, img, &pix))
- RReleaseImage(old_img);
+ RImage *tmp2;
+ if (!back_from_fullscreen)
+ /* manually resized window */
+ tmp2 = RScaleImage(img, xce.width, xce.height);
+ else {
+ /* back from fullscreen mode, maybe img was rotated */
+ tmp2 = img;
+ back_from_fullscreen = False;
+ XClearWindow(dpy, win);
+ }
+ merge_with_background(tmp2);
+ if (RConvertImage(ctx, tmp2, &pix)) {
+ RReleaseImage(old_img);
+ img = RCloneImage(tmp2);
+ RReleaseImage(tmp2);
+ change_title(&title_property, (char *)current_link->data);
+ XSync(dpy, True);
  XResizeWindow(dpy, win, img->width, img->height);
+ XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0,
+ im

[PATCH 1/2] wrlib: add EXIF orientation feature

2014-05-29 Thread David Maciejak
This patch is adding a RLoadOrientedImage that can be used
to extract the EXIF orientation field of a given image
(only JPEG for now), the resulting image is automatically flipped/rotated.


---
 wrlib/libwraster.map |   2 +
 wrlib/load.c |  60 +-
 wrlib/misc.c | 227 ---
 wrlib/wraster.h  |  19 +
 4 files changed, 294 insertions(+), 14 deletions(-)

diff --git a/wrlib/libwraster.map b/wrlib/libwraster.map
index cf36401..8dc5fc7 100644
--- a/wrlib/libwraster.map
+++ b/wrlib/libwraster.map
@@ -52,7 +52,9 @@ LIBWRASTER3
 RGetXImage;
 RHSVtoRGB;
 RLightImage;
+RGetImageOrientation;
 RLoadImage;
+RLoadOrientedImage;
 RMakeCenteredImage;
 RMakeTiledImage;
 RMessageForError;
diff --git a/wrlib/load.c b/wrlib/load.c
index 7c2e6af..cd09990 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -146,7 +146,7 @@ void RReleaseCache(void)
  }
 }

-RImage *RLoadImage(RContext * context, const char *file, int index)
+static RImage *load_image(RContext *context, const char *file, int
index, int orientation)
 {
  RImage *image = NULL;
  int i;
@@ -236,6 +236,49 @@ RImage *RLoadImage(RContext * context, const char
*file, int index)
  return NULL;
  }

+ if (image && (orientation > ROrientationNormal)) {
+ RImage *tmp = NULL;
+ switch (orientation) {
+ case ROrientationFlipHorizontal:
+ tmp = RHorizontalFlipImage(image);
+ break;
+ case ROrientationRotate180:
+ tmp = RRotateImage(image, 180);
+ break;
+ case ROrientationFlipVertical:
+ tmp = RVerticalFlipImage(image);
+ break;
+ case ROrientationTranspose: {
+ RImage *tmp2;
+ tmp2 = RVerticalFlipImage(image);
+ if (tmp2) {
+ tmp = RRotateImage(tmp2, 90);
+ RReleaseImage(tmp2);
+ }
+ }
+ break;
+ case ROrientationRotate90:
+ tmp = RRotateImage(image, 90);
+ break;
+ case ROrientationTransverse: {
+ RImage *tmp2;
+ tmp2 = RVerticalFlipImage(image);
+ if (tmp2) {
+ tmp = RRotateImage(tmp2, 270);
+ RReleaseImage(tmp2);
+ }
+ }
+ break;
+ case ROrientationRotate270:
+ tmp = RRotateImage(image, 270);
+ break;
+ }
+ if (tmp) {
+ RReleaseImage(image);
+ image = tmp;
+ }
+ }
+
  /* store image in cache */
  if (RImageCacheSize > 0 && image &&
 (RImageCacheMaxImage == 0 || RImageCacheMaxImage >= image->width
* image->height)) {
@@ -275,6 +318,17 @@ RImage *RLoadImage(RContext * context, const char
*file, int index)
  return image;
 }

+RImage *RLoadImage(RContext *context, const char *file, int index)
+{
+ return load_image(context, file, index, ROrientationNormal);
+}
+
+RImage *RLoadOrientedImage(RContext *context, const char *file, int index)
+{
+ int orientation = RGetImageOrientation(file);
+ return load_image(context, file, index, orientation);
+}
+
 char *RGetImageFileFormat(const char *file)
 {
  switch (identFile(file)) {
@@ -370,8 +424,8 @@ static WRImgFormat identFile(const char *path)
  return IM_GIF;

  /* check for WEBP */
- if (buffer[ 0] == 'R' && buffer[ 1] == 'I' && buffer[ 2] == 'F' &&
buffer[ 3] == 'F' &&
-buffer[ 8] == 'W' && buffer[ 9] == 'E' && buffer[10] == 'B' &&
buffer[11] == 'P' &&
+ if (buffer[0] == 'R' && buffer[1] == 'I' && buffer[2] == 'F' &&
buffer[3] == 'F' &&
+buffer[8] == 'W' && buffer[9] == 'E' && buffer[10] == 'B' &&
buffer[11] == 'P' &&
 buffer[12] == 'V' && buffer[13] == 'P' && buffer[14] == '8' &&
 (buffer[15] == ' '   /* Simple File Format (Lossy) */
  || buffer[15] == 'L'/* Simple File Format (Lossless) */
diff --git a/wrlib/misc.c b/wrlib/misc.c
index 615777e..d5a63a5 100644
--- a/wrlib/misc.c
+++ b/wrlib/misc.c
@@ -30,7 +30,7 @@
 #include "convert.h"


-void RBevelImage(RImage * image, int bevel_type)
+void RBevelImage(RImage *image, int bevel_type)
 {
  RColor color;
  RColor cdelta;
@@ -83,7 +83,7 @@ void RBevelImage(RImage * image, int bevel_type)
  }
 }

-void RFillImage(RImage * image, const RColor * color)
+void RFillImage(RImage *image, const RColor *color)
 {
  unsigned char *d = image->data;
  unsigned lineSize;
@@ -97,9 +97,8 @@ void RFillImage(RImage * image, const RColor * color)
  *d++ = color->alpha;
  }
  lineSize = image->width * 4;
- for (i = 1; i < image->height; i++, d += lineSize) {
+ for (i = 1; i < image->height; i++, d += lineSize)
  memcpy(d, image->data, lineSize);
- }
  } else {
  for (i = 0; i < image->width; i++) {
  *d++ = color->red;
@@ -107,13 +106,12 @@ void RFillImage(RImage * image, const RColor * color)
  *d++ = color->blue;
  }
  lineSize = image->width * 3;
- for (i = 1; i < image->height; i++, d += lineSize) {
+ for (i = 1; i < image->height; i++, d += lineSize)
  memcpy(d, image->data, lineSize);
- }
  }
 }

-void RClearImage(RImage * image, const RColor * color)
+void RClearImage(RImage *image, const RColor *color)
 {
  unsigned char *d = image->data;
  unsigned lineSize;
@@ -128,9 +126,8 @@ void RClearImage(RImage * image, const RColor * color)
  *d++ = 0xff;
  }
  lineSize = image->width * 4;
- for (i = 1; i < image->height; i++, d += lineSize) {
+ for (i = 

Re: [PATCH 1/2] wrlib: add EXIF orientation feature

2014-05-30 Thread David Maciejak
Seems the link I provided is already dead...
You can find the original code here:
http://sylvana.net/jpegcrop/jpegexiforient.c

length is initialised from reading 2 bytes.

regards,
david

On Fri, May 30, 2014 at 6:00 AM, BALATON Zoltan  wrote:
> On Thu, 29 May 2014, David Maciejak wrote:
>>
>> +/*
>> + Based on jpegexiforient.c
>> + Full src available at
>> http://ftp.freebsd.org/pub/FreeBSD/distfiles/jpeg8b/jpegexiforient.c
>> +
>> + Tested with img samples from
>> http://github.com/recurser/exif-orientation-examples
>> +*/
>> +int RGetImageOrientation(const char *file)
>> +{
>> + int c1, c2;
>> + int set_flag = ROrientationUnknown;
>> + unsigned int length, i;
>> + /* Flag for byte order */
>> + int is_motorola;
>> + unsigned int exif_offset, offset, number_of_tags, tagnum;
>> + FILE *myfile;
>> + unsigned char exif_data[65536L];
>
>
> [...]
>
>
>> + /* Get the marker parameter length count */
>> + c1 = getc(myfile);
>> + if (c1 == EOF)
>> + exif_offset = 0;
>> + c2 = getc(myfile);
>> + if (c2 == EOF)
>> + exif_offset = 0;
>> + length = (((unsigned int) c1) << 8) + ((unsigned int) c2);
>> +
>> + /* Length includes itself, so must be at least 2 */
>> + /* Following Exif data length must be at least 6 */
>> + if (length < 8)
>> + exif_offset = 0;
>> +
>> + exif_offset += 2;
>> +
>> + /* No marker tag. */
>> + if (exif_data[0] != 0xFF)
>> + exif_offset = 0;
>> +
>> + /* Exif if APP1 is found. */
>> + if (exif_data[1] == 0xE1)
>> + break;
>> +
>> + exif_offset += length;
>> +
>> + /* Some other marker found, seek to next one. */
>> + if (-1 == fseek(myfile, length - 2, SEEK_CUR))
>> + /* Can't seek. */
>> + exif_offset = 0;
>> + }
>> +
>> + /* check if something went wrong */
>> + if (!exif_offset)
>> + goto clean_return;
>> +
>> + length -= 8;
>> + /* Read Exif head, check for "Exif" */
>> + for (i = 0; i < 6; i++) {
>> + int c;
>> + c = getc(myfile);
>> + if (c == EOF)
>> + goto clean_return;
>> + exif_data[i] = (unsigned char) c;
>> + }
>> +
>> + if (exif_data[0] != 0x45 || exif_data[1] != 0x78 || exif_data[2] != 0x69
>> ||
>> + exif_data[3] != 0x66 || exif_data[4] != 0 || exif_data[5] != 0)
>> + goto clean_return;
>> +
>> + /* Read Exif body */
>> + for (i = 0; i < length; i++) {
>> + int c;
>> + c = getc(myfile);
>> + if (c == EOF)
>> + goto clean_return;
>> + exif_data[i] = (unsigned char) c;
>> + }
>
>
> How do you make sure that there won't be an overflow of the exif_data[]
> array? I see no checks that length is smaller than the size of this array
> which is a fixed constant.
>
> Regards,
> BALATON Zoltan


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 0/2] EXIF orientation feature

2014-05-30 Thread David Maciejak
On Fri, May 30, 2014 at 6:29 AM, Carlos R. Mafra  wrote:
> On Thu, 29 May 2014 at 20:45:42 +0800, David Maciejak wrote:
>> These patches (one for the lib, one for the viewer tool) are bringing
>> EXIF orientation support in wrlib.
>> Most popular display libs and tools are providing such kind of
>> features these days (eog, gimp, ...).
>> I ported the code from jpegexiforient to be able to extract the tag value,
>> and as said in some previous emails ran tests using
>> examples at http://github.com/recurser/exif-orientation-examples
>> (it resulted in some already merged patches).
>>
>> Now the question is: should it be used to load default bg image too ?
>
> I think it would be better to keep wrlib simple. Does wmaker really
> need the EXIF orientation support in its wrlib? Why?
>
> This smells like 'creeping featurism' 
> (http://en.wikipedia.org/wiki/Feature_creep).
>

Completely agree, let's keep the graphic library simple and outdated.


regards,
david


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 0/2] EXIF orientation feature

2014-05-31 Thread David Maciejak
On Sunday, June 1, 2014, Christophe  wrote:

>
> - Carlos R. Mafra > a écrit :
> > On Fri, 30 May 2014 at 16:27:44 +0800, David Maciejak wrote:
> > > On Fri, May 30, 2014 at 6:29 AM, Carlos R. Mafra  > wrote:
> > > > On Thu, 29 May 2014 at 20:45:42 +0800, David Maciejak wrote:
> > > >> [...]
> > > >>
> > > >> Now the question is: should it be used to load default bg image too
> ?
> > > >
> > > > I think it would be better to keep wrlib simple. Does wmaker really
> > > > need the EXIF orientation support in its wrlib? Why?
> > > >
> > > > This smells like 'creeping featurism' (
> http://en.wikipedia.org/wiki/Feature_creep).
> > > >
> > >
> > > Completely agree, let's keep the graphic library simple and outdated.
> >
> > The question really is: why wmaker should _care_ about EXIF orientation?
> > Should it also care about GPS coordinates in the future?
>
> Hello,
> If you'd allow me to jump into the troll too, I'd to add my personal point
> of view on the matter.
>
> WRaster is a *raster* library, that means providing helpful functions for
> images in memory (draw, rescale, rotate/flip, ...) and loading image is
> just a small service of the library. EXIF are metadata, thus not linked to
> raster operations, they are just additional information.
>
> The goal here is not to keep WRaster "outdated", it is to keep it
> reasonably maintainable.
>
>
> > This feature is not necessary. If someone wants to set a wallpaper
> > with an upside-down image, wmaker should not mess with this choice
> > and be "smart" in "fixing" the orientation automatically (as an
> > hypothetical use of this feature).
>
>
> Actually, that would also assume that EXIF info are right. Which may not
> be the case. They can be missing (in which case it's up to the user) but
> they can also be wrong (incorrect detection from camera's sensor, so... up
> to the user again).
>
> I believe it is the role of the *image viewer* to handle the
> rotation/flip/whatever because this has to interact with the user,
> something a library can't do.
>
> And on a long term notice (because I assume that wmiv is more than just a
> quick toy), integrating EXIF in wraster in not a good idea, because it is
> likely that someday you'll say yourself that it would be a neat feature to
> be able to display those EXIF info to the user, which will not be easy if
> those are loaded inside WRaster. And that's just an example.
>
> On a final note, did you consider libexif? It looks like to be widely
> available.
>
>
First of all, my intent was not to create a troll but to open discussion
about new features.
That's the purpose of the next version ?
Let's jump into it ;)

As I shared some time ago already with Carlos, I believe I have some basic
requirements that are not fulfilled with out-of-box wmaker. I know you will
say it's not the purpose of a window manager and I agree with that to some
extend.

Here my crazy needs:
*open images without relying on some gnome or Kde tools, now that is almost
fulfill with wmiv
*lock my session. I don't care about screensaver thing, just need something
that work like i3lock as xlockmore is not provided anymore on some
distribs and slock is just segfaulting in my tests), what about a wmlock ?

For the exif orientation stuff, I wanted to keep it simple but as you said
maybe some days requirements will change.
The other option I had was to add the metadata processing directly in wmiv,
as now flip/rotation from wrlib are working well. I like the idea I will
implement it and keep it in my own repo if nobody need that.


Regards,
David



>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


Re: [PATCH 00/11] WPrefs: fixes for stuff reported by Coverity

2014-05-31 Thread David Maciejak
Thanks Christophe for all these patches!

On a side note, i saw yesterday that WPrefs is using some fcts from
WINGs/userdefaults.c, at least these 2:
WMSetUDIntegerForKey and WMSetUDFloatForkey

The code looks the same for both fcts and are defining a buffer[128]
and then use sprintf.
It would be cleaner to adjust the size of the buffer and use snprintf
instead. What's your thought ?

regards,
david

On Sun, Jun 1, 2014 at 1:58 AM, Christophe  wrote:
> From: Christophe CURIS 
>
> Hello,
>
> This serie of patch fixes the code in WPrefs that are related
> to these 13 bugs pointed by Coverity:
>
>  #50031: Unchecked return value
>  #50073: Explicit null dereferenced
>  #50098: Dereference null return value
>  #50105: Resource leak
>  #50107: Resource leak
>  #50130: Resource leak
>  #50140: Resource leak
>  #50150: Resource leak
>  #50156: Resource leak
>  #50157: Resource leak
>  #50158: Resource leak
>  #50159: Resource leak
>  #50200: Dereference before null check
>
> Christophe.
>
>
>  WPrefs.app/Appearance.c | 18 +-
>  WPrefs.app/Docks.c  |  7 ++-
>  WPrefs.app/Focus.c  |  1 +
>  WPrefs.app/Menu.c   | 15 ++-
>  WPrefs.app/MouseSettings.c  |  4 +++-
>  WPrefs.app/Paths.c  |  8 +---
>  WPrefs.app/TexturePanel.c   |  4 ++--
>  WPrefs.app/WindowHandling.c | 13 +
>  WPrefs.app/editmenu.c   |  6 +-
>  WPrefs.app/xmodifier.c  | 11 ---
>  10 files changed, 58 insertions(+), 29 deletions(-)
>
> --
> 1.9.2
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH] util/wmiv: add image auto orientation detection

2014-06-02 Thread David Maciejak
This patch is less intrusive than the previous one, almost all is done
in wmiv, the exif metadata handling is based on libexif.


Based on libexif feature, this patch is adding orientation
detection and provides 2 more shortcuts for live
right/left rotation. Internal version was bumped to 0.7.

---
 configure.ac |   6 ++
 m4/wm_libexif.m4 |  34 ++
 util/Makefile.am |   2 +-
 util/wmiv.c  | 193 +++
 4 files changed, 220 insertions(+), 15 deletions(-)
 create mode 100644 m4/wm_libexif.m4

diff --git a/configure.ac b/configure.ac
index 4ea1e32..2b9fe6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -640,6 +640,12 @@ dnl ===
 dnl End of stuff that uses X
 dnl ===

+dnl EXIF Support
+dnl ===
+WM_CHECK_LIBEXIF
+AS_IF([test "x$LIBEXIF" != "x"],
+[AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
+
 dnl PNG Support
 dnl ===
 AC_ARG_ENABLE([png],
diff --git a/m4/wm_libexif.m4 b/m4/wm_libexif.m4
new file mode 100644
index 000..ac501bb
--- /dev/null
+++ b/m4/wm_libexif.m4
@@ -0,0 +1,34 @@
+# wm_libexif.m4 - Macros to check proper libexif
+#
+# Copyright (c) 2014 Window Maker Team
+#
+# 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_CHECK_LIBEXIF
+# -
+#
+# Checks the needed library link flags
+# Sets variable LIBEXIF with the appropriates flags
+AC_DEFUN_ONCE([WM_CHECK_LIBEXIF],
+[AC_CHECK_HEADER([libexif/exif-data.h],
+ [AC_CHECK_FUNC(exif_data_new_from_file,
+ [LIBEXIF=],
+ [AC_CHECK_LIB(exif, [exif_data_new_from_file],
+ [LIBEXIF=-lexif],
+ [AC_MSG_WARN(Could not find EXIF library, you may experience problems)
+ LIBEXIF=] )] )],
+ [AC_MSG_WARN([header for EXIF library not found])])
+AC_SUBST(LIBEXIF) dnl
+])
diff --git a/util/Makefile.am b/util/Makefile.am
index 5cde3ee..b5c9d04 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -73,7 +73,7 @@ wmmenugen_SOURCES = wmmenugen.c wmmenugen.h wmmenugen_misc.c \
 wmiv_LDADD = \
  $(top_builddir)/wrlib/libwraster.la \
  @XLFLAGS@ @XLIBS@ \
- @GFXLIBS@ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+ @GFXLIBS@ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(LIBEXIF)

 wmiv_SOURCES = wmiv.c wmiv.h

diff --git a/util/wmiv.c b/util/wmiv.c
index 2eab5d3..9810b5c 100755
--- a/util/wmiv.c
+++ b/util/wmiv.c
@@ -21,6 +21,7 @@
 #if !defined(_GNU_SOURCE)
 #define _GNU_SOURCE
 #endif
+
 #include 
 #include 
 #include 
@@ -34,6 +35,11 @@
 #include 
 #include 
 #include "config.h"
+
+#ifdef HAVE_EXIF
+#include 
+#endif
+
 #ifdef HAVE_PTHREAD
 #include 
 #endif
@@ -57,7 +63,7 @@ Pixmap pix;

 const char *APPNAME = "wmiv";
 int APPVERSION_MAJOR = 0;
-int APPVERSION_MINOR = 6;
+int APPVERSION_MINOR = 7;
 int NEXT = 0;
 int PREV = 1;
 float zoom_factor = 0;
@@ -66,6 +72,7 @@ int max_height = 0;

 Bool fullscreen_flag = False;
 Bool focus = False;
+Bool back_from_fullscreen = False;

 #ifdef HAVE_PTHREAD
 Bool diaporama_flag = False;
@@ -98,6 +105,90 @@ typedef struct linked_list {
 linked_list_t list;
 link_t *current_link;

+
+/*
+ load_oriented_image: used to load an image and optionally
+ get its orientation if libexif is available
+ return the image on success, NULL on failure
+*/
+RImage *load_oriented_image(RContext *context, const char *file, int index)
+{
+ RImage *image;
+#ifdef HAVE_EXIF
+ int orientation = 0;
+#endif
+ image = RLoadImage(context, file, index);
+ if (!image)
+ return NULL;
+#ifdef HAVE_EXIF
+ ExifData *exifData = exif_data_new_from_file(file);
+ if (exifData) {
+ ExifByteOrder byteOrder = exif_data_get_byte_order(exifData);
+ ExifEntry *exifEntry = exif_data_get_entry(exifData, EXIF_TAG_ORIENTATION);
+ if (exifEntry)
+ orientation = exif_get_short(exifEntry->data, byteOrder);
+
+ exif_data_free(exifData);
+ }
+
+/*
+ 0th Row  0th Column
+ 1  top  left side
+ 2  top  right side
+ 3  bottom right side
+ 4  bottom left side
+ 5  left sidetop
+ 6  right side  top
+ 7  right side  bottom
+ 8  left sidebottom
+*/
+
+ if (image && (orientation > 1)) {
+ RImage *tmp = NULL;
+ switch (orientation) {
+ case 2:
+ tmp = RHorizontalFlipImage(image);
+ break;
+ case 3:
+ tmp = RRotateImage(image, 180);
+ break;
+ case 4:
+ tmp = RVerticalFlipImage(image);
+ break;
+ case 5: {
+ RImage *tmp2;
+ tm

[PATCH] WPrefs: add expert option to disable switch panel

2014-06-03 Thread David Maciejak
This patch is adding a checkbox option in the expert panel
to be able to disable the Alt-Tab window switching panel from the pref GUI.

Please test, i experienced some weird things with the inotify stuff,
sometime a wmaker hot restart is needed to force reload the conf.

thanks,
david

---
 WPrefs.app/Expert.c | 30 +++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index e939df0..0ed0e14 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -31,6 +31,7 @@ static const struct {

  enum {
  OPTION_WMAKER,
+ OPTION_WMAKER_ARRAY,
  OPTION_USERDEF
  } class;

@@ -50,6 +51,9 @@ static const struct {
  { N_("Use SaveUnder in window frames, icons, menus and other objects."),
   /* default: */ False, OPTION_WMAKER, "UseSaveUnders" },

+ { N_("Disable Alt-Tab window switching panel."),
+  /* default: */ False, OPTION_WMAKER_ARRAY, "SwitchPanelImages" },
+
  { N_("Disable confirmation panel for the Kill command."),
   /* default: */ False, OPTION_WMAKER, "DontConfirmKill" },

@@ -96,7 +100,7 @@ typedef struct _Panel {
 #define ICON_FILE "expert"


-static void createPanel(Panel * p)
+static void createPanel(Panel *p)
 {
  _Panel *panel = (_Panel *) p;
  WMScrollView *sv;
@@ -134,6 +138,15 @@ static void createPanel(Panel * p)
  state = expert_options[i].def_state;
  break;

+ case OPTION_WMAKER_ARRAY: {
+ char *str = GetStringForKey(expert_options[i].op_name);
+ if (str && strcasecmp(str, "None") == 0)
+ state = True;
+ else
+ state = expert_options[i].def_state;
+ }
+ break;
+
  case OPTION_USERDEF:
  state = WMGetUDBoolForKey(udb, expert_options[i].op_name);
  break;
@@ -141,7 +154,7 @@ static void createPanel(Panel * p)
  default:
 #ifdef DEBUG
  wwarning("export_options[%d].class = %d, this should not happen\n",
- i, expert_options[i].class);
+ i, expert_options[i].class);
 #endif
  state = expert_options[i].def_state;
  break;
@@ -154,7 +167,7 @@ static void createPanel(Panel * p)
  WMRealizeWidget(panel->box);
 }

-static void storeDefaults(_Panel * panel)
+static void storeDefaults(_Panel *panel)
 {
  WMUserDefaults *udb = WMGetStandardUserDefaults();
  int i;
@@ -165,6 +178,17 @@ static void storeDefaults(_Panel * panel)
  SetBoolForKey(WMGetButtonSelected(panel->swi[i]), expert_options[i].op_name);
  break;

+ case OPTION_WMAKER_ARRAY:
+ if (WMGetButtonSelected(panel->swi[i]))
+ SetStringForKey("None", expert_options[i].op_name);
+ else {
+ /* check if the array was not manually modified */
+ char *str = GetStringForKey(expert_options[i].op_name);
+ if (str && strcasecmp(str, "None") == 0)
+ RemoveObjectForKey(expert_options[i].op_name);
+ }
+ break;
+
  case OPTION_USERDEF:
  WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[i]),
expert_options[i].op_name);
  break;
-- 
1.8.3.2


0001-WPrefs-add-expert-option-to-disable-switch-panel.patch
Description: Binary data


Re: [PATCH] WPrefs: add expert option to disable switch panel

2014-06-03 Thread David Maciejak
On Tuesday, June 3, 2014, Carlos R. Mafra  wrote:

> On Tue,  3 Jun 2014 at 22:13:43 +0800, David Maciejak wrote:
> > This patch is adding a checkbox option in the expert panel
> > to be able to disable the Alt-Tab window switching panel from the pref
> GUI.
> >
> > Please test, i experienced some weird things with the inotify stuff,
> > sometime a wmaker hot restart is needed to force reload the conf.
>
> >
> > + { N_("Disable Alt-Tab window switching panel."),
> > +  /* default: */ False, OPTION_WMAKER_ARRAY, "SwitchPanelImages" },
>
> Perhaps "Do not display Alt-Tab panel icons" would be better?
>
> Otherwise I have the impression that people could misunderstand what
> this option does by thinking that we are disabling the switch panel
> altogether.
>
>
>
That option is effectively disabling *all* the switch panel, not only the
icons.
In fact it can be used either to disable the panel or to set panel bg image.


Re: [PATCH] WPrefs: add expert option to disable switch panel

2014-06-03 Thread David Maciejak
On Tuesday, June 3, 2014, Josip Deanovic  wrote:

> Quoting message written on Tuesday 2014-06-03 22:43:22 by David Maciejak:
> > That option is effectively disabling *all* the switch panel, not only
> > the icons.
> > In fact it can be used either to disable the panel or to set panel bg
> > image.
>
> That's true but I agree with Carlos that the current description might
> be misleading to users, especially to those that lack the knowledge of
> Windowmaker's internal functions and their naming.
>
>
I see no problem to change the description, please everybody share your
ideas !


Re: [PATCH] WPrefs: add expert option to disable switch panel

2014-06-04 Thread David Maciejak
Enclosed the patch with lain text proposal ""Show switch panel when
cycling windows."" and with logic changed, to amend commit
c994b65f14ad2ab872f5c1b91119d78885743cfc.

On Thu, Jun 5, 2014 at 1:41 AM, Yury Tarasievich
 wrote:
> Alt-Tab is "cycling" only in one specific scenario (holding the Alt).
> It's back-and-fro'ing between windows (Alt-Tab with complete release) and
> calls up the "switch panel" (Zoltan is right about that space there)
>
> Anyway, the distinction isn't worth an additional verb, somewhat too
> informal at that.
> Cycling? Bicycling? Recycling?
>
> Yury
>
>
> On 06/04/2014 03:17 PM, Iain Patterson wrote:
>>
>>The shortcut's purpose is to cycle windows
>> and this new preference controls whether or not
>> the above side-effect is active, so I would
>> argue that the term is appropriate.
>
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


0001-PATCH-WPrefs-add-expert-option-to-disable-switch-pan.patch
Description: Binary data


[PATCH] wmaker: increase logo size

2014-06-04 Thread David Maciejak
Increase the size to default 64x64, please test.

---
 WindowMaker/Icons/GNUstep.tiff | Bin 906 -> 3014 bytes
 WindowMaker/Icons/GNUstep.xpm  | 326 ++---
 2 files changed, 271 insertions(+), 55 deletions(-)


0001-wmaker-increase-logo-size.patch
Description: Binary data


Re: [PATCH 00/11] WPrefs: fixes for stuff reported by Coverity

2014-06-07 Thread David Maciejak
On Sunday, June 8, 2014, Christophe  wrote:

>
>
> The only detail I'd see there being that using %f for float is likely to
> loose accuracy in the value stored if the number is more than a basic
> number, but as this function is not used anywhere it does not really
> matter...
>
>
Yes that's what I saw afterwards.

Thanks for the feedback,
David



>
>
>

>
> > On Sun, Jun 1, 2014 at 1:58 AM, Christophe  > wrote:
> > > From: Christophe CURIS >
> > >
> > > Hello,
> > >
> > > This serie of patch fixes the code in WPrefs that are related
> > > to these 13 bugs pointed by Coverity:
> > >
> > >  #50031: Unchecked return value
> > >  #50073: Explicit null dereferenced
> > >  #50098: Dereference null return value
> > >  #50105: Resource leak
> > >  #50107: Resource leak
> > >  #50130: Resource leak
> > >  #50140: Resource leak
> > >  #50150: Resource leak
> > >  #50156: Resource leak
> > >  #50157: Resource leak
> > >  #50158: Resource leak
> > >  #50159: Resource leak
> > >  #50200: Dereference before null check
> > >
> > > Christophe.
> > >
> > >
> > >  WPrefs.app/Appearance.c | 18 +-
> > >  WPrefs.app/Docks.c  |  7 ++-
> > >  WPrefs.app/Focus.c  |  1 +
> > >  WPrefs.app/Menu.c   | 15 ++-
> > >  WPrefs.app/MouseSettings.c  |  4 +++-
> > >  WPrefs.app/Paths.c  |  8 +---
> > >  WPrefs.app/TexturePanel.c   |  4 ++--
> > >  WPrefs.app/WindowHandling.c | 13 +
> > >  WPrefs.app/editmenu.c   |  6 +-
> > >  WPrefs.app/xmodifier.c  | 11 ---
> > >  10 files changed, 58 insertions(+), 29 deletions(-)
> > >
> > > --
> > > 1.9.2
> > >
> > >
> > > --
> > > To unsubscribe, send mail to
> wmaker-dev-unsubscr...@lists.windowmaker.org .
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org
> .
>


[PATCH] WMaker: src/misc.c remove obsolete code

2014-06-10 Thread David Maciejak
This patch is removing the call to get_dnd_selection function
which was removed long time ago.

---
 src/misc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/misc.c b/src/misc.c
index 63e7158..572fbe4 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -627,9 +627,6 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
  dropped_thing = wstrdup(scr->xdestring);
  }
  if (!dropped_thing) {
- dropped_thing = get_dnd_selection(scr);
- }
- if (!dropped_thing) {
  scr->flags.dnd_data_convertion_status = 1;
  goto error;
  }
-- 
1.8.3.2


0001-WMaker-src-misc.c-remove-obsolete-code.patch
Description: Binary data


[PATCH] wrlib: load.c clean coding style

2014-06-10 Thread David Maciejak
just some code cleaning stuff.

---
 wrlib/load.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/wrlib/load.c b/wrlib/load.c
index 7c2e6af..9430854 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -108,16 +108,15 @@ static void init_cache(void)
  char *tmp;

  tmp = getenv("RIMAGE_CACHE");
- if (!tmp || sscanf(tmp, "%i", &RImageCacheSize) != 1) {
+ if (!tmp || sscanf(tmp, "%i", &RImageCacheSize) != 1)
  RImageCacheSize = IMAGE_CACHE_SIZE;
- }
+
  if (RImageCacheSize < 0)
  RImageCacheSize = 0;

  tmp = getenv("RIMAGE_CACHE_SIZE");
- if (!tmp || sscanf(tmp, "%i", &RImageCacheMaxImage) != 1) {
+ if (!tmp || sscanf(tmp, "%i", &RImageCacheMaxImage) != 1)
  RImageCacheMaxImage = IMAGE_CACHE_MAX_IMAGE;
- }

  if (RImageCacheSize > 0) {
  RImageCache = malloc(sizeof(RCachedImage) * RImageCacheSize);
@@ -146,7 +145,7 @@ void RReleaseCache(void)
  }
 }

-RImage *RLoadImage(RContext * context, const char *file, int index)
+RImage *RLoadImage(RContext *context, const char *file, int index)
 {
  RImage *image = NULL;
  int i;
@@ -154,9 +153,8 @@ RImage *RLoadImage(RContext * context, const char
*file, int index)

  assert(file != NULL);

- if (RImageCacheSize < 0) {
+ if (RImageCacheSize < 0)
  init_cache();
- }

  if (RImageCacheSize > 0) {

@@ -370,8 +368,8 @@ static WRImgFormat identFile(const char *path)
  return IM_GIF;

  /* check for WEBP */
- if (buffer[ 0] == 'R' && buffer[ 1] == 'I' && buffer[ 2] == 'F' &&
buffer[ 3] == 'F' &&
-buffer[ 8] == 'W' && buffer[ 9] == 'E' && buffer[10] == 'B' &&
buffer[11] == 'P' &&
+ if (buffer[0] == 'R' && buffer[1] == 'I' && buffer[2] == 'F' &&
buffer[3] == 'F' &&
+buffer[8] == 'W' && buffer[9] == 'E' && buffer[10] == 'B' &&
buffer[11] == 'P' &&
 buffer[12] == 'V' && buffer[13] == 'P' && buffer[14] == '8' &&
 (buffer[15] == ' '   /* Simple File Format (Lossy) */
  || buffer[15] == 'L'/* Simple File Format (Lossless) */
-- 
1.8.3.2


0001-wrlib-clean-coding-style.patch
Description: Binary data


[PATCH 1/2] WINGs: add function to set the color of the frame title

2014-06-12 Thread David Maciejak
This patch adds a function used to set the color of the frame title.

---
 WINGs/WINGs/WINGs.h |  2 ++
 WINGs/wframe.c  | 15 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h
index 51252f5..6333750 100644
--- a/WINGs/WINGs/WINGs.h
+++ b/WINGs/WINGs/WINGs.h
@@ -1135,6 +1135,8 @@ void WMSetFrameRelief(WMFrame *fPtr, WMReliefType relief);

 void WMSetFrameTitle(WMFrame *fPtr, const char *title);

+void WMSetFrameTitleColor(WMFrame *fPtr, WMColor *color);
+
 /* ---[ WINGs/wtextfield.c ]-- */

 WMTextField* WMCreateTextField(WMWidget *parent);
diff --git a/WINGs/wframe.c b/WINGs/wframe.c
index 336f839..ad2fc01 100644
--- a/WINGs/wframe.c
+++ b/WINGs/wframe.c
@@ -6,6 +6,7 @@ typedef struct W_Frame {
  W_View *view;

  char *caption;
+ WMColor *textColor;

  struct {
  WMReliefType relief:4;
@@ -186,7 +187,7 @@ static void paintFrame(Frame * fPtr)
  d = XCreatePixmap(display, view->window, tw, th, scrPtr->depth);
  XFillRectangle(display, d, WMColorGC(view->backColor), 0, 0, tw, th);

- WMDrawString(scrPtr, d, scrPtr->black, font, 0, 0, fPtr->caption, tlen);
+ WMDrawString(scrPtr, d, fPtr->textColor ? fPtr->textColor :
scrPtr->black, font, 0, 0, fPtr->caption, tlen);
  XCopyArea(display, d, view->window, scrPtr->copyGC, 0, 0, tw, th, tx, ty);
  XFreePixmap(display, d);
  } else {
@@ -213,6 +214,17 @@ static void handleEvents(XEvent * event, void *data)
  }
 }

+void WMSetFrameTitleColor(WMFrame *fPtr, WMColor *color)
+{
+ if (fPtr->textColor)
+ WMReleaseColor(fPtr->textColor);
+ fPtr->textColor = WMRetainColor(color);
+
+ if (fPtr->view->flags.realized) {
+ repaintFrame(fPtr);
+ }
+}
+
 WMFrame *WMCreateFrame(WMWidget * parent)
 {
  Frame *fPtr;
@@ -227,6 +239,7 @@ WMFrame *WMCreateFrame(WMWidget * parent)
  return NULL;
  }
  fPtr->view->self = fPtr;
+ fPtr->textColor = WMRetainColor(fPtr->view->screen->black);

  WMCreateEventHandler(fPtr->view, ExposureMask | StructureNotifyMask,
handleEvents, fPtr);

-- 
1.8.3.2


0001-WINGs-add-function-to-set-the-color-of-the-frame-tit.patch
Description: Binary data


[PATCH 2/2] wmaker: darken labels from docked application settings

2014-06-12 Thread David Maciejak
This patch darkens DnD labels in docked app settings when support is
not compiled in.

---
 src/dockedapp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/dockedapp.c b/src/dockedapp.c
index a7bca3b..6a84afc 100644
--- a/src/dockedapp.c
+++ b/src/dockedapp.c
@@ -316,6 +316,9 @@ void ShowDockAppSettingsPanel(WAppIcon * aicon)
 #else
  WMSetTextFieldEditable(panel->dndCommandField, False);
  WMSetLabelText(panel->dndCommandLabel, _("DND support was not compiled in"));
+
+ WMSetFrameTitleColor(panel->dndCommandFrame, WMDarkGrayColor(scr->wmscreen));
+ WMSetLabelTextColor(panel->dndCommandLabel, WMDarkGrayColor(scr->wmscreen));
 #endif
  WMMapSubwidgets(panel->dndCommandFrame);

-- 
1.8.3.2


0002-wmaker-darken-labels-from-docked-application-setting.patch
Description: Binary data


Re: [PATCH] wmaker: increase logo size

2014-06-12 Thread David Maciejak
Sorry for the delay,

normally the dock icons are autoresized so it should still be
displayed within the tile, even if i agree that the icon is bigger
than before.

In fact i was more concern about another border line effect i saw, but
not related to the size of the icon provided.

In WPrefs, if you select (a smaller) size icon, the icon from the Info
panel and Exit panel will also be affected. Should be better to keep a
fixed size for the panels.




On Thu, Jun 12, 2014 at 9:16 PM, Carlos R. Mafra  wrote:
> David?
>
> On Thu,  5 Jun 2014 at 19:10:54 +, Torrance, Douglas wrote:
>> On 06/04/2014 10:47 PM, David Maciejak wrote:
>> > Increase the size to default 64x64, please test.
>> >
>> > ---
>> >   WindowMaker/Icons/GNUstep.tiff | Bin 906 -> 3014 bytes
>> >   WindowMaker/Icons/GNUstep.xpm  | 326 
>> > ++---
>> >   2 files changed, 271 insertions(+), 55 deletions(-)
>> Personally, I use GNUstep.tiff for my dock icon.  It's too large at
>> 64x64.  Would it be possible to provide these icons in addition to,
>> instead of in place of, the original files?
>>
>> Doug
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] wmaker: increase logo size

2014-06-12 Thread David Maciejak
On Thu, Jun 12, 2014 at 9:33 PM, David Maciejak
 wrote:
> Sorry for the delay,
>
> normally the dock icons are autoresized so it should still be
> displayed within the tile, even if i agree that the icon is bigger
> than before.
>

btw Doug, feel free to modify & share them back :)


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] wmaker: increase logo size

2014-06-14 Thread David Maciejak
Found some time to redo the patch and move back to 48x48 icons.
Carlos, could you please amend patch
46d38a22747b237a59315a11be972d0d7da23e0d with the one enclosed, thx !


 WindowMaker/Icons/GNUstep.tiff | Bin 3014 -> 2629 bytes
 WindowMaker/Icons/GNUstep.xpm  | 522 -
 2 files changed, 253 insertions(+), 269 deletions(-)


Thanks,
david

On Sat, Jun 14, 2014 at 8:43 AM, Carlos R. Mafra  wrote:
> On Fri, 13 Jun 2014 at  8:37:08 +0800, David Maciejak wrote:
>> On Thu, Jun 12, 2014 at 9:33 PM, David Maciejak
>>  wrote:
>> > Sorry for the delay,
>> >
>> > normally the dock icons are autoresized so it should still be
>> > displayed within the tile, even if i agree that the icon is bigger
>> > than before.
>> >
>>
>> btw Doug, feel free to modify & share them back :)
>
> It is the person who wrote the patch is supposed to rewrite
> it in order to address the comments :-)
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


0001-wmaker-redo-logo.patch
Description: Binary data


Re: [PATCH] wmaker: increase logo size

2014-06-15 Thread David Maciejak
The definition of this one is better. See comparison enclosed.

On Sun, Jun 15, 2014 at 5:10 PM, Carlos R. Mafra  wrote:
> On Sun, 15 Jun 2014 at 12:41:31 +0800, David Maciejak wrote:
>> Found some time to redo the patch and move back to 48x48 icons.
>> Carlos, could you please amend patch
>> 46d38a22747b237a59315a11be972d0d7da23e0d with the one enclosed, thx !
>>
>>
>>  WindowMaker/Icons/GNUstep.tiff | Bin 3014 -> 2629 bytes
>>  WindowMaker/Icons/GNUstep.xpm  | 522 
>> -
>>  2 files changed, 253 insertions(+), 269 deletions(-)
>
> So what's the end result of applying this? "Move back to 48x48 icons"
> seems like reverting the patch, but this is not the case here since
> otherwise I would simply remove the original patch.
>
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH] wmaker: increase logo size

2014-06-15 Thread David Maciejak
Carlos, plz find the patch enclosed with the comment updated:

[PATCH] wmaker: redo logo

This patch is providing the logo still in 48x48 size
but with a better definition.

On Sun, Jun 15, 2014 at 6:47 PM, Carlos R. Mafra  wrote:
> On Sun, 15 Jun 2014 at 18:24:25 +0800, David Maciejak wrote:
>> The definition of this one is better. See comparison enclosed.
>
> Thanks for the explanation. But again, this should have been
> said in the commit message (at least I didn't see it).
>
> I will not apply patches that don't explain very clearly what
> they do in the commit message. No guesses, no follow-up questions.
>
> You are kind to redo the patch and reply my queries, though.
>
>
>
> --
> To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


0001-wmaker-redo-logo.patch
Description: Binary data


[PATCH] wrlib: fix RCreateImageFromDrawable error log msg

2014-07-23 Thread David Maciejak
This patch is fixing the name of the function from the log message.

---
 wrlib/xpixmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wrlib/xpixmap.c b/wrlib/xpixmap.c
index 14bed08..b3d3853 100644
--- a/wrlib/xpixmap.c
+++ b/wrlib/xpixmap.c
@@ -155,7 +155,7 @@ RImage *RCreateImageFromDrawable(RContext *
context, Drawable drawable, Pixmap m
  assert(drawable != None);

  if (!XGetGeometry(context->dpy, drawable, &baz, &foo, &foo, &w, &h,
&bar, &bar)) {
- printf("wrlib: invalid window or pixmap passed to RCreateImageFromPixmap\n");
+ printf("wrlib: invalid window or pixmap passed to
RCreateImageFromDrawable\n");
  return NULL;
  }
  pimg = XGetImage(context->dpy, drawable, 0, 0, w, h, AllPlanes, ZPixmap);
--


0001-wrlib-fix-RCreateImageFromDrawable-error-log-msg.patch
Description: Binary data


[PATCH 0/4] cppcheck patches

2014-07-26 Thread David Maciejak
Hi,

i am sending some patch suggestions to correct some more issues
reported by cppcheck.


regards,
david


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 1/4] WINGs: correct possible null pointer dereference

2014-07-26 Thread David Maciejak
As reported by cppcheck:

[WINGs/array.c:129] -> [WINGs/array.c:131]: (warning) Possible null
pointer dereference: array - otherwise it is redundant to check it
against null.
[WINGs/array.c:151] -> [WINGs/array.c:153]: (warning) Possible null
pointer dereference: array - otherwise it is redundant to check it
against null.
[WINGs/array.c:170] -> [WINGs/array.c:172]: (warning) Possible null
pointer dereference: array - otherwise it is redundant to check it
against null.

This patch is checking that the var name 'array' exists.
---
 WINGs/array.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/WINGs/array.c b/WINGs/array.c
index 0e08342..0b5be94 100644
--- a/WINGs/array.c
+++ b/WINGs/array.c
@@ -126,7 +126,7 @@ void WMAddToArray(WMArray * array, void *item)

 void WMInsertInArray(WMArray * array, int index, void *item)
 {
- wassertr(index >= 0 && index <= array->itemCount);
+ wassertr(array && index >= 0 && index <= array->itemCount);

  if (array == NULL)
  return;
@@ -148,7 +148,7 @@ void *WMReplaceInArray(WMArray * array, int index,
void *item)
 {
  void *old;

- wassertrv(index >= 0 && index <= array->itemCount, NULL);
+ wassertrv(array && index >= 0 && index <= array->itemCount, NULL);

  if (array == NULL)
  return NULL;
@@ -167,7 +167,7 @@ void *WMReplaceInArray(WMArray * array, int index,
void *item)

 int WMDeleteFromArray(WMArray * array, int index)
 {
- wassertrv(index >= 0 && index < array->itemCount, 0);
+ wassertrv(array && index >= 0 && index < array->itemCount, 0);

  if (array == NULL)
  return 0;


0001-WINGs-correct-possible-null-pointer-dereference.patch
Description: Binary data


  1   2   >