Set WM_STATE_WITHDRAWN when unmapping, unmap windows when destroying (Thanks xeen)

Seems like java apps need it. Also, you probably want to use XToolkit,
when you have to work with java apps:

export AWT_TOOLKIT=XToolkit
This commit is contained in:
Michael Stapelberg 2009-08-11 12:16:10 +02:00
parent 51df900312
commit b9636ceeec
7 changed files with 49 additions and 14 deletions

View File

@ -85,4 +85,16 @@ bool client_is_floating(Client *client);
*/ */
void client_change_border(xcb_connection_t *conn, Client *client, char border_type); void client_change_border(xcb_connection_t *conn, Client *client, char border_type);
/**
* Unmap the client, correctly setting any state which is needed.
*
*/
void client_unmap(xcb_connection_t *conn, Client *client);
/**
* Map the client, correctly restoring any state needed.
*
*/
void client_map(xcb_connection_t *conn, Client *client);
#endif #endif

View File

@ -289,3 +289,28 @@ void client_change_border(xcb_connection_t *conn, Client *client, char border_ty
redecorate_window(conn, client); redecorate_window(conn, client);
} }
/*
* Unmap the client, correctly setting any state which is needed.
*
*/
void client_unmap(xcb_connection_t *conn, Client *client) {
/* Set WM_STATE_WITHDRAWN, it seems like Java apps need it */
long data[] = { XCB_WM_STATE_WITHDRAWN, XCB_NONE };
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client->child, atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);
xcb_unmap_window(conn, client->frame);
}
/*
* Map the client, correctly restoring any state needed.
*
*/
void client_map(xcb_connection_t *conn, Client *client) {
/* Set WM_STATE_NORMAL because GTK applications dont want to drag & drop if we dont.
* Also, xprop(1) needs that to work. */
long data[] = { XCB_WM_STATE_NORMAL, XCB_NONE };
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client->child, atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);
xcb_map_window(conn, client->frame);
}

View File

@ -530,7 +530,7 @@ static void move_floating_window_to_workspace(xcb_connection_t *conn, Client *cl
/* If were moving it to an invisible screen, we need to unmap it */ /* If were moving it to an invisible screen, we need to unmap it */
if (!workspace_is_visible(t_ws)) { if (!workspace_is_visible(t_ws)) {
LOG("This workspace is not visible, unmapping\n"); LOG("This workspace is not visible, unmapping\n");
xcb_unmap_window(conn, client->frame); client_unmap(conn, client);
} else { } else {
/* If this is not the case, we move the window to a workspace /* If this is not the case, we move the window to a workspace
* which is on another screen, so we also need to adjust its * which is on another screen, so we also need to adjust its
@ -613,7 +613,7 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
/* If were moving it to an invisible screen, we need to unmap it */ /* If were moving it to an invisible screen, we need to unmap it */
if (!workspace_is_visible(to_container->workspace)) { if (!workspace_is_visible(to_container->workspace)) {
LOG("This workspace is not visible, unmapping\n"); LOG("This workspace is not visible, unmapping\n");
xcb_unmap_window(conn, current_client->frame); client_unmap(conn, current_client);
} else { } else {
if (current_client->fullscreen) { if (current_client->fullscreen) {
LOG("Calling client_enter_fullscreen again\n"); LOG("Calling client_enter_fullscreen again\n");

View File

@ -415,8 +415,8 @@ void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace) {
LOG("floating_hidden is now: %d\n", workspace->floating_hidden); LOG("floating_hidden is now: %d\n", workspace->floating_hidden);
TAILQ_FOREACH(client, &(workspace->floating_clients), floating_clients) { TAILQ_FOREACH(client, &(workspace->floating_clients), floating_clients) {
if (workspace->floating_hidden) if (workspace->floating_hidden)
xcb_unmap_window(conn, client->frame); client_unmap(conn, client);
else xcb_map_window(conn, client->frame); else client_map(conn, client);
} }
/* If we just unmapped all floating windows we should ensure that the focus /* If we just unmapped all floating windows we should ensure that the focus

View File

@ -696,6 +696,9 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
LOG("child of 0x%08x.\n", client->frame); LOG("child of 0x%08x.\n", client->frame);
xcb_reparent_window(conn, client->child, root, 0, 0); xcb_reparent_window(conn, client->child, root, 0, 0);
client_unmap(conn, client);
xcb_destroy_window(conn, client->frame); xcb_destroy_window(conn, client->frame);
xcb_flush(conn); xcb_flush(conn);
table_remove(&by_parent, client->frame); table_remove(&by_parent, client->frame);

View File

@ -205,11 +205,6 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
/* Yo dawg, I heard you like windows, so I create a window around your window… */ /* Yo dawg, I heard you like windows, so I create a window around your window… */
new->frame = create_window(conn, framerect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, false, mask, values); new->frame = create_window(conn, framerect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, false, mask, values);
/* Set WM_STATE_NORMAL because GTK applications dont want to drag & drop if we dont.
* Also, xprop(1) needs that to work. */
long data[] = { XCB_WM_STATE_NORMAL, XCB_NONE };
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, new->child, atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);
/* Put the client inside the save set. Upon termination (whether killed or normal exit /* Put the client inside the save set. Upon termination (whether killed or normal exit
does not matter) of the window manager, these clients will be correctly reparented does not matter) of the window manager, these clients will be correctly reparented
to their most closest living ancestor (= cleanup) */ to their most closest living ancestor (= cleanup) */
@ -442,7 +437,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
xcb_map_window(conn, child); xcb_map_window(conn, child);
if (map_frame) { if (map_frame) {
LOG("Mapping client\n"); LOG("Mapping client\n");
xcb_map_window(conn, new->frame); client_map(conn, new);
} }
if (CUR_CELL->workspace->fullscreen_client == NULL && !new->dock) { if (CUR_CELL->workspace->fullscreen_client == NULL && !new->dock) {
/* Focus the new window if were not in fullscreen mode and if it is not a dock window */ /* Focus the new window if were not in fullscreen mode and if it is not a dock window */

View File

@ -275,12 +275,12 @@ void workspace_map_clients(xcb_connection_t *conn, Workspace *ws) {
/* Map all clients on the new workspace */ /* Map all clients on the new workspace */
FOR_TABLE(ws) FOR_TABLE(ws)
CIRCLEQ_FOREACH(client, &(ws->table[cols][rows]->clients), clients) CIRCLEQ_FOREACH(client, &(ws->table[cols][rows]->clients), clients)
xcb_map_window(conn, client->frame); client_map(conn, client);
/* Map all floating clients */ /* Map all floating clients */
if (!ws->floating_hidden) if (!ws->floating_hidden)
TAILQ_FOREACH(client, &(ws->floating_clients), floating_clients) TAILQ_FOREACH(client, &(ws->floating_clients), floating_clients)
xcb_map_window(conn, client->frame); client_map(conn, client);
/* Map all stack windows, if any */ /* Map all stack windows, if any */
struct Stack_Window *stack_win; struct Stack_Window *stack_win;
@ -312,7 +312,7 @@ void workspace_unmap_clients(xcb_connection_t *conn, Workspace *u_ws) {
FOR_TABLE(u_ws) FOR_TABLE(u_ws)
CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) { CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) {
LOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child); LOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child);
xcb_unmap_window(conn, client->frame); client_unmap(conn, client);
unmapped_clients++; unmapped_clients++;
} }
@ -323,7 +323,7 @@ void workspace_unmap_clients(xcb_connection_t *conn, Workspace *u_ws) {
LOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child); LOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child);
xcb_unmap_window(conn, client->frame); client_unmap(conn, client);
unmapped_clients++; unmapped_clients++;
} }