Re: [PATCH 2/2] Support for adjusting socket access rights to allow group of users to connect to the socket.

2014-10-22 Thread Jussi Laako

On 20.10.2014 18:13, Daniel Stone wrote:

Each to their own; I don't think it's necessarily any more complex than
split compositors, since at some point you have to deal with input
splitting anyway, and if you want both security (i.e. random users not
opening random devices) and performance (i.e. no unnecessary hops
through input compositor for events), you end up having to deal with
input splitting in your system compositor anyway.


Access control is no different whether you have 1 weston or 3 westons 
running.


It is about amount of changes needed, fairly small patch vs almost 
complete weston rewrite...


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v2] wayland-util: added wl_strtol/wl_strtoul utility functions

2014-10-22 Thread Marek Chalupa
Hi,

Personally, I'd rather see these functions private (somebody has already
mentioned that),
but I understand there are reasons for them to be public and maybe in the
end it will have more pros..
Anyway, I have few nitpicks and a questions - see below.

On 16 October 2014 18:11, Imran Zaman imran.za...@gmail.com wrote:

 strtol/strtoul utility functions are used extensively in
 weston/wayland, and are not bug-free in their current form.
 To avoid definition in weston and wayland, its wrapped
 in functions with appropriate input and output checks.
 Test cases are also updated.

 Signed-off-by: Imran Zaman imran.za...@gmail.com
 ---
  src/scanner.c|   5 +--
  src/wayland-client.c |   5 +--
  src/wayland-util.c   |  38 
  src/wayland-util.h   |   4 ++
  tests/fixed-test.c   | 122
 +++
  5 files changed, 167 insertions(+), 7 deletions(-)

 diff --git a/src/scanner.c b/src/scanner.c
 index 809130b..165b12b 100644
 --- a/src/scanner.c
 +++ b/src/scanner.c
 @@ -315,7 +315,6 @@ start_element(void *data, const char *element_name,
 const char **atts)
 struct description *description;
 const char *name, *type, *interface_name, *value, *summary, *since;
 const char *allow_null;
 -   char *end;
 int i, version;

 ctx-loc.line_number = XML_GetCurrentLineNumber(ctx-parser);
 @@ -404,9 +403,7 @@ start_element(void *data, const char *element_name,
 const char **atts)
 message-destructor = 0;

 if (since != NULL) {
 -   errno = 0;
 -   version = strtol(since, end, 0);
 -   if (errno == EINVAL || end == since || *end !=
 '\0')
 +   if (!wl_strtol(since, NULL, 0, (long *)version))
 fail(ctx-loc,
  invalid integer (%s)\n, since);
 } else {
 diff --git a/src/wayland-client.c b/src/wayland-client.c
 index b0f77b9..fd98705 100644
 --- a/src/wayland-client.c
 +++ b/src/wayland-client.c
 @@ -824,13 +824,12 @@ wl_display_connect_to_fd(int fd)
  WL_EXPORT struct wl_display *
  wl_display_connect(const char *name)
  {
 -   char *connection, *end;
 +   char *connection;
 int flags, fd;

 connection = getenv(WAYLAND_SOCKET);
 if (connection) {
 -   fd = strtol(connection, end, 0);
 -   if (*end != '\0')
 +   if (!wl_strtol(connection, NULL, 0, (long *)fd))
 return NULL;

 flags = fcntl(fd, F_GETFD);
 diff --git a/src/wayland-util.c b/src/wayland-util.c
 index b099882..dfd2eb1 100644
 --- a/src/wayland-util.c
 +++ b/src/wayland-util.c
 @@ -26,6 +26,8 @@
  #include stdio.h
  #include string.h
  #include stdarg.h
 +#include errno.h
 +#include limits.h

  #include wayland-util.h
  #include wayland-private.h
 @@ -361,6 +363,42 @@ wl_map_for_each(struct wl_map *map,
 wl_iterator_func_t func, void *data)
 for_each_helper(map-server_entries, func, data);
  }

 +WL_EXPORT bool
 +wl_strtol(const char *str, char **endptr, int base, long *val)
 +{
 +   char *end = NULL;
 +   long v;
 +
 +   if (!str || !val) return false;
 +   if (!endptr) endptr = end;


The 'return false' and 'endptr =end' should be on new line
http://cgit.freedesktop.org/wayland/wayland/tree/doc/Contributing#n33


 +
 +   errno = 0;
 +   v = strtol(str, endptr, base);
 +   if (errno != 0 || *endptr == str || **endptr != '\0')
 +   return false;
 +
 +   *val = v;
 +   return true;
 +}
 +
 +WL_EXPORT bool
 +wl_strtoul(const char *str, char **endptr, int base, unsigned long *val)
 +{
 +   char *end = NULL;
 +   unsigned long v;
 +
 +   if (!str || !val) return false;
 +   if (!endptr) endptr = end;


The same


 +
 +   errno = 0;
 +   v = strtoul(str, endptr, base);
 +   if (errno != 0 || *endptr == str || **endptr != '\0')
 +   return false;
 +
 +   *val = v;
 +   return true;
 +}
 +
  static void
  wl_log_stderr_handler(const char *fmt, va_list arg)
  {
 diff --git a/src/wayland-util.h b/src/wayland-util.h
 index fd32826..c66cc41 100644
 --- a/src/wayland-util.h
 +++ b/src/wayland-util.h
 @@ -36,6 +36,7 @@ extern C {
  #include stddef.h
  #include inttypes.h
  #include stdarg.h
 +#include stdbool.h

  /* GCC visibility */
  #if defined(__GNUC__)  __GNUC__ = 4
 @@ -243,6 +244,9 @@ static inline wl_fixed_t wl_fixed_from_int(int i)
 return i * 256;
  }

 +bool wl_strtol(const char *str, char **endptr, int base, long *val);
 +bool wl_strtoul(const char *str, char **endptr, int base, unsigned long
 *val);
 +
  /**
   * \brief A union representing all of the basic data types that can be
 passed
   * along the wayland wire format.
 diff --git a/tests/fixed-test.c b/tests/fixed-test.c
 index 739a3b1..aa0340c 100644
 --- a/tests/fixed-test.c
 +++ 

Re: libinput: Support for long press key detection?

2014-10-22 Thread Peter Hutterer
On Tue, Oct 21, 2014 at 08:21:26PM +0200, Stefanie Behme wrote:
 Hi,
 
 on last ELCE in Duesseldorf I learned that the development of libinput was
 started to handle input devices in Wayland compositors. I had a look in the
 API documentation and found that the enum libinput_key_state has these
 values: LIBINPUT_KEY_STATE_RELEASED and LIBINPUT_KEY_STATE_PRESSED.
 
 There is a need to detect if a key is pressed (and hold) for a certain
 amount of time. If this is the case a long-press key event is send. It is
 also possible that several long-press key events are defined for one key,
 e.g.:
 - 500 ms: KEY_STATE_LONG_PRESSED_1
 - 1000 ms: KEY_STATE_LONG_PRESSED_2
 - 5000 ms: KEY_STATE_LONG_PRESSED_3
 
 A long press on a key is e.g. used to create a screen shot.
 
 Is there any plan to support this kind of long press detection? How could
 this look like? Any ideas?

this would be too high-level for libinput. If you need that functionality,
best is to handle it with a timer in the compositor where you also have more
semantic information than in libinput.

Cheers,
   Peter

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v3] wayland-util: added wl_strtol/wl_strtoul utility functions

2014-10-22 Thread Imran Zaman
strtol/strtoul utility functions are used extensively in
weston/wayland, and are not bug-free in their current form.
To avoid definition in weston and wayland, its wrapped
in functions with appropriate input and output checks.
Test cases are also updated.

Signed-off-by: Imran Zaman imran.za...@gmail.com
---
 src/scanner.c|   5 +-
 src/wayland-client.c |   5 +-
 src/wayland-util.c   |  55 
 src/wayland-util.h   |   4 ++
 tests/fixed-test.c   | 142 +++
 5 files changed, 204 insertions(+), 7 deletions(-)

diff --git a/src/scanner.c b/src/scanner.c
index 809130b..165b12b 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -315,7 +315,6 @@ start_element(void *data, const char *element_name, const 
char **atts)
struct description *description;
const char *name, *type, *interface_name, *value, *summary, *since;
const char *allow_null;
-   char *end;
int i, version;
 
ctx-loc.line_number = XML_GetCurrentLineNumber(ctx-parser);
@@ -404,9 +403,7 @@ start_element(void *data, const char *element_name, const 
char **atts)
message-destructor = 0;
 
if (since != NULL) {
-   errno = 0;
-   version = strtol(since, end, 0);
-   if (errno == EINVAL || end == since || *end != '\0')
+   if (!wl_strtol(since, NULL, 0, (long *)version))
fail(ctx-loc,
 invalid integer (%s)\n, since);
} else {
diff --git a/src/wayland-client.c b/src/wayland-client.c
index b0f77b9..fd98705 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -824,13 +824,12 @@ wl_display_connect_to_fd(int fd)
 WL_EXPORT struct wl_display *
 wl_display_connect(const char *name)
 {
-   char *connection, *end;
+   char *connection;
int flags, fd;
 
connection = getenv(WAYLAND_SOCKET);
if (connection) {
-   fd = strtol(connection, end, 0);
-   if (*end != '\0')
+   if (!wl_strtol(connection, NULL, 0, (long *)fd))
return NULL;
 
flags = fcntl(fd, F_GETFD);
diff --git a/src/wayland-util.c b/src/wayland-util.c
index b099882..a930364 100644
--- a/src/wayland-util.c
+++ b/src/wayland-util.c
@@ -26,6 +26,8 @@
 #include stdio.h
 #include string.h
 #include stdarg.h
+#include errno.h
+#include ctype.h
 
 #include wayland-util.h
 #include wayland-private.h
@@ -361,6 +363,59 @@ wl_map_for_each(struct wl_map *map, wl_iterator_func_t 
func, void *data)
for_each_helper(map-server_entries, func, data);
 }
 
+WL_EXPORT bool
+wl_strtol(const char *str, char **endptr, int base, long *val)
+{
+   char *end = NULL;
+   long v;
+
+   if (!str || !val)
+   return false;
+   if (!endptr)
+   endptr = end;
+
+   errno = 0;
+   v = strtol(str, endptr, base);
+   if (errno != 0 || *endptr == str || **endptr != '\0')
+   return false;
+
+   *val = v;
+   return true;
+}
+
+WL_EXPORT bool
+wl_strtoul(const char *str, char **endptr, int base, unsigned long *val)
+{
+   char *end = NULL;
+   unsigned long v;
+   int i = 0;
+
+   if (!str || !val)
+   return false;
+
+   /* check for negative numbers */
+   while (str[i]) {
+   if (!isspace(str[i])) {
+   if (str[i] == '-')
+   return false;
+   else
+   break;
+   }
+   i++;
+   }
+
+   if (!endptr)
+   endptr = end;
+
+   errno = 0;
+   v = strtoul(str, endptr, base);
+   if (errno != 0 || *endptr == str || **endptr != '\0')
+   return false;
+
+   *val = v;
+   return true;
+}
+
 static void
 wl_log_stderr_handler(const char *fmt, va_list arg)
 {
diff --git a/src/wayland-util.h b/src/wayland-util.h
index fd32826..c66cc41 100644
--- a/src/wayland-util.h
+++ b/src/wayland-util.h
@@ -36,6 +36,7 @@ extern C {
 #include stddef.h
 #include inttypes.h
 #include stdarg.h
+#include stdbool.h
 
 /* GCC visibility */
 #if defined(__GNUC__)  __GNUC__ = 4
@@ -243,6 +244,9 @@ static inline wl_fixed_t wl_fixed_from_int(int i)
return i * 256;
 }
 
+bool wl_strtol(const char *str, char **endptr, int base, long *val);
+bool wl_strtoul(const char *str, char **endptr, int base, unsigned long *val);
+
 /**
  * \brief A union representing all of the basic data types that can be passed
  * along the wayland wire format.
diff --git a/tests/fixed-test.c b/tests/fixed-test.c
index 739a3b1..ad40467 100644
--- a/tests/fixed-test.c
+++ b/tests/fixed-test.c
@@ -88,3 +88,145 @@ TEST(fixed_int_conversions)
i = wl_fixed_to_int(f);
assert(i == -0x50);
 }
+
+TEST(strtol_conversions)
+{
+   bool ret;
+   long val = -1;
+ 

Re: [PATCH v2] wayland-util: added wl_strtol/wl_strtoul utility functions

2014-10-22 Thread Imran Zaman
I pushed an updated patch v3. Added test cases for overflow and also
check for negative numbers for wl_strtoul..
please review

BR
imran

On Wed, Oct 22, 2014 at 12:13 PM, Marek Chalupa mchqwe...@gmail.com wrote:
 Hi,

 Personally, I'd rather see these functions private (somebody has already
 mentioned that),
 but I understand there are reasons for them to be public and maybe in the
 end it will have more pros..
 Anyway, I have few nitpicks and a questions - see below.

 On 16 October 2014 18:11, Imran Zaman imran.za...@gmail.com wrote:

 strtol/strtoul utility functions are used extensively in
 weston/wayland, and are not bug-free in their current form.
 To avoid definition in weston and wayland, its wrapped
 in functions with appropriate input and output checks.
 Test cases are also updated.

 Signed-off-by: Imran Zaman imran.za...@gmail.com
 ---
  src/scanner.c|   5 +--
  src/wayland-client.c |   5 +--
  src/wayland-util.c   |  38 
  src/wayland-util.h   |   4 ++
  tests/fixed-test.c   | 122
 +++
  5 files changed, 167 insertions(+), 7 deletions(-)

 diff --git a/src/scanner.c b/src/scanner.c
 index 809130b..165b12b 100644
 --- a/src/scanner.c
 +++ b/src/scanner.c
 @@ -315,7 +315,6 @@ start_element(void *data, const char *element_name,
 const char **atts)
 struct description *description;
 const char *name, *type, *interface_name, *value, *summary,
 *since;
 const char *allow_null;
 -   char *end;
 int i, version;

 ctx-loc.line_number = XML_GetCurrentLineNumber(ctx-parser);
 @@ -404,9 +403,7 @@ start_element(void *data, const char *element_name,
 const char **atts)
 message-destructor = 0;

 if (since != NULL) {
 -   errno = 0;
 -   version = strtol(since, end, 0);
 -   if (errno == EINVAL || end == since || *end !=
 '\0')
 +   if (!wl_strtol(since, NULL, 0, (long *)version))
 fail(ctx-loc,
  invalid integer (%s)\n, since);
 } else {
 diff --git a/src/wayland-client.c b/src/wayland-client.c
 index b0f77b9..fd98705 100644
 --- a/src/wayland-client.c
 +++ b/src/wayland-client.c
 @@ -824,13 +824,12 @@ wl_display_connect_to_fd(int fd)
  WL_EXPORT struct wl_display *
  wl_display_connect(const char *name)
  {
 -   char *connection, *end;
 +   char *connection;
 int flags, fd;

 connection = getenv(WAYLAND_SOCKET);
 if (connection) {
 -   fd = strtol(connection, end, 0);
 -   if (*end != '\0')
 +   if (!wl_strtol(connection, NULL, 0, (long *)fd))
 return NULL;

 flags = fcntl(fd, F_GETFD);
 diff --git a/src/wayland-util.c b/src/wayland-util.c
 index b099882..dfd2eb1 100644
 --- a/src/wayland-util.c
 +++ b/src/wayland-util.c
 @@ -26,6 +26,8 @@
  #include stdio.h
  #include string.h
  #include stdarg.h
 +#include errno.h
 +#include limits.h

  #include wayland-util.h
  #include wayland-private.h
 @@ -361,6 +363,42 @@ wl_map_for_each(struct wl_map *map,
 wl_iterator_func_t func, void *data)
 for_each_helper(map-server_entries, func, data);
  }

 +WL_EXPORT bool
 +wl_strtol(const char *str, char **endptr, int base, long *val)
 +{
 +   char *end = NULL;
 +   long v;
 +
 +   if (!str || !val) return false;
 +   if (!endptr) endptr = end;


 The 'return false' and 'endptr =end' should be on new line
 http://cgit.freedesktop.org/wayland/wayland/tree/doc/Contributing#n33


 +
 +   errno = 0;
 +   v = strtol(str, endptr, base);
 +   if (errno != 0 || *endptr == str || **endptr != '\0')
 +   return false;
 +
 +   *val = v;
 +   return true;
 +}
 +
 +WL_EXPORT bool
 +wl_strtoul(const char *str, char **endptr, int base, unsigned long *val)
 +{
 +   char *end = NULL;
 +   unsigned long v;
 +
 +   if (!str || !val) return false;
 +   if (!endptr) endptr = end;


 The same


 +
 +   errno = 0;
 +   v = strtoul(str, endptr, base);
 +   if (errno != 0 || *endptr == str || **endptr != '\0')
 +   return false;
 +
 +   *val = v;
 +   return true;
 +}
 +
  static void
  wl_log_stderr_handler(const char *fmt, va_list arg)
  {
 diff --git a/src/wayland-util.h b/src/wayland-util.h
 index fd32826..c66cc41 100644
 --- a/src/wayland-util.h
 +++ b/src/wayland-util.h
 @@ -36,6 +36,7 @@ extern C {
  #include stddef.h
  #include inttypes.h
  #include stdarg.h
 +#include stdbool.h

  /* GCC visibility */
  #if defined(__GNUC__)  __GNUC__ = 4
 @@ -243,6 +244,9 @@ static inline wl_fixed_t wl_fixed_from_int(int i)
 return i * 256;
  }

 +bool wl_strtol(const char *str, char **endptr, int base, long *val);
 +bool wl_strtoul(const char *str, char **endptr, int base, unsigned long
 *val);
 +
  /**
   * \brief A 

[PATCH Weston 1/1] desktop-shell: implement autolaunch

2014-10-22 Thread Pekka Paalanen
Process a new section 'autolaunch' from weston.ini, launching all
programs given there on desktop start-up.

[Frederic Plourde: cut redundancy between do_autolaunch and panel_add_launcher]
---
 clients/desktop-shell.c | 97 ++---
 man/weston.ini.man  | 17 +
 weston.ini.in   |  3 ++
 3 files changed, 103 insertions(+), 14 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 961a9b2..a964094 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -597,72 +597,82 @@ load_icon_or_fallback(const char *icon)
cairo_move_to(cr, 4, 16);
cairo_line_to(cr, 16, 4);
cairo_stroke(cr);
 
cairo_destroy(cr);
 
return surface;
 }
 
 static void
-panel_add_launcher(struct panel *panel, const char *icon, const char *path)
+parse_launcher_path(char *path, struct wl_array *envp_array, struct wl_array 
*argv_array)
 {
-   struct panel_launcher *launcher;
char *start, *p, *eq, **ps;
int i, j, k;
 
-   launcher = xzalloc(sizeof *launcher);
-   launcher-icon = load_icon_or_fallback(icon);
-   launcher-path = xstrdup(path);
+   struct wl_array *envp = envp_array;
+   struct wl_array *argv = argv_array;
 
-   wl_array_init(launcher-envp);
-   wl_array_init(launcher-argv);
+   wl_array_init(envp);
+   wl_array_init(argv);
for (i = 0; environ[i]; i++) {
-   ps = wl_array_add(launcher-envp, sizeof *ps);
+   ps = wl_array_add(envp, sizeof *ps);
*ps = environ[i];
}
j = 0;
 
-   start = launcher-path;
+   start = path;
while (*start) {
for (p = start, eq = NULL; *p  !isspace(*p); p++)
if (*p == '=')
eq = p;
 
if (eq  j == 0) {
-   ps = launcher-envp.data;
+   ps = envp-data;
for (k = 0; k  i; k++)
if (strncmp(ps[k], start, eq - start) == 0) {
ps[k] = start;
break;
}
if (k == i) {
-   ps = wl_array_add(launcher-envp, sizeof *ps);
+   ps = wl_array_add(envp, sizeof *ps);
*ps = start;
i++;
}
} else {
-   ps = wl_array_add(launcher-argv, sizeof *ps);
+   ps = wl_array_add(argv, sizeof *ps);
*ps = start;
j++;
}
 
while (*p  isspace(*p))
*p++ = '\0';
 
start = p;
}
 
-   ps = wl_array_add(launcher-envp, sizeof *ps);
+   ps = wl_array_add(envp, sizeof *ps);
*ps = NULL;
-   ps = wl_array_add(launcher-argv, sizeof *ps);
+   ps = wl_array_add(argv, sizeof *ps);
*ps = NULL;
+}
+
+static void
+panel_add_launcher(struct panel *panel, const char *icon, const char *path)
+{
+   struct panel_launcher *launcher;
+
+   launcher = xzalloc(sizeof *launcher);
+   launcher-icon = load_icon_or_fallback(icon);
+   launcher-path = xstrdup(path);
+
+   parse_launcher_path(launcher-path, launcher-envp, launcher-argv);
 
launcher-panel = panel;
wl_list_insert(panel-launcher_list.prev, launcher-link);
 
launcher-widget = widget_add_widget(panel-widget, launcher);
widget_set_enter_handler(launcher-widget,
 panel_launcher_enter_handler);
widget_set_leave_handler(launcher-widget,
   panel_launcher_leave_handler);
widget_set_button_handler(launcher-widget,
@@ -1316,20 +1326,77 @@ panel_add_launchers(struct panel *panel, struct desktop 
*desktop)
}
 
if (count == 0) {
/* add default launcher */
panel_add_launcher(panel,
   DATADIR /weston/terminal.png,
   BINDIR /weston-terminal);
}
 }
 
+static void
+do_autolaunch(const char *path_arg)
+{
+   struct wl_array envp;
+   struct wl_array argv;
+   pid_t pid;
+   char **argvpp;
+   char *path;
+
+   path = xstrdup(path_arg);
+
+   parse_launcher_path(path, envp, argv);
+
+   /* panel_launcher_activate */
+
+   pid = fork();
+   if (pid  0) {
+   fprintf(stderr, fork failed: %m\n);
+   goto out;
+   }
+
+   if (pid)
+   goto out;
+
+   argvpp = argv.data;
+   if (execve(argvpp[0], argvpp, envp.data)  0) {
+   fprintf(stderr, execl '%s' failed: %m\n, argvpp[0]);
+   exit(1);
+   }
+
+out:
+   

Re: [PATCH Weston 1/1] desktop-shell: implement autolaunch

2014-10-22 Thread Derek Foreman
I'd prefer to see the refactor and the new feature in separate patches,
but this is pretty trivial.

I also have a slight preference for exit(EXIT_FAILURE), which is already
used somewhere else in that file - though there's also precedent for
exit(1), so you make the call.  :)

I'd not seen printf's %m until today - do we want to depend on a gnuism?
 I've seen at least some activity towards a freebsd port - I don't
believe %m is supported there?


That said, it runs nicely here and does what it says on the tin...

