[PATCH weston] compositor: when unmapping a surface remove it from the compositor's list

2013-09-21 Thread Giulio Camuffo
compositor.surface_list is recreated every redraw with the mapped
surfaces, but if a surface gets unmapped and then in the same frame
weston_compositor_pick_surface() is called we must make sure it
does not pick the unmapped surface, since it traverses the
surface_list to find one.
If after the unmap the surface gets also deleted it's even more
important, as it must not pick a destroyed surface.
---
 src/compositor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index a1c01fb..fefa001 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -994,6 +994,8 @@ weston_surface_unmap(struct weston_surface *surface)
surface-mapped = 0;
surface-output = NULL;
wl_list_remove(surface-layer_link);
+   wl_list_remove(surface-link);
+   wl_list_init(surface-link);
 
wl_list_for_each(seat, surface-compositor-seat_list, link) {
if (seat-keyboard  seat-keyboard-focus == surface)
-- 
1.8.4

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


Re: [RFC DRAFT] graphics tablet protocol extension

2013-09-21 Thread Bill Spitzak

On 09/20/2013 03:35 AM, Peter Hutterer wrote:


* focus handling for the stylus is easy. focus handling for the buttons on
   the pad isn't. they could technically be focused elsewhere, like a
   keyboard focus. some buttons are definitely stylus based (BTN_STYLUS,
   BTN_STYLUS2, etc.) so should go where the stylus is. Should look at what
   Win/OSX do here.


I tried both Windows 7 and OS/X with a Wacom Intuos3 6x8.

The buttons act precisely like whatever they are emulating. They can be 
set to be a set of modifier keys, or a single mouse button click, or a 
sequence of keystrokes with modifiers, and the result is exactly as 
though I quickly hit the same things on the main keyboard and mouse.


If a button sends keystrokes then they go to the application with the 
keyboard focus even if the mouse is pointing somewhere else.


If they send a shift modifier then they cause keys typed on the keyboard 
to be uppercase.


Setting them to clicks causes the clicks to go to the application under 
the mouse cursor, activating those applications. This is more apparent 
under Windows where the first click in an un-activated app is still 
handled, on OS/X it just activates it and throws away the click (I 
believe Cocoa apps can see this click, but all ignore it to match OS/X 
UI guidelines).


On Windows, by using Alt+Tab, I was able to make a button type into two 
different applications!


Note that both platforms had a method to make all the button assignments 
depend on the current application.


There are also two vertical strips (just really small pads) next to the 
buttons. They may be limited to detecting the vertical position of the 
pen, but I would not be suprised if they are in fact more of the main 
tablet area and can pick up pressure and tilt and some horizontal 
positions. These could also be programmed to send keystrokes and they 
acted like the buttons.


Now for my opinion:

This seems to be an implementation detail and I think it is ok if the 
effect of buttons goes only to the app with the pointer focus.


The default setups make the buttons act like all the different modifiers 
so you can do shift+click on the pad. On OS/X one of the buttons is set 
so when held down it causes the pen to send x/y mouse scrolling events. 
The small vertical strips are set in both cases to smart scroll which 
it is unclear what it does, and imho setting them to the scroll wheel 
works better (smart scroll may be an attempt to work around Window's 
very broken policy of sending the scroll wheel to the keyboard focus). I 
think this covers what is needed for tablet unaware applications. I 
suspect that the modifiers only have to work at the moment a click is 
sent from the pen, though working the way Windows and OS/X does might be 
the easiest implementation but users are not relying on it.


The reason for the keystrokes is obviously to trigger shortcuts in the 
application the pen is being used on, such as to switch tools in 
Photoshop. I suspect it would be ok if they went to the client with 
pointer focus (it could ignore them if it does not have keyboard focus 
if that helps). They can also be unique buttons, it would be much better 
if the client provided the api to change what the buttons do.



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


Re: [PATCH] input: Fix trailing whitspaces and indent.

2013-09-21 Thread Kristian Høgsberg
On Tue, Sep 17, 2013 at 10:54:09AM +0100, Stefan Schmidt wrote:
 Just some cosmetics to conform to the wayland coding style.

Yeah, thanks, lets' get rid of that.

Kristian

 Signed-off-by: Stefan Schmidt s.schm...@samsung.com
 ---
  src/input.c |   10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/src/input.c b/src/input.c
 index 9c30460..fb5bfee 100644
 --- a/src/input.c
 +++ b/src/input.c
 @@ -238,7 +238,7 @@ find_resource_for_surface(struct wl_list *list, struct 
 weston_surface *surface)
  
   if (!surface-resource)
   return NULL;
 - 
 +
   return wl_resource_find_for_client(list, 
 wl_resource_get_client(surface-resource));
  }
  
 @@ -344,7 +344,7 @@ weston_keyboard_create(void)
  
   keyboard = zalloc(sizeof *keyboard);
   if (keyboard == NULL)
 - return NULL;
 + return NULL;
  
   wl_list_init(keyboard-resource_list);
   wl_array_init(keyboard-keys);
 @@ -1350,7 +1350,7 @@ weston_compositor_xkb_init(struct weston_compositor *ec,
   return 0;
  }
  
 -static void 
 +static void
  weston_xkb_info_destroy(struct weston_xkb_info *xkb_info)
  {
   if (--xkb_info-ref_count  0)
 @@ -1381,7 +1381,7 @@ weston_compositor_xkb_destroy(struct weston_compositor 
 *ec)
   free((char *) ec-xkb_names.layout);
   free((char *) ec-xkb_names.variant);
   free((char *) ec-xkb_names.options);
 - 
 +
   if (ec-xkb_info)
   weston_xkb_info_destroy(ec-xkb_info);
   xkb_context_unref(ec-xkb_context);
 @@ -1479,7 +1479,7 @@ weston_compositor_build_global_keymap(struct 
 weston_compositor *ec)
   }
  
   ec-xkb_info = weston_xkb_info_create(keymap);
 - if (ec-xkb_info == NULL) 
 + if (ec-xkb_info == NULL)
   return -1;
  
   return 0;
 -- 
 1.7.9.5
 
 ___
 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 wayland] doc: Slight tweaks to wl_listener

