diff --git a/include/sway/output.h b/include/sway/output.h index feb258739..31b1e220f 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -42,7 +42,7 @@ struct sway_output { struct sway_server *server; struct wl_list link; - struct wlr_box usable_area; + struct wlr_fbox usable_area; struct timespec last_frame; diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 471b8691d..e0a81b18f 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -40,7 +40,7 @@ struct sway_view_impl { enum sway_view_prop prop); uint32_t (*get_int_prop)(struct sway_view *view, enum sway_view_prop prop); uint32_t (*configure)(struct sway_view *view, double lx, double ly, - int width, int height); + double width, double height); void (*set_activated)(struct sway_view *view, bool activated); void (*set_tiled)(struct sway_view *view, bool tiled); void (*set_fullscreen)(struct sway_view *view, bool fullscreen); @@ -81,7 +81,7 @@ struct sway_view { // The geometry for whatever the client is committing, regardless of // transaction state. Updated on every commit. - struct wlr_box geometry; + struct wlr_fbox geometry; struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; struct wl_listener foreign_activate_request; @@ -217,8 +217,8 @@ const char *view_get_shell(struct sway_view *view); void view_get_constraints(struct sway_view *view, double *min_width, double *max_width, double *min_height, double *max_height); -uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, - int height); +uint32_t view_configure(struct sway_view *view, double lx, double ly, + double width, double height); bool view_inhibit_idle(struct sway_view *view); diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 68659b150..8d18f981e 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -19,8 +19,8 @@ #include "sway/tree/workspace.h" #include -static void arrange_surface(struct sway_output *output, const struct wlr_box *full_area, - struct wlr_box *usable_area, struct wlr_scene_tree *tree) { +static void arrange_surface(struct sway_output *output, const struct wlr_fbox *full_area, + struct wlr_fbox *usable_area, struct wlr_scene_tree *tree) { struct wlr_scene_node *node; wl_list_for_each(node, &tree->children, link) { struct sway_scene_descriptor *desc = node->data; @@ -40,10 +40,16 @@ static void arrange_surface(struct sway_output *output, const struct wlr_box *fu } void arrange_layers(struct sway_output *output) { - struct wlr_box usable_area = { 0 }; + int output_width, output_height; wlr_output_effective_resolution(output->wlr_output, - &usable_area.width, &usable_area.height); - const struct wlr_box full_area = usable_area; + &output_width, &output_height); + struct wlr_fbox usable_area = { + .x = 0, + .y = 0, + .width = output_width, + .height = output_height, + }; + const struct wlr_fbox full_area = usable_area; arrange_surface(output, &full_area, &usable_area, output->layers.shell_background); arrange_surface(output, &full_area, &usable_area, output->layers.shell_bottom); @@ -51,9 +57,9 @@ void arrange_layers(struct sway_output *output) { arrange_surface(output, &full_area, &usable_area, output->layers.shell_overlay); if (memcmp(&usable_area, &output->usable_area, - sizeof(struct wlr_box)) != 0) { + sizeof(struct wlr_fbox)) != 0) { sway_log(SWAY_DEBUG, "Usable area changed, rearranging output"); - memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box)); + memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_fbox)); arrange_output(output); } } @@ -182,7 +188,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { transaction_commit_dirty(); } - int lx, ly; + double lx, ly; wlr_scene_node_coords(&surface->scene->tree->node, &lx, &ly); wlr_scene_node_set_position(&surface->popups->node, lx, ly); } @@ -238,12 +244,12 @@ static void popup_unconstrain(struct sway_layer_popup *popup) { struct wlr_xdg_popup *wlr_popup = popup->wlr_popup; struct sway_output *output = popup->toplevel->output; - int lx, ly; + double lx, ly; wlr_scene_node_coords(&popup->toplevel->scene->tree->node, &lx, &ly); // the output box expressed in the coordinate system of the toplevel parent // of the popup - struct wlr_box output_toplevel_sx_box = { + struct wlr_fbox output_toplevel_sx_box = { .x = output->lx - lx, .y = output->ly - ly, .width = output->width, @@ -300,7 +306,7 @@ static void handle_new_popup(struct wl_listener *listener, void *data) { void handle_layer_shell_surface(struct wl_listener *listener, void *data) { struct wlr_layer_surface_v1 *layer_surface = data; sway_log(SWAY_DEBUG, "new layer surface: namespace %s layer %d anchor %" PRIu32 - " size %" PRIu32 "x%" PRIu32 " margin %" PRIu32 ",%" PRIu32 ",%" PRIu32 ",%" PRIu32 ",", + " size %lfx%lf margin %lf,%lf,%lf,%lf", layer_surface->namespace, layer_surface->pending.layer, layer_surface->pending.anchor, diff --git a/sway/desktop/output.c b/sway/desktop/output.c index a0e20f950..db768ac44 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -121,7 +121,7 @@ static struct buffer_timer *buffer_timer_assign(struct wlr_scene_buffer *buffer) } static void send_frame_done_iterator(struct wlr_scene_buffer *buffer, - int x, int y, void *user_data) { + double x, double y, void *user_data) { struct send_frame_done_data *data = user_data; struct sway_output *output = data->output; int view_max_render_time = 0; diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 9b3057b99..067ea0cff 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -599,7 +599,7 @@ static void arrange_output(struct sway_output *output, int width, int height) { arrange_fullscreen(child->layers.fullscreen, fs, child, width, height); } else { - struct wlr_box *area = &output->usable_area; + struct wlr_fbox *area = &output->usable_area; struct side_gaps *gaps = &child->current_gaps; wlr_scene_node_set_position(&child->layers.tiling->node, @@ -631,7 +631,7 @@ static void arrange_popup(struct wlr_scene_tree *popup) { struct sway_xdg_popup *popup = desc->data; struct wlr_scene_tree *tree = popup->child.view->content_tree; - int lx, ly; + double lx, ly; wlr_scene_node_coords(&tree->node, &lx, &ly); wlr_scene_node_set_position(&popup->child.scene_tree->node, lx, ly); } diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 92bfd239f..0cec74561 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -63,7 +63,7 @@ static void popup_unconstrain(struct sway_xdg_popup *popup) { // the output box expressed in the coordinate system of the toplevel parent // of the popup - struct wlr_box output_toplevel_sx_box = { + struct wlr_fbox output_toplevel_sx_box = { .x = output->lx - view->container->pending.content_x + view->geometry.x, .y = output->ly - view->container->pending.content_y + view->geometry.y, .width = output->width, @@ -146,7 +146,7 @@ static const char *get_string_prop(struct sway_view *view, } static uint32_t configure(struct sway_view *view, double lx, double ly, - int width, int height) { + double width, double height) { struct sway_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view); if (xdg_shell_view == NULL) { @@ -257,7 +257,7 @@ static void handle_commit(struct wl_listener *listener, void *data) { struct sway_view *view = &xdg_shell_view->view; struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_toplevel->base; - struct wlr_box new_geo; + struct wlr_fbox new_geo; wlr_xdg_surface_get_geometry(xdg_surface, &new_geo); bool new_size = new_geo.width != view->geometry.width || new_geo.height != view->geometry.height || @@ -268,7 +268,7 @@ static void handle_commit(struct wl_listener *listener, void *data) { // The client changed its surface size in this commit. For floating // containers, we resize the container to match. For tiling containers, // we only recenter the surface. - memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); + memcpy(&view->geometry, &new_geo, sizeof(struct wlr_fbox)); if (container_is_floating(view->container)) { view_update_size(view); transaction_commit_dirty_client(); @@ -317,7 +317,7 @@ static void handle_new_popup(struct wl_listener *listener, void *data) { return; } - int lx, ly; + double lx, ly; wlr_scene_node_coords(&popup->child.view->content_tree->node, &lx, &ly); wlr_scene_node_set_position(&popup->child.scene_tree->node, lx, ly); } diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 2b804ccb5..0f88ca6e0 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -232,8 +232,8 @@ static uint32_t get_int_prop(struct sway_view *view, enum sway_view_prop prop) { } } -static uint32_t configure(struct sway_view *view, double lx, double ly, int width, - int height) { +static uint32_t configure(struct sway_view *view, double lx, double ly, + double width, double height) { struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view); if (xwayland_view == NULL) { return 0; diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index 9c1a11e55..6ce1bdd64 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -259,8 +259,8 @@ void arrange_workspace(struct sway_workspace *workspace) { return; } struct sway_output *output = workspace->output; - struct wlr_box *area = &output->usable_area; - sway_log(SWAY_DEBUG, "Usable area for ws: %dx%d@%d,%d", + struct wlr_fbox *area = &output->usable_area; + sway_log(SWAY_DEBUG, "Usable area for ws: %lfx%lf@%lf,%lf", area->width, area->height, area->x, area->y); bool first_arrange = workspace->width == 0 && workspace->height == 0; diff --git a/sway/tree/container.c b/sway/tree/container.c index f4bfd5085..7abd6802a 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -57,7 +57,7 @@ static void handle_output_leave( } static bool handle_point_accepts_input( - struct wlr_scene_buffer *buffer, int x, int y) { + struct wlr_scene_buffer *buffer, double x, double y) { return false; } diff --git a/sway/tree/view.c b/sway/tree/view.c index 0f1ea1494..2beb55792 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -170,8 +170,8 @@ void view_get_constraints(struct sway_view *view, double *min_width, } } -uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, - int height) { +uint32_t view_configure(struct sway_view *view, double lx, double ly, + double width, double height) { if (view->impl->configure) { return view->impl->configure(view, lx, ly, width, height); } @@ -1138,7 +1138,7 @@ void view_remove_saved_buffer(struct sway_view *view) { } static void view_save_buffer_iterator(struct wlr_scene_buffer *buffer, - int sx, int sy, void *data) { + double sx, double sy, void *data) { struct wlr_scene_tree *tree = data; struct wlr_scene_buffer *sbuf = wlr_scene_buffer_create(tree, NULL); @@ -1178,7 +1178,7 @@ bool view_is_transient_for(struct sway_view *child, } static void send_frame_done_iterator(struct wlr_scene_buffer *scene_buffer, - int x, int y, void *data) { + double x, double y, void *data) { struct timespec *when = data; wl_signal_emit_mutable(&scene_buffer->events.frame_done, when); }