[PATCH v3] shell: support window resizing using touchscreen

2014-04-22 Thread Stanislav Vorobiov
Right, didn't see that theme_get_location can also
return THEME_LOCATION_TITLEBAR, fixed that

Stanislav Vorobiov (1):
  shell: support window resizing using touchscreen

 clients/window.c  |5 +-
 desktop-shell/shell.c |  153 ++---
 shared/cairo-util.h   |2 +-
 shared/frame.c|   20 ---
 4 files changed, 159 insertions(+), 21 deletions(-)

-- 
1.7.9.5

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


[PATCH v3] shell: support window resizing using touchscreen

2014-04-22 Thread Stanislav Vorobiov
if the system doesn't have a pointer device
common_surface_resize will crash on
accessing seat->pointer->button_count. if the system
does have a pointer device, but attempts to resize
a window using touchscreen - nothing happens. here
we implement separate window resizing path for
seat->touch as it is done in common_surface_move
---
 clients/window.c  |5 +-
 desktop-shell/shell.c |  153 ++---
 shared/cairo-util.h   |2 +-
 shared/frame.c|   20 ---
 4 files changed, 159 insertions(+), 21 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index e770a04..185fe23 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2409,9 +2409,10 @@ frame_touch_down_handler(struct widget *widget, struct 
input *input,
 float x, float y, void *data)
 {
struct window_frame *frame = data;
+   enum theme_location location;
 
-   frame_touch_down(frame->frame, input, id, x, y);
-   frame_handle_status(frame, input, time, THEME_LOCATION_CLIENT_AREA);
+   location = frame_touch_down(frame->frame, input, id, x, y);
+   frame_handle_status(frame, input, time, location);
 }
 
 static void
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index bc4a258..23125af 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1581,6 +1581,14 @@ struct weston_resize_grab {
int32_t width, height;
 };
 
+struct weston_touch_resize_grab {
+   struct shell_touch_grab base;
+   int active;
+   uint32_t edges;
+   int32_t width, height;
+   wl_fixed_t dx, dy;
+};
+
 static void
 resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
   wl_fixed_t x, wl_fixed_t y)
@@ -1668,6 +1676,84 @@ static const struct weston_pointer_grab_interface 
resize_grab_interface = {
resize_grab_cancel,
 };
 
+static void
+touch_resize_grab_down(struct weston_touch_grab *grab, uint32_t time,
+int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+{
+}
+
+static void
+touch_resize_grab_up(struct weston_touch_grab *grab, uint32_t time, int 
touch_id)
+{
+   struct weston_touch_resize_grab *resize =
+   (struct weston_touch_resize_grab *) container_of(
+   grab, struct shell_touch_grab, grab);
+
+   if (touch_id == 0)
+   resize->active = 0;
+
+   if (grab->touch->num_tp == 0) {
+   shell_touch_grab_end(&resize->base);
+   free(resize);
+   }
+}
+
+static void
+touch_resize_grab_motion(struct weston_touch_grab *grab, uint32_t time,
+  int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+{
+   struct weston_touch_resize_grab *resize = (struct 
weston_touch_resize_grab *) grab;
+   struct weston_touch *touch = grab->touch;
+   struct shell_surface *shsurf = resize->base.shsurf;
+   int32_t width, height;
+   wl_fixed_t from_x, from_y;
+   wl_fixed_t to_x, to_y;
+
+   if (!shsurf || !resize->active)
+   return;
+
+   weston_view_from_global_fixed(shsurf->view,
+ resize->dx, resize->dy,
+ &from_x, &from_y);
+   weston_view_from_global_fixed(shsurf->view,
+ touch->grab_x, touch->grab_y, &to_x, 
&to_y);
+
+   width = resize->width;
+   if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
+   width += wl_fixed_to_int(from_x - to_x);
+   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
+   width += wl_fixed_to_int(to_x - from_x);
+   }
+
+   height = resize->height;
+   if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
+   height += wl_fixed_to_int(from_y - to_y);
+   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
+   height += wl_fixed_to_int(to_y - from_y);
+   }
+
+   shsurf->client->send_configure(shsurf->surface,
+  resize->edges, width, height);
+}
+
+static void
+touch_resize_grab_cancel(struct weston_touch_grab *grab)
+{
+   struct weston_touch_resize_grab *resize =
+   (struct weston_touch_resize_grab *) container_of(
+   grab, struct shell_touch_grab, grab);
+
+   shell_touch_grab_end(&resize->base);
+   free(resize);
+}
+
+static const struct weston_touch_grab_interface touch_resize_grab_interface = {
+   touch_resize_grab_down,
+   touch_resize_grab_up,
+   touch_resize_grab_motion,
+   touch_resize_grab_cancel,
+};
+
 /*
  * Returns the bounding box of a surface and all its sub-surfaces,
  * in the surface coordinates system. */
@@ -1731,6 +1817,37 @@ surface_resize(struct shell_surface *shsurf,
return 0;
 }
 
+static int
+surface_touch_resize(struct shell_surface *shsurf,
+  struct weston_seat *seat, uint32_t edges)
+{
+   struct weston_touch_resize_grab *resize;
+
+   if

Re: xserver git version?

2014-04-22 Thread Bill Spitzak

On 04/22/2014 08:08 PM, Jasper St. Pierre wrote:

It looks OK, but the upstream is at https://github.com/anholt/libepoxy


Thanks, fixing that.

I had to add --disable-glx but I succeeded in getting xserver to compile.

Like before there are a lot of bugs with the window borders. It often is 
missing some corners, or draws the gradient for the shadow "backwards". 
Also trying to move a window sometimes gets it stuck with the "hand" 
cursor until I resize the window. Are these known bugs or am I the only 
one getting them?


Some of my own X software using fltk does not work until you resize the 
window. It clearly thinks the mouse is in the wrong position, based on 
the highlighting. I suspect fltk is relying on some event that other X 
servers always deliver, not sure if this is considered an fltk bug, or 
that you may want to replicate whatever it is relying on in the server. 
I can send a very small compiled test program if anybody wishes, it is 
easy to compare the behavior on X and xwayland.


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


Re: xserver git version?

2014-04-22 Thread Jasper St. Pierre
It looks OK, but the upstream is at https://github.com/anholt/libepoxy


On Tue, Apr 22, 2014 at 10:54 PM, Bill Spitzak  wrote:

> On 04/22/2014 05:34 PM, Peter Hutterer wrote:
>
>  Config with --enable-xwayland is not working however:
>>>
>>> checking whether to build XWin DDX... no
>>> checking dependency style of $(CC)... none
>>> checking for DMXMODULES... no
>>> checking whether to build Xdmx DDX... no
>>> checking for XWAYLANDMODULES... no
>>> checking whether to build Xwayland DDX... yes
>>> configure: error: Xwayland build explicitly requested, but required
>>> modules not found.
>>>
>>
>> you're missing the required modules. check configure.ac for what you
>> need,
>> it's line 2444 here.
>>
>
> I found "epoxy" in git://people.freedesktop.org/~fredrik/libepoxy
>
> Is that the "Frederic Plourde" who posted some messages here?
>
> Hope that is the right one. make + install seems to make the xserver
> configure happy. Compiling xserver now...
>
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>



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


Re: xserver git version?

2014-04-22 Thread Bill Spitzak

On 04/22/2014 05:34 PM, Peter Hutterer wrote:


Config with --enable-xwayland is not working however:

checking whether to build XWin DDX... no
checking dependency style of $(CC)... none
checking for DMXMODULES... no
checking whether to build Xdmx DDX... no
checking for XWAYLANDMODULES... no
checking whether to build Xwayland DDX... yes
configure: error: Xwayland build explicitly requested, but required
modules not found.


you're missing the required modules. check configure.ac for what you need,
it's line 2444 here.


I found "epoxy" in git://people.freedesktop.org/~fredrik/libepoxy

Is that the "Frederic Plourde" who posted some messages here?

Hope that is the right one. make + install seems to make the xserver 
configure happy. Compiling xserver now...


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


RE: [PATCH weston v2 2/5] libinput-seat: allow setting libinput log priority in weston

2014-04-22 Thread Eoff, Ullysses A
> -Original Message-
> From: Peter Hutterer [mailto:peter.hutte...@who-t.net]
> Sent: Tuesday, April 22, 2014 5:43 PM
> To: Eoff, Ullysses A
> Cc: wayland-devel@lists.freedesktop.org
> Subject: Re: [PATCH weston v2 2/5] libinput-seat: allow setting libinput log 
> priority in weston
> 
> On Thu, Apr 17, 2014 at 07:53:23AM -0700, U. Artie Eoff wrote:
> > Look for WESTON_LIBINPUT_LOG_PRIORITY environment variable.  If
> > it exists then use it to set the libinput log priority.
> > Otherwise, don't set the priority and get whatever libinput's
> > default priority is.
> >
> > Setting WESTON_LIBINPUT_LOG_PRIORITY=0 allows us to log which
> > input devices are detected at Weston startup and makes it a
> > little more consistent with Weston's original evdev input setup
> > log messages... and useful for debugging and testing.
> >
> > Signed-off-by: U. Artie Eoff 
> 
> > ---
> >  src/libinput-seat.c | 7 +++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/src/libinput-seat.c b/src/libinput-seat.c
> > index 99612c4..7aca969 100644
> > --- a/src/libinput-seat.c
> > +++ b/src/libinput-seat.c
> > @@ -262,12 +262,19 @@ int
> >  udev_input_init(struct udev_input *input, struct weston_compositor *c, 
> > struct udev *udev,
> > const char *seat_id)
> >  {
> > +   const char *log_priority = NULL;
> > +
> > memset(input, 0, sizeof *input);
> >
> > input->compositor = c;
> >
> > libinput_log_set_handler(&libinput_log_func, NULL);
> >
> > +   log_priority = getenv("WESTON_LIBINPUT_LOG_PRIORITY");
> > +   if (log_priority) {
> > +   libinput_log_set_priority(strtol(log_priority, NULL, 10));
> > +   }
> > +
> 
> I see this has been merged already, but I think it'd be better to have this
> with the semantic names than the numeric values, e.g.
> WESTON_LIBINPUT_LOG_PRIORITY=error
> it's merely a few added strcmps and the result is more copy/paste proof than
> pure numbers.
> 
> Cheers,
>Peter
>

Yes, that would probably be better... I won't be able to get around to writing 
a 
new patch for a few days however.  Feel free to beat me to it ;).

U. Artie
 
> > input->libinput = libinput_udev_create_for_seat(&libinput_interface, 
> > input,
> > udev, seat_id);
> > if (!input->libinput) {
> > --
> > 1.8.5.3

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


Re: [PATCH libinput 5/6] tools: Add missing newline

2014-04-22 Thread Peter Hutterer
On Mon, Apr 21, 2014 at 07:20:43PM +0200, Carlos Garnacho wrote:
> Signed-off-by: Carlos Garnacho 
> ---
>  tools/event-debug.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/event-debug.c b/tools/event-debug.c
> index c0a08a7..fb79be4 100644
> --- a/tools/event-debug.c
> +++ b/tools/event-debug.c
> @@ -221,8 +221,7 @@ print_event_header(struct libinput_event *ev)
>  
>  static void
>  print_event_time(uint32_t time)
> -{
> - printf("%+6.2fs ", (time - start_time) / 1000.0);
> +{printf("%+6.2fs ", (time - start_time) / 1000.0);
>  }
>  

this one looks a bit odd, the other ones are merged, thanks.

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


RE: [PATCH weston 1/2] evdev: Discard events from a touchscreen paired with an unplugged output

2014-04-22 Thread Eoff, Ullysses A
Hmmm... I think there's more to reconcile for touch device pairing/mapping.

In device_added(), we assign a default output to a paired device when the
the requested output isn't found.  That behavior just changed about a day
ago to fix another bug.  But perhaps I wasn't seeing the big picture at the
time when I changed that.  I admit that the notify_output_destroy() handler
logic felt a little odd to me, though.

Assigning the paired device's output to something (NULL or default) when the
requested output doesn't exist should be the same logic as when the paired
device's output is unplugged.  And possibly the same as when the device doesn't
specify a pairing preference.  Even before this commit, the logic didn't 
reconcile
with that notion either, afaict.

And, of course, when the requested output is hotplugged the paired device's
output needs to be reconciled (which is currently the case).


U. Artie

> -Original Message-
> From: wayland-devel [mailto:wayland-devel-boun...@lists.freedesktop.org] On 
> Behalf Of Ander Conselvan de Oliveira
> Sent: Tuesday, April 22, 2014 8:02 AM
> To: wayland-devel@lists.freedesktop.org
> Cc: Conselvan De Oliveira, Ander
> Subject: [PATCH weston 1/2] evdev: Discard events from a touchscreen paired 
> with an unplugged output
> 
> From: Ander Conselvan de Oliveira 
> 
> Commit 17bccaed intended to make the events coming from a touchscreen
> paired with an unplugged output to be discarded, while an unpaired one
> would just choose a different output. However, the logic was inverted
> causing the opposite to happen.
> ---
>  src/evdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index bc8e5ef..9d97c87 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -602,7 +602,7 @@ notify_output_destroy(struct wl_listener *listener, void 
> *data)
>   struct weston_compositor *c = device->seat->compositor;
>   struct weston_output *output;
> 
> - if (device->output_name) {
> + if (!device->output_name) {
>   output = container_of(c->output_list.next,
> struct weston_output, link);
>   evdev_device_set_output(device, output);
> --
> 1.8.3.2
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput] evdev-mt-touchpad: check calloc result

2014-04-22 Thread Peter Hutterer
On Tue, Apr 15, 2014 at 11:15:35PM +0200, Carlos Olmedo Escobar wrote:
> Check the value returned by calloc.
> ---
>  src/evdev-mt-touchpad.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index bbbd8f3..9ec1682 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -25,6 +25,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "evdev-mt-touchpad.h"
>  
> @@ -721,6 +722,10 @@ tp_init_slots(struct tp_dispatch *tp,
>   }
>   tp->touches = calloc(tp->ntouches,
>sizeof(struct tp_touch));
> + if (!tp->touches) {
> + fprintf(stderr, "Failed to initialize slots.");
> + return -1;
> + }

Please use log_error() or the associated macros for this, though in this
case a simple return -1 is sufficient (we don't have a lot of logging yet
anyway)

Cheers,
   Peter

>  
>   return 0;
>  }
> -- 
> 1.9.2
 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v2 2/5] libinput-seat: allow setting libinput log priority in weston

2014-04-22 Thread Peter Hutterer
On Thu, Apr 17, 2014 at 07:53:23AM -0700, U. Artie Eoff wrote:
> Look for WESTON_LIBINPUT_LOG_PRIORITY environment variable.  If
> it exists then use it to set the libinput log priority.
> Otherwise, don't set the priority and get whatever libinput's
> default priority is.
> 
> Setting WESTON_LIBINPUT_LOG_PRIORITY=0 allows us to log which
> input devices are detected at Weston startup and makes it a
> little more consistent with Weston's original evdev input setup
> log messages... and useful for debugging and testing.
> 
> Signed-off-by: U. Artie Eoff 

> ---
>  src/libinput-seat.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/libinput-seat.c b/src/libinput-seat.c
> index 99612c4..7aca969 100644
> --- a/src/libinput-seat.c
> +++ b/src/libinput-seat.c
> @@ -262,12 +262,19 @@ int
>  udev_input_init(struct udev_input *input, struct weston_compositor *c, 
> struct udev *udev,
>   const char *seat_id)
>  {
> + const char *log_priority = NULL;
> +
>   memset(input, 0, sizeof *input);
>  
>   input->compositor = c;
>  
>   libinput_log_set_handler(&libinput_log_func, NULL);
>  
> + log_priority = getenv("WESTON_LIBINPUT_LOG_PRIORITY");
> + if (log_priority) {
> + libinput_log_set_priority(strtol(log_priority, NULL, 10));
> + }
> +

I see this has been merged already, but I think it'd be better to have this
with the semantic names than the numeric values, e.g.
WESTON_LIBINPUT_LOG_PRIORITY=error 
it's merely a few added strcmps and the result is more copy/paste proof than
pure numbers.

Cheers,
   Peter

>   input->libinput = libinput_udev_create_for_seat(&libinput_interface, 
> input,
>   udev, seat_id);
>   if (!input->libinput) {
> -- 
> 1.8.5.3

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


Re: xserver git version?

2014-04-22 Thread Peter Hutterer
On Mon, Apr 21, 2014 at 10:20:30PM -0700, Bill Spitzak wrote:
> Okay that got a little further.
> 
> I had to delete my xwayland checkout and make a new git clone to get
> git to forget about the xwayland branch (there probably is a git
> command to make it pull from master but I could not find it).
> 
> After that I had to also check out and install fontsproto from git.
> 
> Config with --enable-xwayland is not working however:
> 
> checking whether to build XWin DDX... no
> checking dependency style of $(CC)... none
> checking for DMXMODULES... no
> checking whether to build Xdmx DDX... no
> checking for XWAYLANDMODULES... no
> checking whether to build Xwayland DDX... yes
> configure: error: Xwayland build explicitly requested, but required
> modules not found.

you're missing the required modules. check configure.ac for what you need,
it's line 2444 here.

Cheers,
   Peter

> On 04/15/2014 11:05 PM, Marek Chalupa wrote:
> >Hi,
> >
> >the xwayland was merged to master branch of xserver 12 days ago
> >(http://cgit.freedesktop.org/xorg/xserver/commit/?id=6e539d8817f738289dc2dea13d0720116287ab9d)
> >
> >I just did:
> >  $ git reset --hard origin/master
> >
> >and then configured it with --enable-xwayland.
> >
> >This way I made it run, I hope it'll help
> >
> >Regards,
> >Marek
> >
> >
> >On 16 April 2014 06:45, Bill Spitzak  >> wrote:
> >
> >It looks like the xwayland branch of xserver has disappeared:
> >
> >$ git pull
> >Your configuration specifies to merge with the ref 'xwayland'
> >from the remote, but no such ref was fetched.
> >
> >I tried "git pull origin master" but it produced lots of conflicts,
> >it looks like there are many changes for wayland that are not in master.
> >
> >Any help?
> >
> >Thanks
> >
> >_
> >wayland-devel mailing list
> >wayland-devel@lists.__freedesktop.org
> >
> >http://lists.freedesktop.org/__mailman/listinfo/wayland-devel
> >
> >
> >
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v2] shell: support window resizing using touchscreen

2014-04-22 Thread Jason Ekstrand
On Tue, Apr 22, 2014 at 12:55 PM, Stanislav Vorobiov  wrote:

> if the system doesn't have a pointer device
> common_surface_resize will crash on
> accessing seat->pointer->button_count. if the system
> does have a pointer device, but attempts to resize
> a window using touchscreen - nothing happens. here
> we implement separate window resizing path for
> seat->touch as it is done in common_surface_move
> ---
>  clients/window.c  |5 +-
>  desktop-shell/shell.c |  153
> ++---
>  shared/cairo-util.h   |2 +-
>  shared/frame.c|   10 ++--
>  4 files changed, 154 insertions(+), 16 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index e770a04..185fe23 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -2409,9 +2409,10 @@ frame_touch_down_handler(struct widget *widget,
> struct input *input,
>  float x, float y, void *data)
>  {
> struct window_frame *frame = data;
> +   enum theme_location location;
>
> -   frame_touch_down(frame->frame, input, id, x, y);
> -   frame_handle_status(frame, input, time,
> THEME_LOCATION_CLIENT_AREA);
> +   location = frame_touch_down(frame->frame, input, id, x, y);
> +   frame_handle_status(frame, input, time, location);
>  }
>
>  static void
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index bc4a258..23125af 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -1581,6 +1581,14 @@ struct weston_resize_grab {
> int32_t width, height;
>  };
>
> +struct weston_touch_resize_grab {
> +   struct shell_touch_grab base;
> +   int active;
> +   uint32_t edges;
> +   int32_t width, height;
> +   wl_fixed_t dx, dy;
> +};
> +
>  static void
>  resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
>wl_fixed_t x, wl_fixed_t y)
> @@ -1668,6 +1676,84 @@ static const struct weston_pointer_grab_interface
> resize_grab_interface = {
> resize_grab_cancel,
>  };
>
> +static void
> +touch_resize_grab_down(struct weston_touch_grab *grab, uint32_t time,
> +int touch_id, wl_fixed_t sx, wl_fixed_t sy)
> +{
> +}
> +
> +static void
> +touch_resize_grab_up(struct weston_touch_grab *grab, uint32_t time, int
> touch_id)
> +{
> +   struct weston_touch_resize_grab *resize =
> +   (struct weston_touch_resize_grab *) container_of(
> +   grab, struct shell_touch_grab, grab);
> +
> +   if (touch_id == 0)
> +   resize->active = 0;
> +
> +   if (grab->touch->num_tp == 0) {
> +   shell_touch_grab_end(&resize->base);
> +   free(resize);
> +   }
> +}
> +
> +static void
> +touch_resize_grab_motion(struct weston_touch_grab *grab, uint32_t time,
> +  int touch_id, wl_fixed_t sx, wl_fixed_t sy)
> +{
> +   struct weston_touch_resize_grab *resize = (struct
> weston_touch_resize_grab *) grab;
> +   struct weston_touch *touch = grab->touch;
> +   struct shell_surface *shsurf = resize->base.shsurf;
> +   int32_t width, height;
> +   wl_fixed_t from_x, from_y;
> +   wl_fixed_t to_x, to_y;
> +
> +   if (!shsurf || !resize->active)
> +   return;
> +
> +   weston_view_from_global_fixed(shsurf->view,
> + resize->dx, resize->dy,
> + &from_x, &from_y);
> +   weston_view_from_global_fixed(shsurf->view,
> + touch->grab_x, touch->grab_y, &to_x,
> &to_y);
> +
> +   width = resize->width;
> +   if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
> +   width += wl_fixed_to_int(from_x - to_x);
> +   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
> +   width += wl_fixed_to_int(to_x - from_x);
> +   }
> +
> +   height = resize->height;
> +   if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
> +   height += wl_fixed_to_int(from_y - to_y);
> +   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
> +   height += wl_fixed_to_int(to_y - from_y);
> +   }
> +
> +   shsurf->client->send_configure(shsurf->surface,
> +  resize->edges, width, height);
> +}
> +
> +static void
> +touch_resize_grab_cancel(struct weston_touch_grab *grab)
> +{
> +   struct weston_touch_resize_grab *resize =
> +   (struct weston_touch_resize_grab *) container_of(
> +   grab, struct shell_touch_grab, grab);
> +
> +   shell_touch_grab_end(&resize->base);
> +   free(resize);
> +}
> +
> +static const struct weston_touch_grab_interface
> touch_resize_grab_interface = {
> +   touch_resize_grab_down,
> +   touch_resize_grab_up,
> +   touch_resize_grab_motion,
> +   touch_resize_grab_cancel,
> +};
> +
>  /*
>   * Returns the bounding box of a surface and all its sub

[PATCH v2] shell: support window resizing using touchscreen

2014-04-22 Thread Stanislav Vorobiov
Jason, I've fixed that. Also, I've fixed
2 other issue reported via IRC:
* the "top-left resize" problem
* the "mouse + touchscreen can't resize with mouse" problem

latter is not tested, I don't have the environment for it

Stanislav Vorobiov (1):
  shell: support window resizing using touchscreen

 clients/window.c  |5 +-
 desktop-shell/shell.c |  153 ++---
 shared/cairo-util.h   |2 +-
 shared/frame.c|   10 ++--
 4 files changed, 154 insertions(+), 16 deletions(-)

-- 
1.7.9.5

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


[PATCH v2] shell: support window resizing using touchscreen

2014-04-22 Thread Stanislav Vorobiov
if the system doesn't have a pointer device
common_surface_resize will crash on
accessing seat->pointer->button_count. if the system
does have a pointer device, but attempts to resize
a window using touchscreen - nothing happens. here
we implement separate window resizing path for
seat->touch as it is done in common_surface_move
---
 clients/window.c  |5 +-
 desktop-shell/shell.c |  153 ++---
 shared/cairo-util.h   |2 +-
 shared/frame.c|   10 ++--
 4 files changed, 154 insertions(+), 16 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index e770a04..185fe23 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2409,9 +2409,10 @@ frame_touch_down_handler(struct widget *widget, struct 
input *input,
 float x, float y, void *data)
 {
struct window_frame *frame = data;
+   enum theme_location location;
 
-   frame_touch_down(frame->frame, input, id, x, y);
-   frame_handle_status(frame, input, time, THEME_LOCATION_CLIENT_AREA);
+   location = frame_touch_down(frame->frame, input, id, x, y);
+   frame_handle_status(frame, input, time, location);
 }
 
 static void
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index bc4a258..23125af 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1581,6 +1581,14 @@ struct weston_resize_grab {
int32_t width, height;
 };
 
+struct weston_touch_resize_grab {
+   struct shell_touch_grab base;
+   int active;
+   uint32_t edges;
+   int32_t width, height;
+   wl_fixed_t dx, dy;
+};
+
 static void
 resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
   wl_fixed_t x, wl_fixed_t y)
@@ -1668,6 +1676,84 @@ static const struct weston_pointer_grab_interface 
resize_grab_interface = {
resize_grab_cancel,
 };
 
+static void
+touch_resize_grab_down(struct weston_touch_grab *grab, uint32_t time,
+int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+{
+}
+
+static void
+touch_resize_grab_up(struct weston_touch_grab *grab, uint32_t time, int 
touch_id)
+{
+   struct weston_touch_resize_grab *resize =
+   (struct weston_touch_resize_grab *) container_of(
+   grab, struct shell_touch_grab, grab);
+
+   if (touch_id == 0)
+   resize->active = 0;
+
+   if (grab->touch->num_tp == 0) {
+   shell_touch_grab_end(&resize->base);
+   free(resize);
+   }
+}
+
+static void
+touch_resize_grab_motion(struct weston_touch_grab *grab, uint32_t time,
+  int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+{
+   struct weston_touch_resize_grab *resize = (struct 
weston_touch_resize_grab *) grab;
+   struct weston_touch *touch = grab->touch;
+   struct shell_surface *shsurf = resize->base.shsurf;
+   int32_t width, height;
+   wl_fixed_t from_x, from_y;
+   wl_fixed_t to_x, to_y;
+
+   if (!shsurf || !resize->active)
+   return;
+
+   weston_view_from_global_fixed(shsurf->view,
+ resize->dx, resize->dy,
+ &from_x, &from_y);
+   weston_view_from_global_fixed(shsurf->view,
+ touch->grab_x, touch->grab_y, &to_x, 
&to_y);
+
+   width = resize->width;
+   if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
+   width += wl_fixed_to_int(from_x - to_x);
+   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
+   width += wl_fixed_to_int(to_x - from_x);
+   }
+
+   height = resize->height;
+   if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
+   height += wl_fixed_to_int(from_y - to_y);
+   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
+   height += wl_fixed_to_int(to_y - from_y);
+   }
+
+   shsurf->client->send_configure(shsurf->surface,
+  resize->edges, width, height);
+}
+
+static void
+touch_resize_grab_cancel(struct weston_touch_grab *grab)
+{
+   struct weston_touch_resize_grab *resize =
+   (struct weston_touch_resize_grab *) container_of(
+   grab, struct shell_touch_grab, grab);
+
+   shell_touch_grab_end(&resize->base);
+   free(resize);
+}
+
+static const struct weston_touch_grab_interface touch_resize_grab_interface = {
+   touch_resize_grab_down,
+   touch_resize_grab_up,
+   touch_resize_grab_motion,
+   touch_resize_grab_cancel,
+};
+
 /*
  * Returns the bounding box of a surface and all its sub-surfaces,
  * in the surface coordinates system. */
@@ -1731,6 +1817,37 @@ surface_resize(struct shell_surface *shsurf,
return 0;
 }
 
+static int
+surface_touch_resize(struct shell_surface *shsurf,
+  struct weston_seat *seat, uint32_t edges)
+{
+   struct weston_touch_resize_grab *resize;
+
+   if (s

Re: [PATCH weston] compositor-drm: Fix crash when setting up seat constrained by an output

2014-04-22 Thread Neil Roberts
It looks like this patch makes Weston crash on touch events.

The device_added functions in udev-seat.c and libinput-seat.c try to use
the output list in order to assign the output for the newly created
device. These functions get called via udev_input_init so I guess that
means this function and create_outputs now depend on each other making a
chicken and egg situation. If the device_added function can't find an
output for the new device then it defaults to first output in the list.
However since this patch the output list is now empty at that point so
it ends up with a garbage pointer for the output. When the input code
tries to handle an absolute event (eg, a touch event) then it tries to
get the width and height from the current mode of the output for the
device but this is now garbage. For me with libinput this causes it to
segfault whereas without libinput it gets garbage width and height
values and causes a floating point exception later on.

I haven't looked any further to decide what's the best thing to do.

- Neil

Ander Conselvan de Oliveira  writes:

> From: Ander Conselvan de Oliveira 
>
> Commit 58e15865 changed the parameters for udev_get_seat_by_name() to
> receive a struct udev_input. However, when this gets called from
> create_output_from_connector() during initialization, the input struct
> is not yet initialized, leading to a crash. Previously, that function
> would take only a pointer to the compositor.
>
> This patch fixes the crash by initializing input before creating any
> outputs.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=77503
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 1/2] evdev: Discard events from a touchscreen paired with an unplugged output

2014-04-22 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira 

Commit 17bccaed intended to make the events coming from a touchscreen
paired with an unplugged output to be discarded, while an unpaired one
would just choose a different output. However, the logic was inverted
causing the opposite to happen.
---
 src/evdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/evdev.c b/src/evdev.c
index bc8e5ef..9d97c87 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -602,7 +602,7 @@ notify_output_destroy(struct wl_listener *listener, void 
*data)
struct weston_compositor *c = device->seat->compositor;
struct weston_output *output;
 
-   if (device->output_name) {
+   if (!device->output_name) {
output = container_of(c->output_list.next,
  struct weston_output, link);
evdev_device_set_output(device, output);
-- 
1.8.3.2

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


[PATCH weston 2/2] evdev: Fix assertion error for unplugged output with paired touchscreen

2014-04-22 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira 

If the output a touchscreen is paired to is unplugged, events coming
from it should be ignored. Commit 17bccaed introduced logic for that
in evdev_flush_pending_damage(). However, the break statements it
introduced would cause the assertion after the switch statement to
fail.

This function has the odd behavior that goto's are used to skip the
assertion after the switch statement and jump to the hunk of code that
marks the event as processed. Only in the case where the event type has
an invalid value the assertion should trigger. So this patch fixes the
problem by moving the assertion in to the default case of the switch
and replacing the goto statements with break ones.

https://bugs.freedesktop.org/show_bug.cgi?id=73950
---
I didn't actually manage to reproduce the bug, but looking at the
backtrace and the code in evdev.c that seems like the appropriate
fix.

Thanks,
Ander

---
 src/evdev.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 9d97c87..ff951d3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -100,7 +100,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint32_t time)
notify_motion(master, time, device->rel.dx, device->rel.dy);
device->rel.dx = 0;
device->rel.dy = 0;
-   goto handled;
+   break;
case EVDEV_ABSOLUTE_MT_DOWN:
if (device->output == NULL)
break;
@@ -113,7 +113,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint32_t time)
master->slot_map |= 1 << seat_slot;
 
notify_touch(master, time, seat_slot, x, y, WL_TOUCH_DOWN);
-   goto handled;
+   break;
case EVDEV_ABSOLUTE_MT_MOTION:
if (device->output == NULL)
break;
@@ -123,12 +123,12 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint32_t time)
   &x, &y);
seat_slot = device->mt.slots[slot].seat_slot;
notify_touch(master, time, seat_slot, x, y, WL_TOUCH_MOTION);
-   goto handled;
+   break;
case EVDEV_ABSOLUTE_MT_UP:
seat_slot = device->mt.slots[slot].seat_slot;
master->slot_map &= ~(1 << seat_slot);
notify_touch(master, time, seat_slot, 0, 0, WL_TOUCH_UP);
-   goto handled;
+   break;
case EVDEV_ABSOLUTE_TOUCH_DOWN:
if (device->output == NULL)
break;
@@ -141,7 +141,7 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint32_t time)
device->abs.seat_slot = seat_slot;
master->slot_map |= 1 << seat_slot;
notify_touch(master, time, seat_slot, x, y, WL_TOUCH_DOWN);
-   goto handled;
+   break;
case EVDEV_ABSOLUTE_MOTION:
if (device->output == NULL)
break;
@@ -156,17 +156,16 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint32_t time)
 x, y, WL_TOUCH_MOTION);
else if (device->seat_caps & EVDEV_SEAT_POINTER)
notify_motion_absolute(master, time, x, y);
-   goto handled;
+   break;
case EVDEV_ABSOLUTE_TOUCH_UP:
seat_slot = device->abs.seat_slot;
master->slot_map &= ~(1 << seat_slot);
notify_touch(master, time, seat_slot, 0, 0, WL_TOUCH_UP);
-   goto handled;
+   break;
+   default:
+   assert(0 && "Unknown pending event type");
}
 
-   assert(0 && "Unknown pending event type");
-
-handled:
device->pending_event = EVDEV_NONE;
 }
 
-- 
1.8.3.2

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


Re: [PATCH] shell: support window resizing using touchscreen

2014-04-22 Thread Jason Ekstrand
I don't have time to review the desktop-shell bits right now, but I do have
a few comments on the frame.c bits.


On Tue, Apr 22, 2014 at 9:32 AM, Stanislav Vorobiov
wrote:

> if the system doesn't have a pointer device
> common_surface_resize will crash on
> accessing seat->pointer->button_count. if the system
> does have a pointer device, but attempts to resize
> a window using touchscreen - nothing happens. here
> we implement separate window resizing path for
> seat->touch as it is done in common_surface_move
> ---
>  clients/window.c  |5 +-
>  desktop-shell/shell.c |  147
> ++---
>  shared/cairo-util.h   |2 +-
>  shared/frame.c|   10 ++--
>  4 files changed, 148 insertions(+), 16 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index e770a04..185fe23 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -2409,9 +2409,10 @@ frame_touch_down_handler(struct widget *widget,
> struct input *input,
>  float x, float y, void *data)
>  {
> struct window_frame *frame = data;
> +   enum theme_location location;
>
> -   frame_touch_down(frame->frame, input, id, x, y);
> -   frame_handle_status(frame, input, time,
> THEME_LOCATION_CLIENT_AREA);
> +   location = frame_touch_down(frame->frame, input, id, x, y);
> +   frame_handle_status(frame, input, time, location);
>  }
>

Yeah, this seems correct.


>
>  static void
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index bc4a258..8db5434 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -1581,6 +1581,14 @@ struct weston_resize_grab {
> int32_t width, height;
>  };
>
> +struct weston_touch_resize_grab {
> +   struct shell_touch_grab base;
> +   int active;
> +   uint32_t edges;
> +   int32_t width, height;
> +   wl_fixed_t dx, dy;
> +};
> +
>  static void
>  resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
>wl_fixed_t x, wl_fixed_t y)
> @@ -1668,6 +1676,84 @@ static const struct weston_pointer_grab_interface
> resize_grab_interface = {
> resize_grab_cancel,
>  };
>
> +static void
> +touch_resize_grab_down(struct weston_touch_grab *grab, uint32_t time,
> +int touch_id, wl_fixed_t sx, wl_fixed_t sy)
> +{
> +}
> +
> +static void
> +touch_resize_grab_up(struct weston_touch_grab *grab, uint32_t time, int
> touch_id)
> +{
> +   struct weston_touch_resize_grab *resize =
> +   (struct weston_touch_resize_grab *) container_of(
> +   grab, struct shell_touch_grab, grab);
> +
> +   if (touch_id == 0)
> +   resize->active = 0;
> +
> +   if (grab->touch->num_tp == 0) {
> +   shell_touch_grab_end(&resize->base);
> +   free(resize);
> +   }
> +}
> +
> +static void
> +touch_resize_grab_motion(struct weston_touch_grab *grab, uint32_t time,
> +  int touch_id, wl_fixed_t sx, wl_fixed_t sy)
> +{
> +   struct weston_touch_resize_grab *resize = (struct
> weston_touch_resize_grab *) grab;
> +   struct weston_touch *touch = grab->touch;
> +   struct shell_surface *shsurf = resize->base.shsurf;
> +   int32_t width, height;
> +   wl_fixed_t from_x, from_y;
> +   wl_fixed_t to_x, to_y;
> +
> +   if (!shsurf || !resize->active)
> +   return;
> +
> +   weston_view_from_global_fixed(shsurf->view,
> + resize->dx, resize->dy,
> + &from_x, &from_y);
> +   weston_view_from_global_fixed(shsurf->view,
> + touch->grab_x, touch->grab_y, &to_x,
> &to_y);
> +
> +   width = resize->width;
> +   if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
> +   width += wl_fixed_to_int(from_x - to_x);
> +   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
> +   width += wl_fixed_to_int(to_x - from_x);
> +   }
> +
> +   height = resize->height;
> +   if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
> +   height += wl_fixed_to_int(from_y - to_y);
> +   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
> +   height += wl_fixed_to_int(to_y - from_y);
> +   }
> +
> +   shsurf->client->send_configure(shsurf->surface,
> +  resize->edges, width, height);
> +}
> +
> +static void
> +touch_resize_grab_cancel(struct weston_touch_grab *grab)
> +{
> +   struct weston_touch_resize_grab *resize =
> +   (struct weston_touch_resize_grab *) container_of(
> +   grab, struct shell_touch_grab, grab);
> +
> +   shell_touch_grab_end(&resize->base);
> +   free(resize);
> +}
> +
> +static const struct weston_touch_grab_interface
> touch_resize_grab_interface = {
> +   touch_resize_grab_down,
> +   touch_resize_grab_up,
> + 

[PATCH] shell: support window resizing using touchscreen

2014-04-22 Thread Stanislav Vorobiov
if the system doesn't have a pointer device
common_surface_resize will crash on
accessing seat->pointer->button_count. if the system
does have a pointer device, but attempts to resize
a window using touchscreen - nothing happens. here
we implement separate window resizing path for
seat->touch as it is done in common_surface_move
---
 clients/window.c  |5 +-
 desktop-shell/shell.c |  147 ++---
 shared/cairo-util.h   |2 +-
 shared/frame.c|   10 ++--
 4 files changed, 148 insertions(+), 16 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index e770a04..185fe23 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2409,9 +2409,10 @@ frame_touch_down_handler(struct widget *widget, struct 
input *input,
 float x, float y, void *data)
 {
struct window_frame *frame = data;
+   enum theme_location location;
 
-   frame_touch_down(frame->frame, input, id, x, y);
-   frame_handle_status(frame, input, time, THEME_LOCATION_CLIENT_AREA);
+   location = frame_touch_down(frame->frame, input, id, x, y);
+   frame_handle_status(frame, input, time, location);
 }
 
 static void
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index bc4a258..8db5434 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1581,6 +1581,14 @@ struct weston_resize_grab {
int32_t width, height;
 };
 
+struct weston_touch_resize_grab {
+   struct shell_touch_grab base;
+   int active;
+   uint32_t edges;
+   int32_t width, height;
+   wl_fixed_t dx, dy;
+};
+
 static void
 resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
   wl_fixed_t x, wl_fixed_t y)
