Re: [PATCH v4 xdg-shell-unstable-v6] xdg-shell: add preferred min/max size requests

2016-04-07 Thread Olivier Fourdan
Hi

> I see no reason for "preferred" to be in the name. There is no intention to
> be able to ever specify a "real" min/max size so this word does not
> distinguish the values from any thing else.

This was asked explicitly on irc #wayland last Monday (iirc) by SardemFF7.

This is not to distinguish from a "real" min/max size, this is intended to make 
it very clear even in the request name that this is by no mean enforceable by 
the client.

In other words, it's just a hint (just that we can't use hint as this is dirty 
word nowadays ^_~)

> Also if these remain two calls, the compositor must allow the maximum to be
> less than the minimum, at least temporarily between the calls.

I reckon this is the compositor implementation, not sure this should be in the 
spec.

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


Re: [PATCH] Fix implicit declaration of function 'xf86Msg' in xf86libinput.c

2016-04-07 Thread Peter Hutterer
On Wed, Oct 14, 2015 at 10:43:34AM +1000, Stanislav Ochotnicky wrote:
> Addition of xf86.h header fixes compilation issues in some cases.
> 
> See: https://bugs.gentoo.org/show_bug.cgi?id=560970
> Signed-off-by: Stanislav Ochotnicky 
> ---
>  src/xf86libinput.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/xf86libinput.c b/src/xf86libinput.c
> index c1b13ff..c6b651c 100644
> --- a/src/xf86libinput.c
> +++ b/src/xf86libinput.c
> @@ -33,6 +33,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> -- 
> 2.4.9

sorry, fell through the cracks. Pushed now, thanks

   13726f4..602bb8e  master -> master

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


[PATCH weston v3 4/8] desktop-shell: Support tracking active surfaces

2016-04-07 Thread Bryce Harrington
Activity for desktop-shell simply follows keyboard focus.  Only a single
surface can be active at a time.

Signed-off-by: Bryce Harrington 
---
 desktop-shell/shell.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 6e49076..48e4e30 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5065,6 +5065,8 @@ activate(struct desktop_shell *shell, struct 
weston_surface *es,
 
old_es = state->keyboard_focus;
focus_state_set_focus(state, es);
+   if (old_es != NULL)
+   weston_surface_deactivate(old_es);
 
if (shsurf->state.fullscreen && configure)
shell_configure_fullscreen(shsurf);
-- 
1.9.1

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


[PATCH weston v3 8/8] desktop-shell: Enable per-output fade animations

2016-04-07 Thread Bryce Harrington
Instead of creating a single global fade surface across all outputs,
create a separate surface for each output.  This lets us individually
fade each output (or block fading if the output has an inhibiting
surface).

When there are client surfaces with valid idle inhibits present, fade
out only the outputs those surfaces are not visible on.  Then fade those
out too, if the client terminates for some reason while the system is in
sleep/idle/offscreen mode.

This also fixes a potential issue if on multihead layout spanning a
desktop wider than 8096 (or higher than 8096), the fade animation may
not completely cover all surfaces.

This assumes the output geometry doesn't change larger during the course
of the fade animation.

Signed-off-by: Bryce Harrington 
---
v3: Fix failure to resume fade-out animation when inhibiting client exits

 desktop-shell/shell.c | 166 +++---
 desktop-shell/shell.h |  14 ++---
 2 files changed, 109 insertions(+), 71 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 48e4e30..78ec665 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3545,10 +3545,23 @@ destroy_shell_surface(struct shell_surface *shsurf)
 }
 
 static void
+shell_fade(struct desktop_shell *shell, enum fade_type type);
+
+static void
 shell_destroy_shell_surface(struct wl_resource *resource)
 {
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
 
+   /* Re-queue the fade animation to be evaluated if client had been 
inhibiting */
+   if (shsurf->surface->inhibit_idling &&
+   (shsurf->shell->compositor->state == WESTON_COMPOSITOR_IDLE
+|| shsurf->shell->compositor->state == WESTON_COMPOSITOR_OFFSCREEN
+|| shsurf->shell->compositor->state == WESTON_COMPOSITOR_SLEEPING))
+   {
+   shsurf->surface->inhibit_idling = false;
+   shell_fade(shsurf->shell, FADE_OUT);
+   }
+
if (!wl_list_empty(&shsurf->popup.grab_link))
remove_popup_grab(shsurf);
wl_list_remove(wl_resource_get_link(shsurf->resource));
@@ -4285,9 +4298,6 @@ xdg_shell_unversioned_dispatch(const void *implementation,
 /***/
 
 static void
-shell_fade(struct desktop_shell *shell, enum fade_type type);
-
-static void
 configure_static_view(struct weston_view *ev, struct weston_layer *layer)
 {
struct weston_view *v, *next;
@@ -5224,24 +5234,27 @@ static void
 shell_fade_done(struct weston_view_animation *animation, void *data)
 {
struct desktop_shell *shell = data;
+   struct shell_output *shell_output;
 
-   shell->fade.animation = NULL;
+   wl_list_for_each(shell_output, &shell->output_list, link) {
+   shell_output->fade.animation = NULL;
 
-   switch (shell->fade.type) {
-   case FADE_IN:
-   weston_surface_destroy(shell->fade.view->surface);
-   shell->fade.view = NULL;
-   break;
-   case FADE_OUT:
-   lock(shell);
-   break;
-   default:
-   break;
+   switch (shell_output->fade.type) {
+   case FADE_IN:
+   
weston_surface_destroy(shell_output->fade.view->surface);
+   shell_output->fade.view = NULL;
+   break;
+   case FADE_OUT:
+   lock(shell);
+   break;
+   default:
+   break;
+   }
}
 }
 
 static struct weston_view *
-shell_fade_create_surface(struct desktop_shell *shell)
+shell_fade_create_surface_for_output(struct desktop_shell *shell, struct 
shell_output *shell_output)
 {
struct weston_compositor *compositor = shell->compositor;
struct weston_surface *surface;
@@ -5257,8 +5270,8 @@ shell_fade_create_surface(struct desktop_shell *shell)
return NULL;
}
 
-   weston_surface_set_size(surface, 8192, 8192);
-   weston_view_set_position(view, 0, 0);
+   weston_surface_set_size(surface, shell_output->output->width, 
shell_output->output->height);
+   weston_view_set_position(view, shell_output->output->x, 
shell_output->output->y);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
weston_layer_entry_insert(&compositor->fade_layer.view_list,
  &view->layer_link);
@@ -5271,6 +5284,8 @@ static void
 shell_fade(struct desktop_shell *shell, enum fade_type type)
 {
float tint;
+   struct shell_output *shell_output;
+   uint32_t inhibit_mask = 
weston_output_inhibited_outputs(shell->compositor);
 
switch (type) {
case FADE_IN:
@@ -5280,36 +5295,41 @@ shell_fade(struct desktop_shell *shell, enum fade_type 
type)
tint = 1.0;
break;
default:
-   weston_log("shell: invalid fade type\n");
return;
}
 

[PATCH weston v3 5/8] fullscreen-shell: Support tracking active surfaces

2016-04-07 Thread Bryce Harrington
Surface activity is determined by what surface is being displayed
fullscreen.  Only a single surface can be active in the shell.

Signed-off-by: Bryce Harrington 
---
 fullscreen-shell/fullscreen-shell.c | 27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/fullscreen-shell/fullscreen-shell.c 
b/fullscreen-shell/fullscreen-shell.c
index e1f8a63..8b1930f 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -46,6 +46,7 @@ struct fullscreen_shell {
struct wl_listener output_created_listener;
 
struct wl_listener seat_created_listener;
+   struct weston_surface *active_surface;
 };
 
 struct fs_output {
@@ -84,14 +85,23 @@ struct pointer_focus_listener {
 };
 
 static void
-pointer_focus_changed(struct wl_listener *listener, void *data)
+pointer_focus_changed(struct wl_listener *l, void *data)
 {
struct weston_pointer *pointer = data;
+   struct weston_surface *old_surface;
+   struct pointer_focus_listener *listener;
+
+   listener = container_of(l, struct pointer_focus_listener,
+   seat_destroyed);
 
if (pointer->focus && pointer->focus->surface->resource) {
+   old_surface = listener->shell->active_surface;
+   if (old_surface != NULL)
+   weston_surface_deactivate(old_surface);
weston_surface_assign_keyboard(pointer->focus->surface, 
pointer->seat);
if (pointer->focus->surface != NULL)
weston_surface_activate(pointer->focus->surface);
+   listener->shell->active_surface = pointer->focus->surface;
}
 }
 
@@ -101,6 +111,7 @@ seat_caps_changed(struct wl_listener *l, void *data)
struct weston_seat *seat = data;
struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
+   struct weston_surface *old_surface;
struct pointer_focus_listener *listener;
struct fs_output *fsout;
 
@@ -119,11 +130,15 @@ seat_caps_changed(struct wl_listener *l, void *data)
}
 
if (keyboard && keyboard->focus != NULL) {
+   old_surface = listener->shell->active_surface;
wl_list_for_each(fsout, &listener->shell->output_list, link) {
if (fsout->surface) {
+   if (old_surface != NULL)
+   weston_surface_deactivate(old_surface);
weston_surface_assign_keyboard(fsout->surface, 
seat);
if (fsout->surface != NULL)
weston_surface_activate(fsout->surface);
+   listener->shell->active_surface = 
fsout->surface;
return;
}
}
@@ -676,6 +691,7 @@ fullscreen_shell_present_surface(struct wl_client *client,
wl_resource_get_user_data(resource);
struct weston_output *output;
struct weston_surface *surface;
+   struct weston_surface *old_surface;
struct weston_seat *seat;
struct fs_output *fsout;
 
@@ -709,9 +725,13 @@ fullscreen_shell_present_surface(struct wl_client *client,
weston_seat_get_keyboard(seat);
 
if (keyboard && !keyboard->focus) {
+   old_surface = shell->active_surface;
+   if (old_surface != NULL)
+   weston_surface_deactivate(old_surface);
weston_surface_assign_keyboard(surface, seat);
if (surface != NULL)
weston_surface_activate(surface);
+   shell->active_surface = surface;
}
}
}
@@ -737,6 +757,7 @@ fullscreen_shell_present_surface_for_mode(struct wl_client 
*client,
wl_resource_get_user_data(resource);
struct weston_output *output;
struct weston_surface *surface;
+   struct weston_surface *old_surface;
struct weston_seat *seat;
struct fs_output *fsout;
 
@@ -763,9 +784,13 @@ fullscreen_shell_present_surface_for_mode(struct wl_client 
*client,
weston_seat_get_keyboard(seat);
 
if (keyboard && !keyboard->focus) {
+   old_surface = shell->active_surface;
+   if (old_surface != NULL)
+   weston_surface_deactivate(old_surface);
weston_surface_assign_keyboard(surface, seat);
if (surface != NULL)
weston_surface_activate(surface);
+   shell->active_surface = surface;
}
}
 }

[PATCH weston v3 6/8] ivi-shell: Support tracking active surfaces

2016-04-07 Thread Bryce Harrington
Activity for ivi-shell follows either click or touch.  Only a single
surface can be active in the shell at a time.

Signed-off-by: Bryce Harrington 
---
 Makefile.am   |  4 ++-
 configure.ac  |  2 ++
 ivi-shell/ivi-shell.c | 10 ++
 ivi-shell/ivi-shell.h |  2 ++
 src/compositor.c  | 91 ++-
 5 files changed, 107 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index cbb3b57..aa3aa1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -126,7 +126,9 @@ nodist_weston_SOURCES = 
\
protocol/scaler-protocol.c  \
protocol/scaler-server-protocol.h   \
protocol/linux-dmabuf-unstable-v1-protocol.c\
-   protocol/linux-dmabuf-unstable-v1-server-protocol.h
+   protocol/linux-dmabuf-unstable-v1-server-protocol.h \
+   protocol/idle-inhibit-unstable-v1-protocol.c\
+   protocol/idle-inhibit-unstable-v1-server-protocol.h
 
 BUILT_SOURCES += $(nodist_weston_SOURCES)
 
diff --git a/configure.ac b/configure.ac
index bba8050..d4817a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,8 @@ m4_define([weston_micro_version], [90])
 m4_define([weston_version],
   [weston_major_version.weston_minor_version.weston_micro_version])
 
+# Note: Inhibition patchset requires inhibition protocol in wayland-protocol
+
 AC_PREREQ([2.64])
 AC_INIT([weston],
 [weston_version],
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index 59f5656..9739014 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -434,11 +434,16 @@ static void
 click_to_activate_binding(struct weston_pointer *pointer, uint32_t time,
  uint32_t button, void *data)
 {
+   struct ivi_shell *shell = data;
+
if (pointer->grab != &pointer->default_grab)
return;
if (pointer->focus == NULL)
return;
 
+   if (shell->active_surface != NULL)
+   weston_surface_deactivate(shell->active_surface);
+
activate_binding(pointer->seat, pointer->focus);
 }
 
@@ -446,11 +451,16 @@ static void
 touch_to_activate_binding(struct weston_touch *touch, uint32_t time,
  void *data)
 {
+   struct ivi_shell *shell = data;
+
if (touch->grab != &touch->default_grab)
return;
if (touch->focus == NULL)
return;
 
+   if (shell->active_surface != NULL)
+   weston_surface_deactivate(shell->active_surface);
+
activate_binding(touch->seat, touch->focus);
 }
 
diff --git a/ivi-shell/ivi-shell.h b/ivi-shell/ivi-shell.h
index 9a05eb2..87bce3a 100644
--- a/ivi-shell/ivi-shell.h
+++ b/ivi-shell/ivi-shell.h
@@ -55,6 +55,8 @@ struct ivi_shell
struct wl_resource *binding;
struct wl_list surfaces;
} input_panel;
+
+   struct weston_surface *active_surface;
 };
 
 struct weston_view *
diff --git a/src/compositor.c b/src/compositor.c
index 8e01d38..c89e443 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -51,6 +51,8 @@
 #include 
 #include 
 
+#include 
+
 #include "timeline.h"
 
 #include "compositor.h"
@@ -2412,7 +2414,7 @@ weston_output_inhibited_outputs(struct weston_compositor 
*compositor)
continue;
 
/* Does the view's surface inhibit this output? */
-   if (!view->surface->inhibit_screensaving)
+   if (!view->surface->inhibit_idling)
continue;
 
inhibited_outputs_mask |= view->output_mask;
@@ -4631,6 +4633,89 @@ compositor_bind(struct wl_client *client,
   compositor, NULL);
 }
 
+struct weston_idle_inhibitor {
+   struct weston_surface *surface;
+};
+
+static void
+destroy_idle_inhibitor(struct wl_resource *resource)
+{
+   struct weston_idle_inhibitor *inhibitor = 
wl_resource_get_user_data(resource);
+
+   inhibitor->surface = NULL;
+   free(inhibitor);
+}
+
+static void
+idle_inhibitor_destroy(struct wl_client *client, struct wl_resource *resource)
+{
+   struct weston_idle_inhibitor *inhibitor = 
wl_resource_get_user_data(resource);
+
+   assert(inhibitor);
+
+   inhibitor->surface->inhibit_idling = false;
+}
+
+static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_interface = 
{
+   idle_inhibitor_destroy
+};
+
+static void
+idle_inhibit_manager_destroy(struct wl_client *client, struct wl_resource 
*resource)
+{
+}
+
+static void
+idle_inhibit_manager_create_inhibitor(struct wl_client *client, struct 
wl_resource *resource,
+ uint32_t id, struct wl_resource 
*surface_resource)
+{
+   struct weston_surface *surface = 
wl_resource_get_user_data(surface_resource);
+   struct weston_idle_inhibitor *inhibitor;
+   struct wl_resource *cr;
+
+   cr = wl_resource_create(client, &zwp_idle_inhibit

[PATCH weston v3 0/8] Implement screensaver/idle inhibition

2016-04-07 Thread Bryce Harrington
This patchset implements screensaver inhibition for Weston (see separate
wayland-protocols patch).

The first three patches set up some infrastructure adjustments that will
be needed in the latter patches.  This makes idle behavior tracked on a
per-seat basis, so that shells can connect an inhibit on an active
surface with the seat generating the input events for that surface.
Surfaces gain parameters for tracking inhibition requests from clients,
and tracking activity as defined by shells.

The fourth patch integrates these bits to implement the core
functionality of per-output idle management.

Patches 5, 6, and 7 shift the shells to use the new functionality.  Each
shell can make it's own decision as to what 'active' means, but this
just sets the assumption to "has the keyboard focus".

Next come the actual client and server protocol implementation.  With
these, clients are able to specify inhibition and the server will honor
it.  The client patch includes an example implementation for the
simple-shm client.

The final patch adjusts how the fade-out animation works in
desktop-shell.  Instead of a single fade-out surface stretched across
all outputs, separate fade-out surfaces are created and managed for each
output.  When the system idles, only outputs without inhibiting client
surfaces are faded; if the client terminates while the system is still
in idle mode, its outputs are then faded too.

v2:
 + Fixed fade-out animation (see above)
 + Updated patchset for the protocol rename from screensaver-inhibit
   to idle-inhibit (see the separate wayland-protocol patch)

v3:
 + Split keyboard focus assignment to separate routine from surface
   activation (as suggested by Giulio Camuffo)


Bryce Harrington (8):
  compositor: Track idle as a per-seat property
  compositor: Track inhibition state in weston_surface
  compositor: If the output is inhibited, don't idle it off
  desktop-shell: Support tracking active surfaces
  fullscreen-shell: Support tracking active surfaces
  ivi-shell: Support tracking active surfaces
  Define the screensaver inhibitor client interface
  desktop-shell: Enable per-output fade animations

 Makefile.am |  13 ++-
 clients/simple-shm.c|  28 -
 configure.ac|   2 +
 desktop-shell/shell.c   | 172 +++
 desktop-shell/shell.h   |  14 +--
 fullscreen-shell/fullscreen-shell.c |  52 --
 ivi-shell/ivi-shell.c   |  14 ++-
 ivi-shell/ivi-shell.h   |   2 +
 src/compositor.c| 199 ++--
 src/compositor.h|  32 +-
 src/input.c |  54 +++---
 tests/weston-test.c |   8 +-
 12 files changed, 449 insertions(+), 141 deletions(-)

-- 
1.9.1

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


[PATCH weston v3 7/8] Define the screensaver inhibitor client interface

2016-04-07 Thread Bryce Harrington
Hook up the API defined in wayland-protocols to allow client screensaver
inhibition requests.

Signed-off-by: Bryce Harrington 
---
v2: Update for protocol rename

 Makefile.am  |  9 +++--
 clients/simple-shm.c | 28 
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index aa3aa1b..73affd1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -478,7 +478,10 @@ nodist_weston_simple_shm_SOURCES = \
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/ivi-application-protocol.c \
-   protocol/ivi-application-client-protocol.h
+   protocol/ivi-application-client-protocol.h  \
+   protocol/idle-inhibit-unstable-v1-protocol.c\
+   protocol/idle-inhibit-unstable-v1-client-protocol.h
+
 weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
 weston_simple_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la
 
@@ -766,7 +769,9 @@ BUILT_SOURCES +=\
protocol/ivi-hmi-controller-protocol.c  \
protocol/ivi-hmi-controller-client-protocol.h   \
protocol/ivi-application-protocol.c \
-   protocol/ivi-application-client-protocol.h
+   protocol/ivi-application-client-protocol.h  \
+   protocol/idle-inhibit-unstable-v1-protocol.c \
+   protocol/idle-inhibit-unstable-v1-client-protocol.h
 
 westondatadir = $(datadir)/weston
 dist_westondata_DATA = \
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index e6f0bd0..1dc609c 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -42,12 +42,15 @@
 #include "ivi-application-client-protocol.h"
 #define IVI_SURFACE_ID 9000
 
+#include "idle-inhibit-unstable-v1-client-protocol.h"
+
 struct display {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct xdg_shell *shell;
struct zwp_fullscreen_shell_v1 *fshell;
+   struct zwp_idle_inhibit_manager_v1 *inhibit;
struct wl_shm *shm;
uint32_t formats;
struct ivi_application *ivi_application;
@@ -68,6 +71,7 @@ struct window {
struct buffer buffers[2];
struct buffer *prev_buffer;
struct wl_callback *callback;
+   struct zwp_idle_inhibitor_v1 *inhibitor;
 };
 
 static int running = 1;
@@ -201,6 +205,12 @@ create_window(struct display *display, int width, int 
height)
assert(0);
}
 
+   /* Request the screensaver be inhibited for duration of our surface */
+   if (display->inhibit) {
+   window->inhibitor = 
zwp_idle_inhibit_manager_v1_create_inhibitor(display->inhibit,
+   
 window->surface);
+   }
+
return window;
 }
 
@@ -217,6 +227,10 @@ destroy_window(struct window *window)
 
if (window->xdg_surface)
xdg_surface_destroy(window->xdg_surface);
+
+   if (window->inhibitor)
+   zwp_idle_inhibitor_v1_destroy(window->inhibitor);
+
wl_surface_destroy(window->surface);
free(window);
 }
@@ -381,12 +395,15 @@ registry_handle_global(void *data, struct wl_registry 
*registry,
d->shm = wl_registry_bind(registry,
  id, &wl_shm_interface, 1);
wl_shm_add_listener(d->shm, &shm_listener, d);
-   }
-   else if (strcmp(interface, "ivi_application") == 0) {
+   } else if (strcmp(interface, "ivi_application") == 0) {
d->ivi_application =
-   wl_registry_bind(registry, id,
-&ivi_application_interface, 1);
+   wl_registry_bind(registry,
+id, &ivi_application_interface, 1);
+   } else if (strcmp(interface, "zwp_idle_inhibit_manager_v1") == 0) {
+   d->inhibit = wl_registry_bind(registry,
+ id, 
&zwp_idle_inhibit_manager_v1_interface, 1);
}
+
 }
 
 static void
@@ -476,6 +493,9 @@ create_display(void)
 static void
 destroy_display(struct display *display)
 {
+   if (display->inhibit)
+   zwp_idle_inhibit_manager_v1_destroy(display->inhibit);
+
if (display->shm)
wl_shm_destroy(display->shm);
 
-- 
1.9.1

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


[PATCH weston v3 1/8] compositor: Track idle as a per-seat property

2016-04-07 Thread Bryce Harrington
Instead of having a single global idle tracker, track idling separately
for each seat.  Still treat inhibition on any one seat as inhibiting
the screensaver globally, for now.

Signed-off-by: Bryce Harrington 
---
 src/compositor.c |  6 --
 src/compositor.h |  3 ++-
 src/input.c  | 39 ---
 3 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 254e9e4..83cabf7 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3882,9 +3882,11 @@ static int
 idle_handler(void *data)
 {
struct weston_compositor *compositor = data;
+   struct weston_seat *seat;
 
-   if (compositor->idle_inhibit)
-   return 1;
+   wl_list_for_each(seat, &compositor->seat_list, link)
+   if (seat->idle_inhibit)
+   return 1;
 
compositor->state = WESTON_COMPOSITOR_IDLE;
wl_signal_emit(&compositor->idle_signal, compositor);
diff --git a/src/compositor.h b/src/compositor.h
index 8a5aa91..df8ef2d 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -563,6 +563,8 @@ struct weston_seat {
 
struct input_method *input_method;
char *seat_name;
+
+   uint32_t idle_inhibit;
 };
 
 enum {
@@ -724,7 +726,6 @@ struct weston_compositor {
 
uint32_t state;
struct wl_event_source *idle_source;
-   uint32_t idle_inhibit;
int idle_time;  /* timeout, s */
 
const struct weston_pointer_grab_interface *default_pointer_grab;
diff --git a/src/input.c b/src/input.c
index f5bb54e..a3d982e 100644
--- a/src/input.c
+++ b/src/input.c
@@ -151,20 +151,6 @@ weston_seat_repick(struct weston_seat *seat)
 }
 
 static void
-weston_compositor_idle_inhibit(struct weston_compositor *compositor)
-{
-   weston_compositor_wake(compositor);
-   compositor->idle_inhibit++;
-}
-
-static void
-weston_compositor_idle_release(struct weston_compositor *compositor)
-{
-   compositor->idle_inhibit--;
-   weston_compositor_wake(compositor);
-}
-
-static void
 pointer_focus_view_destroyed(struct wl_listener *listener, void *data)
 {
struct weston_pointer *pointer =
@@ -1242,7 +1228,8 @@ notify_button(struct weston_seat *seat, uint32_t time, 
int32_t button,
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
 
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
-   weston_compositor_idle_inhibit(compositor);
+   weston_compositor_wake(compositor);
+   seat->idle_inhibit++;
if (pointer->button_count == 0) {
pointer->grab_button = button;
pointer->grab_time = time;
@@ -1251,7 +1238,8 @@ notify_button(struct weston_seat *seat, uint32_t time, 
int32_t button,
}
pointer->button_count++;
} else {
-   weston_compositor_idle_release(compositor);
+   seat->idle_inhibit--;
+   weston_compositor_wake(compositor);
pointer->button_count--;
}
 
@@ -1540,9 +1528,11 @@ notify_key(struct weston_seat *seat, uint32_t time, 
uint32_t key,
uint32_t *k, *end;
 
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
-   weston_compositor_idle_inhibit(compositor);
+   weston_compositor_wake(compositor);
+   seat->idle_inhibit++;
} else {
-   weston_compositor_idle_release(compositor);
+   seat->idle_inhibit--;
+   weston_compositor_wake(compositor);
}
 
end = keyboard->keys.data + keyboard->keys.size;
@@ -1625,7 +1615,8 @@ notify_keyboard_focus_in(struct weston_seat *seat, struct 
wl_array *keys,
serial = wl_display_next_serial(compositor->wl_display);
wl_array_copy(&keyboard->keys, keys);
wl_array_for_each(k, &keyboard->keys) {
-   weston_compositor_idle_inhibit(compositor);
+   weston_compositor_wake(compositor);
+   seat->idle_inhibit++;
if (update_state == STATE_UPDATE_AUTOMATIC)
update_modifier_state(seat, serial, *k,
  WL_KEYBOARD_KEY_STATE_PRESSED);
@@ -1650,7 +1641,8 @@ notify_keyboard_focus_out(struct weston_seat *seat)
 
serial = wl_display_next_serial(compositor->wl_display);
wl_array_for_each(k, &keyboard->keys) {
-   weston_compositor_idle_release(compositor);
+   seat->idle_inhibit--;
+   weston_compositor_wake(compositor);
update_modifier_state(seat, serial, *k,
  WL_KEYBOARD_KEY_STATE_RELEASED);
}
@@ -1739,8 +1731,8 @@ notify_touch(struct weston_seat *seat, uint32_t time, int 
touch_id,
 
switch (touch_type) {
case WL_TOUCH_DOWN:
-   weston_compositor_idle_inhibit(ec);
-
+   weston_compositor_wake(ec);
+

[PATCH weston v3 3/8] compositor: If the output is inhibited, don't idle it off

2016-04-07 Thread Bryce Harrington
Adds a helper routine weston_output_inhibited_outputs() which returns a
mask of outputs that should inhibit screen idling.

Use this routine to check for inhibiting outputs for handling of idle
behaviors in core:  In sleep mode, only halt repainting outputs that
don't have valid inhibits.  Don't send these monitors DPMS off commands
either, if the system would otherwise be powering them down.

Signed-off-by: Bryce Harrington 
---
 src/compositor.c | 62 +---
 src/compositor.h |  2 ++
 2 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 9531a0a..8e01d38 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2389,15 +2389,48 @@ weston_output_schedule_repaint_reset(struct 
weston_output *output)
 weston_compositor_read_input, compositor);
 }
 
+/** Retrieves a mask of outputs that should inhibit screensaving
+ *
+ * \param compositor The compositor instance.
+ * \return An output mask indicating the ids of all inhibiting outputs
+ *
+ *  Checks for surfaces whose clients have requested that they
+ *  disable the screenserver and display powersaving while they are
+ *  'active' (as defined by the particular shell being used).  Note
+ *  the output ids for these surfaces.
+ *
+ */
+WL_EXPORT uint32_t
+weston_output_inhibited_outputs(struct weston_compositor *compositor)
+{
+   struct weston_view *view;
+   uint32_t inhibited_outputs_mask = 0;
+
+   wl_list_for_each(view, &compositor->view_list, link) {
+   /* Only look at views whose surfaces are considered "active" by 
the shell */
+   if (!view->surface->active)
+   continue;
+
+   /* Does the view's surface inhibit this output? */
+   if (!view->surface->inhibit_screensaving)
+   continue;
+
+   inhibited_outputs_mask |= view->output_mask;
+   }
+   return inhibited_outputs_mask;
+}
+
 static int
 output_repaint_timer_handler(void *data)
 {
struct weston_output *output = data;
struct weston_compositor *compositor = output->compositor;
+   uint32_t inhibited_outputs_mask = 
weston_output_inhibited_outputs(compositor);
 
if (output->repaint_needed &&
-   compositor->state != WESTON_COMPOSITOR_SLEEPING &&
compositor->state != WESTON_COMPOSITOR_OFFSCREEN &&
+   (compositor->state != WESTON_COMPOSITOR_SLEEPING
+|| inhibited_outputs_mask & (1 << output->id)) &&
weston_output_repaint(output) == 0)
return 0;
 
@@ -2519,9 +2552,15 @@ weston_output_schedule_repaint(struct weston_output 
*output)
 {
struct weston_compositor *compositor = output->compositor;
struct wl_event_loop *loop;
+   uint32_t inhibited_outputs_mask = 
weston_output_inhibited_outputs(compositor);
 
-   if (compositor->state == WESTON_COMPOSITOR_SLEEPING ||
-   compositor->state == WESTON_COMPOSITOR_OFFSCREEN)
+   /* If we're offscreen, or if we're sleeping and the monitor
+* isn't currently being inhibited by an active surface, then
+* skip repainting.
+*/
+   if (compositor->state == WESTON_COMPOSITOR_OFFSCREEN ||
+   (compositor->state == WESTON_COMPOSITOR_SLEEPING &&
+!(inhibited_outputs_mask & (1 << output->id
return;
 
if (!output->repaint_needed)
@@ -3863,11 +3902,20 @@ static void
 weston_compositor_dpms(struct weston_compositor *compositor,
   enum dpms_enum state)
 {
-struct weston_output *output;
+   struct weston_output *output;
+   struct weston_view *view;
+   uint32_t inhibited_outputs_mask = 
weston_output_inhibited_outputs(compositor);
 
-wl_list_for_each(output, &compositor->output_list, link)
-   if (output->set_dpms)
-   output->set_dpms(output, state);
+   wl_list_for_each(output, &compositor->output_list, link) {
+   if (!output->set_dpms)
+   continue;
+
+   /* If output is inhibited, don't do DPMS. */
+   if (inhibited_outputs_mask & (1 << output->id))
+   continue;
+
+   output->set_dpms(output, state);
+   }
 }
 
 WL_EXPORT void
diff --git a/src/compositor.h b/src/compositor.h
index d8d5368..98f73b6 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -1206,6 +1206,8 @@ void
 weston_output_finish_frame(struct weston_output *output,
   const struct timespec *stamp,
   uint32_t presented_flags);
+uint32_t
+weston_output_inhibited_outputs(struct weston_compositor *compositor);
 void
 weston_output_schedule_repaint(struct weston_output *output);
 void
-- 
1.9.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesk

[PATCH weston v3 2/8] compositor: Track inhibition state in weston_surface

2016-04-07 Thread Bryce Harrington
Signed-off-by: Bryce Harrington 
---
v3: Rename inhibit_screensaving to inhibit_idling

 desktop-shell/shell.c   |  4 +++-
 fullscreen-shell/fullscreen-shell.c | 25 +++---
 ivi-shell/ivi-shell.c   |  4 +++-
 src/compositor.c| 42 +
 src/compositor.h| 27 +---
 src/input.c | 15 -
 tests/weston-test.c |  8 +--
 7 files changed, 96 insertions(+), 29 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 780902d..6e49076 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5055,7 +5055,9 @@ activate(struct desktop_shell *shell, struct 
weston_surface *es,
 * Leave fullscreen surfaces on unrelated outputs alone. */
lower_fullscreen_layer(shell, shsurf->output);
 
-   weston_surface_activate(es, seat);
+   weston_surface_assign_keyboard(es, seat);
+   if (es != NULL)
+   weston_surface_activate(es);
 
state = ensure_focus_state(shell, seat);
if (state == NULL)
diff --git a/fullscreen-shell/fullscreen-shell.c 
b/fullscreen-shell/fullscreen-shell.c
index abc4e84..e1f8a63 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -88,8 +88,11 @@ pointer_focus_changed(struct wl_listener *listener, void 
*data)
 {
struct weston_pointer *pointer = data;
 
-   if (pointer->focus && pointer->focus->surface->resource)
-   weston_surface_activate(pointer->focus->surface, pointer->seat);
+   if (pointer->focus && pointer->focus->surface->resource) {
+   weston_surface_assign_keyboard(pointer->focus->surface, 
pointer->seat);
+   if (pointer->focus->surface != NULL)
+   weston_surface_activate(pointer->focus->surface);
+   }
 }
 
 static void
@@ -118,7 +121,9 @@ seat_caps_changed(struct wl_listener *l, void *data)
if (keyboard && keyboard->focus != NULL) {
wl_list_for_each(fsout, &listener->shell->output_list, link) {
if (fsout->surface) {
-   weston_surface_activate(fsout->surface, seat);
+   weston_surface_assign_keyboard(fsout->surface, 
seat);
+   if (fsout->surface != NULL)
+   weston_surface_activate(fsout->surface);
return;
}
}
@@ -703,8 +708,11 @@ fullscreen_shell_present_surface(struct wl_client *client,
struct weston_keyboard *keyboard =
weston_seat_get_keyboard(seat);
 
-   if (keyboard && !keyboard->focus)
-   weston_surface_activate(surface, seat);
+   if (keyboard && !keyboard->focus) {
+   weston_surface_assign_keyboard(surface, seat);
+   if (surface != NULL)
+   weston_surface_activate(surface);
+   }
}
}
 }
@@ -754,8 +762,11 @@ fullscreen_shell_present_surface_for_mode(struct wl_client 
*client,
struct weston_keyboard *keyboard =
weston_seat_get_keyboard(seat);
 
-   if (keyboard && !keyboard->focus)
-   weston_surface_activate(surface, seat);
+   if (keyboard && !keyboard->focus) {
+   weston_surface_assign_keyboard(surface, seat);
+   if (surface != NULL)
+   weston_surface_activate(surface);
+   }
}
 }
 
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index a767ccf..59f5656 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -425,7 +425,9 @@ activate_binding(struct weston_seat *seat,
if (get_ivi_shell_surface(main_surface) == NULL)
return;
 
-   weston_surface_activate(focus, seat);
+   weston_surface_assign_keyboard(focus, seat);
+   if (focus != NULL)
+   weston_surface_activate(focus);
 }
 
 static void
diff --git a/src/compositor.c b/src/compositor.c
index 83cabf7..9531a0a 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -612,6 +612,9 @@ weston_surface_create(struct weston_compositor *compositor)
weston_matrix_init(&surface->buffer_to_surface_matrix);
weston_matrix_init(&surface->surface_to_buffer_matrix);
 
+   surface->active = false;
+   surface->inhibit_idling = false;
+
return surface;
 }
 
@@ -3422,6 +3425,45 @@ weston_surface_copy_content(struct weston_surface 
*surface,
 src_x, src_y, width, height);
 }
 
+/** Sets the keyboard focus to the given surface
+ */
+WL_EXPORT void
+weston_surface_assig

Re: [PATCH weston v2 03/10] compositor: Track surface activity

2016-04-07 Thread Bryce Harrington
On Mon, Mar 28, 2016 at 06:17:43PM -0700, Bryce Harrington wrote:
> On Mon, Mar 28, 2016 at 10:25:24AM +0300, Giulio Camuffo wrote:
> > 2016-03-24 20:27 GMT+02:00 Bryce Harrington :
> > > Surfaces flagged as 'active' are considered of primary urgency to the
> > > user.  It might be the surface with the keyboard focus or displaying
> > > something important; the exact specification of what 'active' means is
> > > left as shell-specific.
> > >
> > > An 'active' surface may be granted special treatment by the compositor.
> > > For instance, it may only honor inhibition requests by active surfaces.
> > >
> > > Signed-off-by: Bryce Harrington 
> > > ---
> > >  src/compositor.c | 41 +
> > >  src/compositor.h | 20 +---
> > >  src/input.c  | 15 ---
> > >  3 files changed, 58 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/src/compositor.c b/src/compositor.c
> > > index 4b091b0..574a0b8 100644
> > > --- a/src/compositor.c
> > > +++ b/src/compositor.c
> > > @@ -612,6 +612,7 @@ weston_surface_create(struct weston_compositor 
> > > *compositor)
> > > weston_matrix_init(&surface->buffer_to_surface_matrix);
> > > weston_matrix_init(&surface->surface_to_buffer_matrix);
> > >
> > > +   surface->active = false;
> > > surface->inhibit_screensaving = false;
> > >
> > > return surface;
> > > @@ -3424,6 +3425,46 @@ weston_surface_copy_content(struct weston_surface 
> > > *surface,
> > >  src_x, src_y, width, height);
> > >  }
> > >
> > > +/** Set surface as active.
> > > + *
> > > + *  Marks a surface as considered 'active' by the shell
> > > + *  and gives the surface keyboard focus.
> > > + */
> > > +WL_EXPORT void
> > > +weston_surface_activate(struct weston_surface *surface,
> > > +struct weston_seat *seat)
> > 
> > weston_surface_activate was previously only setting the keyboard
> > focus, even though the name of the function was maybe ill chosen. Now
> > you're giving it another meaning, that is it sets the 'active' state
> > of the surface (as the name of the function suggests) but you're
> > keeping the old meaning too.
> 
> Yeah, I know, it seems a bit awkward to me too.
> 
> > I would split them apart, a shell may
> > want to e.g. set also the pointer focus surface as active, while
> > keeping the keyboard focus where it is.
> 
> I was tempted to do this too, but wasn't sure if that might be too
> invasive of a change?

I went ahead and did this change and will post v3 directly.

In fact it did require tweaks to each of the shells, although the
changes were reasonably contained.

Thanks again,
Bryce
 
> Thanks for the review,
> Bryce
> 
> > Cheers,
> > Giulio
> > 
> > > +{
> > > +struct weston_compositor *compositor = seat->compositor;
> > > +struct weston_keyboard *keyboard = 
> > > weston_seat_get_keyboard(seat);
> > > +
> > > +   surface->active = true;
> > > +
> > > +if (keyboard) {
> > > +weston_keyboard_set_focus(keyboard, surface);
> > > +wl_data_device_set_keyboard_focus(seat);
> > > +}
> > > +
> > > +wl_signal_emit(&compositor->activate_signal, surface);
> > > +}
> > > +
> > > +/** Set surface as inactive.
> > > + *
> > > + *  Marks a surface as no longer considered 'active' by the shell.
> > > + *  Note that this does not change keyboard focus.
> > > + */
> > > +WL_EXPORT void
> > > +weston_surface_deactivate(struct weston_surface *surface,
> > > +  struct weston_seat *seat)
> > > +{
> > > +   surface->active = false;
> > > +}
> > > +
> > > +WL_EXPORT bool
> > > +weston_surface_is_active(struct weston_surface *surface)
> > > +{
> > > +   return surface->active;
> > > +}
> > > +
> > >  static void
> > >  subsurface_set_position(struct wl_client *client,
> > > struct wl_resource *resource, int32_t x, int32_t 
> > > y)
> > > diff --git a/src/compositor.h b/src/compositor.h
> > > index d982feb..9a9ab1a 100644
> > > --- a/src/compositor.h
> > > +++ b/src/compositor.h
> > > @@ -1039,11 +1039,19 @@ struct weston_surface {
> > > struct weston_timeline_object timeline;
> > >
> > > /*
> > > +* A shell-specific indicator that the surface is in immediate
> > > +* use by the user.  For example, the surface might have keyboard
> > > +* focus.
> > > +*/
> > > +   bool active;
> > > +
> > > +   /*
> > >  * Indicates the surface prefers no screenblanking, screensaving,
> > >  * or other automatic obscurement to kick in while the surface is
> > >  * considered "active" by the shell.
> > >  */
> > > bool inhibit_screensaving;
> > > +
> > >  };
> > >
> > >  struct weston_subsurface {
> > > @@ -1129,9 +1137,6 @@ int
> > >  weston_spring_done(struct weston_spring *spring);
> > >
> > >  void
> > > -weston_surface_activate(struct 

Re: [PATCH weston v2 01/10] compositor: Track idle as a per-seat property

2016-04-07 Thread Bryce Harrington
On Thu, Apr 07, 2016 at 08:44:44AM +0300, Giulio Camuffo wrote:
> 2016-04-07 1:46 GMT+03:00 Bryce Harrington :
> > On Mon, Mar 28, 2016 at 10:17:20AM +0300, Giulio Camuffo wrote:
> >> 2016-03-24 20:27 GMT+02:00 Bryce Harrington :
> >> > Instead of having a single global idle tracker, track idling separately
> >> > for each seat.  Still treat inhibition on any one seat as inhibiting
> >> > the screensaver globally, for now.
> >> >
> >> > Signed-off-by: Bryce Harrington 
> >> > ---
> >> >  src/compositor.c |  6 --
> >> >  src/compositor.h |  3 ++-
> >> >  src/input.c  | 39 ---
> >> >  3 files changed, 22 insertions(+), 26 deletions(-)
> >> >
> >> > diff --git a/src/compositor.c b/src/compositor.c
> >> > index 254e9e4..83cabf7 100644
> >> > --- a/src/compositor.c
> >> > +++ b/src/compositor.c
> >> > @@ -3882,9 +3882,11 @@ static int
> >> >  idle_handler(void *data)
> >> >  {
> >> > struct weston_compositor *compositor = data;
> >> > +   struct weston_seat *seat;
> >> >
> >> > -   if (compositor->idle_inhibit)
> >> > -   return 1;
> >> > +   wl_list_for_each(seat, &compositor->seat_list, link)
> >> > +   if (seat->idle_inhibit)
> >> > +   return 1;
> >> >
> >> > compositor->state = WESTON_COMPOSITOR_IDLE;
> >> > wl_signal_emit(&compositor->idle_signal, compositor);
> >> > diff --git a/src/compositor.h b/src/compositor.h
> >> > index 8a5aa91..df8ef2d 100644
> >> > --- a/src/compositor.h
> >> > +++ b/src/compositor.h
> >> > @@ -563,6 +563,8 @@ struct weston_seat {
> >> >
> >> > struct input_method *input_method;
> >> > char *seat_name;
> >> > +
> >> > +   uint32_t idle_inhibit;
> >> >  };
> >> >
> >> >  enum {
> >> > @@ -724,7 +726,6 @@ struct weston_compositor {
> >> >
> >> > uint32_t state;
> >> > struct wl_event_source *idle_source;
> >> > -   uint32_t idle_inhibit;
> >> > int idle_time;  /* timeout, s */
> >> >
> >> > const struct weston_pointer_grab_interface *default_pointer_grab;
> >> > diff --git a/src/input.c b/src/input.c
> >> > index f5bb54e..a3d982e 100644
> >> > --- a/src/input.c
> >> > +++ b/src/input.c
> >> > @@ -151,20 +151,6 @@ weston_seat_repick(struct weston_seat *seat)
> >> >  }
> >> >
> >> >  static void
> >> > -weston_compositor_idle_inhibit(struct weston_compositor *compositor)
> >> > -{
> >> > -   weston_compositor_wake(compositor);
> >> > -   compositor->idle_inhibit++;
> >> > -}
> >> > -
> >> > -static void
> >> > -weston_compositor_idle_release(struct weston_compositor *compositor)
> >> > -{
> >> > -   compositor->idle_inhibit--;
> >> > -   weston_compositor_wake(compositor);
> >> > -}
> >> > -
> >> > -static void
> >> >  pointer_focus_view_destroyed(struct wl_listener *listener, void *data)
> >> >  {
> >> > struct weston_pointer *pointer =
> >> > @@ -1242,7 +1228,8 @@ notify_button(struct weston_seat *seat, uint32_t 
> >> > time, int32_t button,
> >> > struct weston_pointer *pointer = weston_seat_get_pointer(seat);
> >> >
> >> > if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
> >> > -   weston_compositor_idle_inhibit(compositor);
> >> > +   weston_compositor_wake(compositor);
> >> > +   seat->idle_inhibit++;
> >>
> >> Seeing you have these two lines (and the decrement ones too) many
> >> times in the code i think it would make sense to have
> >> weston_seat_idle_inhibit/release(), as the
> >> weston_compositor_idle_inhibit/release() you are removing.
> >
> > The problem here is that before we were doing two different operations
> > on the compositor, now we're doing them on two different objects, so the
> > routines would be kind of a hodge-podge:
> >
> > static void
> > weston_seat_inhibit_idle(struct weston_seat *seat,
> >  struct weston_compositor *compositor)
> > {
> > weston_compositor_wake(compositor);
> 
> But weston_seat has a compositor member, no need to pass it here.

Ah, true enough.  That would mostly address the issue that was bugging me.

> > seat->idle_inhibit++;
> > }
> >
> > static void
> > weston_seat_release_idle(struct weston_seat *seat,
> >  struct weston_compositor *compositor)
> > {
> > seat->idle_inhibit--;
> > weston_compositor_wake(compositor);
> > }
> >
> > I feel it's clearer to just eliminate the functions and inline their
> > code.  The delta is only 3 lines for the first routine and 4 for the
> > second, which doesn't seem worth the overhead of having them split out.
> 
> It's sure no biggie, but i think it would be clearer with the functions.
> Either way, Reviewed-By: Giulio Camuffo 

Thanks for reviewing.

Yeah I could go either way with this, especially with the fix you
suggest.  I've got the v3 patchset ready to go now, with the code as it
is.  Why don't I post it without the helpers, and see if anyone 

Re: [PATCH weston v2] Makefile: Fix compilation error when git commit message has quotes

2016-04-07 Thread Bryce Harrington
On Thu, Apr 07, 2016 at 04:53:31PM +, Chokshi, Mitul wrote:
> 
> A double-quote in log message prematurely ends the enquoted string
> in src/git-version.h, causing an error during compilation.
> Used stream editor to replace " with \"
> 
> Signed-off-by: Mitul Chokshi 
> ---
>  Makefile.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index d1644ac..a09ea0b 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -162,7 +162,7 @@ endif
>  
>  if HAVE_GIT_REPO
>  src/git-version.h : $(top_srcdir)/.git/logs/HEAD
> - $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
> --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
> --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@
> + $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
> --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
> --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)' | $(SED) 
> 's|\"|\\\"|g' )\"" > $@
>  else
>  src/git-version.h :
>   $(AM_V_GEN)echo "#define BUILD_ID \"unknown (not built from git or 
> tarball)\"" > $@

Confirmed:

$ echo "foo" >> README
$ git commit README -m "testing \""

$ make
make  all-am
make[1]: Entering directory `/home/bryce/src/Wayland/weston'
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `echo "  GEN " src/git-version.h;echo "#define 
BUILD_ID \"1.9.0-168-gb1f52e1 testing " (2016-04-07 10:53:15 -0700)\"" > 
src/git-version.h'
make[1]: *** [src/git-version.h] Error 1
make[1]: Leaving directory `/home/bryce/src/Wayland/weston'
make: *** [all] Error 2

With the patch applied, the make passes properly.

Tested-by: Bryce Harrington 

> -- 
> 1.9.1
> > --
> Intel Research and Development Ireland Limited
> Registered in Ireland
> Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
> Registered Number: 308263
> 
> 
> This e-mail and any attachments may contain confidential material for the sole
> use of the intended recipient(s). Any review or distribution by others is
> strictly prohibited. If you are not the intended recipient, please contact the
> sender and delete all copies.
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v2] Makefile: Fix compilation error when git commit message has quotes

2016-04-07 Thread Chokshi, Mitul

A double-quote in log message prematurely ends the enquoted string
in src/git-version.h, causing an error during compilation.
Used stream editor to replace " with \"

Signed-off-by: Mitul Chokshi 
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index d1644ac..a09ea0b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -162,7 +162,7 @@ endif
 
 if HAVE_GIT_REPO
 src/git-version.h : $(top_srcdir)/.git/logs/HEAD
-   $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
--git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
--git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@
+   $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
--git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
--git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)' | $(SED) 's|\"|\\\"|g' 
)\"" > $@
 else
 src/git-version.h :
$(AM_V_GEN)echo "#define BUILD_ID \"unknown (not built from git or 
tarball)\"" > $@
-- 
1.9.1

--
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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


RE: [PATCH] Fix compilation error when git commit message has quotes (")

2016-04-07 Thread Chokshi, Mitul
Hi Yong,

Thanks for the review comments. I'll send the updated patch shortly.

Regards,
Mitul

-Original Message-
From: Yong Bakos [mailto:j...@humanoriented.com] 
Sent: Thursday, April 7, 2016 3:40 PM
To: Chokshi, Mitul ; 
wayland-devel@lists.freedesktop.org
Subject: Re: [PATCH] Fix compilation error when git commit message has quotes 
(")

> On Apr 7, 2016, at 3:14 AM, Chokshi, Mitul  wrote:
> 
> 
> Used stream editor to replace " with \"
> 
> Signed-off-by: Mitul Chokshi 
> ---
> Makefile.am | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am index d1644ac..a09ea0b 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -162,7 +162,7 @@ endif
> 
> if HAVE_GIT_REPO
> src/git-version.h : $(top_srcdir)/.git/logs/HEAD
> - $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
> --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
> --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@
> + $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
> +--git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
> +--git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)' | $(SED) 
> +'s|\"|\\\"|g' )\"" > $@
> else
> src/git-version.h :
>   $(AM_V_GEN)echo "#define BUILD_ID \"unknown (not built from git or 
> tarball)\"" > $@
> --
> 1.9.1


Hi Mitul,
Thanks for the patch - it's something I've reviewed, but it took me time to
answer:

1) What repository/project is this for?
   Using a subject line of [PATCH weston] is preferred.
   Tip: git config --add format.subjectprefix "PATCH `basename $PWD`"

2) What problem does this fix?
   "A double-quote in a log message prematurely ends the enquoted string
   in src/git-version.h, causing an error during compilation."
   I know this is a simple patch, but writing a good commit message goes
   a long way in speeding up a review.

3) The maintainers prefer a short prefix for the first line of the commit
   message. eg: "makefile: Fix compilation error when..."

(btw, you're way more experienced than I am at this, so please forgive me if 
you already know all this.)

Reviewed-by: Yong Bakos 

yong

--
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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


Re: [PATCH v4 xdg-shell-unstable-v6] xdg-shell: add preferred min/max size requests

2016-04-07 Thread Olivier Fourdan
Hi Yong,

- Original Message -
> Hi Olivier,
> Some minor spelling corrections below. (Same as the previous response,
> replying again to associate with this latest patch version.) I'm happy
> to correct these with my own separate patch after this is merged.
> 
> 
> > ---
> > v2: Rename the request to "set_preferred_max_size",
> > add "set_preferred_min_size" as well
> > v3: Rebase above patch 72427 in branch xdg-shell-unstable-v6
> > Rephrase description to clarify the unscaled size and using 0 to
> > reset back the preferred size to an unspecified state
> > v4: Patch the correct xml file (v6, not v5 )
> > Fix mutliple mismatch of min/max in the description
> 
> multiple

These are notes for the reviewers, they won't end up in the patch itself nor in 
the git log, so it doesn't really count.

The others do though, I'll fix these typos in my next iteration, I guess you 
can sense some sort of copy/paste pattern :)

Thanks!
Olivier
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v3] xdg-shell: add preferred min/max size requests

2016-04-07 Thread Yong Bakos
> On Apr 7, 2016, at 1:56 AM, Olivier Fourdan  wrote:
> 
> Some application may wish to restrict their window in size, but
> xdg-shell has no mechanism for the client to advertise such a maximum
> or minimum size the compositor can use.
> 
> As a result, the compositor may try to maximize or fullscreen a window
> while the client would not allow for the requested size.
> 
> Add new requests "set_preferred_max_size" and "set_preferred_min_size"
> to xdg-shell so that the client can tell the compositor which would be
> its preferred smallest/largest acceptable size, so that he compositor
> can decide if maximize or fullscreen makes sense, draw an accurate
> animation, etc.
> 
> Signed-off-by: Olivier Fourdan 
> Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=764413

Hi Olivier,
Some minor spelling fixes noted below.


> ---
> v2: Rename the request to "set_preferred_max_size",
> add "set_preferred_min_size" as well
> v3: Rebase above patch 72427 in branch xdg-shell-unstable-v6
> Rephrase description to clarify the unscaled size and using 0 to
> reset back the preferred size to an unspecified state
> 
> unstable/xdg-shell/xdg-shell-unstable-v5.xml | 62 
> 1 file changed, 62 insertions(+)
> 
> diff --git a/unstable/xdg-shell/xdg-shell-unstable-v5.xml 
> b/unstable/xdg-shell/xdg-shell-unstable-v5.xml
> index 542491f..6e7fa6e 100644
> --- a/unstable/xdg-shell/xdg-shell-unstable-v5.xml
> +++ b/unstable/xdg-shell/xdg-shell-unstable-v5.xml
> @@ -462,6 +462,68 @@
>   
> 
> 
> +
> +  
> +Set a preferred maximum size for the surface.
> +
> +The client can specify a preferred maximum size to tell the
> +compositor that a surface should not be resized beyond this
> +size.
> +
> +The compositor may use this information from the client to allow
> +or disallow different states like maximixe or fullscreen and

maximize

> +draw accurate animations.
> +
> +Similarily, a tiling window manager can use this information to

Similarly


> +place and resize client windows in a more effective way.
> +
> +If never set, the size of the surface is not limited by the client.
> +
> +A value of zero in the request for either width, height or both
> +means that the client has no preference regarding the minimum size
> +in the given dimension. As a result, a client wishing to reset the
> +preferred minimum size to an unspecified state can use zero for
> +width and height in the request.
> +
> +The values provided by the client are unscaled, the compositor
> +needs to apply the relevant scale for the surface for its own
> +size computations.
> +  
> +  
> +  
> +
> +
> +
> +  
> +Set a preferred minimum size for the surface.
> +
> +The client can specify a preferred minimum size to tell the
> +compositor that a surface should not be resized below this
> +size.
> +
> +The compositor may use this information from the client to allow
> +or disallow different states like maximixe or fullscreen and

maximize


> +draw accurate animations.
> +
> +Similarily, a tiling window manager can use this information to

Similarly


> +place and resize client windows in a more effective way.
> +
> +If never set, the size of the surface is not limited by the client.
> +
> +A value of zero in the request for either width, height or both
> +means that the client has no preference regarding the maximum size
> +in the given dimension. As a result, a client wishing to reset the
> +preferred maximum size to an unspecified state can use zero for
> +width and height in the request.
> +
> +The values provided by the client are unscaled, the compositor

, and the compositor

yong


> +needs to apply the relevant scale for the surface for its own
> +size computations.
> +  
> +  
> +  
> +
> +
> 
>   
> Maximize the surface.
> -- 
> 2.5.5

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


Re: [PATCH v4 xdg-shell-unstable-v6] xdg-shell: add preferred min/max size requests

2016-04-07 Thread Yong Bakos
> On Apr 7, 2016, at 2:39 AM, Olivier Fourdan  wrote:
> 
> Some application may wish to restrict their window in size, but
> xdg-shell has no mechanism for the client to advertise such a maximum
> or minimum preferred size the compositor can use.
> 
> As a result, the compositor may try to maximize or fullscreen a window
> while the client would not allow for the requested size.
> 
> Add new requests "set_preferred_max_size" and "set_preferred_min_size"
> to xdg-shell so that the client can tell the compositor which would be
> its preferred smallest/largest acceptable size, so that he compositor
> can decide if maximize or fullscreen makes sense, draw an accurate
> animation, etc.
> 
> Signed-off-by: Olivier Fourdan 
> Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=764413

Hi Olivier,
Some minor spelling corrections below. (Same as the previous response,
replying again to associate with this latest patch version.) I'm happy
to correct these with my own separate patch after this is merged.


> ---
> v2: Rename the request to "set_preferred_max_size",
> add "set_preferred_min_size" as well
> v3: Rebase above patch 72427 in branch xdg-shell-unstable-v6
> Rephrase description to clarify the unscaled size and using 0 to
> reset back the preferred size to an unspecified state
> v4: Patch the correct xml file (v6, not v5 )
> Fix mutliple mismatch of min/max in the description

multiple


> Remove mention of "unscaled", specify window geometry coordinates
> and refer to set_window_geometry.
> 
> unstable/xdg-shell/xdg-shell-unstable-v6.xml | 60 
> 1 file changed, 60 insertions(+)
> 
> diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml 
> b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> index 3fc7d42..05f28f6 100644
> --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> @@ -489,6 +489,66 @@
>   
> 
> 
> +
> +  
> + Set a preferred maximum size for the window.
> +
> + The client can specify a preferred maximum size to tell the
> + compositor that a window should not be resized beyond this
> + size.
> +
> + The width and height arguments are in window geometry coordinates.
> + See set_window_geometry.
> +
> + The compositor may use this information from the client to allow
> + or disallow different states like maximixe or fullscreen and

maximize


> + draw accurate animations.
> +
> + Similarily, a tiling window manager can use this information to

Similarly,


> + place and resize client windows in a more effective way.
> +
> + If never set, the size of the window is not limited by the client.
> +
> + A value of zero in the request for either width, height or both
> + means that the client has no preference regarding the maximum size
> + in the given dimension. As a result, a client wishing to reset the
> + preferred maximum size to an unspecified state can use zero for
> + width and height in the request.
> +  
> +  
> +  
> +
> +
> +
> +  
> + Set a preferred minimum size for the window.
> +
> + The client can specify a preferred minimum size to tell the
> + compositor that a window should not be resized below this
> + size.
> +
> + The width and height arguments are in window geometry coordinates.
> + See set_window_geometry.
> +
> + The compositor may use this information from the client to allow
> + or disallow different states like maximixe or fullscreen and

maximize


> + draw accurate animations.
> +
> + Similarily, a tiling window manager can use this information to

Similarly

yong


> + place and resize client windows in a more effective way.
> +
> + If never set, the size of the window is not limited by the client.
> +
> + A value of zero in the request for either width, height or both
> + means that the client has no preference regarding the minimum size
> + in the given dimension. As a result, a client wishing to reset the
> + preferred minimum size to an unspecified state can use zero for
> + width and height in the request.
> +  
> +  
> +  
> +
> +
> 
>   
>   Maximize the surface.
> -- 
> 2.5.5

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


Re: [PATCH] Fix compilation error when git commit message has quotes (")

2016-04-07 Thread Olivier Fourdan
Hi,

On 7 April 2016 at 10:14, Chokshi, Mitul  wrote:

> This e-mail and any attachments may contain confidential material for the
> sole
> use of the intended recipient(s).
> ​​
> Any review or distribution by others is
> ​​
> strictly prohibited. If you are not the intended recipient, please contact
> the
> sender and delete all copies.
>

​That footer above in your message might make it a tad risky for anyone to
make a review,
 how to make a review if
​"a​
ny review or distribution by others is
​
​
strictly prohibited
​"​
​ ?

Cheers,
Olivier​
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] Fix compilation error when git commit message has quotes (")

2016-04-07 Thread Yong Bakos
> On Apr 7, 2016, at 3:14 AM, Chokshi, Mitul  wrote:
> 
> 
> Used stream editor to replace " with \"
> 
> Signed-off-by: Mitul Chokshi 
> ---
> Makefile.am | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index d1644ac..a09ea0b 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -162,7 +162,7 @@ endif
> 
> if HAVE_GIT_REPO
> src/git-version.h : $(top_srcdir)/.git/logs/HEAD
> - $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
> --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
> --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@
> + $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
> --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
> --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)' | $(SED) 
> 's|\"|\\\"|g' )\"" > $@
> else
> src/git-version.h :
>   $(AM_V_GEN)echo "#define BUILD_ID \"unknown (not built from git or 
> tarball)\"" > $@
> -- 
> 1.9.1


Hi Mitul,
Thanks for the patch - it's something I've reviewed, but it took me time to
answer:

1) What repository/project is this for?
   Using a subject line of [PATCH weston] is preferred.
   Tip: git config --add format.subjectprefix "PATCH `basename $PWD`"

2) What problem does this fix?
   "A double-quote in a log message prematurely ends the enquoted string
   in src/git-version.h, causing an error during compilation."
   I know this is a simple patch, but writing a good commit message goes
   a long way in speeding up a review.

3) The maintainers prefer a short prefix for the first line of the commit
   message. eg: "makefile: Fix compilation error when..."

(btw, you're way more experienced than I am at this, so please forgive me
if you already know all this.)

Reviewed-by: Yong Bakos 

yong

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


Re: [PATCH wayland v2] Add API to install protocol loggers on the server wl_display

2016-04-07 Thread Yong Bakos

> On Apr 7, 2016, at 6:37 AM, Giulio Camuffo  wrote:
> 
> The new wl_display_add_protocol_logger allows to set a function as
> a logger, which will get called when a new request is received or an
> event is sent.
> This is akin to setting WAYLAND_DEBUG=1, but more powerful because it
> can be enabled at run time and allows to show the log e.g. in a UI view.
> 
> Signed-off-by: Giulio Camuffo 
> ---

This will be very handy! One minor nitpick below, about a doc comment.


> v2: changed the logger function to pass a struct wl_log_message* with all
>the relevant data instead of a string.
> 
> src/wayland-server-core.h |  21 ++
> src/wayland-server.c  | 100 +++---
> 2 files changed, 115 insertions(+), 6 deletions(-)
> 
> diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
> index 9980c29..07a42fc 100644
> --- a/src/wayland-server-core.h
> +++ b/src/wayland-server-core.h
> @@ -514,6 +514,27 @@ wl_shm_buffer_create(struct wl_client *client,
> 
> void wl_log_set_handler_server(wl_log_func_t handler);
> 
> +enum wl_protocol_logger_direction {
> +WL_PROTOCOL_LOGGER_INCOMING,
> +WL_PROTOCOL_LOGGER_OUTGOING,
> +};
> +
> +struct wl_log_message {
> + struct wl_resource *resource;
> + int message_opcode;
> + const struct wl_message *message;
> + int arguments_count;
> + const union wl_argument *arguments;
> +};
> +
> +typedef void (*wl_protocol_logger_func_t)(void *, enum 
> wl_protocol_logger_direction,
> +   const struct wl_log_message *);
> +void wl_add_protocol_logger(struct wl_display *display,
> +wl_protocol_logger_func_t, void *user_data);
> +
> +void wl_remove_protocol_logger(struct wl_display *display,
> +wl_protocol_logger_func_t, void *user_data);
> +
> #ifdef  __cplusplus
> }
> #endif
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index e47ccec..18bbec8 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -95,6 +95,7 @@ struct wl_display {
>   struct wl_list global_list;
>   struct wl_list socket_list;
>   struct wl_list client_list;
> + struct wl_list protocol_loggers;
> 
>   struct wl_signal destroy_signal;
>   struct wl_signal create_client_signal;
> @@ -121,10 +122,45 @@ struct wl_resource {
>   void *data;
>   int version;
>   wl_dispatcher_func_t dispatcher;
> + struct wl_resource *parent;
> +};
> +
> +struct wl_protocol_logger {
> + struct wl_list link;
> + wl_protocol_logger_func_t func;
> + void *user_data;
> };
> 
> static int debug_server = 0;
> 
> +static void
> +closure_log(struct wl_resource *resource,
> + struct wl_closure *closure, int send)
> +{
> + struct wl_object *object = &resource->object;
> + struct wl_display *display = resource->client->display;
> + struct wl_protocol_logger *protocol_logger;
> + struct wl_log_message message;
> +
> + if (debug_server)
> + wl_closure_print(closure, object, send);
> +
> + if (!wl_list_empty(&display->protocol_loggers)) {
> + message.resource = resource;
> + message.message_opcode = closure->opcode;
> + message.message = closure->message;
> + message.arguments_count = closure->count;
> + message.arguments = closure->args;
> + wl_list_for_each(protocol_logger,
> +  &display->protocol_loggers, link) {
> + protocol_logger->func(protocol_logger->user_data,
> +   send ? 
> WL_PROTOCOL_LOGGER_OUTGOING :
> +  
> WL_PROTOCOL_LOGGER_INCOMING,
> +   &message);
> + }
> + }
> +}
> +
> WL_EXPORT void
> wl_resource_post_event_array(struct wl_resource *resource, uint32_t opcode,
>union wl_argument *args)
> @@ -143,8 +179,7 @@ wl_resource_post_event_array(struct wl_resource 
> *resource, uint32_t opcode,
>   if (wl_closure_send(closure, resource->client->connection))
>   resource->client->error = 1;
> 
> - if (debug_server)
> - wl_closure_print(closure, object, true);
> + closure_log(resource, closure, true);
> 
>   wl_closure_destroy(closure);
> }
> @@ -183,8 +218,7 @@ wl_resource_queue_event_array(struct wl_resource 
> *resource, uint32_t opcode,
>   if (wl_closure_queue(closure, resource->client->connection))
>   resource->client->error = 1;
> 
> - if (debug_server)
> - wl_closure_print(closure, object, true);
> + closure_log(resource, closure, true);
> 
>   wl_closure_destroy(closure);
> }
> @@ -331,8 +365,7 @@ wl_client_connection_data(int fd, uint32_t mask, void 
> *data)
>   break;
>   }
> 
> - if (debug_server)
> - wl_c

[PATCH wayland v2] Add API to install protocol loggers on the server wl_display

2016-04-07 Thread Giulio Camuffo
The new wl_display_add_protocol_logger allows to set a function as
a logger, which will get called when a new request is received or an
event is sent.
This is akin to setting WAYLAND_DEBUG=1, but more powerful because it
can be enabled at run time and allows to show the log e.g. in a UI view.

Signed-off-by: Giulio Camuffo 
---

v2: changed the logger function to pass a struct wl_log_message* with all
the relevant data instead of a string.

 src/wayland-server-core.h |  21 ++
 src/wayland-server.c  | 100 +++---
 2 files changed, 115 insertions(+), 6 deletions(-)

diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index 9980c29..07a42fc 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -514,6 +514,27 @@ wl_shm_buffer_create(struct wl_client *client,
 
 void wl_log_set_handler_server(wl_log_func_t handler);
 
+enum wl_protocol_logger_direction {
+WL_PROTOCOL_LOGGER_INCOMING,
+WL_PROTOCOL_LOGGER_OUTGOING,
+};
+
+struct wl_log_message {
+   struct wl_resource *resource;
+   int message_opcode;
+   const struct wl_message *message;
+   int arguments_count;
+   const union wl_argument *arguments;
+};
+
+typedef void (*wl_protocol_logger_func_t)(void *, enum 
wl_protocol_logger_direction,
+ const struct wl_log_message *);
+void wl_add_protocol_logger(struct wl_display *display,
+wl_protocol_logger_func_t, void *user_data);
+
+void wl_remove_protocol_logger(struct wl_display *display,
+wl_protocol_logger_func_t, void *user_data);
+
 #ifdef  __cplusplus
 }
 #endif
diff --git a/src/wayland-server.c b/src/wayland-server.c
index e47ccec..18bbec8 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -95,6 +95,7 @@ struct wl_display {
struct wl_list global_list;
struct wl_list socket_list;
struct wl_list client_list;
+   struct wl_list protocol_loggers;
 
struct wl_signal destroy_signal;
struct wl_signal create_client_signal;
@@ -121,10 +122,45 @@ struct wl_resource {
void *data;
int version;
wl_dispatcher_func_t dispatcher;
+   struct wl_resource *parent;
+};
+
+struct wl_protocol_logger {
+   struct wl_list link;
+   wl_protocol_logger_func_t func;
+   void *user_data;
 };
 
 static int debug_server = 0;
 
+static void
+closure_log(struct wl_resource *resource,
+   struct wl_closure *closure, int send)
+{
+   struct wl_object *object = &resource->object;
+   struct wl_display *display = resource->client->display;
+   struct wl_protocol_logger *protocol_logger;
+   struct wl_log_message message;
+
+   if (debug_server)
+   wl_closure_print(closure, object, send);
+
+   if (!wl_list_empty(&display->protocol_loggers)) {
+   message.resource = resource;
+   message.message_opcode = closure->opcode;
+   message.message = closure->message;
+   message.arguments_count = closure->count;
+   message.arguments = closure->args;
+   wl_list_for_each(protocol_logger,
+&display->protocol_loggers, link) {
+   protocol_logger->func(protocol_logger->user_data,
+ send ? 
WL_PROTOCOL_LOGGER_OUTGOING :
+
WL_PROTOCOL_LOGGER_INCOMING,
+ &message);
+   }
+   }
+}
+
 WL_EXPORT void
 wl_resource_post_event_array(struct wl_resource *resource, uint32_t opcode,
 union wl_argument *args)
@@ -143,8 +179,7 @@ wl_resource_post_event_array(struct wl_resource *resource, 
uint32_t opcode,
if (wl_closure_send(closure, resource->client->connection))
resource->client->error = 1;
 
-   if (debug_server)
-   wl_closure_print(closure, object, true);
+   closure_log(resource, closure, true);
 
wl_closure_destroy(closure);
 }
@@ -183,8 +218,7 @@ wl_resource_queue_event_array(struct wl_resource *resource, 
uint32_t opcode,
if (wl_closure_queue(closure, resource->client->connection))
resource->client->error = 1;
 
-   if (debug_server)
-   wl_closure_print(closure, object, true);
+   closure_log(resource, closure, true);
 
wl_closure_destroy(closure);
 }
@@ -331,8 +365,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
break;
}
 
-   if (debug_server)
-   wl_closure_print(closure, object, false);
+   closure_log(resource, closure, false);
 
if ((resource_flags & WL_MAP_ENTRY_LEGACY) ||
resource->dispatcher == NULL) {
@@ -879,6 +912,7 @@ wl_display_create(void)
wl_lis

Plans for Weston surface remoting for IVI

2016-04-07 Thread Pekka Paalanen
Hi all,

I have written a rough design on how to implement per-surface remoting
on Weston, primarily over network:
https://people.collabora.com/~pq/Adit/Weston-IVI-remoting.pdf

Before you get carried away, I must note that this will not work on
desktops without considerable work. The design is written for ivi-shell
which has a trivial Wayland protocol extension. The design could
support desktops too, in theory, but you will need to think how to get
all the desktop shell protocol features implemented, and you probably
want something friendly to control the remoting, too.

What this design does do, is give a plan how to remote the essentials
of the core Wayland protocol. This includes creating wl_surfaces and
wl_buffers, transmitting pixel data, feedback in the form of frame
callbacks, and also relaying input events, and how to expose remote
output and input to Wayland applications.

The document is not a rigorous technical description, but a high-level
plan on what we will likely be working on in the following months. You
have already seen a few patches or RFCs originating from this work.

Serious feedback is warmly welcome, but please keep in mind that this
work is not aiming for the desktop as is.

I would love to hear if you have plans for or have implemented something
around the idea of remoting individual Wayland surfaces.

Collabora is working on this by the request of ADIT. ADIT is joint
venture company of DENSO Corporation and Bosch GmbH.


Thanks,
pq


pgpsE5azdbk7U.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] Fix compilation error when git commit message has quotes (")

2016-04-07 Thread Chokshi, Mitul

Used stream editor to replace " with \"

Signed-off-by: Mitul Chokshi 
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index d1644ac..a09ea0b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -162,7 +162,7 @@ endif
 
 if HAVE_GIT_REPO
 src/git-version.h : $(top_srcdir)/.git/logs/HEAD
-   $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
--git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
--git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@
+   $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git 
--git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git 
--git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)' | $(SED) 's|\"|\\\"|g' 
)\"" > $@
 else
 src/git-version.h :
$(AM_V_GEN)echo "#define BUILD_ID \"unknown (not built from git or 
tarball)\"" > $@
-- 
1.9.1

--
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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


[PATCH v4 xdg-shell-unstable-v6] xdg-shell: add preferred min/max size requests

2016-04-07 Thread Olivier Fourdan
Some application may wish to restrict their window in size, but
xdg-shell has no mechanism for the client to advertise such a maximum
or minimum preferred size the compositor can use.

As a result, the compositor may try to maximize or fullscreen a window
while the client would not allow for the requested size.

Add new requests "set_preferred_max_size" and "set_preferred_min_size"
to xdg-shell so that the client can tell the compositor which would be
its preferred smallest/largest acceptable size, so that he compositor
can decide if maximize or fullscreen makes sense, draw an accurate
animation, etc.

Signed-off-by: Olivier Fourdan 
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=764413
---
 v2: Rename the request to "set_preferred_max_size",
 add "set_preferred_min_size" as well
 v3: Rebase above patch 72427 in branch xdg-shell-unstable-v6
 Rephrase description to clarify the unscaled size and using 0 to
 reset back the preferred size to an unspecified state
 v4: Patch the correct xml file (v6, not v5 )
 Fix mutliple mismatch of min/max in the description
 Remove mention of "unscaled", specify window geometry coordinates
 and refer to set_window_geometry.

 unstable/xdg-shell/xdg-shell-unstable-v6.xml | 60 
 1 file changed, 60 insertions(+)

diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml 
b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
index 3fc7d42..05f28f6 100644
--- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
+++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
@@ -489,6 +489,66 @@
   
 
 
+
+  
+   Set a preferred maximum size for the window.
+
+   The client can specify a preferred maximum size to tell the
+   compositor that a window should not be resized beyond this
+   size.
+
+   The width and height arguments are in window geometry coordinates.
+   See set_window_geometry.
+
+   The compositor may use this information from the client to allow
+   or disallow different states like maximixe or fullscreen and
+   draw accurate animations.
+
+   Similarily, a tiling window manager can use this information to
+   place and resize client windows in a more effective way.
+
+   If never set, the size of the window is not limited by the client.
+
+   A value of zero in the request for either width, height or both
+   means that the client has no preference regarding the maximum size
+   in the given dimension. As a result, a client wishing to reset the
+   preferred maximum size to an unspecified state can use zero for
+   width and height in the request.
+  
+  
+  
+
+
+
+  
+   Set a preferred minimum size for the window.
+
+   The client can specify a preferred minimum size to tell the
+   compositor that a window should not be resized below this
+   size.
+
+   The width and height arguments are in window geometry coordinates.
+   See set_window_geometry.
+
+   The compositor may use this information from the client to allow
+   or disallow different states like maximixe or fullscreen and
+   draw accurate animations.
+
+   Similarily, a tiling window manager can use this information to
+   place and resize client windows in a more effective way.
+
+   If never set, the size of the window is not limited by the client.
+
+   A value of zero in the request for either width, height or both
+   means that the client has no preference regarding the minimum size
+   in the given dimension. As a result, a client wishing to reset the
+   preferred minimum size to an unspecified state can use zero for
+   width and height in the request.
+  
+  
+  
+
+
 
   
Maximize the surface.
-- 
2.5.5

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


Re: [PATCH 2/5] drm: port the drm backend to the new init api

2016-04-07 Thread Pekka Paalanen
On Thu, 7 Apr 2016 09:04:46 +0300
Giulio Camuffo  wrote:

> 2016-04-06 11:37 GMT+03:00 Pekka Paalanen :
> > On Wed,  9 Mar 2016 16:49:29 -0800
> > Bryce Harrington  wrote:
> >  
> >> From: Giulio Camuffo 
> >>
> >> Signed-off-by: Bryce Harrington 
> >> Reviewed-by: Quentin Glidic 
> >> Acked-by: Pekka Paalanen 
> >> ---
> >> v4: Update to current trunk
> >> - Add missing param doc for mode in drm_output_choose_initial_mode
> >> - Rebase to account for code changes by 91880f1e to make vt
> >>   switching configurable.
> >>
> >>  Makefile.am  |   3 +
> >>  src/compositor-drm.c | 196 
> >> ++-
> >>  src/compositor.h |   2 -
> >>  src/main.c   |  94 +++-
> >>  4 files changed, 165 insertions(+), 130 deletions(-)  
> >
> > Hi Giulio and Bryce,
> >
> > I'm sorry it has taken so long for me to come back to this.
> >  
> >> diff --git a/Makefile.am b/Makefile.am
> >> index fe08d94..9330f0e 100644
> >> --- a/Makefile.am
> >> +++ b/Makefile.am
> >> @@ -72,6 +72,7 @@ weston_SOURCES =\
> >>   src/log.c   \
> >>   src/compositor.c\
> >>   src/compositor.h\
> >> + src/compositor-drm.h\
> >>   src/input.c \
> >>   src/data-device.c   \
> >>   src/screenshooter.c \
> >> @@ -207,6 +208,7 @@ westonincludedir = $(includedir)/weston
> >>  westoninclude_HEADERS =  \
> >>   src/version.h   \
> >>   src/compositor.h\
> >> + src/compositor-drm.h\
> >>   src/timeline-object.h   \
> >>   shared/matrix.h \
> >>   shared/config-parser.h  \
> >> @@ -276,6 +278,7 @@ drm_backend_la_CFLAGS =   \
> >>   $(AM_CFLAGS)
> >>  drm_backend_la_SOURCES = \
> >>   src/compositor-drm.c\
> >> + src/compositor-drm.h\
> >>   $(INPUT_BACKEND_SOURCES)\
> >>   shared/helpers.h\
> >>   shared/timespec-util.h  \
> >> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> >> index e01f6b9..111c882 100644
> >> --- a/src/compositor-drm.c
> >> +++ b/src/compositor-drm.c  
> >  
> >> @@ -2185,30 +2162,45 @@ get_gbm_format_from_section(struct 
> >> weston_config_section *section,
> >>   * Find the most suitable mode to use for initial setup (or 
> >> reconfiguration on
> >>   * hotplug etc) for a DRM output.
> >>   *
> >> + * @param backend The DRM backend object
> >>   * @param output DRM output to choose mode for
> >> - * @param kind Strategy and preference to use when choosing mode
> >> - * @param width Desired width for this output
> >> - * @param height Desired height for this output
> >> + * @param mode Controls how to select the mode
> >> + * @param config Desired configuration for the output
> >>   * @param current_mode Mode currently being displayed on this output
> >> - * @param modeline Manually-entered mode (may be NULL)
> >>   * @returns A mode from the output's mode list, or NULL if none available
> >>   */
> >>  static struct drm_mode *
> >> -drm_output_choose_initial_mode(struct drm_output *output,
> >> -enum output_config kind,
> >> -int width, int height,
> >> -const drmModeModeInfo *current_mode,
> >> -const drmModeModeInfo *modeline)
> >> +drm_output_choose_initial_mode(struct drm_backend *backend,
> >> +struct drm_output *output,
> >> +enum weston_drm_backend_output_mode mode,
> >> +struct weston_drm_backend_output_config 
> >> *config,
> >> +const drmModeModeInfo *current_mode)
> >>  {
> >>   struct drm_mode *preferred = NULL;
> >>   struct drm_mode *current = NULL;
> >>   struct drm_mode *configured = NULL;
> >>   struct drm_mode *best = NULL;
> >>   struct drm_mode *drm_mode;
> >> + drmModeModeInfo modeline;
> >> + int32_t width, height;
> >> +
> >> + if (mode == WESTON_DRM_BACKEND_OUTPUT_PREFERRED && config->modeline) 
> >> {
> >> + if (sscanf(config->modeline, "%dx%d", &width, &height) != 2) 
> >> {
> >> + width = -1;
> >> +
> >> + if (parse_modeline(config->modeline, &modeline) == 
> >> 0) {
> >> + configured = drm_output_add_mode(output, 
> >> &modeline);
> >> + if (!configured)
> >> + return NULL;
> >> + } e