2013-09-21 Thread Kristian Høgsberg
On Tue, Sep 17, 2013 at 04:44:24PM -0500, Aaron Faanes wrote:
 Prefer \comment over // in code blocks for consistency's sake and keep
 variable definitions separated by a line from the rest of the body.
 ---

Thanks, got these patches.

Kristian

  src/wayland-server.h | 10 ++
  1 file changed, 6 insertions(+), 4 deletions(-)
 
 diff --git a/src/wayland-server.h b/src/wayland-server.h
 index 997e6c7..c93987d 100644
 --- a/src/wayland-server.h
 +++ b/src/wayland-server.h
 @@ -143,17 +143,18 @@ wl_client_post_no_memory(struct wl_client *client);
   * listener should be done through provided accessor methods. A listener can
   * only listen to one signal at a time.
   *
 - * \code
 + * ~~~
   * struct wl_listener your_listener;
 + *
   * your_listener.notify = your_callback_method;
   *
 - * // Direct access
 + * \comment{Direct access}
   * wl_signal_add(some_object-destroy_signal, your_listener);
   *
 - * // Accessor access
 + * \comment{Accessor access}
   * wl_event_loop *loop = ...;
   * wl_event_loop_add_destroy_listener(loop, your_listener);
 - * \endcode
 + * ~~~
   *
   * If the listener is part of a larger struct, #wl_container_of can be used
   * to retrieve a pointer to it:
 @@ -162,6 +163,7 @@ wl_client_post_no_memory(struct wl_client *client);
   * void your_listener(struct wl_listener *listener, void *data)
   * {
   *   struct your_data *data = NULL;
 + *
   *   your_data = wl_container_of(listener, data, your_member_name);
   * }
   * \endcode
 -- 
 1.8.3.1
 
 ___
 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] client: fix an inconsistency in documentation

2013-09-21 Thread Kristian Høgsberg
On Wed, Sep 18, 2013 at 10:45:06AM +, Chang Liu wrote:
 The errno is set to EAGAIN when there are undispatched events, according
 to L1066 of wayland-client.c.

Thanks, good catch.

Kristian

 ---
  src/wayland-client.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/wayland-client.c b/src/wayland-client.c
 index 04d988b..d043459 100644
 --- a/src/wayland-client.c
 +++ b/src/wayland-client.c
 @@ -1087,7 +1087,7 @@ wl_display_prepare_read_queue(struct wl_display 
 *display,
   * calls wl_display_read_events(), no other thread will read from the
   * file descriptor.  This only succeeds if the event queue is empty
   * though, and if there are undispatched events in the queue, -1 is
 - * returned and errno set to EBUSY.
 + * returned and errno set to EAGAIN.
   *
   * If a thread successfully calls wl_display_prepare_read(), it must
   * either call wl_display_read_events() when it's ready or cancel the
 -- 
 1.8.3.4
 
 ___
 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 weston] xwm: set the right cursor when hovering on the decoration borders

2013-09-21 Thread Kristian Høgsberg
On Wed, Sep 18, 2013 at 03:20:04PM +0200, Giulio Camuffo wrote:
 use the alternative cursor names used also in window.c, since the
 names it used previously are not guaranteed to exist in all themes.

Makes sense, applied.

Kristian

 ---
  src/xwayland/window-manager.c | 86 
 +++
  1 file changed, 79 insertions(+), 7 deletions(-)
 
 diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
 index b4f64d3..7c7bef7 100644
 --- a/src/xwayland/window-manager.c
 +++ b/src/xwayland/window-manager.c
 @@ -1282,27 +1282,99 @@ enum cursor_type {
   XWM_CURSOR_LEFT_PTR,
  };
  
 -static const char *cursors[] = {
 - top_side,
 +/*
 + * The following correspondences between file names and cursors was copied
 + * from: https://bugs.kde.org/attachment.cgi?id=67313
 + */
 +
 +static const char *bottom_left_corners[] = {
 + bottom_left_corner,
 + sw-resize,
 + size_bdiag
 +};
 +
 +static const char *bottom_right_corners[] = {
 + bottom_right_corner,
 + se-resize,
 + size_fdiag
 +};
 +
 +static const char *bottom_sides[] = {
   bottom_side,
 + s-resize,
 + size_ver
 +};
 +
 +static const char *left_ptrs[] = {
 + left_ptr,
 + default,
 + top_left_arrow,
 + left-arrow
 +};
 +
 +static const char *left_sides[] = {
   left_side,
 + w-resize,
 + size_hor
 +};
 +
 +static const char *right_sides[] = {
   right_side,
 + e-resize,
 + size_hor
 +};
 +
 +static const char *top_left_corners[] = {
   top_left_corner,
 + nw-resize,
 + size_fdiag
 +};
 +
 +static const char *top_right_corners[] = {
   top_right_corner,
 - bottom_left_corner,
 - bottom_right_corner,
 - left_ptr
 + ne-resize,
 + size_bdiag
 +};
 +
 +static const char *top_sides[] = {
 + top_side,
 + n-resize,
 + size_ver
 +};
 +
 +struct cursor_alternatives {
 + const char **names;
 + size_t count;
 +};
 +
 +static const struct cursor_alternatives cursors[] = {
 + {top_sides, ARRAY_LENGTH(top_sides)},
 + {bottom_sides, ARRAY_LENGTH(bottom_sides)},
 + {left_sides, ARRAY_LENGTH(left_sides)},
 + {right_sides, ARRAY_LENGTH(right_sides)},
 + {top_left_corners, ARRAY_LENGTH(top_left_corners)},
 + {top_right_corners, ARRAY_LENGTH(top_right_corners)},
 + {bottom_left_corners, ARRAY_LENGTH(bottom_left_corners)},
 + {bottom_right_corners, ARRAY_LENGTH(bottom_right_corners)},
 + {left_ptrs, ARRAY_LENGTH(left_ptrs)},
  };
  
  static void
  weston_wm_create_cursors(struct weston_wm *wm)
  {
 + const char *name;
   int i, count = ARRAY_LENGTH(cursors);
 + size_t j;
  
   wm-cursors = malloc(count * sizeof(xcb_cursor_t));
   for (i = 0; i  count; i++) {
 - wm-cursors[i] =
 - xcb_cursor_library_load_cursor(wm, cursors[i]);
 + for (j = 0; j  cursors[i].count; j++) {
 + name = cursors[i].names[j];
 + wm-cursors[i] =
 + xcb_cursor_library_load_cursor(wm, name);
 + if (wm-cursors[i] != (xcb_cursor_t)-1)
 + break;
 + }
   }
  
   wm-last_cursor = -1;
 -- 
 1.8.4
 
 ___
 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: Tests for wl_signal and wl_resource

2013-09-21 Thread Kristian Høgsberg
On Wed, Sep 18, 2013 at 05:29:47PM +0200, Marek Ch wrote:
 
 Hey,
 
 I wrote these tests, could you please review it?
 Additionaly, I modified test-runner so that now it prints how many leaks are 
 present
 in test.

That's a good change and the test cases look good.  Thanks, all three
patches applied.

Kristian

 Regards,
 Marek Ch
 ___
 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 4/9] output gl repaint in clone mode

2013-09-21 Thread Zhang, Xiong Y
The primary output will wait clone output. Until all the finish of clone 
output's page flip, primary output can send frame callback to clients and begin 
the next page flip.

thanks 
-Original Message-
From: wayland-devel-bounces+xiong.y.zhang=intel@lists.freedesktop.org 
[mailto:wayland-devel-bounces+xiong.y.zhang=intel@lists.freedesktop.org] On 
Behalf Of Axel Davy
Sent: Thursday, September 19, 2013 4:21 PM
To: wayland mailing list
Subject: Re: [PATCH 4/9] output gl repaint in clone mode



How does this work if the primary output frequency is more than the clone 
output?

I'm afraid the weston log might become very big after a while when running a 
such a configuration

Axel Davy

Le 18/09/2013 05:50, Xiong Zhang a écrit :
 Only repsone to primary output repaint request; Primary output and 
 clone output share the same frame buffer, once primary output do page 
 flip, clone output will do page flip also. When both primary output 
 and clone output finish the page flip, the fb obj can be released.

 Signed-off-by: Xiong Zhang xiong.y.zh...@intel.com
 ---
   src/compositor-drm.c | 101 
 +++
   src/compositor.c |   9 +
   2 files changed, 110 insertions(+)

 diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 
 8d16d29..0b9ab45 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -103,6 +103,8 @@ struct drm_compositor {

   clockid_t clock;
   struct udev_input input;
 +
 + uint32_t flip_counter;
   };

   struct drm_mode {
 @@ -581,6 +583,12 @@ drm_output_repaint(struct weston_output *output_base,
   struct drm_sprite *s;
   struct drm_mode *mode;
   int ret = 0;
 + struct drm_output *clone_output;
 +
 + /*ignore clone output repaint request*/
 + if ((compositor-base.multiscreen_mode == WESTON_MULTISCREEN_CLONE) 
 + output_base != compositor-base.primary_output)
 + return;

   if (!output-next)
   drm_output_render(output, damage); @@ -598,6 +606,22 @@ 
 drm_output_repaint(struct weston_output *output_base,
   return;
   }
   output_base-set_dpms(output_base, WESTON_DPMS_ON);
 + if (compositor-base.multiscreen_mode == 
 WESTON_MULTISCREEN_CLONE) {
 + wl_list_for_each(clone_output, 
 compositor-base.output_list, base.link) {
 + if (clone_output-base != output_base) {
 + mode = 
 container_of(clone_output-base.current, struct drm_mode, base);
 + ret = 
 drmModeSetCrtc(compositor-drm.fd, clone_output-crtc_id,
 + 
 output-next-fb_id, 0, 0,
 + 
 clone_output-connector_id, 1,
 + 
 mode-mode_info);
 + if (ret) {
 + weston_log(set mode failed: 
 %m\n);
 + return;
 + }
 + 
 clone_output-base.set_dpms(clone_output-base, WESTON_DPMS_ON);
 + }
 + }
 + }
   }

   if (drmModePageFlip(compositor-drm.fd, output-crtc_id, @@ -608,6 
 +632,21 @@ drm_output_repaint(struct weston_output *output_base,
   }

   output-page_flip_pending = 1;
 + compositor-flip_counter++;
 +
 + if (compositor-base.multiscreen_mode == WESTON_MULTISCREEN_CLONE) {
 + wl_list_for_each(clone_output, compositor-base.output_list, 
 base.link) {
 + if (clone_output-base != output_base) {
 + if (drmModePageFlip(compositor-drm.fd, 
 clone_output-crtc_id,
 + 
 output-next-fb_id,
 + 
 DRM_MODE_PAGE_FLIP_EVENT, clone_output)  0) {
 + weston_log(queueing pageflip failed: 
 %m\n);
 + return;
 + }
 + compositor-flip_counter++;
 + }
 + }
 + }

   drm_output_set_cursor(output);

 @@ -666,9 +705,19 @@ drm_output_start_repaint_loop(struct weston_output 
 *output_base)
   struct drm_compositor *compositor = (struct drm_compositor *)
   output_base-compositor;
   uint32_t fb_id;
 + struct drm_output *clone_output;

   struct timespec ts;

 + /* ignore clone output repaint request */
 + /* clear clone_output-repaint_scheduled, so when clone_output became 
 primary */
 + /* output, it can repaint */
 + if 

Re: weston-launch: xkbcommon error

2013-09-21 Thread christophe . jarry
 xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb

 You need to install xkeyboard-config into /usr/share.

Thanks. This fixed this issue.

Christophe

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


Re: [PATCH weston] compositor: when unmapping a surface remove it from the compositor's list

2013-09-21 Thread Kristian Høgsberg
On Sat, Sep 21, 2013 at 06:08:28PM +0200, Giulio Camuffo wrote:
 compositor.surface_list is recreated every redraw with the mapped
 surfaces, but if a surface gets unmapped and then in the same frame
 weston_compositor_pick_surface() is called we must make sure it
 does not pick the unmapped surface, since it traverses the
 surface_list to find one.
 If after the unmap the surface gets also deleted it's even more
 important, as it must not pick a destroyed surface.

We have a call to weston_compositor_build_surface_list() in after the
call to weston_surface_unmap() in weston_surface_destroy(), but we
should be able to keep the list uptodate as we unmap surfaces.  I
think we did it just to be safe, but your patch should be enough and
if it isn't I want to find out what we're missing.

I'll push your patch and then remove the rebuild of the surface list
in weston_surface_destroy().

Kristian


 ---
  src/compositor.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/src/compositor.c b/src/compositor.c
 index a1c01fb..fefa001 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -994,6 +994,8 @@ weston_surface_unmap(struct weston_surface *surface)
   surface-mapped = 0;
   surface-output = NULL;
   wl_list_remove(surface-layer_link);
 + wl_list_remove(surface-link);
 + wl_list_init(surface-link);
  
   wl_list_for_each(seat, surface-compositor-seat_list, link) {
   if (seat-keyboard  seat-keyboard-focus == surface)
 -- 
 1.8.4
 
 ___
 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 weston 1/2 v2] input: Emit events on all resources for a client

2013-09-21 Thread Kristian Høgsberg
On Thu, Sep 19, 2013 at 05:32:00PM +0100, Neil Roberts wrote:
 Here is a second version of Robert's patch with the following changes:
 
 I think the problem where clients would not immediately become active
 when starting was caused by it calling weston_*_set_focus instead of
 sending the enter event for the first keyboard or pointer resource.
 The set_focus functions don't do anything if the surface already has
 focus so the client was never getting the enter event. I've changed it
 so that it uses the same code path regardless of whether it is the
 first or a subsequent resource and now it just always explicitly sends
 the enter event.
 
 I've removed the focus listeners. We don't need them anymore because
 the resource will automatically remove itself from the list when it is
 destroyed and that will have the same effect as the old destroy
 callback which would just unset the focus resource pointer. This
 should remove the need for Robert's patch which changes the destroy
 listeners to listen to the client resource.
 
 When setting the pointer focus it will now send the keyboard modifiers
 regardless of whether the focused client has a pointer resource. This
 is not how it works in master and Rob's patch also changed it to do
 this but I'm not sure if that was intentional. This is important
 because otherwise if you get the pointer later than getting the
 keyboard then the modifiers might not be up-to-date.
 
 I've changed the move_resource function to just use wl_list_insert
 which should have the same effect but will be faster because it
 doesn't need to iterate the list.
 
 In a couple of places the patch made it so that it would increment the
 serial even if there are no resources for the pointer or keyboard.
 I've changed these so that it checks if the resource list is empty to
 make it retain the old behaviour. In particular this was happening in
 binding_key and default_grab_key.
 
 When getting the keyboard, it now sends the modifiers to the client
 when it either has the pointer focus or the keyboard focus, instead of
 only if it has the keyboard focus.
 
 I've split up long lines and moved some bits of code into common
 functions, for example to emit the modifiers event.
 
 I've brought back the find_resource_for_surface functions so that the
 set focus functions can avoid incrementing the serial if there is no
 pointer or keyboard resource for the client of that surface.
 
 I removed the duplicated checks for seat-touch_focus != surface in
 wl_touch_set_focus because this is ensured right at the start of the
 function so it is redundant to check it again.
 
 I fixed the spelling of ‘focussed‘.

This is great, I think you got it just right, all those changes make
sense.

 Regards,
 - Neil
 
 -- 8 --

Instead of this manual marker, you can add comments like the above
below the three dashes that git inserts between the commit message and
the actual patch.  git am will take the text up until the --- marker
as the commit message and discard everything from there on until the
actual patch.

Kristian

 From: Rob Bradford r...@linux.intel.com
 
 The Wayland protocol permits a client to request the pointer, keyboard
 and touch multiple times from the seat global. This is very useful in a
 component like Clutter-GTK where we are combining two libraries that use
 Wayland together.
 
 This change migrates the weston input handling code to emit the
 events for all the resources for the client by using the newly added
 wl_resource_for_each macro to iterate over the resources that are
 associated with the focused surface's client.
 
 We maintain a list of focused resources on the pointer and keyboard
 which is updated when the focus changes. However since we can have
 resources created after the focus has already been set we must add the
 resources to the right list and also update any state.
 
 Additionally when setting the pointer focus it will now send the
 keyboard modifiers regardless of whether the focused client has a
 pointer resource. This is important because otherwise if the client
 gets the pointer later than you getting the keyboard then the
 modifiers might not be up-to-date.
 
 Co-author: Neil Roberts n...@linux.intel.com
 ---

[ That is, text here (including the diffstat below) will be discarded by
  git am, which makes this a good place for informal, out-of-band text. ]

  src/bindings.c|  21 +--
  src/compositor.h  |   9 +-
  src/data-device.c |  16 ++-
  src/input.c   | 399 
 +++---
  src/shell.c   |  34 +++--
  5 files changed, 309 insertions(+), 170 deletions(-)
 
 diff --git a/src/bindings.c b/src/bindings.c
 index a871c26..f6ec9ea 100644
 --- a/src/bindings.c
 +++ b/src/bindings.c
 @@ -160,7 +160,6 @@ binding_key(struct weston_keyboard_grab *grab,
   struct weston_keyboard *keyboard = grab-keyboard;
   struct wl_display *display = keyboard-seat-compositor-wl_display;
  
 - resource = grab-keyboard-focus_resource;

Re: [PATCH 2/2] Add a hacky client to test multiple pointer/keyboard resources

2013-09-21 Thread Kristian Høgsberg
On Thu, Sep 19, 2013 at 05:32:01PM +0100, Neil Roberts wrote:
 ** I don't expect this patch to be landed but it might be useful if
anyone wants to test the multi-resource stuff **
 
 This adds a hacked version of simple-shm which can create multiple
 pointer and keyboard resources. The resources are created with the
 command line options -p and -k. Both take an integer argument which
 specifies the time in seconds after the program is started when the
 resource should be created. It can also take a second time with a
 colon separator to specify when the resource should be released.
 
 For example:
 
  weston-multi-resource -p5 -p7 -k9 -p12:14
 
 That would create a pointer after 5 seconds, a second pointer 2
 seconds later, a keyboard 2 seconds after that, a third pointer after
 a further 3 seconds and finally after 2 more seconds it would release
 that final pointer resource.
 
 This can be used along with WAYLAND_DEBUG to check that it gets the
 right events for example if the pointer is created while the client's
 surface already has focus and so on.

No, I think this is exactly the kind of clients we have in weston.
Most clients test a few specific features in a minimal way and that's
that.  And lacking a fully automated test case, at least having a
simple client that makes it easy to test and verify the feature is
critical.

Looking through the code, it seems like we should try to find a way to
share code a little better.  window.c started out this way, but now it
feels like too much of a framework and it's hard to pick out a few
helper functions.

Kristian

 ---
  clients/Makefile.am  |   9 +-
  clients/multi-resource.c | 596 
 +++
  2 files changed, 604 insertions(+), 1 deletion(-)
  create mode 100644 clients/multi-resource.c
 
 diff --git a/clients/Makefile.am b/clients/Makefile.am
 index 24c6489..d4bee2a 100644
 --- a/clients/Makefile.am
 +++ b/clients/Makefile.am
 @@ -32,7 +32,8 @@ AM_CPPFLAGS =   \
  if BUILD_SIMPLE_CLIENTS
  simple_clients_programs =\
   weston-simple-shm   \
 - weston-simple-touch
 + weston-simple-touch \
 + weston-multi-resource
  
  weston_simple_shm_SOURCES = simple-shm.c \
   ../shared/os-compatibility.c\
 @@ -45,6 +46,12 @@ weston_simple_touch_SOURCES = simple-touch.c   \
   ../shared/os-compatibility.h
  weston_simple_touch_CPPFLAGS = $(SIMPLE_CLIENT_CFLAGS)
  weston_simple_touch_LDADD = $(SIMPLE_CLIENT_LIBS)
 +
 +weston_multi_resource_SOURCES = multi-resource.c \
 + ../shared/os-compatibility.c\
 + ../shared/os-compatibility.h
 +weston_multi_resource_CPPFLAGS = $(SIMPLE_CLIENT_CFLAGS)
 +weston_multi_resource_LDADD = $(SIMPLE_CLIENT_LIBS)
  endif
  
  if BUILD_SIMPLE_EGL_CLIENTS
 diff --git a/clients/multi-resource.c b/clients/multi-resource.c
 new file mode 100644
 index 000..1c2e5c9
 --- /dev/null
 +++ b/clients/multi-resource.c
 @@ -0,0 +1,596 @@
 +/*
 + * Copyright © 2011 Benjamin Franzke
 + * Copyright © 2010, 2013 Intel Corporation
 + *
 + * Permission to use, copy, modify, distribute, and sell this software and 
 its
 + * documentation for any purpose is hereby granted without fee, provided that
 + * the above copyright notice appear in all copies and that both that 
 copyright
 + * notice and this permission notice appear in supporting documentation, and
 + * that the name of the copyright holders not be used in advertising or
 + * publicity pertaining to distribution of the software without specific,
 + * written prior permission.  The copyright holders make no representations
 + * about the suitability of this software for any purpose.  It is provided 
 as
 + * is without express or implied warranty.
 + *
 + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 
 SOFTWARE,
 + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 
 USE,
 + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
 PERFORMANCE
 + * OF THIS SOFTWARE.
 + */
 +
 +#include config.h
 +
 +#include stdio.h
 +#include stdlib.h
 +#include errno.h
 +#include string.h
 +#include stdbool.h
 +#include assert.h
 +#include unistd.h
 +#include sys/mman.h
 +#include signal.h
 +#include time.h
 +#include sys/poll.h
 +#include float.h
 +
 +#include wayland-client.h
 +#include ../shared/os-compatibility.h
 +
 +struct device {
 + enum { KEYBOARD, POINTER } type;
 +
 + int start_time;
 + int end_time;
 + struct wl_list link;
 +
 + union {
 + struct wl_keyboard *keyboard;
 + struct wl_pointer *pointer;
 + } p;
 +};
 +
 +struct display {
 + struct wl_display 

Re: [PATCH wayland] Export the Wayland protocol XML file

2013-09-21 Thread Kristian Høgsberg
On Fri, Sep 20, 2013 at 08:27:06AM -0500, Jason Ekstrand wrote:
 Signed-off-by: Jason Ekstrand ja...@jlekstrand.net

Yeah, let's do this; committed.

Kristian

 ---
  protocol/Makefile.am | 2 +-
  src/wayland-client.pc.in | 2 ++
  src/wayland-server.pc.in | 2 ++
  3 files changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/protocol/Makefile.am b/protocol/Makefile.am
 index 08690b3..cc9cd1c 100644
 --- a/protocol/Makefile.am
 +++ b/protocol/Makefile.am
 @@ -1 +1 @@
 -EXTRA_DIST = wayland.xml
 +dist_pkgdata_DATA = wayland.xml
 diff --git a/src/wayland-client.pc.in b/src/wayland-client.pc.in
 index e453018..eef61da 100644
 --- a/src/wayland-client.pc.in
 +++ b/src/wayland-client.pc.in
 @@ -1,5 +1,7 @@
  prefix=@prefix@
  exec_prefix=@exec_prefix@
 +datarootdir=@datarootdir@
 +pkgdatadir=@datadir@/@PACKAGE@
  libdir=@libdir@
  includedir=@includedir@
  
 diff --git a/src/wayland-server.pc.in b/src/wayland-server.pc.in
 index 18a0b52..50dff53 100644
 --- a/src/wayland-server.pc.in
 +++ b/src/wayland-server.pc.in
 @@ -1,5 +1,7 @@
  prefix=@prefix@
  exec_prefix=@exec_prefix@
 +datarootdir=@datarootdir@
 +pkgdatadir=@datadir@/@PACKAGE@
  libdir=@libdir@
  includedir=@includedir@
  
 -- 
 1.8.3.1
 
 ___
 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 0/2] v2, Notify clients when the native mode is switched

2013-09-21 Thread Kristian Høgsberg
On Wed, Sep 18, 2013 at 11:56:34PM +0200, Hardening wrote:
 This revised version takes in account the comment of Pekka Paalanen and
 Jason Ekstrand.

Thanks for working on this, both patches committed.

Kristian

 Hardening (2):
   Rename current, origin, scale, origin_scale
   Notify clients on mode_switch()
 
  src/compositor-drm.c  |  57 ---
  src/compositor-fbdev.c|   3 +-
  src/compositor-headless.c |   3 +-
  src/compositor-rdp.c  |  33 --
  src/compositor-rpi.c  |   3 +-
  src/compositor-wayland.c  |   3 +-
  src/compositor-x11.c  |  11 ++---
  src/compositor.c  | 113 
 ++
  src/compositor.h  |  19 ++--
  src/evdev.c   |   8 ++--
  src/gl-renderer.c |  14 +++---
  src/pixman-renderer.c |  12 ++---
  src/rpi-renderer.c|   4 +-
  src/screenshooter.c   |  52 ++---
  src/shell.c   |  12 +++--
  15 files changed, 215 insertions(+), 132 deletions(-)
 
 -- 
 1.8.1.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