output: remove lx, ly

Fixes https://github.com/swaywm/wlroots/issues/1610
This commit is contained in:
emersion 2019-03-11 11:21:18 +01:00 committed by Drew DeVault
parent 930e37eae9
commit 1515c56cae
7 changed files with 34 additions and 48 deletions

View File

@ -111,9 +111,6 @@ struct wlr_output {
struct wlr_output_cursor *hardware_cursor; struct wlr_output_cursor *hardware_cursor;
int software_cursor_locks; // number of locks forcing software cursors int software_cursor_locks; // number of locks forcing software cursors
// the output position in layout space reported to clients
int32_t lx, ly;
struct wl_listener display_destroy; struct wl_listener display_destroy;
void *data; void *data;
@ -173,7 +170,6 @@ bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh); int32_t height, int32_t refresh);
void wlr_output_set_transform(struct wlr_output *output, void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform); enum wl_output_transform transform);
void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
void wlr_output_set_scale(struct wlr_output *output, float scale); void wlr_output_set_scale(struct wlr_output *output, float scale);
void wlr_output_set_subpixel(struct wlr_output *output, enum wl_output_subpixel subpixel); void wlr_output_set_subpixel(struct wlr_output *output, enum wl_output_subpixel subpixel);
void wlr_output_destroy(struct wlr_output *output); void wlr_output_destroy(struct wlr_output *output);

View File

@ -122,12 +122,15 @@ void output_surface_for_each_surface(struct roots_output *output,
void output_view_for_each_surface(struct roots_output *output, void output_view_for_each_surface(struct roots_output *output,
struct roots_view *view, roots_surface_iterator_func_t iterator, struct roots_view *view, roots_surface_iterator_func_t iterator,
void *user_data) { void *user_data) {
struct wlr_box *output_box =
wlr_output_layout_get_box(output->desktop->layout, output->wlr_output);
struct surface_iterator_data data = { struct surface_iterator_data data = {
.user_iterator = iterator, .user_iterator = iterator,
.user_data = user_data, .user_data = user_data,
.output = output, .output = output,
.ox = view->box.x - output->wlr_output->lx, .ox = view->box.x - output_box->x,
.oy = view->box.y - output->wlr_output->ly, .oy = view->box.y - output_box->y,
.width = view->box.width, .width = view->box.width,
.height = view->box.height, .height = view->box.height,
.rotation = view->rotation, .rotation = view->rotation,
@ -140,11 +143,14 @@ void output_view_for_each_surface(struct roots_output *output,
void output_xwayland_children_for_each_surface( void output_xwayland_children_for_each_surface(
struct roots_output *output, struct wlr_xwayland_surface *surface, struct roots_output *output, struct wlr_xwayland_surface *surface,
roots_surface_iterator_func_t iterator, void *user_data) { roots_surface_iterator_func_t iterator, void *user_data) {
struct wlr_box *output_box =
wlr_output_layout_get_box(output->desktop->layout, output->wlr_output);
struct wlr_xwayland_surface *child; struct wlr_xwayland_surface *child;
wl_list_for_each(child, &surface->children, parent_link) { wl_list_for_each(child, &surface->children, parent_link) {
if (child->mapped) { if (child->mapped) {
double ox = child->x - output->wlr_output->lx; double ox = child->x - output_box->x;
double oy = child->y - output->wlr_output->ly; double oy = child->y - output_box->y;
output_surface_for_each_surface(output, child->surface, output_surface_for_each_surface(output, child->surface,
ox, oy, iterator, user_data); ox, oy, iterator, user_data);
} }
@ -187,6 +193,9 @@ void output_layer_for_each_surface(struct roots_output *output,
void output_drag_icons_for_each_surface(struct roots_output *output, void output_drag_icons_for_each_surface(struct roots_output *output,
struct roots_input *input, roots_surface_iterator_func_t iterator, struct roots_input *input, roots_surface_iterator_func_t iterator,
void *user_data) { void *user_data) {
struct wlr_box *output_box =
wlr_output_layout_get_box(output->desktop->layout, output->wlr_output);
struct roots_seat *seat; struct roots_seat *seat;
wl_list_for_each(seat, &input->seats, link) { wl_list_for_each(seat, &input->seats, link) {
struct roots_drag_icon *drag_icon = seat->drag_icon; struct roots_drag_icon *drag_icon = seat->drag_icon;
@ -194,8 +203,8 @@ void output_drag_icons_for_each_surface(struct roots_output *output,
continue; continue;
} }
double ox = drag_icon->x - output->wlr_output->lx; double ox = drag_icon->x - output_box->x;
double oy = drag_icon->y - output->wlr_output->ly; double oy = drag_icon->y - output_box->y;
output_surface_for_each_surface(output, output_surface_for_each_surface(output,
drag_icon->wlr_drag_icon->surface, ox, oy, iterator, user_data); drag_icon->wlr_drag_icon->surface, ox, oy, iterator, user_data);
} }
@ -430,7 +439,12 @@ static void update_output_manager_config(struct roots_desktop *desktop) {
struct roots_output *output; struct roots_output *output;
wl_list_for_each(output, &desktop->outputs, link) { wl_list_for_each(output, &desktop->outputs, link) {
struct wlr_output_configuration_head_v1 *config_head =
wlr_output_configuration_head_v1_create(config, output->wlr_output); wlr_output_configuration_head_v1_create(config, output->wlr_output);
struct wlr_box *output_box = wlr_output_layout_get_box(
output->desktop->layout, output->wlr_output);
config_head->state.x = output_box->x;
config_head->state.y = output_box->y;
} }
wlr_output_manager_v1_set_configuration(desktop->output_manager_v1, config); wlr_output_manager_v1_set_configuration(desktop->output_manager_v1, config);

View File

@ -87,21 +87,20 @@ static void popup_unconstrain(struct roots_xdg_popup *popup) {
struct wlr_output *output = struct wlr_output *output =
wlr_output_layout_output_at(layout, dest_x, dest_y); wlr_output_layout_output_at(layout, dest_x, dest_y);
if (output == NULL) { if (output == NULL) {
return; return;
} }
int width = 0, height = 0; struct wlr_box *output_box =
wlr_output_effective_resolution(output, &width, &height); wlr_output_layout_get_box(view->desktop->layout, output);
// the output box expressed in the coordinate system of the toplevel parent // the output box expressed in the coordinate system of the toplevel parent
// of the popup // of the popup
struct wlr_box output_toplevel_sx_box = { struct wlr_box output_toplevel_sx_box = {
.x = output->lx - view->box.x, .x = output_box->x - view->box.x,
.y = output->ly - view->box.y, .y = output_box->y - view->box.y,
.width = width, .width = output_box->width,
.height = height .height = output_box->height,
}; };
wlr_xdg_popup_unconstrain_from_box( wlr_xdg_popup_unconstrain_from_box(

View File

@ -87,21 +87,20 @@ static void popup_unconstrain(struct roots_xdg_popup_v6 *popup) {
struct wlr_output *output = struct wlr_output *output =
wlr_output_layout_output_at(layout, dest_x, dest_y); wlr_output_layout_output_at(layout, dest_x, dest_y);
if (output == NULL) { if (output == NULL) {
return; return;
} }
int width = 0, height = 0; struct wlr_box *output_box =
wlr_output_effective_resolution(output, &width, &height); wlr_output_layout_get_box(view->desktop->layout, output);
// the output box expressed in the coordinate system of the toplevel parent // the output box expressed in the coordinate system of the toplevel parent
// of the popup // of the popup
struct wlr_box output_toplevel_sx_box = { struct wlr_box output_toplevel_sx_box = {
.x = output->lx - view->box.x, .x = output_box->x - view->box.x,
.y = output->ly - view->box.y, .y = output_box->y - view->box.y,
.width = width, .width = output_box->width,
.height = height .height = output_box->height,
}; };
wlr_xdg_popup_v6_unconstrain_from_box(popup->wlr_popup, &output_toplevel_sx_box); wlr_xdg_popup_v6_unconstrain_from_box(popup->wlr_popup, &output_toplevel_sx_box);

View File

@ -23,7 +23,7 @@ static void output_send_to_resource(struct wl_resource *resource) {
struct wlr_output *output = wlr_output_from_resource(resource); struct wlr_output *output = wlr_output_from_resource(resource);
const uint32_t version = wl_resource_get_version(resource); const uint32_t version = wl_resource_get_version(resource);
if (version >= WL_OUTPUT_GEOMETRY_SINCE_VERSION) { if (version >= WL_OUTPUT_GEOMETRY_SINCE_VERSION) {
wl_output_send_geometry(resource, output->lx, output->ly, wl_output_send_geometry(resource, 0, 0,
output->phys_width, output->phys_height, output->subpixel, output->phys_width, output->phys_height, output->subpixel,
output->make, output->model, output->transform); output->make, output->model, output->transform);
} }
@ -223,22 +223,6 @@ void wlr_output_set_transform(struct wlr_output *output,
wlr_signal_emit_safe(&output->events.transform, output); wlr_signal_emit_safe(&output->events.transform, output);
} }
void wlr_output_set_position(struct wlr_output *output, int32_t lx,
int32_t ly) {
if (lx == output->lx && ly == output->ly) {
return;
}
output->lx = lx;
output->ly = ly;
// TODO: only send geometry and done
struct wl_resource *resource;
wl_resource_for_each(resource, &output->resources) {
output_send_to_resource(resource);
}
}
void wlr_output_set_scale(struct wlr_output *output, float scale) { void wlr_output_set_scale(struct wlr_output *output, float scale) {
if (output->scale == scale) { if (output->scale == scale) {
return; return;

View File

@ -127,10 +127,6 @@ static void output_layout_reconfigure(struct wlr_output_layout *layout) {
max_x += box->width; max_x += box->width;
} }
wl_list_for_each(l_output, &layout->outputs, link) {
wlr_output_set_position(l_output->output, l_output->x, l_output->y);
}
wlr_signal_emit_safe(&layout->events.change, layout); wlr_signal_emit_safe(&layout->events.change, layout);
} }

View File

@ -122,8 +122,6 @@ struct wlr_output_configuration_head_v1 *
config_head->state.custom_mode.width = output->width; config_head->state.custom_mode.width = output->width;
config_head->state.custom_mode.height = output->height; config_head->state.custom_mode.height = output->height;
config_head->state.custom_mode.refresh = output->refresh; config_head->state.custom_mode.refresh = output->refresh;
config_head->state.x = output->lx;
config_head->state.y = output->ly;
config_head->state.transform = output->transform; config_head->state.transform = output->transform;
config_head->state.scale = output->scale; config_head->state.scale = output->scale;
return config_head; return config_head;