aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
Diffstat (limited to 'rootston')
-rw-r--r--rootston/cursor.c8
-rw-r--r--rootston/desktop.c9
-rw-r--r--rootston/layer_shell.c12
-rw-r--r--rootston/output.c48
-rw-r--r--rootston/wl_shell.c8
-rw-r--r--rootston/xwayland.c8
6 files changed, 56 insertions, 37 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 1cf81704..904af67f 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -200,8 +200,8 @@ static void roots_cursor_update_position(
case ROOTS_CURSOR_ROTATE:
view = roots_seat_get_focus(seat);
if (view != NULL) {
- int ox = view->x + view->wlr_surface->current->width/2,
- oy = view->y + view->wlr_surface->current->height/2;
+ int ox = view->x + view->wlr_surface->current.width/2,
+ oy = view->y + view->wlr_surface->current.height/2;
int ux = cursor->offs_x - ox,
uy = cursor->offs_y - oy;
int vx = cursor->cursor->x - ox,
@@ -239,12 +239,12 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
break;
case BTN_RIGHT:
edges = 0;
- if (sx < view->wlr_surface->current->width/2) {
+ if (sx < view->wlr_surface->current.width/2) {
edges |= WLR_EDGE_LEFT;
} else {
edges |= WLR_EDGE_RIGHT;
}
- if (sy < view->wlr_surface->current->height/2) {
+ if (sy < view->wlr_surface->current.height/2) {
edges |= WLR_EDGE_TOP;
} else {
edges |= WLR_EDGE_BOTTOM;
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 2bba06e2..4b5a5c9a 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -69,8 +69,8 @@ enum roots_deco_part view_get_deco_part(struct roots_view *view, double sx,
return ROOTS_DECO_PART_NONE;
}
- int sw = view->wlr_surface->current->width;
- int sh = view->wlr_surface->current->height;
+ int sw = view->wlr_surface->current.width;
+ int sh = view->wlr_surface->current.height;
int bw = view->border_width;
int titlebar_h = view->titlebar_height;
@@ -558,7 +558,7 @@ static bool view_at(struct roots_view *view, double lx, double ly,
double view_sx = lx - view->x;
double view_sy = ly - view->y;
- struct wlr_surface_state *state = view->wlr_surface->current;
+ struct wlr_surface_state *state = &view->wlr_surface->current;
struct wlr_box box = {
.x = 0, .y = 0,
.width = state->width, .height = state->height,
@@ -875,6 +875,9 @@ struct roots_desktop *desktop_create(struct roots_server *server,
wl_signal_add(&desktop->virtual_keyboard->events.new_virtual_keyboard,
&desktop->virtual_keyboard_new);
desktop->virtual_keyboard_new.notify = handle_virtual_keyboard;
+
+ desktop->screencopy = wlr_screencopy_manager_v1_create(server->wl_display);
+
return desktop;
}
diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c
index db0aeb59..2adf11a5 100644
--- a/rootston/layer_shell.c
+++ b/rootston/layer_shell.c
@@ -381,12 +381,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
layer_surface->client_pending.margin.bottom,
layer_surface->client_pending.margin.left);
- struct roots_layer_surface *roots_surface =
- calloc(1, sizeof(struct roots_layer_surface));
- if (!roots_surface) {
- return;
- }
-
if (!layer_surface->output) {
struct roots_input *input = desktop->server->input;
struct roots_seat *seat = input_last_active_seat(input);
@@ -409,6 +403,12 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
}
}
+ struct roots_layer_surface *roots_surface =
+ calloc(1, sizeof(struct roots_layer_surface));
+ if (!roots_surface) {
+ return;
+ }
+
roots_surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&layer_surface->surface->events.commit,
&roots_surface->surface_commit);
diff --git a/rootston/output.c b/rootston/output.c
index bf671d6b..e3b03984 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -45,8 +45,8 @@ struct layout_data {
static void get_layout_position(struct layout_data *data, double *lx, double *ly,
const struct wlr_surface *surface, int sx, int sy) {
double _sx = sx, _sy = sy;
- rotate_child_position(&_sx, &_sy, surface->current->width,
- surface->current->height, data->width, data->height, data->rotation);
+ rotate_child_position(&_sx, &_sy, surface->current.width,
+ surface->current.height, data->width, data->height, data->rotation);
*lx = data->x + _sx;
*ly = data->y + _sy;
}
@@ -56,8 +56,8 @@ static void surface_for_each_surface(struct wlr_surface *surface,
wlr_surface_iterator_func_t iterator, void *user_data) {
layout_data->x = lx;
layout_data->y = ly;
- layout_data->width = surface->current->width;
- layout_data->height = surface->current->height;
+ layout_data->width = surface->current.width;
+ layout_data->height = surface->current.height;
layout_data->rotation = rotation;
wlr_surface_for_each_surface(surface, iterator, user_data);
@@ -68,8 +68,8 @@ static void view_for_each_surface(struct roots_view *view,
void *user_data) {
layout_data->x = view->x;
layout_data->y = view->y;
- layout_data->width = view->wlr_surface->current->width;
- layout_data->height = view->wlr_surface->current->height;
+ layout_data->width = view->wlr_surface->current.width;
+ layout_data->height = view->wlr_surface->current.height;
layout_data->rotation = view->rotation;
switch (view->type) {
@@ -147,16 +147,19 @@ static bool surface_intersect_output(struct wlr_surface *surface,
double ox = lx, oy = ly;
wlr_output_layout_output_coords(output_layout, wlr_output, &ox, &oy);
+ ox += surface->sx;
+ oy += surface->sy;
+
if (box != NULL) {
box->x = ox * wlr_output->scale;
box->y = oy * wlr_output->scale;
- box->width = surface->current->width * wlr_output->scale;
- box->height = surface->current->height * wlr_output->scale;
+ box->width = surface->current.width * wlr_output->scale;
+ box->height = surface->current.height * wlr_output->scale;
}
struct wlr_box layout_box = {
.x = lx, .y = ly,
- .width = surface->current->width, .height = surface->current->height,
+ .width = surface->current.width, .height = surface->current.height,
};
wlr_box_rotated_bounds(&layout_box, rotation, &layout_box);
return wlr_output_layout_intersects(output_layout, wlr_output, &layout_box);
@@ -224,7 +227,7 @@ static void render_surface(struct wlr_surface *surface, int sx, int sy,
float matrix[9];
enum wl_output_transform transform =
- wlr_output_transform_invert(surface->current->transform);
+ wlr_output_transform_invert(surface->current.transform);
wlr_matrix_project_box(matrix, &box, transform, rotation,
output->wlr_output->transform_matrix);
@@ -248,8 +251,8 @@ static void get_decoration_box(struct roots_view *view,
double sx = deco_box.x - view->x;
double sy = deco_box.y - view->y;
rotate_child_position(&sx, &sy, deco_box.width, deco_box.height,
- view->wlr_surface->current->width,
- view->wlr_surface->current->height, view->rotation);
+ view->wlr_surface->current.width,
+ view->wlr_surface->current.height, view->rotation);
double x = sx + view->x;
double y = sy + view->y;
@@ -518,6 +521,13 @@ static void render_output(struct roots_output *output) {
renderer_end:
wlr_renderer_scissor(renderer, NULL);
wlr_renderer_end(renderer);
+
+ if (server->config->debug_damage_tracking) {
+ int width, height;
+ wlr_output_transformed_resolution(wlr_output, &width, &height);
+ pixman_region32_union_rect(&damage, &damage, 0, 0, width, height);
+ }
+
if (!wlr_output_damage_swap_buffers(output->damage, &now, &damage)) {
goto damage_finish;
}
@@ -686,15 +696,21 @@ static void damage_from_surface(struct wlr_surface *surface, int sx, int sy,
int center_x = box.x + box.width/2;
int center_y = box.y + box.height/2;
+ enum wl_output_transform transform =
+ wlr_output_transform_invert(surface->current.transform);
+
pixman_region32_t damage;
pixman_region32_init(&damage);
- pixman_region32_copy(&damage, &surface->current->surface_damage);
- wlr_region_scale(&damage, &damage, wlr_output->scale);
- if (ceil(wlr_output->scale) > surface->current->scale) {
+ pixman_region32_copy(&damage, &surface->buffer_damage);
+ wlr_region_transform(&damage, &damage, transform,
+ surface->current.buffer_width, surface->current.buffer_height);
+ wlr_region_scale(&damage, &damage,
+ wlr_output->scale / (float)surface->current.scale);
+ if (ceil(wlr_output->scale) > surface->current.scale) {
// When scaling up a surface, it'll become blurry so we need to
// expand the damage region
wlr_region_expand(&damage, &damage,
- ceil(wlr_output->scale) - surface->current->scale);
+ ceil(wlr_output->scale) - surface->current.scale);
}
pixman_region32_translate(&damage, box.x, box.y);
wlr_region_rotated_bounds(&damage, &damage, rotation, center_x, center_y);
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index d58f030a..02160773 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -158,8 +158,8 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
view_apply_damage(view);
- int width = wlr_surface->current->width;
- int height = wlr_surface->current->height;
+ int width = wlr_surface->current.width;
+ int height = wlr_surface->current.height;
view_update_size(view, width, height);
double x = view->x;
@@ -236,8 +236,8 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
return;
}
view->type = ROOTS_WL_SHELL_VIEW;
- view->width = surface->surface->current->width;
- view->height = surface->surface->current->height;
+ view->width = surface->surface->current.width;
+ view->height = surface->surface->current.height;
view->wl_shell_surface = surface;
view->roots_wl_shell_surface = roots_surface;
diff --git a/rootston/xwayland.c b/rootston/xwayland.c
index b7dbab54..d0b80821 100644
--- a/rootston/xwayland.c
+++ b/rootston/xwayland.c
@@ -206,8 +206,8 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
view_apply_damage(view);
- int width = wlr_surface->current->width;
- int height = wlr_surface->current->height;
+ int width = wlr_surface->current.width;
+ int height = wlr_surface->current.height;
view_update_size(view, width, height);
double x = view->x;
@@ -233,8 +233,8 @@ static void handle_map(struct wl_listener *listener, void *data) {
view->x = surface->x;
view->y = surface->y;
- view->width = surface->surface->current->width;
- view->height = surface->surface->current->height;
+ view->width = surface->surface->current.width;
+ view->height = surface->surface->current.height;
roots_surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&surface->surface->events.commit,