[PATCH weston 2/2] libweston-desktop: Drop (wrongly named) new_buffer in committed
Quentin Glidic
sardemff7+wayland at sardemff7.net
Mon Aug 15 11:51:42 UTC 2016
From: Quentin Glidic <sardemff7+git at sardemff7.net>
Instead we store the buffer move and just use it when the signal is
fired.
Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
libweston-desktop/internal.h | 2 +-
libweston-desktop/surface.c | 64 ++++++++++++++++++----------------------
libweston-desktop/wl-shell.c | 2 +-
libweston-desktop/xdg-shell-v5.c | 2 +-
libweston-desktop/xdg-shell-v6.c | 2 +-
libweston-desktop/xwayland.c | 2 +-
6 files changed, 34 insertions(+), 40 deletions(-)
diff --git a/libweston-desktop/internal.h b/libweston-desktop/internal.h
index 21181a6..a9c974b 100644
--- a/libweston-desktop/internal.h
+++ b/libweston-desktop/internal.h
@@ -96,7 +96,7 @@ struct weston_desktop_surface_implementation {
void (*set_size)(struct weston_desktop_surface *surface,
void *user_data, int32_t width, int32_t height);
void (*committed)(struct weston_desktop_surface *surface, void *user_data,
- bool new_buffer, int32_t sx, int32_t sy);
+ int32_t sx, int32_t sy);
void (*update_position)(struct weston_desktop_surface *surface,
void *user_data);
void (*ping)(struct weston_desktop_surface *surface, uint32_t serial,
diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c
index bdf6dbc..42258db 100644
--- a/libweston-desktop/surface.c
+++ b/libweston-desktop/surface.c
@@ -51,7 +51,7 @@ struct weston_desktop_surface {
void *user_data;
struct weston_surface *surface;
struct wl_list view_list;
- bool has_new_buffer;
+ struct weston_position buffer_move;
struct wl_listener surface_commit_listener;
struct wl_listener surface_destroy_listener;
struct wl_listener client_destroy_listener;
@@ -104,34 +104,6 @@ weston_desktop_surface_update_view_position(struct weston_desktop_surface *surfa
static void
weston_desktop_view_propagate_layer(struct weston_desktop_view *view);
-static void
-weston_desktop_surface_committed_common(struct weston_desktop_surface *surface,
- bool new_buffer, int32_t sx, int32_t sy)
-{
- if (surface->implementation->committed != NULL)
- surface->implementation->committed(surface,
- surface->implementation_data,
- new_buffer, sx, sy);
-
- if (surface->parent != NULL) {
- struct weston_desktop_view *view;
-
- wl_list_for_each(view, &surface->view_list, link) {
- weston_view_set_transform_parent(view->view,
- view->parent->view);
- weston_desktop_view_propagate_layer(view->parent);
- }
- weston_desktop_surface_update_view_position(surface);
- }
-
- if (!wl_list_empty(&surface->children_list)) {
- struct weston_desktop_surface *child;
-
- wl_list_for_each(child, &surface->children_list, children_link)
- weston_desktop_surface_update_view_position(child);
- }
-}
-
static void
weston_desktop_view_destroy(struct weston_desktop_view *view)
{
@@ -197,10 +169,32 @@ weston_desktop_surface_surface_committed(struct wl_listener *listener,
struct weston_desktop_surface *surface =
wl_container_of(listener, surface, surface_commit_listener);
- if (surface->has_new_buffer)
- surface->has_new_buffer = false;
- else
- weston_desktop_surface_committed_common(surface, false, 0, 0);
+ if (surface->implementation->committed != NULL)
+ surface->implementation->committed(surface,
+ surface->implementation_data,
+ surface->buffer_move.x,
+ surface->buffer_move.y);
+
+ if (surface->parent != NULL) {
+ struct weston_desktop_view *view;
+
+ wl_list_for_each(view, &surface->view_list, link) {
+ weston_view_set_transform_parent(view->view,
+ view->parent->view);
+ weston_desktop_view_propagate_layer(view->parent);
+ }
+ weston_desktop_surface_update_view_position(surface);
+ }
+
+ if (!wl_list_empty(&surface->children_list)) {
+ struct weston_desktop_surface *child;
+
+ wl_list_for_each(child, &surface->children_list, children_link)
+ weston_desktop_surface_update_view_position(child);
+ }
+
+ surface->buffer_move.x = 0;
+ surface->buffer_move.y = 0;
}
static void
@@ -229,8 +223,8 @@ weston_desktop_surface_committed(struct weston_surface *wsurface,
{
struct weston_desktop_surface *surface = wsurface->committed_private;
- weston_desktop_surface_committed_common(surface, true, sx, sy);
- surface->has_new_buffer = true;
+ surface->buffer_move.x = sx;
+ surface->buffer_move.y = sy;
}
static void
diff --git a/libweston-desktop/wl-shell.c b/libweston-desktop/wl-shell.c
index 12409cd..7c6a589 100644
--- a/libweston-desktop/wl-shell.c
+++ b/libweston-desktop/wl-shell.c
@@ -89,7 +89,7 @@ weston_desktop_wl_shell_surface_maybe_ungrab(struct weston_desktop_wl_shell_surf
static void
weston_desktop_wl_shell_surface_committed(struct weston_desktop_surface *dsurface,
- void *user_data, bool new_buffer,
+ void *user_data,
int32_t sx, int32_t sy)
{
struct weston_desktop_wl_shell_surface *surface = user_data;
diff --git a/libweston-desktop/xdg-shell-v5.c b/libweston-desktop/xdg-shell-v5.c
index 8a1383d..f8943ab 100644
--- a/libweston-desktop/xdg-shell-v5.c
+++ b/libweston-desktop/xdg-shell-v5.c
@@ -188,7 +188,7 @@ weston_desktop_xdg_surface_set_size(struct weston_desktop_surface *dsurface,
static void
weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface,
- void *user_data, bool new_buffer,
+ void *user_data,
int32_t sx, int32_t sy)
{
struct weston_desktop_xdg_surface *surface = user_data;
diff --git a/libweston-desktop/xdg-shell-v6.c b/libweston-desktop/xdg-shell-v6.c
index 87b8ca8..36fe036 100644
--- a/libweston-desktop/xdg-shell-v6.c
+++ b/libweston-desktop/xdg-shell-v6.c
@@ -1000,7 +1000,7 @@ weston_desktop_xdg_surface_ping(struct weston_desktop_surface *dsurface,
static void
weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface,
- void *user_data, bool new_buffer,
+ void *user_data,
int32_t sx, int32_t sy)
{
struct weston_desktop_xdg_surface *surface = user_data;
diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
index 7362a72..6c63483 100644
--- a/libweston-desktop/xwayland.c
+++ b/libweston-desktop/xwayland.c
@@ -112,7 +112,7 @@ weston_desktop_xwayland_surface_change_state(struct weston_desktop_xwayland_surf
static void
weston_desktop_xwayland_surface_committed(struct weston_desktop_surface *dsurface,
- void *user_data, bool new_buffer,
+ void *user_data,
int32_t sx, int32_t sy)
{
struct weston_desktop_xwayland_surface *surface = user_data;
--
2.9.2
More information about the wayland-devel
mailing list