#include "e_util_video_intern.h"
#include "e_video_debug_intern.h"
#include "e_client_intern.h"
+#include "e_compositor_intern.h"
#include <wayland-tbm-server.h>
static void
_e_video_hwc_geometry_output_rect_get(E_Client *ec, Eina_Rectangle *out)
{
+ E_Subsurface *subsurface;
+
if (e_comp_wl_subsurface_check(ec))
- e_comp_wl_subsurface_global_coord_get(ec, &out->x, &out->y);
+ {
+ subsurface = e_subsurface_from_ec(ec);
+ e_subsurface_coord_get(subsurface, &out->x, &out->y);
+ }
else
{
out->x = ec->x;
E_Comp_Wl_Buffer_Viewport *vp;
E_Comp_Wl_Subsurf_Data *sdata;
E_Comp_Wl_Client_Data *cdata;
+ E_Subsurface *subsurface;
int x1, y1, x2, y2, x, y;
int dx = 0, dy = 0;
Eina_Bool zoom_animating = EINA_FALSE;
if (e_comp_wl_subsurface_check(ec))
{
- e_comp_wl_subsurface_global_coord_get(ec, &dx, &dy);
+ subsurface = e_subsurface_from_ec(ec);
+ e_subsurface_coord_get(subsurface, &dx, &dy);
sdata = ec->comp_data->sub.data;
if (sdata->remote_surface.offscreen_parent)
break;
}
}
+
+ evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
+ if (x != dx || y != dy)
+ e_subsurface_view_position_set(subsurface, dx, dy);
}
else
{
dx = ec->x;
dy = ec->y;
- }
- evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
- if (x != dx || y != dy)
- evas_object_move(ec->frame, dx, dy);
+ evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
+ if (x != dx || y != dy)
+ evas_object_move(ec->frame, dx, dy);
+ }
if (!cdata->viewport_transform)
{
E_Client *ec;
E_Client *subc;
Eina_List *l;
- int x = 0 , y = 0;
+ E_Subsurface *subsurface;
if (!(ec = data)) return;
if (e_object_is_del(E_OBJECT(ec))) return;
EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc)
{
if (!e_comp_wl_subsurface_check(subc)) continue;
- e_comp_wl_subsurface_global_coord_get(subc, &x, &y);
- evas_object_move(subc->frame, x, y);
+ subsurface = e_subsurface_from_ec(subc);
+ e_subsurface_view_reposition(subsurface);
E_Comp_Wl_Client_Data *cdata = subc->comp_data;
if (cdata->viewport_transform)
EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc)
{
if (!e_comp_wl_subsurface_check(subc)) continue;
- e_comp_wl_subsurface_global_coord_get(subc, &x, &y);
- evas_object_move(subc->frame, x, y);
+ subsurface = e_subsurface_from_ec(subc);
+ e_subsurface_view_reposition(subsurface);
E_Comp_Wl_Client_Data *cdata = subc->comp_data;
if (cdata->viewport_transform)
static void
_e_comp_wl_surface_output_viewport_get(E_Client *ec, Eina_Rectangle *out)
{
+ E_Subsurface *subsurface;
+
if (!out)
return;
return;
if (e_comp_wl_subsurface_check(ec))
- e_comp_wl_subsurface_global_coord_get(ec, &out->x, &out->y);
+ {
+ subsurface = e_subsurface_from_ec(ec);
+ e_subsurface_coord_get(subsurface, &out->x, &out->y);
+ }
else
{
out->x = ec->x;
return EINA_TRUE;
}
-EINTERN Eina_Bool
-e_comp_wl_subsurface_global_coord_get(E_Client *ec, int *x, int *y)
-{
- E_Client *parent;
- E_Comp_Wl_Subsurf_Data *sdata;
- int ret_x = 0, ret_y = 0;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
- EINA_SAFETY_ON_FALSE_RETURN_VAL(e_comp_wl_subsurface_check(ec), EINA_FALSE);
-
- sdata = ec->comp_data->sub.data;
- EINA_SAFETY_ON_NULL_RETURN_VAL(sdata, EINA_FALSE);
-
- while (1)
- {
- ret_x += sdata->position.x;
- ret_y += sdata->position.y;
-
- parent = sdata->parent;
- if (!parent)
- break;
-
- sdata = _e_comp_wl_subsurface_data_get(parent);
- if (!sdata)
- {
- ret_x += parent->x;
- ret_y += parent->y;
- break;
- }
- }
-
- if (x)
- *x = ret_x;
- if (y)
- *y = ret_y;
-
- return EINA_TRUE;
-}
-
static E_Comp_Wl_Subsurf_Data *
_e_comp_wl_subsurface_data_get(E_Client *ec)
{
EINTERN E_Client *e_comp_wl_subsurface_parent_get(E_Client *ec);
EINTERN Eina_Bool e_comp_wl_subsurface_stand_alone_mode_get(E_Client *ec);
EINTERN Eina_Bool e_comp_wl_subsurface_position_get(E_Client *ec, int *x, int *y);
-EINTERN Eina_Bool e_comp_wl_subsurface_global_coord_get(E_Client *ec, int *x, int *y);
#endif
#include "e_client_video_intern.h"
#include "e_client_intern.h"
+#include <assert.h>
#include <libds/compositor.h>
#include <libds/subcompositor.h>
#include <libds/types/ds_surface.h>
} events;
};
+typedef struct
+{
+ E_Client *ec;
+ E_Subsurface *subsurface;
+
+ struct
+ {
+ struct wl_signal reposition;
+ } events;
+} E_Subsurface_View;
+
struct _E_Subsurface
{
E_Comp_Wl_Subsurf_Data base;
+ E_Subsurface_View view;
E_Surface *surface;
struct ds_subsurface *ds_subsurface;
static void _e_subsurface_destroy(E_Subsurface *sub);
static void _e_subsurface_commit(E_Subsurface *sub);
static void _e_subsurface_place_below_parent(E_Subsurface *sub);
-static void _e_subsurface_position_update(E_Subsurface *sub);
static void _e_subsurface_cb_destroy(struct wl_listener *listener, void *data);
static void _e_subsurface_cb_cached(struct wl_listener *listener, void *data);
static void _e_subsurface_cb_sync_precommit(struct wl_listener *listener, void *data);
return _e_subsurface_from_surface(surface);
}
+EINTERN E_Subsurface *
+e_subsurface_from_ec(E_Client *ec)
+{
+ E_Subsurface *subsurface;
+
+ assert(ec->comp_data->sub.data);
+
+ return wl_container_of(ec->comp_data->sub.data, subsurface, base);
+}
+
EINTERN Eina_Bool
e_subsurface_position_set(E_Subsurface *subsurface, int x, int y)
{
}
}
+static void
+_e_subsurface_view_init(E_Subsurface_View *view, E_Subsurface *subsurface)
+{
+ int x, y;
+
+ view->subsurface = subsurface;
+ view->ec = subsurface->surface->ec;
+
+ wl_signal_init(&view->events.reposition);
+
+ e_subsurface_coord_get(subsurface, &x, &y);
+ evas_object_move(view->ec->frame, x, y);
+}
+
static E_Subsurface *
_e_subsurface_create(struct ds_subsurface *ds_subsurface, E_Surface *parent_surface)
{
epc,
offscreen_parent);
- _e_subsurface_position_update(sub);
+ _e_subsurface_view_init(&sub->view, sub);
ELOGF("SUBSURFACE", "Create: parent(%p)", surface->ec, epc);
}
static void
-_e_subsurface_position_update(E_Subsurface *sub)
-{
- E_Client *ec = sub->surface->ec;
- int x, y;
-
- if (e_comp_wl_subsurface_global_coord_get(ec, &x, &y))
- evas_object_move(ec->frame, x, y);
-}
-
-static void
_e_subsurface_place_below_parent(E_Subsurface *sub)
{
struct ds_subsurface *ds_subsurface = sub->ds_subsurface;
sub->base.position.x = ds_subsurface->current.x;
sub->base.position.y = ds_subsurface->current.y;
- _e_subsurface_position_update(sub);
+ e_subsurface_view_reposition(sub);
}
static void
{
EINA_SAFETY_ON_NULL_RETURN(subsurface);
wl_signal_add(&subsurface->events.desync_precommit, listener);
-}
\ No newline at end of file
+}
+
+EINTERN void
+e_subsurface_coord_get(E_Subsurface *subsurface, int *x, int *y)
+{
+ E_Subsurface *iter = subsurface;
+ E_Client *parent;
+ int ret_x = 0, ret_y = 0;
+
+ while (1)
+ {
+ ret_x += iter->base.position.x;
+ ret_y += iter->base.position.y;
+
+ parent = iter->base.parent;
+ if (!parent)
+ break;
+
+ if (parent->comp_data && parent->comp_data->sub.data)
+ {
+ iter = wl_container_of(parent->comp_data->sub.data, iter, base);
+ }
+ else
+ {
+ ret_x += parent->x;
+ ret_y += parent->y;
+ break;
+ }
+ }
+
+ if (x)
+ *x = ret_x;
+ if (y)
+ *y = ret_y;
+}
+
+EINTERN void
+e_subsurface_view_reposition_listener_add(E_Subsurface *subsurface, struct wl_listener *listener)
+{
+ E_Subsurface_View *view = &subsurface->view;
+
+ wl_signal_add(&view->events.reposition, listener);
+}
+
+EINTERN void
+e_subsurface_view_position_set(E_Subsurface *subsurface, int x, int y)
+{
+ E_Subsurface_View *view = &subsurface->view;
+
+ evas_object_move(view->ec->frame, x, y);
+
+ wl_signal_emit(&view->events.reposition, subsurface);
+}
+
+EINTERN void
+e_subsurface_view_reposition(E_Subsurface *subsurface)
+{
+ int x, y;
+
+ e_subsurface_coord_get(subsurface, &x, &y);
+ e_subsurface_view_position_set(subsurface, x, y);
+}
EINTERN E_Subsurface *e_subsurface_from_resource(struct wl_resource *resource);
EINTERN E_Subsurface *e_subsurface_from_surface(E_Surface *surface);
+EINTERN E_Subsurface *e_subsurface_from_ec(E_Client *ec);
EINTERN Eina_Bool e_subsurface_position_set(E_Subsurface *subsurface, int x, int y);
EINTERN void e_subsurface_destroy_listener_add(E_Subsurface *subsurface, struct wl_listener *listener);
EINTERN void e_subsurface_cached_listener_add(E_Subsurface *subsurface, struct wl_listener *listener);
EINTERN void e_subsurface_sync_commit_pre_listener_add(E_Subsurface *subsurface, struct wl_listener *listener);
EINTERN void e_subsurface_desync_commit_pre_listener_add(E_Subsurface *subsurface, struct wl_listener *listener);
+EINTERN void e_subsurface_view_reposition_listener_add(E_Subsurface *subsurface, struct wl_listener *listener);
+EINTERN void e_subsurface_view_position_set(E_Subsurface *subsurface, int x, int y);
+EINTERN void e_subsurface_view_reposition(E_Subsurface *subsurface);
+
#endif