E_Compositor *comp;
E_Surface *es;
+ printf("Comp Surface Create: %d\n", id);
+
/* try to cast to our compositor */
if (!(comp = resource->data)) return;
/* set surface plane to compositor primary plane */
es->plane = &comp->plane;
+ printf("\tAdding Surface: %p\n", es);
+
/* add this surface to the compositors list */
comp->surfaces = eina_list_append(comp->surfaces, es);
}
E_Input *seat;
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,
&_e_data_device_interface, id, seat);
- wl_list_insert(&seat->drag_resources, &res->link);
-
- res->destroy = _e_comp_data_device_cb_unbind;
+ wl_list_insert(&seat->drag_resources, wl_resource_get_link(res));
+ wl_resource_set_destructor(res, _e_comp_data_device_cb_unbind);
}
static void
_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);
}
resource = pointer->focus_resource;
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);
wl_pointer_send_leave(resource, serial, pointer->focus->wl.resource);
// wl_list_remove(&pointer->focus_listener.link);
((pointer->focus != surface) ||
(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);
if (kbd)
wl_pointer_send_enter(resource, serial, surface->wl.resource,
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;
}
if ((keyboard->focus_resource) && (keyboard->focus != surface))
{
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);
printf("Send Keyboard Leave: %p\n", keyboard->focus);
if (surface) printf("\tSurface: %p\n", surface);
if ((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);
wl_keyboard_send_modifiers(res, serial,
keyboard->modifiers.pressed,
printf("Send Keyboard Enter: %p\n", surface);
wl_keyboard_send_enter(res, serial,
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;
}
static void
_e_input_capabilities_update(E_Input *seat)
{
- struct wl_resource *res;
+ struct wl_list *link;
enum wl_seat_capability caps = 0;
if (seat->pointer)
/* if (seat->touch) */
/* caps |= WL_SEAT_CAPABILITY_TOUCH; */
- wl_list_for_each(res, &seat->resources, link)
- wl_seat_send_capabilities(res, caps);
+ for (link = seat->resources.next;
+ link != &seat->resources; link = link->next)
+ {
+ wl_seat_send_capabilities(wl_resource_from_link(link), caps);
+ }
}
static void
res = wl_client_add_object(client, &wl_seat_interface,
&_e_input_interface, id, data);
- wl_list_insert(&seat->resources, &res->link);
-
- res->destroy = _e_input_cb_unbind;
+ wl_list_insert(&seat->resources, wl_resource_get_link(res));
+ wl_resource_set_destructor(res, _e_input_cb_unbind);
if (seat->pointer)
caps |= WL_SEAT_CAPABILITY_POINTER;
E_Input *seat;
struct wl_resource *res;
- if (!(seat = resource->data)) return;
+ if (!(seat = wl_resource_get_user_data(resource))) return;
if (!seat->pointer) return;
res = wl_client_add_object(client, &wl_pointer_interface,
&_e_pointer_interface, id, seat->pointer);
- wl_list_insert(&seat->pointer->resources, &res->link);
-
- res->destroy = _e_input_cb_unbind;
+ wl_list_insert(&seat->pointer->resources, wl_resource_get_link(res));
+ wl_resource_set_destructor(res, _e_input_cb_unbind);
if ((seat->pointer->focus) &&
(wl_resource_get_client(seat->pointer->focus->wl.resource) == client))
E_Input *seat;
struct wl_resource *res;
- if (!(seat = resource->data)) return;
+ if (!(seat = wl_resource_get_user_data(resource))) return;
if (!seat->keyboard) return;
res = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, seat);
- wl_list_insert(&seat->keyboard->resources, &res->link);
-
- res->destroy = _e_input_cb_unbind;
+ wl_list_insert(&seat->keyboard->resources, wl_resource_get_link(res));
+ wl_resource_set_destructor(res, _e_input_cb_unbind);
wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
seat->kbd_info.fd, seat->kbd_info.size);
E_Input_Pointer *ptr;
E_Surface *es;
- if (!(ptr = resource->data)) return;
- if (surface_resource) es = surface_resource->data;
+ if (!(ptr = wl_resource_get_user_data(resource))) return;
+ if (surface_resource) es = wl_resource_get_user_data(surface_resource);
if (!ptr->focus) return;
+ if (!ptr->focus->wl.resource) return;
if (wl_resource_get_client(ptr->focus->wl.resource) != client) return;
if (ptr->focus_serial - serial > UINT32_MAX / 2) return;
static struct wl_resource *
_e_input_surface_resource_get(struct wl_list *list, E_Surface *surface)
{
- struct wl_resource *ret;
-
if (!surface) return NULL;
- wl_list_for_each(ret, list, link)
- if (ret->client == wl_resource_get_client(surface->wl.resource))
- return ret;
-
- return NULL;
+ return wl_resource_find_for_client(list, wl_resource_get_client(surface->wl.resource));
}
/* add this output to the client */
resource =
wl_client_add_object(client, &wl_output_interface, NULL, id, output);
- wl_list_insert(&output->wl.resources, &resource->link);
-
- /* setup destroy callback */
- resource->destroy = _e_output_cb_unbind;
+ wl_list_insert(&output->wl.resources, wl_resource_get_link(resource));
+ wl_resource_set_destructor(resource, _e_output_cb_unbind);
/* send out this output's geometry */
wl_output_send_geometry(resource, output->x, output->y,
EINA_LIST_FOREACH(output->modes, l, mode)
wl_output_send_mode(resource, mode->flags, mode->w, mode->h,
mode->refresh);
+
+ if (version >= 2) wl_output_send_done(resource);
}
static void
_e_output_cb_unbind(struct wl_resource *resource)
{
- wl_list_remove(&resource->link);
+ wl_list_remove(wl_resource_get_link(resource));
free(resource);
}
{
E_Region *reg;
- /* try to cast resource to our region */
- if (!(reg = resource->data)) return;
+ if (!(reg = wl_resource_get_user_data(resource))) return;
pixman_region32_union_rect(®->region, ®->region, x, y, w, h);
}
pixman_region32_t rect;
/* 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_subtract(®->region, ®->region, &rect);
case WL_SHM_FORMAT_ARGB8888:
format = PIXMAN_a8r8g8b8;
break;
+ default:
+ e_buffer_reference(&state->buffer_reference, NULL);
+ return;
+ break;
}
buffer->shm_buffer = shm_buffer;
ess->type = 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);
- ess->wl.resource.object.id = id;
- ess->wl.resource.object.interface = &wl_shell_surface_interface;
- ess->wl.resource.data = 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);
+}
{
struct
{
- struct wl_resource resource;
+ struct wl_resource *resource;
struct wl_listener surface_destroy;
struct wl_list link;
} wl;
+ struct
+ {
+ struct wl_signal destroy;
+ } signals;
+
struct
{
Evas_Coord x, y, w, h;
};
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
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_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_frame_cb_destroy(struct wl_resource *resource);
/* local wayland interfaces */
_e_surface_cb_opaque_set,
_e_surface_cb_input_set,
_e_surface_cb_commit,
- NULL // cb_buffer_transform_set
+ NULL, // cb_buffer_transform_set
+ NULL // cb_buffer_scale_set
};
EAPI E_Surface *
es->wl.id = id;
+ es->scale = 1;
+ es->pending.scale = es->scale;
+
/* initialize the destroy signal */
wl_signal_init(&es->signals.destroy);
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 */
static void
_e_surface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
E_Surface *es;
E_Buffer *buffer = NULL;
+ printf("E_Surface Attach\n");
+
/* 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 (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
*
* NB: This means that attach was called more than once without calling
E_Surface *es;
/* 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 */
pixman_region32_union_rect(&es->pending.damage, &es->pending.damage,
Evas_Coord bw = 0, bh = 0;
pixman_region32_t opaque;
+ printf("Surface Commit\n");
+
/* 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 ((es->pending.buffer) || (es->pending.new_attach))
/* if we have a referenced buffer, get it's size */
if (es->buffer.reference.buffer)
{
- bw = es->buffer.reference.buffer->w;
- bh = es->buffer.reference.buffer->h;
+ bw = e_surface_buffer_width(es);
+ bh = e_surface_buffer_height(es);
}
/* if we attached a new buffer, call the surface configure function */
pixman_region32_union(&es->damage, &es->damage, &es->pending.damage);
pixman_region32_intersect_rect(&es->damage, &es->damage,
0, 0, es->geometry.w, es->geometry.h);
- /* TODO: empty region */
/* free any pending damage */
pixman_region32_fini(&es->pending.damage);
pixman_region32_copy(&es->opaque, &opaque);
es->geometry.changed = EINA_TRUE;
}
+ pixman_region32_fini(&opaque);
/* combine any pending input */
pixman_region32_fini(&es->input);
E_Surface *es;
/* 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)
{
E_Region *reg;
/* 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);
}
else
E_Surface *es;
/* 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)
{
E_Region *reg;
/* 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);
}
else
}
}
+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
_e_surface_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED)
{
Evas_Coord x, y;
Eina_Bool new_attach : 1;
+ int scale;
} pending;
pixman_region32_t bounding;
E_Plane *plane;
E_Output *output;
unsigned int output_mask;
+ int scale;
struct
{
EAPI void e_surface_repaint_schedule(E_Surface *es);
EAPI void e_surface_output_assign(E_Surface *es);
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