|
|
@ -133,7 +133,6 @@ struct wlsc_compositor { |
|
|
|
struct wl_event_source *drm_source; |
|
|
|
struct wl_event_source *drm_source; |
|
|
|
|
|
|
|
|
|
|
|
uint32_t modifier_state; |
|
|
|
uint32_t modifier_state; |
|
|
|
struct wl_list animate_list; |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#define MODIFIER_CTRL (1 << 8) |
|
|
|
#define MODIFIER_CTRL (1 << 8) |
|
|
@ -143,13 +142,6 @@ struct wlsc_vector { |
|
|
|
GLdouble x, y, z; |
|
|
|
GLdouble x, y, z; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct wlsc_animate { |
|
|
|
|
|
|
|
struct wl_list link; |
|
|
|
|
|
|
|
void (*animate)(struct wlsc_animate *animate,
|
|
|
|
|
|
|
|
struct wlsc_compositor *compositor, |
|
|
|
|
|
|
|
uint32_t frame, uint32_t msecs); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wlsc_surface { |
|
|
|
struct wlsc_surface { |
|
|
|
struct wl_surface base; |
|
|
|
struct wl_surface base; |
|
|
|
struct wlsc_compositor *compositor; |
|
|
|
struct wlsc_compositor *compositor; |
|
|
@ -193,8 +185,7 @@ screenshooter_shoot(struct wl_client *client, struct screenshooter *shooter) |
|
|
|
int i, j; |
|
|
|
int i, j; |
|
|
|
|
|
|
|
|
|
|
|
i = 0; |
|
|
|
i = 0; |
|
|
|
output = container_of(ec->output_list.next, struct wlsc_output, link); |
|
|
|
wl_list_for_each(output, &ec->output_list, link) { |
|
|
|
while (&output->link != &ec->output_list) { |
|
|
|
|
|
|
|
snprintf(buffer, sizeof buffer, "wayland-screenshot-%d.png", i++); |
|
|
|
snprintf(buffer, sizeof buffer, "wayland-screenshot-%d.png", i++); |
|
|
|
data = malloc(output->width * output->height * 4); |
|
|
|
data = malloc(output->width * output->height * 4); |
|
|
|
if (data == NULL) { |
|
|
|
if (data == NULL) { |
|
|
@ -219,9 +210,6 @@ screenshooter_shoot(struct wl_client *client, struct screenshooter *shooter) |
|
|
|
gdk_pixbuf_unref(normal); |
|
|
|
gdk_pixbuf_unref(normal); |
|
|
|
gdk_pixbuf_unref(pixbuf); |
|
|
|
gdk_pixbuf_unref(pixbuf); |
|
|
|
free(data); |
|
|
|
free(data); |
|
|
|
|
|
|
|
|
|
|
|
output = container_of(output->link.next, |
|
|
|
|
|
|
|
struct wlsc_output, link); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -368,19 +356,14 @@ static void |
|
|
|
wlsc_surface_destroy(struct wlsc_surface *surface, |
|
|
|
wlsc_surface_destroy(struct wlsc_surface *surface, |
|
|
|
struct wlsc_compositor *compositor) |
|
|
|
struct wlsc_compositor *compositor) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wlsc_listener *l, *next; |
|
|
|
struct wlsc_listener *l; |
|
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&surface->link); |
|
|
|
wl_list_remove(&surface->link); |
|
|
|
glDeleteTextures(1, &surface->texture); |
|
|
|
glDeleteTextures(1, &surface->texture); |
|
|
|
wl_client_remove_surface(surface->base.client, &surface->base); |
|
|
|
wl_client_remove_surface(surface->base.client, &surface->base); |
|
|
|
|
|
|
|
|
|
|
|
l = container_of(compositor->surface_destroy_listener_list.next, |
|
|
|
wl_list_for_each(l, &compositor->surface_destroy_listener_list, link) |
|
|
|
struct wlsc_listener, link); |
|
|
|
|
|
|
|
while (&l->link != &compositor->surface_destroy_listener_list) { |
|
|
|
|
|
|
|
next = container_of(l->link.next, struct wlsc_listener, link); |
|
|
|
|
|
|
|
l->func(l, surface); |
|
|
|
l->func(l, surface); |
|
|
|
l = next; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
free(surface); |
|
|
|
free(surface); |
|
|
|
} |
|
|
|
} |
|
|
@ -578,7 +561,6 @@ page_flip_handler(int fd, unsigned int frame, |
|
|
|
unsigned int sec, unsigned int usec, void *data) |
|
|
|
unsigned int sec, unsigned int usec, void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wlsc_output *output = data; |
|
|
|
struct wlsc_output *output = data; |
|
|
|
struct wlsc_animate *animate, *next; |
|
|
|
|
|
|
|
struct wlsc_compositor *compositor = output->compositor; |
|
|
|
struct wlsc_compositor *compositor = output->compositor; |
|
|
|
uint32_t msecs; |
|
|
|
uint32_t msecs; |
|
|
|
|
|
|
|
|
|
|
@ -590,14 +572,6 @@ page_flip_handler(int fd, unsigned int frame, |
|
|
|
wl_event_source_timer_update(compositor->timer_source, 5); |
|
|
|
wl_event_source_timer_update(compositor->timer_source, 5); |
|
|
|
compositor->repaint_on_timeout = 1; |
|
|
|
compositor->repaint_on_timeout = 1; |
|
|
|
|
|
|
|
|
|
|
|
animate = container_of(compositor->animate_list.next, struct wlsc_animate, link); |
|
|
|
|
|
|
|
while (&animate->link != &compositor->animate_list) { |
|
|
|
|
|
|
|
next = container_of(animate->link.next, |
|
|
|
|
|
|
|
struct wlsc_animate, link); |
|
|
|
|
|
|
|
animate->animate(animate, compositor, compositor->current_frame, msecs); |
|
|
|
|
|
|
|
animate = next; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compositor->current_frame++; |
|
|
|
compositor->current_frame++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -626,23 +600,12 @@ repaint_output(struct wlsc_output *output) |
|
|
|
else |
|
|
|
else |
|
|
|
glClear(GL_COLOR_BUFFER_BIT); |
|
|
|
glClear(GL_COLOR_BUFFER_BIT); |
|
|
|
|
|
|
|
|
|
|
|
es = container_of(ec->surface_list.next, |
|
|
|
wl_list_for_each(es, &ec->surface_list, link) |
|
|
|
struct wlsc_surface, link); |
|
|
|
|
|
|
|
while (&es->link != &ec->surface_list) { |
|
|
|
|
|
|
|
wlsc_surface_draw(es); |
|
|
|
wlsc_surface_draw(es); |
|
|
|
es = container_of(es->link.next, |
|
|
|
|
|
|
|
struct wlsc_surface, link); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eid = container_of(ec->input_device_list.next, |
|
|
|
wl_list_for_each(eid, &ec->input_device_list, link) |
|
|
|
struct wlsc_input_device, link); |
|
|
|
|
|
|
|
while (&eid->link != &ec->input_device_list) { |
|
|
|
|
|
|
|
wlsc_surface_draw(eid->sprite); |
|
|
|
wlsc_surface_draw(eid->sprite); |
|
|
|
|
|
|
|
|
|
|
|
eid = container_of(eid->link.next, |
|
|
|
|
|
|
|
struct wlsc_input_device, link); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fd = eglGetDisplayFD(ec->display); |
|
|
|
fd = eglGetDisplayFD(ec->display); |
|
|
|
output->current ^= 1; |
|
|
|
output->current ^= 1; |
|
|
|
|
|
|
|
|
|
|
@ -666,12 +629,8 @@ repaint(void *data) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
output = container_of(ec->output_list.next, struct wlsc_output, link); |
|
|
|
wl_list_for_each(output, &ec->output_list, link) |
|
|
|
while (&output->link != &ec->output_list) { |
|
|
|
|
|
|
|
repaint_output(output); |
|
|
|
repaint_output(output); |
|
|
|
output = container_of(output->link.next, |
|
|
|
|
|
|
|
struct wlsc_output, link); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ec->repaint_needed = 0; |
|
|
|
ec->repaint_needed = 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -687,15 +646,10 @@ wlsc_compositor_schedule_repaint(struct wlsc_compositor *compositor) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
fd = eglGetDisplayFD(compositor->display); |
|
|
|
fd = eglGetDisplayFD(compositor->display); |
|
|
|
output = container_of(compositor->output_list.next, |
|
|
|
wl_list_for_each(output, &compositor->output_list, link) |
|
|
|
struct wlsc_output, link); |
|
|
|
|
|
|
|
while (&output->link != &compositor->output_list) { |
|
|
|
|
|
|
|
drmModePageFlip(fd, output->crtc_id, |
|
|
|
drmModePageFlip(fd, output->crtc_id, |
|
|
|
output->fb_id[output->current ^ 1], |
|
|
|
output->fb_id[output->current ^ 1], |
|
|
|
DRM_MODE_PAGE_FLIP_EVENT, output); |
|
|
|
DRM_MODE_PAGE_FLIP_EVENT, output); |
|
|
|
output = container_of(output->link.next, |
|
|
|
|
|
|
|
struct wlsc_output, link); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
@ -876,9 +830,7 @@ pick_surface(struct wlsc_input_device *device, int32_t *sx, int32_t *sy) |
|
|
|
return device->grab_surface; |
|
|
|
return device->grab_surface; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
es = container_of(ec->surface_list.prev, |
|
|
|
wl_list_for_each(es, &ec->surface_list, link) |
|
|
|
struct wlsc_surface, link); |
|
|
|
|
|
|
|
while (&es->link != &ec->surface_list) { |
|
|
|
|
|
|
|
if (es->map.x <= device->x && |
|
|
|
if (es->map.x <= device->x && |
|
|
|
device->x < es->map.x + es->map.width && |
|
|
|
device->x < es->map.x + es->map.width && |
|
|
|
es->map.y <= device->y && |
|
|
|
es->map.y <= device->y && |
|
|
@ -887,11 +839,6 @@ pick_surface(struct wlsc_input_device *device, int32_t *sx, int32_t *sy) |
|
|
|
return es; |
|
|
|
return es; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
es = container_of(es->link.prev, |
|
|
|
|
|
|
|
struct wlsc_surface, link); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1333,17 +1280,13 @@ static void on_enter_vt(int signal_number, void *data) |
|
|
|
ioctl(ec->tty_fd, VT_RELDISP, VT_ACKACQ); |
|
|
|
ioctl(ec->tty_fd, VT_RELDISP, VT_ACKACQ); |
|
|
|
ec->vt_active = TRUE; |
|
|
|
ec->vt_active = TRUE; |
|
|
|
|
|
|
|
|
|
|
|
output = container_of(ec->output_list.next, struct wlsc_output, link); |
|
|
|
wl_list_for_each(output, &ec->output_list, link) { |
|
|
|
while (&output->link != &ec->output_list) { |
|
|
|
|
|
|
|
ret = drmModeSetCrtc(fd, output->crtc_id, |
|
|
|
ret = drmModeSetCrtc(fd, output->crtc_id, |
|
|
|
output->fb_id[output->current ^ 1], 0, 0, |
|
|
|
output->fb_id[output->current ^ 1], 0, 0, |
|
|
|
&output->connector_id, 1, &output->mode); |
|
|
|
&output->connector_id, 1, &output->mode); |
|
|
|
if (ret) |
|
|
|
if (ret) |
|
|
|
fprintf(stderr, "failed to set mode for connector %d: %m\n", |
|
|
|
fprintf(stderr, "failed to set mode for connector %d: %m\n", |
|
|
|
output->connector_id); |
|
|
|
output->connector_id); |
|
|
|
|
|
|
|
|
|
|
|
output = container_of(output->link.next, |
|
|
|
|
|
|
|
struct wlsc_output, link); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1524,8 +1467,6 @@ wlsc_compositor_create(struct wl_display *display) |
|
|
|
ec->timer_source = wl_event_loop_add_timer(loop, repaint, ec); |
|
|
|
ec->timer_source = wl_event_loop_add_timer(loop, repaint, ec); |
|
|
|
wlsc_compositor_schedule_repaint(ec); |
|
|
|
wlsc_compositor_schedule_repaint(ec); |
|
|
|
|
|
|
|
|
|
|
|
wl_list_init(&ec->animate_list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ec; |
|
|
|
return ec; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|