@@ -1668,6 +1676,84 @@ static const struct weston_pointer_grab_interface 
resize_grab_interface = {
resize_grab_cancel,
 };
 
+static void
+touch_resize_grab_down(struct weston_touch_grab *grab, uint32_t time,
+int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+{
+}
+
+static void
+touch_resize_grab_up(struct weston_touch_grab *grab, uint32_t time, int 
touch_id)
+{
+   struct weston_touch_resize_grab *resize =
+   (struct weston_touch_resize_grab *) container_of(
+   grab, struct shell_touch_grab, grab);
+
+   if (touch_id == 0)
+   resize->active = 0;
+
+   if (grab->touch->num_tp == 0) {
+   shell_touch_grab_end(&resize->base);
+   free(resize);
+   }
+}
+
+static void
+touch_resize_grab_motion(struct weston_touch_grab *grab, uint32_t time,
+  int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+{
+   struct weston_touch_resize_grab *resize = (struct 
weston_touch_resize_grab *) grab;
+   struct weston_touch *touch = grab->touch;
+   struct shell_surface *shsurf = resize->base.shsurf;
+   int32_t width, height;
+   wl_fixed_t from_x, from_y;
+   wl_fixed_t to_x, to_y;
+
+   if (!shsurf || !resize->active)
+   return;
+
+   weston_view_from_global_fixed(shsurf->view,
+ resize->dx, resize->dy,
+ &from_x, &from_y);
+   weston_view_from_global_fixed(shsurf->view,
+ touch->grab_x, touch->grab_y, &to_x, 
&to_y);
+
+   width = resize->width;
+   if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
+   width += wl_fixed_to_int(from_x - to_x);
+   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
+   width += wl_fixed_to_int(to_x - from_x);
+   }
+
+   height = resize->height;
+   if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
+   height += wl_fixed_to_int(from_y - to_y);
+   } else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
+   height += wl_fixed_to_int(to_y - from_y);
+   }
+
+   shsurf->client->send_configure(shsurf->surface,
+  resize->edges, width, height);
+}
+
+static void
+touch_resize_grab_cancel(struct weston_touch_grab *grab)
+{
+   struct weston_touch_resize_grab *resize =
+   (struct weston_touch_resize_grab *) container_of(
+   grab, struct shell_touch_grab, grab);
+
+   shell_touch_grab_end(&resize->base);
+   free(resize);
+}
+
+static const struct weston_touch_grab_interface touch_resize_grab_interface = {
+   touch_resize_grab_down,
+   touch_resize_grab_up,
+   touch_resize_grab_motion,
+   touch_resize_grab_cancel,
+};
+
 /*
  * Returns the bounding box of a surface and all its sub-surfaces,
  * in the surface coordinates system. */
@@ -1731,6 +1817,36 @@ surface_resize(struct shell_surface *shsurf,
return 0;
 }
 
+static int
+surface_touch_resize(struct shell_surface *shsurf,
+  struct weston_seat *seat, uint32_t edges)
+{
+   struct weston_touch_resize_grab *resize;
+
+   if (s

Re: [PATCH wayland] connection: fix a format string typo in error message

2014-04-22 Thread Pekka Paalanen
On Tue, 22 Apr 2014 16:03:12 +0300
Giulio Camuffo  wrote:

> ---
>  src/connection.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/connection.c b/src/connection.c
> index 63b0592..47ee556 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -724,7 +724,7 @@ wl_connection_demarshal(struct wl_connection *connection,
>   }
>  
>   if (wl_map_reserve_new(objects, id) < 0) {
> - wl_log("not a valid new object id (%d), "
> + wl_log("not a valid new object id (%u), "
>  "message %s(%s)\n",
>  id, message->name, message->signature);
>   errno = EINVAL;

Yeah, seems trivially correct. One would see the difference, if there
was a problem with a server-created object.

It looks like wl_connection_demarshal() would have several other places
too, that print like "object(%d)", which I think would need to be %u.


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


[PATCH wayland] connection: fix a format string typo in error message

2014-04-22 Thread Giulio Camuffo
---
 src/connection.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/connection.c b/src/connection.c
index 63b0592..47ee556 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -724,7 +724,7 @@ wl_connection_demarshal(struct wl_connection *connection,
}
 
if (wl_map_reserve_new(objects, id) < 0) {
-   wl_log("not a valid new object id (%d), "
+   wl_log("not a valid new object id (%u), "
   "message %s(%s)\n",
   id, message->name, message->signature);
errno = EINVAL;
-- 
1.9.2

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