Re: [PATCH 1/2] compositor: keep track of the weston_layer a weston_view is in

2014-01-28 Thread Bryce W. Harrington
On Mon, Jan 27, 2014 at 09:46:49PM +0200, Giulio Camuffo wrote:
 This introduces a new struct, weston_layer_entry, which is now used
 in place of wl_list to keep the link for the layer list in weston_view
 and the head of the list in weston_layer.
 weston_layer_entry also has a weston_layer*, which points to the layer
 the view is in or, in the case the entry it's the head of the list, to
 the layer itself.

Both patches appear to compile without adding warnings, and no new
failures turn up via make check with this patch applied, so:

Tested-by: Bryce Harrington b.harring...@samsung.com

 ---
  desktop-shell/exposay.c |   4 +-
  desktop-shell/input-panel.c |  11 +++--
  desktop-shell/shell.c   | 115 
 +++-
  src/compositor.c|  33 ++---
  src/compositor.h|  14 +-
  src/data-device.c   |   6 +--
  src/input.c |   4 +-
  tests/weston-test.c |   6 +--
  8 files changed, 114 insertions(+), 79 deletions(-)
 
 diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
 index fe7a3a7..5e4b341 100644
 --- a/desktop-shell/exposay.c
 +++ b/desktop-shell/exposay.c
 @@ -192,7 +192,7 @@ exposay_layout(struct desktop_shell *shell)
   wl_list_init(shell-exposay.surface_list);
  
   shell-exposay.num_surfaces = 0;
 - wl_list_for_each(view, workspace-layer.view_list, layer_link) {
 + wl_list_for_each(view, workspace-layer.view_list.link, 
 layer_link.link) {
   if (!get_shell_surface(view-surface))
   continue;
   shell-exposay.num_surfaces++;
 @@ -243,7 +243,7 @@ exposay_layout(struct desktop_shell *shell)
   shell-exposay.surface_size = output-height / 2;
  
   i = 0;
 - wl_list_for_each(view, workspace-layer.view_list, layer_link) {
 + wl_list_for_each(view, workspace-layer.view_list.link, 
 layer_link.link) {
   int pad;
  
   pad = shell-exposay.surface_size + 
 shell-exposay.padding_inner;
 diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
 index c08a403..d97a248 100644
 --- a/desktop-shell/input-panel.c
 +++ b/desktop-shell/input-panel.c
 @@ -70,8 +70,8 @@ show_input_panels(struct wl_listener *listener, void *data)
 shell-input_panel.surfaces, link) {
   if (ipsurf-surface-width == 0)
   continue;
 - wl_list_insert(shell-input_panel_layer.view_list,
 -ipsurf-view-layer_link);
 + weston_layer_entry_insert(shell-input_panel_layer.view_list,
 +   ipsurf-view-layer_link);
   weston_view_geometry_dirty(ipsurf-view);
   weston_view_update_transform(ipsurf-view);
   weston_surface_damage(ipsurf-surface);
 @@ -97,7 +97,8 @@ hide_input_panels(struct wl_listener *listener, void *data)
   wl_list_remove(shell-input_panel_layer.link);
  
   wl_list_for_each_safe(view, next,
 -   shell-input_panel_layer.view_list, layer_link)
 +   shell-input_panel_layer.view_list.link,
 +   layer_link.link)
   weston_view_unmap(view);
  }
  
 @@ -136,8 +137,8 @@ input_panel_configure(struct weston_surface *surface, 
 int32_t sx, int32_t sy)
   weston_view_set_position(ip_surface-view, x, y);
  
   if (!weston_surface_is_mapped(surface)  shell-showing_input_panels) {
 - wl_list_insert(shell-input_panel_layer.view_list,
 -ip_surface-view-layer_link);
 + weston_layer_entry_insert(shell-input_panel_layer.view_list,
 +   ip_surface-view-layer_link);
   weston_view_update_transform(ip_surface-view);
   weston_surface_damage(surface);
   weston_slide_run(ip_surface-view, 
 ip_surface-view-surface-height * 0.9, 0, NULL, NULL);
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index c275543..51cb298 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -266,12 +266,12 @@ shell_surface_is_top_fullscreen(struct shell_surface 
 *shsurf)
  
   shell = shell_surface_get_shell(shsurf);
  
 - if (wl_list_empty(shell-fullscreen_layer.view_list))
 + if (wl_list_empty(shell-fullscreen_layer.view_list.link))
   return false;
  
 - top_fs_ev = container_of(shell-fullscreen_layer.view_list.next,
 + top_fs_ev = container_of(shell-fullscreen_layer.view_list.link.next,
struct weston_view,
 -  layer_link);
 +  layer_link.link);
   return (shsurf == get_shell_surface(top_fs_ev-surface));
  }
  
 @@ -594,7 +594,8 @@ focus_state_surface_destroy(struct wl_listener *listener, 
 void *data)
   main_surface = weston_surface_get_main_surface(state-keyboard_focus);
  
   

[PATCH 1/2] compositor: keep track of the weston_layer a weston_view is in

2014-01-27 Thread Giulio Camuffo
This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.
---
 desktop-shell/exposay.c |   4 +-
 desktop-shell/input-panel.c |  11 +++--
 desktop-shell/shell.c   | 115 +++-
 src/compositor.c|  33 ++---
 src/compositor.h|  14 +-
 src/data-device.c   |   6 +--
 src/input.c |   4 +-
 tests/weston-test.c |   6 +--
 8 files changed, 114 insertions(+), 79 deletions(-)

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index fe7a3a7..5e4b341 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -192,7 +192,7 @@ exposay_layout(struct desktop_shell *shell)
wl_list_init(shell-exposay.surface_list);
 
shell-exposay.num_surfaces = 0;
-   wl_list_for_each(view, workspace-layer.view_list, layer_link) {
+   wl_list_for_each(view, workspace-layer.view_list.link, 
layer_link.link) {
if (!get_shell_surface(view-surface))
continue;
shell-exposay.num_surfaces++;
@@ -243,7 +243,7 @@ exposay_layout(struct desktop_shell *shell)
shell-exposay.surface_size = output-height / 2;
 
i = 0;
-   wl_list_for_each(view, workspace-layer.view_list, layer_link) {
+   wl_list_for_each(view, workspace-layer.view_list.link, 
layer_link.link) {
int pad;
 
pad = shell-exposay.surface_size + 
shell-exposay.padding_inner;
diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
index c08a403..d97a248 100644
--- a/desktop-shell/input-panel.c
+++ b/desktop-shell/input-panel.c
@@ -70,8 +70,8 @@ show_input_panels(struct wl_listener *listener, void *data)
  shell-input_panel.surfaces, link) {
if (ipsurf-surface-width == 0)
continue;
-   wl_list_insert(shell-input_panel_layer.view_list,
-  ipsurf-view-layer_link);
+   weston_layer_entry_insert(shell-input_panel_layer.view_list,
+ ipsurf-view-layer_link);
weston_view_geometry_dirty(ipsurf-view);
weston_view_update_transform(ipsurf-view);
weston_surface_damage(ipsurf-surface);
@@ -97,7 +97,8 @@ hide_input_panels(struct wl_listener *listener, void *data)
wl_list_remove(shell-input_panel_layer.link);
 
wl_list_for_each_safe(view, next,
- shell-input_panel_layer.view_list, layer_link)
+ shell-input_panel_layer.view_list.link,
+ layer_link.link)
weston_view_unmap(view);
 }
 
@@ -136,8 +137,8 @@ input_panel_configure(struct weston_surface *surface, 
int32_t sx, int32_t sy)
weston_view_set_position(ip_surface-view, x, y);
 
if (!weston_surface_is_mapped(surface)  shell-showing_input_panels) {
-   wl_list_insert(shell-input_panel_layer.view_list,
-  ip_surface-view-layer_link);
+   weston_layer_entry_insert(shell-input_panel_layer.view_list,
+ ip_surface-view-layer_link);
weston_view_update_transform(ip_surface-view);
weston_surface_damage(surface);
weston_slide_run(ip_surface-view, 
ip_surface-view-surface-height * 0.9, 0, NULL, NULL);
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index c275543..51cb298 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -266,12 +266,12 @@ shell_surface_is_top_fullscreen(struct shell_surface 
*shsurf)
 
shell = shell_surface_get_shell(shsurf);
 
-   if (wl_list_empty(shell-fullscreen_layer.view_list))
+   if (wl_list_empty(shell-fullscreen_layer.view_list.link))
return false;
 
-   top_fs_ev = container_of(shell-fullscreen_layer.view_list.next,
+   top_fs_ev = container_of(shell-fullscreen_layer.view_list.link.next,
 struct weston_view,
-layer_link);
+layer_link.link);
return (shsurf == get_shell_surface(top_fs_ev-surface));
 }
 
@@ -594,7 +594,8 @@ focus_state_surface_destroy(struct wl_listener *listener, 
void *data)
main_surface = weston_surface_get_main_surface(state-keyboard_focus);
 
next = NULL;
-   wl_list_for_each(view, state-ws-layer.view_list, layer_link) {
+   wl_list_for_each(view,
+state-ws-layer.view_list.link, layer_link.link) {
if (view-surface == main_surface)