diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-12-04 06:33:57 -0500 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2024-01-18 18:36:54 +0300 |
commit | 9c17cba0b29979ae23c4521b884f7419fd558770 (patch) | |
tree | db563b9ebcc9eda7afed3e5cd263fb13f531caac /sway/desktop/surface.c | |
parent | 0e1a02bf0aad3d743985602b55043c5de019d1f0 (diff) |
renderer: Render scene_graph
Diffstat (limited to 'sway/desktop/surface.c')
-rw-r--r-- | sway/desktop/surface.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/sway/desktop/surface.c b/sway/desktop/surface.c index 5932eaa2..af17a8bb 100644 --- a/sway/desktop/surface.c +++ b/sway/desktop/surface.c @@ -1,53 +1,12 @@ #define _POSIX_C_SOURCE 200112L #include <stdlib.h> -#include <time.h> #include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_fractional_scale_v1.h> #include "sway/server.h" #include "sway/surface.h" #include "sway/output.h" -static void handle_destroy(struct wl_listener *listener, void *data) { - struct sway_surface *surface = wl_container_of(listener, surface, destroy); - - surface->wlr_surface->data = NULL; - wl_list_remove(&surface->destroy.link); - - if (surface->frame_done_timer) { - wl_event_source_remove(surface->frame_done_timer); - } - - free(surface); -} - -static int surface_frame_done_timer_handler(void *data) { - struct sway_surface *surface = data; - - struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - wlr_surface_send_frame_done(surface->wlr_surface, &now); - - return 0; -} - -void handle_compositor_new_surface(struct wl_listener *listener, void *data) { - struct wlr_surface *wlr_surface = data; - - struct sway_surface *surface = calloc(1, sizeof(struct sway_surface)); - surface->wlr_surface = wlr_surface; - wlr_surface->data = surface; - - surface->destroy.notify = handle_destroy; - wl_signal_add(&wlr_surface->events.destroy, &surface->destroy); - - surface->frame_done_timer = wl_event_loop_add_timer(server.wl_event_loop, - surface_frame_done_timer_handler, surface); - if (!surface->frame_done_timer) { - wl_resource_post_no_memory(wlr_surface->resource); - } -} - -void surface_update_outputs(struct wlr_surface *surface) { +static void surface_update_outputs(struct wlr_surface *surface) { float scale = 1; struct wlr_surface_output *surface_output; wl_list_for_each(surface_output, &surface->current_outputs, link) { |