Update output container box in event handler
This commit is contained in:
parent
c7abb77f22
commit
d293c42942
|
@ -6,7 +6,6 @@
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server.h>
|
|
||||||
#include <wlr/types/wlr_box.h>
|
#include <wlr/types/wlr_box.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
|
@ -29,7 +29,8 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
|
|
||||||
struct output_config *output = new_output_config();
|
struct output_config *output = new_output_config();
|
||||||
if (!output) {
|
if (!output) {
|
||||||
return cmd_results_new(CMD_FAILURE, "output", "Unable to allocate output config");
|
sway_log(L_ERROR, "Failed to allocate output config");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
output->name = strdup(name);
|
output->name = strdup(name);
|
||||||
|
|
||||||
|
|
|
@ -131,12 +131,6 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
|
||||||
wlr_output_layout_add_auto(root_container.sway_root->output_layout,
|
wlr_output_layout_add_auto(root_container.sway_root->output_layout,
|
||||||
wlr_output);
|
wlr_output);
|
||||||
}
|
}
|
||||||
struct wlr_box *output_layout_box = wlr_output_layout_get_box(
|
|
||||||
root_container.sway_root->output_layout, wlr_output);
|
|
||||||
output->x = output_layout_box->x;
|
|
||||||
output->y = output_layout_box->y;
|
|
||||||
output->width = output_layout_box->width;
|
|
||||||
output->height = output_layout_box->height;
|
|
||||||
|
|
||||||
if (!oc || !oc->background) {
|
if (!oc || !oc->background) {
|
||||||
// Look for a * config for background
|
// Look for a * config for background
|
||||||
|
|
|
@ -91,19 +91,30 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
soutput->last_frame = now;
|
soutput->last_frame = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void output_update_size(struct sway_output *output) {
|
||||||
|
struct wlr_box *output_layout_box = wlr_output_layout_get_box(
|
||||||
|
root_container.sway_root->output_layout, output->wlr_output);
|
||||||
|
output->swayc->x = output_layout_box->x;
|
||||||
|
output->swayc->y = output_layout_box->y;
|
||||||
|
output->swayc->width = output_layout_box->width;
|
||||||
|
output->swayc->height = output_layout_box->height;
|
||||||
|
|
||||||
|
arrange_windows(output->swayc, -1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
static void output_resolution_notify(struct wl_listener *listener, void *data) {
|
static void output_resolution_notify(struct wl_listener *listener, void *data) {
|
||||||
struct sway_output *soutput = wl_container_of(listener, soutput, resolution);
|
struct sway_output *output = wl_container_of(listener, output, resolution);
|
||||||
arrange_windows(soutput->swayc, -1, -1);
|
output_update_size(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_scale_notify(struct wl_listener *listener, void *data) {
|
static void output_scale_notify(struct wl_listener *listener, void *data) {
|
||||||
struct sway_output *soutput = wl_container_of(listener, soutput, scale);
|
struct sway_output *output = wl_container_of(listener, output, scale);
|
||||||
arrange_windows(soutput->swayc, -1, -1);
|
output_update_size(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_transform_notify(struct wl_listener *listener, void *data) {
|
static void output_transform_notify(struct wl_listener *listener, void *data) {
|
||||||
struct sway_output *soutput = wl_container_of(listener, soutput, transform);
|
struct sway_output *output = wl_container_of(listener, output, transform);
|
||||||
arrange_windows(soutput->swayc, -1, -1);
|
output_update_size(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void output_add_notify(struct wl_listener *listener, void *data) {
|
void output_add_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
Loading…
Reference in a new issue