mirror of
https://github.com/swaywm/sway.git
synced 2024-11-16 05:03:17 +00:00
Address review feedback
This commit is contained in:
parent
68cfa7ef67
commit
8d6bce02af
|
@ -1,10 +1,10 @@
|
||||||
#ifndef _SWAY_OUTPUT_H
|
#ifndef _SWAY_OUTPUT_H
|
||||||
#define _SWAY_OUTPUT_H
|
#define _SWAY_OUTPUT_H
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/types/wlr_box.h>
|
#include <wlr/types/wlr_box.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
struct sway_server;
|
struct sway_server;
|
||||||
struct sway_container;
|
struct sway_container;
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/output.h"
|
#include "sway/output.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -192,9 +192,10 @@ void arrange_layers(struct sway_output *output) {
|
||||||
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct sway_layer_surface *sway_layer =
|
struct sway_layer_surface *sway_layer =
|
||||||
wl_container_of(listener, sway_layer, output_destroy);
|
wl_container_of(listener, sway_layer, output_destroy);
|
||||||
sway_layer->layer_surface->output = NULL;
|
|
||||||
wl_list_remove(&sway_layer->output_destroy.link);
|
wl_list_remove(&sway_layer->output_destroy.link);
|
||||||
wl_list_remove(&sway_layer->output_mode.link);
|
wl_list_remove(&sway_layer->output_mode.link);
|
||||||
|
wl_list_remove(&sway_layer->output_transform.link);
|
||||||
|
sway_layer->layer_surface->output = NULL;
|
||||||
wlr_layer_surface_close(sway_layer->layer_surface);
|
wlr_layer_surface_close(sway_layer->layer_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,9 +241,11 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
wl_list_remove(&sway_layer->map.link);
|
wl_list_remove(&sway_layer->map.link);
|
||||||
wl_list_remove(&sway_layer->unmap.link);
|
wl_list_remove(&sway_layer->unmap.link);
|
||||||
wl_list_remove(&sway_layer->surface_commit.link);
|
wl_list_remove(&sway_layer->surface_commit.link);
|
||||||
wl_list_remove(&sway_layer->output_destroy.link);
|
if (sway_layer->layer_surface->output != NULL) {
|
||||||
wl_list_remove(&sway_layer->output_mode.link);
|
wl_list_remove(&sway_layer->output_destroy.link);
|
||||||
wl_list_remove(&sway_layer->output_transform.link);
|
wl_list_remove(&sway_layer->output_mode.link);
|
||||||
|
wl_list_remove(&sway_layer->output_transform.link);
|
||||||
|
}
|
||||||
struct sway_output *output = sway_layer->layer_surface->output->data;
|
struct sway_output *output = sway_layer->layer_surface->output->data;
|
||||||
arrange_layers(output);
|
arrange_layers(output);
|
||||||
free(sway_layer);
|
free(sway_layer);
|
||||||
|
|
|
@ -81,9 +81,7 @@ static void render_surface(struct wlr_surface *surface,
|
||||||
rotate_child_position(&sx, &sy, sw, sh, width, height, rotation);
|
rotate_child_position(&sx, &sy, sw, sh, width, height, rotation);
|
||||||
|
|
||||||
render_surface(subsurface->surface, wlr_output, when,
|
render_surface(subsurface->surface, wlr_output, when,
|
||||||
lx + sx,
|
lx + sx, ly + sy, rotation);
|
||||||
ly + sy,
|
|
||||||
rotation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,9 +140,15 @@ static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct render_data {
|
||||||
|
struct sway_output *output;
|
||||||
|
struct timespec *now;
|
||||||
|
};
|
||||||
|
|
||||||
static void output_frame_view(swayc_t *view, void *data) {
|
static void output_frame_view(swayc_t *view, void *data) {
|
||||||
struct sway_output *output = data;
|
struct render_data *rdata = data;
|
||||||
|
struct sway_output *output = rdata->output;
|
||||||
|
struct timespec *now = rdata->now;
|
||||||
struct wlr_output *wlr_output = output->wlr_output;
|
struct wlr_output *wlr_output = output->wlr_output;
|
||||||
struct sway_view *sway_view = view->sway_view;
|
struct sway_view *sway_view = view->sway_view;
|
||||||
struct wlr_surface *surface = sway_view->surface;
|
struct wlr_surface *surface = sway_view->surface;
|
||||||
|
@ -157,23 +161,18 @@ static void output_frame_view(swayc_t *view, void *data) {
|
||||||
case SWAY_XDG_SHELL_V6_VIEW: {
|
case SWAY_XDG_SHELL_V6_VIEW: {
|
||||||
int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x;
|
int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x;
|
||||||
int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y;
|
int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y;
|
||||||
render_surface(surface, wlr_output, &output->last_frame,
|
render_surface(surface, wlr_output, now,
|
||||||
view->x - window_offset_x,
|
view->x - window_offset_x, view->y - window_offset_y, 0);
|
||||||
view->y - window_offset_y,
|
|
||||||
0);
|
|
||||||
render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output,
|
render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output,
|
||||||
&output->last_frame,
|
now, view->x - window_offset_x, view->y - window_offset_y, 0);
|
||||||
view->x - window_offset_x, view->y - window_offset_y,
|
|
||||||
0);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SWAY_WL_SHELL_VIEW:
|
case SWAY_WL_SHELL_VIEW:
|
||||||
render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output,
|
render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output,
|
||||||
&output->last_frame, view->x, view->y, 0, false);
|
now, view->x, view->y, 0, false);
|
||||||
break;
|
break;
|
||||||
case SWAY_XWAYLAND_VIEW:
|
case SWAY_XWAYLAND_VIEW:
|
||||||
render_surface(surface, wlr_output, &output->last_frame, view->x,
|
render_surface(surface, wlr_output, now, view->x, view->y, 0);
|
||||||
view->y, 0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -224,7 +223,11 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
focus :
|
focus :
|
||||||
swayc_parent_by_type(focus, C_WORKSPACE));
|
swayc_parent_by_type(focus, C_WORKSPACE));
|
||||||
|
|
||||||
swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, soutput);
|
struct render_data rdata = {
|
||||||
|
.output = soutput,
|
||||||
|
.now = &now,
|
||||||
|
};
|
||||||
|
swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, &rdata);
|
||||||
|
|
||||||
// render unmanaged views on top
|
// render unmanaged views on top
|
||||||
struct sway_view *view;
|
struct sway_view *view;
|
||||||
|
@ -246,8 +249,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
&soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
|
&soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
|
||||||
|
|
||||||
wlr_renderer_end(server->renderer);
|
wlr_renderer_end(server->renderer);
|
||||||
wlr_output_swap_buffers(wlr_output, &soutput->last_frame, NULL);
|
wlr_output_swap_buffers(wlr_output, &now, NULL);
|
||||||
|
|
||||||
soutput->last_frame = now;
|
soutput->last_frame = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue