Bugfix: Don’t focus new cons when there is a fullscreen con (Thanks dothebart)
Also, remove the focus_it parameter from tree_open_con, it makes more sense to call con_focus outside of the function.
This commit is contained in:
parent
8ce5f2a21b
commit
287d7f9527
|
@ -24,7 +24,7 @@ void tree_init();
|
||||||
* Opens an empty container in the current container
|
* Opens an empty container in the current container
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Con *tree_open_con(Con *con, bool focus_it);
|
Con *tree_open_con(Con *con);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splits (horizontally or vertically) the given container by creating a new
|
* Splits (horizontally or vertically) the given container by creating a new
|
||||||
|
|
|
@ -403,7 +403,8 @@ open:
|
||||||
TOK_OPEN
|
TOK_OPEN
|
||||||
{
|
{
|
||||||
printf("opening new container\n");
|
printf("opening new container\n");
|
||||||
Con *con = tree_open_con(NULL, true);
|
Con *con = tree_open_con(NULL);
|
||||||
|
con_focus(con);
|
||||||
asprintf(&json_output, "{\"success\":true, \"id\":%ld}", (long int)con);
|
asprintf(&json_output, "{\"success\":true, \"id\":%ld}", (long int)con);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
25
src/manage.c
25
src/manage.c
|
@ -201,7 +201,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||||
LOG("using current container, focused = %p, focused->name = %s\n",
|
LOG("using current container, focused = %p, focused->name = %s\n",
|
||||||
focused, focused->name);
|
focused, focused->name);
|
||||||
nc = focused;
|
nc = focused;
|
||||||
} else nc = tree_open_con(NULL, true);
|
} else nc = tree_open_con(NULL);
|
||||||
} else {
|
} else {
|
||||||
/* M_ACTIVE are assignments */
|
/* M_ACTIVE are assignments */
|
||||||
if (match != NULL && match->insert_where == M_ACTIVE) {
|
if (match != NULL && match->insert_where == M_ACTIVE) {
|
||||||
|
@ -213,13 +213,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||||
/* We need to open a new con */
|
/* We need to open a new con */
|
||||||
/* TODO: make a difference between match-once containers (directly assign
|
/* TODO: make a difference between match-once containers (directly assign
|
||||||
* cwindow) and match-multiple (tree_open_con first) */
|
* cwindow) and match-multiple (tree_open_con first) */
|
||||||
nc = tree_open_con(nc->parent, true);
|
nc = tree_open_con(nc->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* M_BELOW inserts the new window as a child of the one which was
|
/* M_BELOW inserts the new window as a child of the one which was
|
||||||
* matched (e.g. dock areas) */
|
* matched (e.g. dock areas) */
|
||||||
else if (match != NULL && match->insert_where == M_BELOW) {
|
else if (match != NULL && match->insert_where == M_BELOW) {
|
||||||
nc = tree_open_con(nc, !cwindow->dock);
|
nc = tree_open_con(nc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,6 +234,18 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||||
x_set_name(nc, name);
|
x_set_name(nc, name);
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
|
Con *ws = con_get_workspace(nc);
|
||||||
|
Con *fs = (ws ? con_get_fullscreen_con(ws) : NULL);
|
||||||
|
|
||||||
|
if (fs == NULL) {
|
||||||
|
DLOG("Not in fullscreen mode, focusing\n");
|
||||||
|
if (!cwindow->dock)
|
||||||
|
con_focus(nc);
|
||||||
|
else DLOG("dock, not focusing\n");
|
||||||
|
} else {
|
||||||
|
DLOG("fs = %p, ws = %p, not focusing\n", fs, ws);
|
||||||
|
}
|
||||||
|
|
||||||
/* set floating if necessary */
|
/* set floating if necessary */
|
||||||
bool want_floating = false;
|
bool want_floating = false;
|
||||||
if (xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_DIALOG]) ||
|
if (xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_DIALOG]) ||
|
||||||
|
@ -251,15 +263,12 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||||
LOG("This window is transiert for another window, setting floating\n");
|
LOG("This window is transiert for another window, setting floating\n");
|
||||||
want_floating = true;
|
want_floating = true;
|
||||||
|
|
||||||
if (config.popup_during_fullscreen == PDF_LEAVE_FULLSCREEN) {
|
if (config.popup_during_fullscreen == PDF_LEAVE_FULLSCREEN &&
|
||||||
Con *ws, *fs;
|
fs != NULL) {
|
||||||
if ((ws = con_get_workspace(nc)) &&
|
|
||||||
(fs = con_get_fullscreen_con(ws))) {
|
|
||||||
LOG("There is a fullscreen window, leaving fullscreen mode\n");
|
LOG("There is a fullscreen window, leaving fullscreen mode\n");
|
||||||
con_toggle_fullscreen(fs);
|
con_toggle_fullscreen(fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* dock clients cannot be floating, that makes no sense */
|
/* dock clients cannot be floating, that makes no sense */
|
||||||
if (cwindow->dock)
|
if (cwindow->dock)
|
||||||
|
|
|
@ -55,7 +55,7 @@ void tree_init() {
|
||||||
* Opens an empty container in the current container
|
* Opens an empty container in the current container
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Con *tree_open_con(Con *con, bool focus_it) {
|
Con *tree_open_con(Con *con) {
|
||||||
if (con == NULL) {
|
if (con == NULL) {
|
||||||
/* every focusable Con has a parent (outputs have parent root) */
|
/* every focusable Con has a parent (outputs have parent root) */
|
||||||
con = focused->parent;
|
con = focused->parent;
|
||||||
|
@ -80,10 +80,6 @@ Con *tree_open_con(Con *con, bool focus_it) {
|
||||||
/* 4: re-calculate child->percent for each child */
|
/* 4: re-calculate child->percent for each child */
|
||||||
con_fix_percent(con);
|
con_fix_percent(con);
|
||||||
|
|
||||||
/* 5: focus the new container */
|
|
||||||
if (focus_it)
|
|
||||||
con_focus(new);
|
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue