From e97a7e34f7b57df236c7d69077467b65bbf12a7a Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 27 Aug 2011 13:47:10 +0200 Subject: [PATCH] Bugfix: Re-implement reconfiguring height of dock windows (+test) (Thanks thomasba) --- include/data.h | 10 ---------- src/handlers.c | 42 +++++++++++------------------------------- testcases/t/10-dock.t | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 41 deletions(-) diff --git a/include/data.h b/include/data.h index 4dc379c2..5797b7d8 100644 --- a/include/data.h +++ b/include/data.h @@ -230,16 +230,6 @@ struct xoutput { /** x, y, width, height */ Rect rect; -#if 0 - /** The bar window */ - xcb_window_t bar; - xcb_gcontext_t bargc; - - /** Contains all clients with _NET_WM_WINDOW_TYPE == - * _NET_WM_WINDOW_TYPE_DOCK */ - SLIST_HEAD(dock_clients_head, Client) dock_clients; -#endif - TAILQ_ENTRY(xoutput) outputs; }; diff --git a/src/handlers.c b/src/handlers.c index 02c37283..6b79ed40 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -374,40 +374,20 @@ static int handle_configure_request(xcb_configure_request_event_t *event) { tree_render(); } + /* Dock windows can be reconfigured in their height */ + if (con->parent && con->parent->type == CT_DOCKAREA) { + DLOG("Dock window, only height reconfiguration allowed\n"); + if (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT) { + DLOG("Height given, changing\n"); + + con->geometry.height = event->height; + tree_render(); + } + } + fake_absolute_configure_notify(con); return 1; -#if 0 - /* Dock clients can be reconfigured in their height */ - if (client->dock) { - DLOG("Reconfiguring height of this dock client\n"); - - if (!(event->value_mask & XCB_CONFIG_WINDOW_HEIGHT)) { - DLOG("Ignoring configure request, no height given\n"); - return 1; - } - - client->desired_height = event->height; - render_workspace(conn, c_ws->output, c_ws); - xcb_flush(conn); - - return 1; - } - - if (client->fullscreen) { - DLOG("Client is in fullscreen mode\n"); - - Rect child_rect = client->container->workspace->rect; - child_rect.x = child_rect.y = 0; - fake_configure_notify(conn, child_rect, client->child); - - return 1; - } - - fake_absolute_configure_notify(conn, client); - - return 1; -#endif } #if 0 diff --git a/testcases/t/10-dock.t b/testcases/t/10-dock.t index d4da8245..3f0a5195 100644 --- a/testcases/t/10-dock.t +++ b/testcases/t/10-dock.t @@ -61,6 +61,25 @@ is($docknode->{rect}->{y}, 0, 'dock node placed at y=0'); is($docknode->{rect}->{width}, $primary->rect->width, 'dock node as wide as the screen'); is($docknode->{rect}->{height}, 30, 'dock node has unchanged height'); +##################################################################### +# check that re-configuring the height works +##################################################################### + +$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 50, height => 40)); + +sleep 0.25; + +@docked = get_dock_clients('top'); +is(@docked, 1, 'one dock client found'); + +# verify the position/size +$docknode = $docked[0]; + +is($docknode->{rect}->{x}, 0, 'dock node placed at x=0'); +is($docknode->{rect}->{y}, 0, 'dock node placed at y=0'); +is($docknode->{rect}->{width}, $primary->rect->width, 'dock node as wide as the screen'); +is($docknode->{rect}->{height}, 40, 'dock height changed'); + $window->destroy; sleep 0.25;