36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
|
|
#include <stdlib.h>
|
||
|
|
|
||
|
|
#include "types.h"
|
||
|
|
|
||
|
|
void output_frame(struct wl_listener *listener, void *data)
|
||
|
|
{
|
||
|
|
struct absinthe_output *output = wl_container_of(listener, output, frame);
|
||
|
|
struct wlr_scene *scene = output->server->scene;
|
||
|
|
|
||
|
|
struct wlr_scene_output *scene_output = wlr_scene_get_scene_output(scene, output->wlr_output);
|
||
|
|
|
||
|
|
wlr_scene_output_commit(scene_output, NULL);
|
||
|
|
|
||
|
|
struct timespec now;
|
||
|
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||
|
|
wlr_scene_output_send_frame_done(scene_output, &now);
|
||
|
|
}
|
||
|
|
|
||
|
|
void output_request_state(struct wl_listener *listener, void *data)
|
||
|
|
{
|
||
|
|
struct absinthe_output *output = wl_container_of(listener, output, request_state);
|
||
|
|
const struct wlr_output_event_request_state *event = data;
|
||
|
|
wlr_output_commit_state(output->wlr_output, event->state);
|
||
|
|
}
|
||
|
|
|
||
|
|
void output_destroy(struct wl_listener *listener, void *data)
|
||
|
|
{
|
||
|
|
struct absinthe_output *output = wl_container_of(listener, output, request_state);
|
||
|
|
|
||
|
|
wl_list_remove(&output->frame.link);
|
||
|
|
wl_list_remove(&output->request_state.link);
|
||
|
|
wl_list_remove(&output->destroy.link);
|
||
|
|
wl_list_remove(&output->link);
|
||
|
|
free(output);
|
||
|
|
}
|