Don’t assign ->container for dock-windows

This commit is contained in:
Michael Stapelberg 2009-02-23 03:44:10 +01:00
parent 8b0bc8c3ff
commit 07b92c2792
5 changed files with 33 additions and 16 deletions

View File

@ -89,6 +89,8 @@ static void focus_window(xcb_connection_t *connection, direction_t direction) {
*/ */
static bool move_current_window_in_container(xcb_connection_t *connection, Client *client, static bool move_current_window_in_container(xcb_connection_t *connection, Client *client,
direction_t direction) { direction_t direction) {
assert(client->container != NULL);
Client *other = (direction == D_UP ? CIRCLEQ_PREV(client, clients) : Client *other = (direction == D_UP ? CIRCLEQ_PREV(client, clients) :
CIRCLEQ_NEXT(client, clients)); CIRCLEQ_NEXT(client, clients));

View File

@ -141,6 +141,11 @@ int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_
*second = NULL; *second = NULL;
enum { O_HORIZONTAL, O_VERTICAL } orientation = O_VERTICAL; enum { O_HORIZONTAL, O_VERTICAL } orientation = O_VERTICAL;
if (con == NULL) {
printf("dock. done.\n");
return 1;
}
printf("event->event_x = %d, client->rect.width = %d\n", event->event_x, client->rect.width); printf("event->event_x = %d, client->rect.width = %d\n", event->event_x, client->rect.width);
if (!border_click) { if (!border_click) {
@ -310,15 +315,16 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *c, xcb_unmap_notify_
client = table_remove(byChild, e->window); client = table_remove(byChild, e->window);
printf("UnmapNotify for 0x%08x (received from 0x%08x): ", e->window, e->event); printf("UnmapNotify for 0x%08x (received from 0x%08x): ", e->window, e->event);
if(client == NULL) { if (client == NULL) {
printf("not a managed window. Ignoring.\n"); printf("not a managed window. Ignoring.\n");
return 0; return 0;
} }
if (client->container != NULL) {
if (client->container->currently_focused == client) if (client->container->currently_focused == client)
client->container->currently_focused = NULL; client->container->currently_focused = NULL;
CIRCLEQ_REMOVE(&(client->container->clients), client, clients); CIRCLEQ_REMOVE(&(client->container->clients), client, clients);
}
printf("child of 0x%08x.\n", client->frame); printf("child of 0x%08x.\n", client->frame);
xcb_reparent_window(c, client->child, root, 0, 0); xcb_reparent_window(c, client->child, root, 0, 0);

View File

@ -89,6 +89,10 @@ void decorate_window(xcb_connection_t *conn, Client *client) {
text_color, text_color,
border_color; border_color;
/* Clients without a container (docks) wont get decorated */
if (client->container == NULL)
return;
if (client->container->currently_focused == client) { if (client->container->currently_focused == client) {
background_color = get_colorpixel(conn, client->frame, "#285577"); background_color = get_colorpixel(conn, client->frame, "#285577");
text_color = get_colorpixel(conn, client->frame, "#ffffff"); text_color = get_colorpixel(conn, client->frame, "#ffffff");
@ -207,13 +211,6 @@ static void render_container(xcb_connection_t *connection, Container *container)
int current_client = 0; int current_client = 0;
CIRCLEQ_FOREACH(client, &(container->clients), clients) { CIRCLEQ_FOREACH(client, &(container->clients), clients) {
/* TODO: currently, clients are assigned to the current container.
Therefore, we need to skip them here. Does anything harmful happen
if clients *do not* have a container. Is this the more desired
situation? Lets find out */
if (client->dock)
continue;
/* Check if we changed client->x or client->y by updating it… /* Check if we changed client->x or client->y by updating it…
* Note the bitwise OR instead of logical OR to force evaluation of both statements */ * Note the bitwise OR instead of logical OR to force evaluation of both statements */
if (client->force_reconfigure | if (client->force_reconfigure |

View File

@ -141,9 +141,6 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
uint32_t mask = 0; uint32_t mask = 0;
uint32_t values[3]; uint32_t values[3];
/* Insert into the currently active container */
CIRCLEQ_INSERT_TAIL(&(CUR_CELL->clients), new, clients);
/* Update the data structures */ /* Update the data structures */
CUR_CELL->currently_focused = new; CUR_CELL->currently_focused = new;
new->container = CUR_CELL; new->container = CUR_CELL;
@ -222,7 +219,8 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
new->dock = true; new->dock = true;
new->titlebar_position = TITLEBAR_OFF; new->titlebar_position = TITLEBAR_OFF;
new->force_reconfigure = true; new->force_reconfigure = true;
SLIST_INSERT_HEAD(&(new->container->workspace->dock_clients), new, dock_clients); new->container = NULL;
SLIST_INSERT_HEAD(&(c_ws->dock_clients), new, dock_clients);
} }
} }
@ -238,6 +236,10 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
printf("the client wants to be %d pixels height\n", new->desired_height); printf("the client wants to be %d pixels height\n", new->desired_height);
} }
/* Insert into the currently active container, if its not a dock window */
if (!new->dock)
CIRCLEQ_INSERT_TAIL(&(CUR_CELL->clients), new, clients);
render_layout(conn); render_layout(conn);
} }

View File

@ -16,6 +16,7 @@
#include <string.h> #include <string.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h>
#include "i3.h" #include "i3.h"
#include "data.h" #include "data.h"
@ -113,6 +114,12 @@ void check_error(xcb_connection_t *connection, xcb_void_cookie_t cookie, char *e
* *
*/ */
void set_focus(xcb_connection_t *conn, Client *client) { void set_focus(xcb_connection_t *conn, Client *client) {
/* The dock window cannot be focused */
/* TODO: does this play well with dzen2s popup menus? or do we just need to set the input
focus but not update our internal structures? */
if (client->dock)
return;
/* TODO: check if the focus needs to be changed at all */ /* TODO: check if the focus needs to be changed at all */
/* Store current_row/current_col */ /* Store current_row/current_col */
c_ws->current_row = current_row; c_ws->current_row = current_row;
@ -154,6 +161,9 @@ void warp_pointer_into(xcb_connection_t *connection, Client *client) {
* *
*/ */
void toggle_fullscreen(xcb_connection_t *conn, Client *client) { void toggle_fullscreen(xcb_connection_t *conn, Client *client) {
/* clients without a container (docks) cannot be focused */
assert(client->container != NULL);
Workspace *workspace = client->container->workspace; Workspace *workspace = client->container->workspace;
workspace->fullscreen_client = (client->fullscreen ? NULL : client); workspace->fullscreen_client = (client->fullscreen ? NULL : client);