Fix restarting with 32bit depth windows (v5)
What I do in this patch is: 1. Split the con_new() function, so I can create a Con without actually create a window. 2. Store the depth of Cons in the layout file when i3 is restarting. Fix typos and mis-staged files in previous patch.
This commit is contained in:
committed by
Michael Stapelberg
parent
7552a02d5c
commit
5b4ff1804d
22
src/con.c
22
src/con.c
@ -44,11 +44,10 @@ static void con_force_split_parents_redraw(Con *con) {
|
||||
|
||||
/*
|
||||
* Create a new container (and attach it to the given parent, if not NULL).
|
||||
* This function initializes the data structures and creates the appropriate
|
||||
* X11 IDs using x_con_init().
|
||||
* This function only initializes the data structures.
|
||||
*
|
||||
*/
|
||||
Con *con_new(Con *parent, i3Window *window) {
|
||||
Con *con_new_skeleton(Con *parent, i3Window *window) {
|
||||
Con *new = scalloc(sizeof(Con));
|
||||
new->on_remove_child = con_on_remove_child;
|
||||
TAILQ_INSERT_TAIL(&all_cons, new, all_cons);
|
||||
@ -56,6 +55,10 @@ Con *con_new(Con *parent, i3Window *window) {
|
||||
new->window = window;
|
||||
new->border_style = config.default_border;
|
||||
new->current_border_width = -1;
|
||||
if (window)
|
||||
new->depth = window->depth;
|
||||
else
|
||||
new->depth = XCB_COPY_FROM_PARENT;
|
||||
static int cnt = 0;
|
||||
DLOG("opening window %d\n", cnt);
|
||||
|
||||
@ -66,10 +69,6 @@ Con *con_new(Con *parent, i3Window *window) {
|
||||
cnt++;
|
||||
if ((cnt % (sizeof(colors) / sizeof(char*))) == 0)
|
||||
cnt = 0;
|
||||
if (window)
|
||||
x_con_init(new, window->depth);
|
||||
else
|
||||
x_con_init(new, XCB_COPY_FROM_PARENT);
|
||||
|
||||
TAILQ_INIT(&(new->floating_head));
|
||||
TAILQ_INIT(&(new->nodes_head));
|
||||
@ -82,6 +81,15 @@ Con *con_new(Con *parent, i3Window *window) {
|
||||
return new;
|
||||
}
|
||||
|
||||
/* A wrapper for con_new_skeleton, to retain the old con_new behaviour
|
||||
*
|
||||
*/
|
||||
Con *con_new(Con *parent, i3Window *window) {
|
||||
Con *new = con_new_skeleton(parent, window);
|
||||
x_con_init(new, new->depth);
|
||||
return new;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attaches the given container to the given parent. This happens when moving
|
||||
* a container or when inserting a new container at a specific place in the
|
||||
|
Reference in New Issue
Block a user