mirror of
https://github.com/NickHu/sway
synced 2024-12-28 22:23:30 +01:00
Remove output from layout
This commit is contained in:
parent
8764dc26c6
commit
4a14aa9ad9
3 changed files with 7 additions and 2 deletions
|
@ -227,7 +227,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
if (output->name) {
|
if (output->name) {
|
||||||
// Try to find the output container and apply configuration now. If
|
// Try to find the output container and apply configuration now. If
|
||||||
// this is during startup then there will be no container and config
|
// this is during startup then there will be no container and config
|
||||||
// will be applied during normal "new output" event from wlc.
|
// will be applied during normal "new output" event from wlroots.
|
||||||
swayc_t *cont = NULL;
|
swayc_t *cont = NULL;
|
||||||
for (int i = 0; i < root_container.children->length; ++i) {
|
for (int i = 0; i < root_container.children->length; ++i) {
|
||||||
cont = root_container.children->items[i];
|
cont = root_container.children->items[i];
|
||||||
|
|
|
@ -91,12 +91,13 @@ static void set_mode(struct wlr_output *output, int width, int height,
|
||||||
void apply_output_config(struct output_config *oc, swayc_t *output) {
|
void apply_output_config(struct output_config *oc, swayc_t *output) {
|
||||||
assert(output->type == C_OUTPUT);
|
assert(output->type == C_OUTPUT);
|
||||||
|
|
||||||
|
struct wlr_output *wlr_output = output->sway_output->wlr_output;
|
||||||
if (oc && oc->enabled == 0) {
|
if (oc && oc->enabled == 0) {
|
||||||
|
wlr_output_layout_remove(root_container.output_layout, wlr_output);
|
||||||
destroy_output(output);
|
destroy_output(output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output *wlr_output = output->sway_output->wlr_output;
|
|
||||||
if (oc && oc->width > 0 && oc->height > 0) {
|
if (oc && oc->width > 0 && oc->height > 0) {
|
||||||
set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
|
set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "sway/container.h"
|
#include "sway/container.h"
|
||||||
#include "sway/layout.h"
|
#include "sway/layout.h"
|
||||||
#include "sway/output.h"
|
#include "sway/output.h"
|
||||||
|
#include "sway/server.h"
|
||||||
#include "sway/view.h"
|
#include "sway/view.h"
|
||||||
#include "sway/workspace.h"
|
#include "sway/workspace.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
@ -172,6 +173,7 @@ swayc_t *destroy_output(swayc_t *output) {
|
||||||
if (!sway_assert(output, "null output passed to destroy_output")) {
|
if (!sway_assert(output, "null output passed to destroy_output")) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output->children->length > 0) {
|
if (output->children->length > 0) {
|
||||||
// TODO save workspaces when there are no outputs.
|
// TODO save workspaces when there are no outputs.
|
||||||
// TODO also check if there will ever be no outputs except for exiting
|
// TODO also check if there will ever be no outputs except for exiting
|
||||||
|
@ -190,9 +192,11 @@ swayc_t *destroy_output(swayc_t *output) {
|
||||||
arrange_windows(root_container.children->items[p], -1, -1);
|
arrange_windows(root_container.children->items[p], -1, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sway_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
|
sway_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
|
||||||
free_swayc(output);
|
free_swayc(output);
|
||||||
update_root_geometry();
|
update_root_geometry();
|
||||||
|
|
||||||
return &root_container;
|
return &root_container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue