Update e_wayland for recent wl_resource and wl_client changes
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
11054d55e5
commit
b8081e7c05
|
@ -407,6 +407,8 @@ _e_comp_cb_surface_create(struct wl_client *client, struct wl_resource *resource
|
||||||
E_Compositor *comp;
|
E_Compositor *comp;
|
||||||
E_Surface *es;
|
E_Surface *es;
|
||||||
|
|
||||||
|
printf("Comp Surface Create: %d\n", id);
|
||||||
|
|
||||||
/* try to cast to our compositor */
|
/* try to cast to our compositor */
|
||||||
if (!(comp = resource->data)) return;
|
if (!(comp = resource->data)) return;
|
||||||
|
|
||||||
|
@ -431,6 +433,8 @@ _e_comp_cb_surface_create(struct wl_client *client, struct wl_resource *resource
|
||||||
/* set surface plane to compositor primary plane */
|
/* set surface plane to compositor primary plane */
|
||||||
es->plane = &comp->plane;
|
es->plane = &comp->plane;
|
||||||
|
|
||||||
|
printf("\tAdding Surface: %p\n", es);
|
||||||
|
|
||||||
/* add this surface to the compositors list */
|
/* add this surface to the compositors list */
|
||||||
comp->surfaces = eina_list_append(comp->surfaces, es);
|
comp->surfaces = eina_list_append(comp->surfaces, es);
|
||||||
}
|
}
|
||||||
|
@ -521,20 +525,19 @@ _e_comp_data_device_cb_get(struct wl_client *client, struct wl_resource *resourc
|
||||||
E_Input *seat;
|
E_Input *seat;
|
||||||
struct wl_resource *res;
|
struct wl_resource *res;
|
||||||
|
|
||||||
if (!(seat = seat_resource->data)) return;
|
if (!(seat = wl_resource_get_user_data(seat_resource))) return;
|
||||||
|
|
||||||
res = wl_client_add_object(client, &wl_data_device_interface,
|
res = wl_client_add_object(client, &wl_data_device_interface,
|
||||||
&_e_data_device_interface, id, seat);
|
&_e_data_device_interface, id, seat);
|
||||||
|
|
||||||
wl_list_insert(&seat->drag_resources, &res->link);
|
wl_list_insert(&seat->drag_resources, wl_resource_get_link(res));
|
||||||
|
wl_resource_set_destructor(res, _e_comp_data_device_cb_unbind);
|
||||||
res->destroy = _e_comp_data_device_cb_unbind;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_comp_data_device_cb_unbind(struct wl_resource *resource)
|
_e_comp_data_device_cb_unbind(struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
wl_list_remove(&resource->link);
|
wl_list_remove(wl_resource_get_link(resource));
|
||||||
free(resource);
|
free(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ e_input_pointer_focus_set(E_Input_Pointer *pointer, E_Surface *surface, Evas_Coo
|
||||||
resource = pointer->focus_resource;
|
resource = pointer->focus_resource;
|
||||||
if ((resource) && (pointer->focus != surface))
|
if ((resource) && (pointer->focus != surface))
|
||||||
{
|
{
|
||||||
disp = wl_client_get_display(resource->client);
|
disp = wl_client_get_display(wl_resource_get_client(resource));
|
||||||
serial = wl_display_next_serial(disp);
|
serial = wl_display_next_serial(disp);
|
||||||
wl_pointer_send_leave(resource, serial, pointer->focus->wl.resource);
|
wl_pointer_send_leave(resource, serial, pointer->focus->wl.resource);
|
||||||
// wl_list_remove(&pointer->focus_listener.link);
|
// wl_list_remove(&pointer->focus_listener.link);
|
||||||
|
@ -182,7 +182,7 @@ e_input_pointer_focus_set(E_Input_Pointer *pointer, E_Surface *surface, Evas_Coo
|
||||||
((pointer->focus != surface) ||
|
((pointer->focus != surface) ||
|
||||||
(pointer->focus_resource != resource)))
|
(pointer->focus_resource != resource)))
|
||||||
{
|
{
|
||||||
disp = wl_client_get_display(resource->client);
|
disp = wl_client_get_display(wl_resource_get_client(resource));
|
||||||
serial = wl_display_next_serial(disp);
|
serial = wl_display_next_serial(disp);
|
||||||
|
|
||||||
if (kbd)
|
if (kbd)
|
||||||
|
@ -202,7 +202,7 @@ e_input_pointer_focus_set(E_Input_Pointer *pointer, E_Surface *surface, Evas_Coo
|
||||||
|
|
||||||
wl_pointer_send_enter(resource, serial, surface->wl.resource,
|
wl_pointer_send_enter(resource, serial, surface->wl.resource,
|
||||||
wl_fixed_from_int(x), wl_fixed_from_int(y));
|
wl_fixed_from_int(x), wl_fixed_from_int(y));
|
||||||
wl_signal_add(&resource->destroy_signal, &pointer->focus_listener);
|
wl_resource_add_destroy_listener(resource, &pointer->focus_listener);
|
||||||
pointer->focus_serial = serial;
|
pointer->focus_serial = serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ e_input_keyboard_focus_set(E_Input_Keyboard *keyboard, E_Surface *surface)
|
||||||
if ((keyboard->focus_resource) && (keyboard->focus != surface))
|
if ((keyboard->focus_resource) && (keyboard->focus != surface))
|
||||||
{
|
{
|
||||||
res = keyboard->focus_resource;
|
res = keyboard->focus_resource;
|
||||||
disp = wl_client_get_display(res->client);
|
disp = wl_client_get_display(wl_resource_get_client(res));
|
||||||
serial = wl_display_next_serial(disp);
|
serial = wl_display_next_serial(disp);
|
||||||
printf("Send Keyboard Leave: %p\n", keyboard->focus);
|
printf("Send Keyboard Leave: %p\n", keyboard->focus);
|
||||||
if (surface) printf("\tSurface: %p\n", surface);
|
if (surface) printf("\tSurface: %p\n", surface);
|
||||||
|
@ -307,7 +307,7 @@ e_input_keyboard_focus_set(E_Input_Keyboard *keyboard, E_Surface *surface)
|
||||||
if ((res) &&
|
if ((res) &&
|
||||||
((keyboard->focus != surface) || (keyboard->focus_resource != res)))
|
((keyboard->focus != surface) || (keyboard->focus_resource != res)))
|
||||||
{
|
{
|
||||||
disp = wl_client_get_display(res->client);
|
disp = wl_client_get_display(wl_resource_get_client(res));
|
||||||
serial = wl_display_next_serial(disp);
|
serial = wl_display_next_serial(disp);
|
||||||
wl_keyboard_send_modifiers(res, serial,
|
wl_keyboard_send_modifiers(res, serial,
|
||||||
keyboard->modifiers.pressed,
|
keyboard->modifiers.pressed,
|
||||||
|
@ -317,7 +317,7 @@ e_input_keyboard_focus_set(E_Input_Keyboard *keyboard, E_Surface *surface)
|
||||||
printf("Send Keyboard Enter: %p\n", surface);
|
printf("Send Keyboard Enter: %p\n", surface);
|
||||||
wl_keyboard_send_enter(res, serial,
|
wl_keyboard_send_enter(res, serial,
|
||||||
surface->wl.resource, &keyboard->keys);
|
surface->wl.resource, &keyboard->keys);
|
||||||
wl_signal_add(&res->destroy_signal, &keyboard->focus_listener);
|
wl_resource_add_destroy_listener(res, &keyboard->focus_listener);
|
||||||
keyboard->focus_serial = serial;
|
keyboard->focus_serial = serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ e_input_keyboard_focus_destroy(struct wl_listener *listener, void *data)
|
||||||
static void
|
static void
|
||||||
_e_input_capabilities_update(E_Input *seat)
|
_e_input_capabilities_update(E_Input *seat)
|
||||||
{
|
{
|
||||||
struct wl_resource *res;
|
struct wl_list *link;
|
||||||
enum wl_seat_capability caps = 0;
|
enum wl_seat_capability caps = 0;
|
||||||
|
|
||||||
if (seat->pointer)
|
if (seat->pointer)
|
||||||
|
@ -388,8 +388,11 @@ _e_input_capabilities_update(E_Input *seat)
|
||||||
/* if (seat->touch) */
|
/* if (seat->touch) */
|
||||||
/* caps |= WL_SEAT_CAPABILITY_TOUCH; */
|
/* caps |= WL_SEAT_CAPABILITY_TOUCH; */
|
||||||
|
|
||||||
wl_list_for_each(res, &seat->resources, link)
|
for (link = seat->resources.next;
|
||||||
wl_seat_send_capabilities(res, caps);
|
link != &seat->resources; link = link->next)
|
||||||
|
{
|
||||||
|
wl_seat_send_capabilities(wl_resource_from_link(link), caps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -404,9 +407,8 @@ _e_input_cb_bind(struct wl_client *client, void *data, unsigned int version, uns
|
||||||
res = wl_client_add_object(client, &wl_seat_interface,
|
res = wl_client_add_object(client, &wl_seat_interface,
|
||||||
&_e_input_interface, id, data);
|
&_e_input_interface, id, data);
|
||||||
|
|
||||||
wl_list_insert(&seat->resources, &res->link);
|
wl_list_insert(&seat->resources, wl_resource_get_link(res));
|
||||||
|
wl_resource_set_destructor(res, _e_input_cb_unbind);
|
||||||
res->destroy = _e_input_cb_unbind;
|
|
||||||
|
|
||||||
if (seat->pointer)
|
if (seat->pointer)
|
||||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||||
|
@ -433,15 +435,14 @@ _e_input_cb_pointer_get(struct wl_client *client, struct wl_resource *resource,
|
||||||
E_Input *seat;
|
E_Input *seat;
|
||||||
struct wl_resource *res;
|
struct wl_resource *res;
|
||||||
|
|
||||||
if (!(seat = resource->data)) return;
|
if (!(seat = wl_resource_get_user_data(resource))) return;
|
||||||
if (!seat->pointer) return;
|
if (!seat->pointer) return;
|
||||||
|
|
||||||
res = wl_client_add_object(client, &wl_pointer_interface,
|
res = wl_client_add_object(client, &wl_pointer_interface,
|
||||||
&_e_pointer_interface, id, seat->pointer);
|
&_e_pointer_interface, id, seat->pointer);
|
||||||
|
|
||||||
wl_list_insert(&seat->pointer->resources, &res->link);
|
wl_list_insert(&seat->pointer->resources, wl_resource_get_link(res));
|
||||||
|
wl_resource_set_destructor(res, _e_input_cb_unbind);
|
||||||
res->destroy = _e_input_cb_unbind;
|
|
||||||
|
|
||||||
if ((seat->pointer->focus) &&
|
if ((seat->pointer->focus) &&
|
||||||
(wl_resource_get_client(seat->pointer->focus->wl.resource) == client))
|
(wl_resource_get_client(seat->pointer->focus->wl.resource) == client))
|
||||||
|
@ -461,14 +462,13 @@ _e_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *resource,
|
||||||
E_Input *seat;
|
E_Input *seat;
|
||||||
struct wl_resource *res;
|
struct wl_resource *res;
|
||||||
|
|
||||||
if (!(seat = resource->data)) return;
|
if (!(seat = wl_resource_get_user_data(resource))) return;
|
||||||
if (!seat->keyboard) return;
|
if (!seat->keyboard) return;
|
||||||
|
|
||||||
res = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, seat);
|
res = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, seat);
|
||||||
|
|
||||||
wl_list_insert(&seat->keyboard->resources, &res->link);
|
wl_list_insert(&seat->keyboard->resources, wl_resource_get_link(res));
|
||||||
|
wl_resource_set_destructor(res, _e_input_cb_unbind);
|
||||||
res->destroy = _e_input_cb_unbind;
|
|
||||||
|
|
||||||
wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
|
wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
|
||||||
seat->kbd_info.fd, seat->kbd_info.size);
|
seat->kbd_info.fd, seat->kbd_info.size);
|
||||||
|
@ -496,9 +496,10 @@ _e_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resource *res
|
||||||
E_Input_Pointer *ptr;
|
E_Input_Pointer *ptr;
|
||||||
E_Surface *es;
|
E_Surface *es;
|
||||||
|
|
||||||
if (!(ptr = resource->data)) return;
|
if (!(ptr = wl_resource_get_user_data(resource))) return;
|
||||||
if (surface_resource) es = surface_resource->data;
|
if (surface_resource) es = wl_resource_get_user_data(surface_resource);
|
||||||
if (!ptr->focus) return;
|
if (!ptr->focus) return;
|
||||||
|
if (!ptr->focus->wl.resource) return;
|
||||||
if (wl_resource_get_client(ptr->focus->wl.resource) != client) return;
|
if (wl_resource_get_client(ptr->focus->wl.resource) != client) return;
|
||||||
if (ptr->focus_serial - serial > UINT32_MAX / 2) return;
|
if (ptr->focus_serial - serial > UINT32_MAX / 2) return;
|
||||||
|
|
||||||
|
@ -660,13 +661,7 @@ _e_input_keyboard_grab_cb_modifiers(E_Input_Keyboard_Grab *grab, unsigned int se
|
||||||
static struct wl_resource *
|
static struct wl_resource *
|
||||||
_e_input_surface_resource_get(struct wl_list *list, E_Surface *surface)
|
_e_input_surface_resource_get(struct wl_list *list, E_Surface *surface)
|
||||||
{
|
{
|
||||||
struct wl_resource *ret;
|
|
||||||
|
|
||||||
if (!surface) return NULL;
|
if (!surface) return NULL;
|
||||||
|
|
||||||
wl_list_for_each(ret, list, link)
|
return wl_resource_find_for_client(list, wl_resource_get_client(surface->wl.resource));
|
||||||
if (ret->client == wl_resource_get_client(surface->wl.resource))
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,10 +155,8 @@ _e_output_cb_bind(struct wl_client *client, void *data, unsigned int version EIN
|
||||||
/* add this output to the client */
|
/* add this output to the client */
|
||||||
resource =
|
resource =
|
||||||
wl_client_add_object(client, &wl_output_interface, NULL, id, output);
|
wl_client_add_object(client, &wl_output_interface, NULL, id, output);
|
||||||
wl_list_insert(&output->wl.resources, &resource->link);
|
wl_list_insert(&output->wl.resources, wl_resource_get_link(resource));
|
||||||
|
wl_resource_set_destructor(resource, _e_output_cb_unbind);
|
||||||
/* setup destroy callback */
|
|
||||||
resource->destroy = _e_output_cb_unbind;
|
|
||||||
|
|
||||||
/* send out this output's geometry */
|
/* send out this output's geometry */
|
||||||
wl_output_send_geometry(resource, output->x, output->y,
|
wl_output_send_geometry(resource, output->x, output->y,
|
||||||
|
@ -169,12 +167,14 @@ _e_output_cb_bind(struct wl_client *client, void *data, unsigned int version EIN
|
||||||
EINA_LIST_FOREACH(output->modes, l, mode)
|
EINA_LIST_FOREACH(output->modes, l, mode)
|
||||||
wl_output_send_mode(resource, mode->flags, mode->w, mode->h,
|
wl_output_send_mode(resource, mode->flags, mode->w, mode->h,
|
||||||
mode->refresh);
|
mode->refresh);
|
||||||
|
|
||||||
|
if (version >= 2) wl_output_send_done(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_output_cb_unbind(struct wl_resource *resource)
|
_e_output_cb_unbind(struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
wl_list_remove(&resource->link);
|
wl_list_remove(wl_resource_get_link(resource));
|
||||||
free(resource);
|
free(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,7 @@ _e_region_cb_add(struct wl_client *client EINA_UNUSED, struct wl_resource *resou
|
||||||
{
|
{
|
||||||
E_Region *reg;
|
E_Region *reg;
|
||||||
|
|
||||||
/* try to cast resource to our region */
|
if (!(reg = wl_resource_get_user_data(resource))) return;
|
||||||
if (!(reg = resource->data)) return;
|
|
||||||
|
|
||||||
pixman_region32_union_rect(®->region, ®->region, x, y, w, h);
|
pixman_region32_union_rect(®->region, ®->region, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +54,7 @@ _e_region_cb_subtract(struct wl_client *client EINA_UNUSED, struct wl_resource *
|
||||||
pixman_region32_t rect;
|
pixman_region32_t rect;
|
||||||
|
|
||||||
/* try to cast resource to our region */
|
/* try to cast resource to our region */
|
||||||
if (!(reg = resource->data)) return;
|
if (!(reg = wl_resource_get_user_data(resource))) return;
|
||||||
|
|
||||||
pixman_region32_init_rect(&rect, x, y, w, h);
|
pixman_region32_init_rect(&rect, x, y, w, h);
|
||||||
pixman_region32_subtract(®->region, ®->region, &rect);
|
pixman_region32_subtract(®->region, ®->region, &rect);
|
||||||
|
|
|
@ -292,6 +292,10 @@ _e_renderer_cb_attach(E_Surface *surface, E_Buffer *buffer)
|
||||||
case WL_SHM_FORMAT_ARGB8888:
|
case WL_SHM_FORMAT_ARGB8888:
|
||||||
format = PIXMAN_a8r8g8b8;
|
format = PIXMAN_a8r8g8b8;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
e_buffer_reference(&state->buffer_reference, NULL);
|
||||||
|
return;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->shm_buffer = shm_buffer;
|
buffer->shm_buffer = shm_buffer;
|
||||||
|
|
|
@ -19,12 +19,35 @@ e_shell_surface_new(E_Surface *surface, unsigned int id)
|
||||||
ess->type = E_SHELL_SURFACE_TYPE_NONE;
|
ess->type = E_SHELL_SURFACE_TYPE_NONE;
|
||||||
ess->ntype = E_SHELL_SURFACE_TYPE_NONE;
|
ess->ntype = E_SHELL_SURFACE_TYPE_NONE;
|
||||||
|
|
||||||
wl_signal_init(&ess->wl.resource.destroy_signal);
|
|
||||||
wl_list_init(&ess->wl.link);
|
wl_list_init(&ess->wl.link);
|
||||||
|
|
||||||
ess->wl.resource.object.id = id;
|
|
||||||
ess->wl.resource.object.interface = &wl_shell_surface_interface;
|
|
||||||
ess->wl.resource.data = ess;
|
|
||||||
|
|
||||||
return ess;
|
return ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_shell_surface_destroy(E_Shell_Surface *ess)
|
||||||
|
{
|
||||||
|
if (!ess) return;
|
||||||
|
|
||||||
|
wl_signal_emit(&ess->signals.destroy, ess);
|
||||||
|
|
||||||
|
/* TODO: handle popup */
|
||||||
|
|
||||||
|
wl_list_remove(&ess->wl.surface_destroy.link);
|
||||||
|
ess->surface->configure = NULL;
|
||||||
|
|
||||||
|
if (ess->ping_timer)
|
||||||
|
{
|
||||||
|
if (ess->ping_timer->source)
|
||||||
|
wl_event_source_remove(ess->ping_timer->source);
|
||||||
|
|
||||||
|
E_FREE(ess->ping_timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(ess->title);
|
||||||
|
free(ess->clas);
|
||||||
|
|
||||||
|
wl_list_remove(&ess->wl.link);
|
||||||
|
|
||||||
|
E_FREE(ess);
|
||||||
|
}
|
||||||
|
|
|
@ -22,11 +22,16 @@ struct _E_Shell_Surface
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct wl_resource resource;
|
struct wl_resource *resource;
|
||||||
struct wl_listener surface_destroy;
|
struct wl_listener surface_destroy;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
} wl;
|
} wl;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
struct wl_signal destroy;
|
||||||
|
} signals;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
|
@ -67,6 +72,7 @@ struct _E_Shell_Surface_Ping_Timer
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI E_Shell_Surface *e_shell_surface_new(E_Surface *surface, unsigned int id);
|
EAPI E_Shell_Surface *e_shell_surface_new(E_Surface *surface, unsigned int id);
|
||||||
|
EAPI void e_shell_surface_destroy(E_Shell_Surface *ess);
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,8 +8,8 @@ static void _e_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl
|
||||||
static void _e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsigned int callback);
|
static void _e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsigned int callback);
|
||||||
static void _e_surface_cb_opaque_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource);
|
static void _e_surface_cb_opaque_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource);
|
||||||
static void _e_surface_cb_input_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource);
|
static void _e_surface_cb_input_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource);
|
||||||
|
static void _e_surface_cb_buffer_scale_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int scale);
|
||||||
static void _e_surface_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED);
|
static void _e_surface_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED);
|
||||||
|
|
||||||
static void _e_surface_frame_cb_destroy(struct wl_resource *resource);
|
static void _e_surface_frame_cb_destroy(struct wl_resource *resource);
|
||||||
|
|
||||||
/* local wayland interfaces */
|
/* local wayland interfaces */
|
||||||
|
@ -22,7 +22,8 @@ static const struct wl_surface_interface _e_surface_interface =
|
||||||
_e_surface_cb_opaque_set,
|
_e_surface_cb_opaque_set,
|
||||||
_e_surface_cb_input_set,
|
_e_surface_cb_input_set,
|
||||||
_e_surface_cb_commit,
|
_e_surface_cb_commit,
|
||||||
NULL // cb_buffer_transform_set
|
NULL, // cb_buffer_transform_set
|
||||||
|
NULL // cb_buffer_scale_set
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI E_Surface *
|
EAPI E_Surface *
|
||||||
|
@ -35,6 +36,9 @@ e_surface_new(struct wl_client *client, unsigned int id)
|
||||||
|
|
||||||
es->wl.id = id;
|
es->wl.id = id;
|
||||||
|
|
||||||
|
es->scale = 1;
|
||||||
|
es->pending.scale = es->scale;
|
||||||
|
|
||||||
/* initialize the destroy signal */
|
/* initialize the destroy signal */
|
||||||
wl_signal_init(&es->signals.destroy);
|
wl_signal_init(&es->signals.destroy);
|
||||||
|
|
||||||
|
@ -289,6 +293,18 @@ e_surface_activate(E_Surface *es, E_Input *seat)
|
||||||
wl_signal_emit(&comp->signals.activate, es);
|
wl_signal_emit(&comp->signals.activate, es);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
e_surface_buffer_width(E_Surface *es)
|
||||||
|
{
|
||||||
|
return es->buffer.reference.buffer->w / es->scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
e_surface_buffer_height(E_Surface *es)
|
||||||
|
{
|
||||||
|
return es->buffer.reference.buffer->h / es->scale;
|
||||||
|
}
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void
|
static void
|
||||||
_e_surface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
|
_e_surface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
|
||||||
|
@ -302,12 +318,28 @@ _e_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_resource *r
|
||||||
E_Surface *es;
|
E_Surface *es;
|
||||||
E_Buffer *buffer = NULL;
|
E_Buffer *buffer = NULL;
|
||||||
|
|
||||||
|
printf("E_Surface Attach\n");
|
||||||
|
|
||||||
/* try to cast the resource to our surface */
|
/* try to cast the resource to our surface */
|
||||||
if (!(es = wl_resource_get_user_data(resource))) return;
|
if (!(es = wl_resource_get_user_data(resource)))
|
||||||
|
{
|
||||||
|
printf("\tCOULD NOT GET SURFACE FROM RESOURCE !!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\tHave Surface: %p\n", es);
|
||||||
|
|
||||||
/* if we have a buffer resource, get a wl_buffer from it */
|
/* if we have a buffer resource, get a wl_buffer from it */
|
||||||
if (buffer_resource) buffer = e_buffer_resource_get(buffer_resource);
|
if (buffer_resource) buffer = e_buffer_resource_get(buffer_resource);
|
||||||
|
|
||||||
|
if (buffer) printf("\tHave Buffer\n");
|
||||||
|
else printf("\tNO BUFFER !!!\n");
|
||||||
|
|
||||||
|
if (buffer)
|
||||||
|
{
|
||||||
|
printf("\tBuffer Size: %d %d\n", buffer->w, buffer->h);
|
||||||
|
}
|
||||||
|
|
||||||
/* if we have a previous pending buffer, remove it
|
/* if we have a previous pending buffer, remove it
|
||||||
*
|
*
|
||||||
* NB: This means that attach was called more than once without calling
|
* NB: This means that attach was called more than once without calling
|
||||||
|
@ -332,7 +364,7 @@ _e_surface_cb_damage(struct wl_client *client EINA_UNUSED, struct wl_resource *r
|
||||||
E_Surface *es;
|
E_Surface *es;
|
||||||
|
|
||||||
/* try to cast the resource to our surface */
|
/* try to cast the resource to our surface */
|
||||||
if (!(es = resource->data)) return;
|
if (!(es = wl_resource_get_user_data(resource))) return;
|
||||||
|
|
||||||
/* add this damage rectangle */
|
/* add this damage rectangle */
|
||||||
pixman_region32_union_rect(&es->pending.damage, &es->pending.damage,
|
pixman_region32_union_rect(&es->pending.damage, &es->pending.damage,
|
||||||
|
@ -346,8 +378,14 @@ _e_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *r
|
||||||
Evas_Coord bw = 0, bh = 0;
|
Evas_Coord bw = 0, bh = 0;
|
||||||
pixman_region32_t opaque;
|
pixman_region32_t opaque;
|
||||||
|
|
||||||
|
printf("Surface Commit\n");
|
||||||
|
|
||||||
/* try to cast the resource to our surface */
|
/* try to cast the resource to our surface */
|
||||||
if (!(es = resource->data)) return;
|
if (!(es = wl_resource_get_user_data(resource))) return;
|
||||||
|
|
||||||
|
printf("\tHave Surface: %p\n", es);
|
||||||
|
|
||||||
|
es->scale = es->pending.scale;
|
||||||
|
|
||||||
/* if we have a pending buffer, attach it */
|
/* if we have a pending buffer, attach it */
|
||||||
if ((es->pending.buffer) || (es->pending.new_attach))
|
if ((es->pending.buffer) || (es->pending.new_attach))
|
||||||
|
@ -356,8 +394,8 @@ _e_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *r
|
||||||
/* if we have a referenced buffer, get it's size */
|
/* if we have a referenced buffer, get it's size */
|
||||||
if (es->buffer.reference.buffer)
|
if (es->buffer.reference.buffer)
|
||||||
{
|
{
|
||||||
bw = es->buffer.reference.buffer->w;
|
bw = e_surface_buffer_width(es);
|
||||||
bh = es->buffer.reference.buffer->h;
|
bh = e_surface_buffer_height(es);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we attached a new buffer, call the surface configure function */
|
/* if we attached a new buffer, call the surface configure function */
|
||||||
|
@ -377,7 +415,6 @@ _e_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *r
|
||||||
pixman_region32_union(&es->damage, &es->damage, &es->pending.damage);
|
pixman_region32_union(&es->damage, &es->damage, &es->pending.damage);
|
||||||
pixman_region32_intersect_rect(&es->damage, &es->damage,
|
pixman_region32_intersect_rect(&es->damage, &es->damage,
|
||||||
0, 0, es->geometry.w, es->geometry.h);
|
0, 0, es->geometry.w, es->geometry.h);
|
||||||
/* TODO: empty region */
|
|
||||||
|
|
||||||
/* free any pending damage */
|
/* free any pending damage */
|
||||||
pixman_region32_fini(&es->pending.damage);
|
pixman_region32_fini(&es->pending.damage);
|
||||||
|
@ -391,6 +428,7 @@ _e_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *r
|
||||||
pixman_region32_copy(&es->opaque, &opaque);
|
pixman_region32_copy(&es->opaque, &opaque);
|
||||||
es->geometry.changed = EINA_TRUE;
|
es->geometry.changed = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
pixman_region32_fini(&opaque);
|
||||||
|
|
||||||
/* combine any pending input */
|
/* combine any pending input */
|
||||||
pixman_region32_fini(&es->input);
|
pixman_region32_fini(&es->input);
|
||||||
|
@ -436,14 +474,15 @@ _e_surface_cb_opaque_set(struct wl_client *client EINA_UNUSED, struct wl_resourc
|
||||||
E_Surface *es;
|
E_Surface *es;
|
||||||
|
|
||||||
/* try to cast the resource to our surface */
|
/* try to cast the resource to our surface */
|
||||||
if (!(es = resource->data)) return;
|
if (!(es = wl_resource_get_user_data(resource))) return;
|
||||||
|
|
||||||
if (region_resource)
|
if (region_resource)
|
||||||
{
|
{
|
||||||
E_Region *reg;
|
E_Region *reg;
|
||||||
|
|
||||||
/* try to cast this resource to our region */
|
/* try to cast this resource to our region */
|
||||||
reg = region_resource->data;
|
if (!(reg = wl_resource_get_user_data(region_resource)))
|
||||||
|
return;
|
||||||
pixman_region32_copy(&es->pending.opaque, ®->region);
|
pixman_region32_copy(&es->pending.opaque, ®->region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -459,14 +498,15 @@ _e_surface_cb_input_set(struct wl_client *client EINA_UNUSED, struct wl_resource
|
||||||
E_Surface *es;
|
E_Surface *es;
|
||||||
|
|
||||||
/* try to cast the resource to our surface */
|
/* try to cast the resource to our surface */
|
||||||
if (!(es = resource->data)) return;
|
if (!(es = wl_resource_get_user_data(resource))) return;
|
||||||
|
|
||||||
if (region_resource)
|
if (region_resource)
|
||||||
{
|
{
|
||||||
E_Region *reg;
|
E_Region *reg;
|
||||||
|
|
||||||
/* try to cast this resource to our region */
|
/* try to cast this resource to our region */
|
||||||
reg = region_resource->data;
|
if (!(reg = wl_resource_get_user_data(region_resource)))
|
||||||
|
return;
|
||||||
pixman_region32_copy(&es->pending.input, ®->region);
|
pixman_region32_copy(&es->pending.input, ®->region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -477,6 +517,15 @@ _e_surface_cb_input_set(struct wl_client *client EINA_UNUSED, struct wl_resource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_surface_cb_buffer_scale_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int scale)
|
||||||
|
{
|
||||||
|
E_Surface *es;
|
||||||
|
|
||||||
|
if (!(es = wl_resource_get_user_data(resource))) return;
|
||||||
|
es->pending.scale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_surface_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED)
|
_e_surface_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@ struct _E_Surface
|
||||||
|
|
||||||
Evas_Coord x, y;
|
Evas_Coord x, y;
|
||||||
Eina_Bool new_attach : 1;
|
Eina_Bool new_attach : 1;
|
||||||
|
int scale;
|
||||||
} pending;
|
} pending;
|
||||||
|
|
||||||
pixman_region32_t bounding;
|
pixman_region32_t bounding;
|
||||||
|
@ -50,6 +51,7 @@ struct _E_Surface
|
||||||
E_Plane *plane;
|
E_Plane *plane;
|
||||||
E_Output *output;
|
E_Output *output;
|
||||||
unsigned int output_mask;
|
unsigned int output_mask;
|
||||||
|
int scale;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -86,6 +88,8 @@ EAPI void e_surface_show(E_Surface *es);
|
||||||
EAPI void e_surface_repaint_schedule(E_Surface *es);
|
EAPI void e_surface_repaint_schedule(E_Surface *es);
|
||||||
EAPI void e_surface_output_assign(E_Surface *es);
|
EAPI void e_surface_output_assign(E_Surface *es);
|
||||||
EAPI void e_surface_activate(E_Surface *es, E_Input *seat);
|
EAPI void e_surface_activate(E_Surface *es, E_Input *seat);
|
||||||
|
EAPI int e_surface_buffer_width(E_Surface *es);
|
||||||
|
EAPI int e_surface_buffer_height(E_Surface *es);
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue