ivi-shell: call shell_surface_send_configure() directly
For some reason, it seems that ivi-layout.c has tried hard to avoid calling directly into ivi-shell.c. This means there is a jump through hoops just to get the configure event sent to the clients. Ivi-shell registers a listener for a ivi-layout signal for sending the event. Instead, let ivi-layout.c call directly into ivi-shell.c, and expose a function to send out the configure events. This reduces some confusion on who calls what. The main idea though is that this makes ivi-shell.c not depend on struct ivi_layout_surface fields directly anymore. In following patches, ivi_layout_surface can be made opaque for ivi-shell.c. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "ivi-shell.h"
|
||||||
#include "ivi-layout-export.h"
|
#include "ivi-layout-export.h"
|
||||||
#include "ivi-layout-private.h"
|
#include "ivi-layout-private.h"
|
||||||
|
|
||||||
@@ -303,6 +304,9 @@ transition_move_resize_view_destroy(struct ivi_layout_transition *transition)
|
|||||||
struct ivi_layout_surface *layout_surface = data->surface;
|
struct ivi_layout_surface *layout_surface = data->surface;
|
||||||
|
|
||||||
wl_signal_emit(&layout_surface->configured, layout_surface);
|
wl_signal_emit(&layout_surface->configured, layout_surface);
|
||||||
|
shell_surface_send_configure(layout_surface->surface,
|
||||||
|
layout_surface->prop.dest_width,
|
||||||
|
layout_surface->prop.dest_height);
|
||||||
|
|
||||||
if (transition->private_data) {
|
if (transition->private_data) {
|
||||||
free(transition->private_data);
|
free(transition->private_data);
|
||||||
|
|||||||
+11
-2
@@ -61,6 +61,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
|
#include "ivi-shell.h"
|
||||||
#include "ivi-layout-export.h"
|
#include "ivi-layout-export.h"
|
||||||
#include "ivi-layout-private.h"
|
#include "ivi-layout-private.h"
|
||||||
|
|
||||||
@@ -776,8 +777,12 @@ commit_surface_list(struct ivi_layout *layout)
|
|||||||
ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
||||||
ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
||||||
|
|
||||||
if (configured && !is_surface_transition(ivisurf))
|
if (configured && !is_surface_transition(ivisurf)) {
|
||||||
wl_signal_emit(&ivisurf->configured, ivisurf);
|
wl_signal_emit(&ivisurf->configured, ivisurf);
|
||||||
|
shell_surface_send_configure(ivisurf->surface,
|
||||||
|
ivisurf->prop.dest_width,
|
||||||
|
ivisurf->prop.dest_height);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
configured = 0;
|
configured = 0;
|
||||||
if (ivisurf->prop.dest_width != ivisurf->pending.prop.dest_width ||
|
if (ivisurf->prop.dest_width != ivisurf->pending.prop.dest_width ||
|
||||||
@@ -789,8 +794,12 @@ commit_surface_list(struct ivi_layout *layout)
|
|||||||
ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
||||||
ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
|
||||||
|
|
||||||
if (configured && !is_surface_transition(ivisurf))
|
if (configured && !is_surface_transition(ivisurf)) {
|
||||||
wl_signal_emit(&ivisurf->configured, ivisurf);
|
wl_signal_emit(&ivisurf->configured, ivisurf);
|
||||||
|
shell_surface_send_configure(ivisurf->surface,
|
||||||
|
ivisurf->prop.dest_width,
|
||||||
|
ivisurf->prop.dest_height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-24
@@ -63,8 +63,6 @@ struct ivi_shell_surface
|
|||||||
int32_t height;
|
int32_t height;
|
||||||
|
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
struct wl_listener configured_listener;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ivi_shell_setting
|
struct ivi_shell_setting
|
||||||
@@ -77,25 +75,6 @@ struct ivi_shell_setting
|
|||||||
* Implementation of ivi_surface
|
* Implementation of ivi_surface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
|
||||||
surface_configure_notify(struct wl_listener *listener, void *data)
|
|
||||||
{
|
|
||||||
struct ivi_layout_surface *layout_surf =
|
|
||||||
(struct ivi_layout_surface *)data;
|
|
||||||
|
|
||||||
struct ivi_shell_surface *shell_surf =
|
|
||||||
container_of(listener,
|
|
||||||
struct ivi_shell_surface,
|
|
||||||
configured_listener);
|
|
||||||
|
|
||||||
int32_t dest_width = layout_surf->prop.dest_width;
|
|
||||||
int32_t dest_height = layout_surf->prop.dest_height;
|
|
||||||
|
|
||||||
if (shell_surf->resource)
|
|
||||||
ivi_surface_send_configure(shell_surf->resource,
|
|
||||||
dest_width, dest_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ivi_shell_surface_configure(struct weston_surface *, int32_t, int32_t);
|
ivi_shell_surface_configure(struct weston_surface *, int32_t, int32_t);
|
||||||
|
|
||||||
@@ -108,6 +87,21 @@ get_ivi_shell_surface(struct weston_surface *surface)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
shell_surface_send_configure(struct weston_surface *surface,
|
||||||
|
int32_t width, int32_t height)
|
||||||
|
{
|
||||||
|
struct ivi_shell_surface *shsurf;
|
||||||
|
|
||||||
|
shsurf = get_ivi_shell_surface(surface);
|
||||||
|
assert(shsurf);
|
||||||
|
if (!shsurf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (shsurf->resource)
|
||||||
|
ivi_surface_send_configure(shsurf->resource, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ivi_shell_surface_configure(struct weston_surface *surface,
|
ivi_shell_surface_configure(struct weston_surface *surface,
|
||||||
int32_t sx, int32_t sy)
|
int32_t sx, int32_t sy)
|
||||||
@@ -255,9 +249,7 @@ application_surface_create(struct wl_client *client,
|
|||||||
ivisurf->width = 0;
|
ivisurf->width = 0;
|
||||||
ivisurf->height = 0;
|
ivisurf->height = 0;
|
||||||
ivisurf->layout_surface = layout_surface;
|
ivisurf->layout_surface = layout_surface;
|
||||||
ivisurf->configured_listener.notify = surface_configure_notify;
|
|
||||||
ivi_layout_surface_add_configured_listener(layout_surface,
|
|
||||||
&ivisurf->configured_listener);
|
|
||||||
/*
|
/*
|
||||||
* The following code relies on wl_surface destruction triggering
|
* The following code relies on wl_surface destruction triggering
|
||||||
* immediateweston_surface destruction
|
* immediateweston_surface destruction
|
||||||
|
|||||||
@@ -69,4 +69,8 @@ input_panel_setup(struct ivi_shell *shell);
|
|||||||
void
|
void
|
||||||
input_panel_destroy(struct ivi_shell *shell);
|
input_panel_destroy(struct ivi_shell *shell);
|
||||||
|
|
||||||
|
void
|
||||||
|
shell_surface_send_configure(struct weston_surface *surface,
|
||||||
|
int32_t width, int32_t height);
|
||||||
|
|
||||||
#endif /* WESTON_IVI_SHELL_H */
|
#endif /* WESTON_IVI_SHELL_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user