Bugfix: fix disabling RandR outputs
This commit is contained in:
parent
35e79c87c8
commit
a92b9dca73
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ include $(TOPDIR)/common.mk
|
|||
|
||||
# Depend on the object files of all source-files in src/*.c and on all header files
|
||||
AUTOGENERATED:=src/cfgparse.tab.c src/cfgparse.yy.c src/cmdparse.tab.c src/cmdparse.yy.c
|
||||
FILES:=src/ipc.c src/main.c src/log.c src/util.c src/tree.c src/xcb.c src/manage.c src/workspace.c src/x.c src/floating.c src/click.c src/config.c src/handlers.c src/randr.c src/xinerama.c src/con.c src/load_layout.c src/render.c src/window.c src/match.c src/xcursor.c src/resize.c src/sighandler.c src/move.c
|
||||
FILES:=src/ipc.c src/main.c src/log.c src/util.c src/tree.c src/xcb.c src/manage.c src/workspace.c src/x.c src/floating.c src/click.c src/config.c src/handlers.c src/randr.c src/xinerama.c src/con.c src/load_layout.c src/render.c src/window.c src/match.c src/xcursor.c src/resize.c src/sighandler.c src/move.c src/output.c
|
||||
FILES:=$(FILES:.c=.o)
|
||||
HEADERS:=$(filter-out include/loglevels.h,$(wildcard include/*.h))
|
||||
|
||||
|
|
|
@ -55,5 +55,6 @@
|
|||
#include "resize.h"
|
||||
#include "sighandler.h"
|
||||
#include "move.h"
|
||||
#include "output.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* vim:ts=4:sw=4:expandtab
|
||||
*/
|
||||
|
||||
#ifndef _OUTPUT_H
|
||||
#define _OUTPUT_H
|
||||
|
||||
/**
|
||||
* Returns the output container below the given output container.
|
||||
*
|
||||
*/
|
||||
Con *output_get_content(Con *output);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* vim:ts=4:sw=4:expandtab
|
||||
*/
|
||||
|
||||
#include "all.h"
|
||||
|
||||
/*
|
||||
* Returns the output container below the given output container.
|
||||
*
|
||||
*/
|
||||
Con *output_get_content(Con *output) {
|
||||
Con *child;
|
||||
|
||||
TAILQ_FOREACH(child, &(output->nodes_head), nodes)
|
||||
if (child->type == CT_CON)
|
||||
return child;
|
||||
|
||||
ELOG("output_get_content() called on non-output %p\n", output);
|
||||
assert(false);
|
||||
}
|
|
@ -586,6 +586,8 @@ void randr_query_outputs() {
|
|||
if ((first = get_first_output()) == NULL)
|
||||
die("No usable outputs available\n");
|
||||
|
||||
Con *first_content = output_get_content(first->con);
|
||||
|
||||
if (output->con != NULL) {
|
||||
/* We need to move the workspaces from the disappearing output to the first output */
|
||||
/* 1: Get the con to focus next, if the disappearing ws is focused */
|
||||
|
@ -598,12 +600,13 @@ void randr_query_outputs() {
|
|||
|
||||
/* 2: iterate through workspaces and re-assign them */
|
||||
Con *current;
|
||||
while (!TAILQ_EMPTY(&(output->con->nodes_head))) {
|
||||
current = TAILQ_FIRST(&(output->con->nodes_head));
|
||||
Con *old_content = output_get_content(output->con);
|
||||
while (!TAILQ_EMPTY(&(old_content->nodes_head))) {
|
||||
current = TAILQ_FIRST(&(old_content->nodes_head));
|
||||
DLOG("Detaching current = %p / %s\n", current, current->name);
|
||||
con_detach(current);
|
||||
DLOG("Re-attaching current = %p / %s\n", current, current->name);
|
||||
con_attach(current, first->con, false);
|
||||
con_attach(current, first_content, false);
|
||||
DLOG("Done, next\n");
|
||||
}
|
||||
DLOG("re-attached all workspaces\n");
|
||||
|
|
Loading…
Reference in New Issue