libweston-desktop: Drop (wrongly named) new_buffer in committed

Instead we store the buffer move and just use it when the signal is
fired.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
dev
Quentin Glidic 8 years ago committed by Jonas Ådahl
parent cba26e7b65
commit 003da8863b
  1. 2
      libweston-desktop/internal.h
  2. 64
      libweston-desktop/surface.c
  3. 2
      libweston-desktop/wl-shell.c
  4. 2
      libweston-desktop/xdg-shell-v5.c
  5. 2
      libweston-desktop/xdg-shell-v6.c
  6. 2
      libweston-desktop/xwayland.c

@ -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,

@ -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

@ -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;

@ -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;

@ -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;

@ -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;

Loading…
Cancel
Save