Reviewed-by: Derek Foreman der...@osg.samsung.com

On 22/10/14 08:53 AM, Pekka Paalanen wrote:
 Process a new section 'autolaunch' from weston.ini, launching all
 programs given there on desktop start-up.
 
 [Frederic Plourde: cut redundancy between do_autolaunch and 
 panel_add_launcher]
 ---
  clients/desktop-shell.c | 97 
 ++---
  man/weston.ini.man  | 17 +
  weston.ini.in   |  3 ++
  3 files changed, 103 insertions(+), 14 deletions(-)
 
 diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
 index 961a9b2..a964094 100644
 --- a/clients/desktop-shell.c
 +++ b/clients/desktop-shell.c
 @@ -597,72 +597,82 @@ load_icon_or_fallback(const char *icon)
   cairo_move_to(cr, 4, 16);
   cairo_line_to(cr, 16, 4);
   cairo_stroke(cr);
  
   cairo_destroy(cr);
  
   return surface;
  }
  
  static void
 -panel_add_launcher(struct panel *panel, const char *icon, const char *path)
 +parse_launcher_path(char *path, struct wl_array *envp_array, struct wl_array 
 *argv_array)
  {
 - struct panel_launcher *launcher;
   char *start, *p, *eq, **ps;
   int i, j, k;
  
 - launcher = xzalloc(sizeof *launcher);
 - launcher-icon = load_icon_or_fallback(icon);
 - launcher-path = xstrdup(path);
 + struct wl_array *envp = envp_array;
 + struct wl_array *argv = argv_array;
  
 - wl_array_init(launcher-envp);
 - wl_array_init(launcher-argv);
 + wl_array_init(envp);
 + wl_array_init(argv);
   for (i = 0; environ[i]; i++) {
 - ps = wl_array_add(launcher-envp, sizeof *ps);
 + ps = wl_array_add(envp, sizeof *ps);
   *ps = environ[i];
   }
   j = 0;
  
 - start = launcher-path;
 + start = path;
   while (*start) {
   for (p = start, eq = NULL; *p  !isspace(*p); p++)
   if (*p == '=')
   eq = p;
  
   if (eq  j == 0) {
 - ps = launcher-envp.data;
 + ps = envp-data;
   for (k = 0; k  i; k++)
   if (strncmp(ps[k], start, eq - start) == 0) {
   ps[k] = start;
   break;
   }
   if (k == i) {
 - ps = wl_array_add(launcher-envp, sizeof *ps);
 + ps = wl_array_add(envp, sizeof *ps);
   *ps = start;
   i++;
   }
   } else {
 - ps = wl_array_add(launcher-argv, sizeof *ps);
 + ps = wl_array_add(argv, sizeof *ps);
   *ps = start;
   j++;
   }
  
   while (*p  isspace(*p))
   *p++ = '\0';
  
   start = p;
   }
  
 - ps = wl_array_add(launcher-envp, sizeof *ps);
 + ps = wl_array_add(envp, sizeof *ps);
   *ps = NULL;
 - ps = wl_array_add(launcher-argv, sizeof *ps);
 + ps = wl_array_add(argv, sizeof *ps);
   *ps = NULL;
 +}
 +
 +static void
 +panel_add_launcher(struct panel *panel, const char *icon, const char *path)
 +{
 + struct panel_launcher *launcher;
 +
 + launcher = xzalloc(sizeof *launcher);
 + launcher-icon = load_icon_or_fallback(icon);
 + launcher-path = xstrdup(path);
 +
 + parse_launcher_path(launcher-path, launcher-envp, launcher-argv);
  
   launcher-panel = panel;
   wl_list_insert(panel-launcher_list.prev, launcher-link);
  
   launcher-widget = widget_add_widget(panel-widget, launcher);
   widget_set_enter_handler(launcher-widget,
panel_launcher_enter_handler);
   widget_set_leave_handler(launcher-widget,
  panel_launcher_leave_handler);
   widget_set_button_handler(launcher-widget,
 @@ -1316,20 +1326,77 @@ panel_add_launchers(struct panel *panel, struct 
 desktop *desktop)
   }
  
   if (count == 0) {
   /* add default launcher */
   panel_add_launcher(panel,
  DATADIR /weston/terminal.png,
  BINDIR /weston-terminal);
   }
  }
  
 +static void
 +do_autolaunch(const char *path_arg)
 +{
 + struct wl_array envp;
 + struct wl_array argv;
 + 

[PATCH] gitignore: adpat to scanner and protocol path changes

2014-10-22 Thread Olivier Blin
Since commit 4c163b9b001bd93aaf97d7e962873a379eb90bfd, wayland-scanner
is built in top builddir instead of src, and protocol files are
generated in protocol subdir instead of src.
Protocol files generated in the new path are already properly ignored
in the toplevel gitignore file.

Signed-off-by: Olivier Blin olivier.b...@softathome.com
---
 .gitignore | 2 +-
 src/.gitignore | 4 
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index d9d26ed..4e0f5d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,5 +54,5 @@ resources-test
 sanity-test
 signal-test
 socket-test
-wayland-scanner
+/wayland-scanner
 protocol/*.[ch]
diff --git a/src/.gitignore b/src/.gitignore
index 1438b74..4421b46 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,5 +1 @@
-wayland-scanner
-wayland-client-protocol.h
-wayland-protocol.c
-wayland-server-protocol.h
 /wayland-version.h
-- 
2.1.2

-- This message and any attachments herein are confidential, intended solely 
for the addressees and are SoftAtHome.s ownership. Any unauthorized use or 
dissemination is prohibited. If you are not the intended addressee of this 
message, please cancel it immediately and inform the sender.
-- This message and any attachments herein are confidential, intended solely 
for the addressees and are SoftAtHome.s ownership. Any unauthorized use or 
dissemination is prohibited. If you are not the intended addressee of this 
message, please cancel it immediately and inform the sender.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v2] wayland-util: added wl_strtol/wl_strtoul utility functions

2014-10-22 Thread Bill Spitzak

On 10/22/2014 02:13 AM, Marek Chalupa wrote:


What I'm wondering is what should be the behavior of wl_strtoul for
negative numbers?
strtoul silently converts them, but I don't think this is what we always
want... or is it?


-1 is a handy shortcut for strtoul to get all the bits turned on and get 
the maximum possible value.


Not sure if other negative numbers are much use though.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel