aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/render.c4
-rw-r--r--sway/desktop/transaction.c16
-rw-r--r--sway/desktop/xdg_shell.c39
-rw-r--r--sway/desktop/xdg_shell_v6.c39
4 files changed, 21 insertions, 77 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index b370f8a2..4bfc573b 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -15,6 +15,7 @@
#include <wlr/util/region.h>
#include "log.h"
#include "sway/config.h"
+#include "sway/debug.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/layers.h"
@@ -786,6 +787,8 @@ static void render_floating(struct sway_output *soutput,
}
}
+const char *damage_debug = NULL;
+
void output_render(struct sway_output *output, struct timespec *when,
pixman_region32_t *damage) {
struct wlr_output *wlr_output = output->wlr_output;
@@ -805,7 +808,6 @@ void output_render(struct sway_output *output, struct timespec *when,
goto renderer_end;
}
- const char *damage_debug = getenv("SWAY_DAMAGE_DEBUG");
if (damage_debug != NULL) {
if (strcmp(damage_debug, "highlight") == 0) {
wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1});
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 2b3f87c3..5e42fde5 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -19,14 +19,14 @@
* How long we should wait for views to respond to the configure before giving
* up and applying the transaction anyway.
*/
-#define TIMEOUT_MS 200
+int txn_timeout_ms = 200;
/**
* If enabled, sway will always wait for the transaction timeout before
* applying it, rather than applying it when the views are ready. This allows us
* to observe the rendered state while a transaction is in progress.
*/
-#define TRANSACTION_DEBUG false
+bool txn_debug = false;
struct sway_transaction {
struct wl_event_source *timer;
@@ -330,7 +330,7 @@ void transaction_commit(struct sway_transaction *transaction) {
// Set up a timer which the views must respond within
transaction->timer = wl_event_loop_add_timer(server.wl_event_loop,
handle_timeout, transaction);
- wl_event_source_timer_update(transaction->timer, TIMEOUT_MS);
+ wl_event_source_timer_update(transaction->timer, txn_timeout_ms);
}
// The debug tree shows the pending/live tree. Here is a good place to
@@ -361,11 +361,11 @@ static void set_instruction_ready(
// If all views are ready, apply the transaction.
// If the transaction has timed out then its num_waiting will be 0 already.
if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) {
-#if !TRANSACTION_DEBUG
- wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction);
- wl_event_source_timer_update(transaction->timer, 0);
- transaction_progress_queue();
-#endif
+ if (!txn_debug) {
+ wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction);
+ wl_event_source_timer_update(transaction->timer, 0);
+ transaction_progress_queue();
+ }
}
}
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 17b7b750..fbeeb2e3 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -46,47 +46,18 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) {
}
static void popup_unconstrain(struct sway_xdg_popup *popup) {
- // get the output of the popup's positioner anchor point and convert it to
- // the toplevel parent's coordinate system and then pass it to
- // wlr_xdg_popup_unconstrain_from_box
-
struct sway_view *view = popup->child.view;
- struct wlr_output_layout *output_layout =
- root_container.sway_root->output_layout;
struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_surface->popup;
- int anchor_lx, anchor_ly;
- wlr_xdg_popup_get_anchor_point(wlr_popup, &anchor_lx, &anchor_ly);
-
- int popup_lx, popup_ly;
- wlr_xdg_popup_get_toplevel_coords(wlr_popup, wlr_popup->geometry.x,
- wlr_popup->geometry.y, &popup_lx, &popup_ly);
- popup_lx += view->x;
- popup_ly += view->y;
-
- anchor_lx += popup_lx;
- anchor_ly += popup_ly;
-
- double dest_x = 0, dest_y = 0;
- wlr_output_layout_closest_point(output_layout, NULL, anchor_lx, anchor_ly,
- &dest_x, &dest_y);
-
- struct wlr_output *output =
- wlr_output_layout_output_at(output_layout, dest_x, dest_y);
- if (output == NULL) {
- return;
- }
-
- int width = 0, height = 0;
- wlr_output_effective_resolution(output, &width, &height);
+ struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
// the output box expressed in the coordinate system of the toplevel parent
// of the popup
struct wlr_box output_toplevel_sx_box = {
- .x = output->lx - view->x,
- .y = output->ly - view->y,
- .width = width,
- .height = height
+ .x = output->x - view->x,
+ .y = output->y - view->y,
+ .width = output->width,
+ .height = output->height,
};
wlr_xdg_popup_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box);
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 43e58918..88d9bb94 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -45,47 +45,18 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) {
}
static void popup_unconstrain(struct sway_xdg_popup_v6 *popup) {
- // get the output of the popup's positioner anchor point and convert it to
- // the toplevel parent's coordinate system and then pass it to
- // wlr_xdg_popup_unconstrain_from_box
-
struct sway_view *view = popup->child.view;
- struct wlr_output_layout *output_layout =
- root_container.sway_root->output_layout;
struct wlr_xdg_popup_v6 *wlr_popup = popup->wlr_xdg_surface_v6->popup;
- int anchor_lx, anchor_ly;
- wlr_xdg_popup_v6_get_anchor_point(wlr_popup, &anchor_lx, &anchor_ly);
-
- int popup_lx, popup_ly;
- wlr_xdg_popup_v6_get_toplevel_coords(wlr_popup, wlr_popup->geometry.x,
- wlr_popup->geometry.y, &popup_lx, &popup_ly);
- popup_lx += view->x;
- popup_ly += view->y;
-
- anchor_lx += popup_lx;
- anchor_ly += popup_ly;
-
- double dest_x = 0, dest_y = 0;
- wlr_output_layout_closest_point(output_layout, NULL, anchor_lx, anchor_ly,
- &dest_x, &dest_y);
-
- struct wlr_output *output =
- wlr_output_layout_output_at(output_layout, dest_x, dest_y);
- if (output == NULL) {
- return;
- }
-
- int width = 0, height = 0;
- wlr_output_effective_resolution(output, &width, &height);
+ struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
// the output box expressed in the coordinate system of the toplevel parent
// of the popup
struct wlr_box output_toplevel_sx_box = {
- .x = output->lx - view->x,
- .y = output->ly - view->y,
- .width = width,
- .height = height
+ .x = output->x - view->x,
+ .y = output->y - view->y,
+ .width = output->width,
+ .height = output->height,
};
wlr_xdg_popup_v6_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box);