From: Michael Stapelberg Date: Tue, 30 Mar 2010 11:06:41 +0000 (+0200) Subject: Merge branch 'next' X-Git-Tag: 3.e~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=96128c9cfbda0029775cabaa22b82b97a0a1f2f3;p=i3%2Fi3 Merge branch 'next' --- 96128c9cfbda0029775cabaa22b82b97a0a1f2f3 diff --cc include/client.h index 41bd5db3,8f97eb44..45b8f4a7 --- a/include/client.h +++ b/include/client.h @@@ -51,14 -51,14 +51,20 @@@ bool client_matches_class_name(Client * * and when moving a fullscreen client to another screen. * */ - void client_enter_fullscreen(xcb_connection_t *conn, Client *client); + void client_enter_fullscreen(xcb_connection_t *conn, Client *client, bool global); + + /** + * Leaves fullscreen mode for the given client. This is called by toggle_fullscreen. + * + */ + void client_leave_fullscreen(xcb_connection_t *conn, Client *client); +/** + * Leaves fullscreen mode for the current client. This is called by toggle_fullscreen. + * + */ +void client_leave_fullscreen(xcb_connection_t *conn, Client *client); + /** * Toggles fullscreen mode for the given client. It updates the data * structures and reconfigures (= resizes/moves) the client and its frame to diff --cc include/data.h index 8e1a80cc,3618dfb8..a8b31d3b --- a/include/data.h +++ b/include/data.h @@@ -75,18 -77,22 +77,28 @@@ enum /** * Stores a rectangle, for example the size of a window, the child window etc. + * It needs to be packed so that the compiler will not add any padding bytes. + * (it is used in src/ewmh.c for example) + * + * Note that x and y can contain signed values in some cases (for example when + * used for the coordinates of a window, which can be set outside of the + * visible area, but not when specifying the position of a workspace for the + * _NET_WM_WORKAREA hint). Not declaring x/y as int32_t saves us a lot of + * typecasts. * + * Note that x and y can contain signed values in some cases (for example when + * used for the coordinates of a window, which can be set outside of the + * visible area, but not when specifying the position of a workspace for the + * _NET_WM_WORKAREA hint). Not declaring x/y as int32_t saves us a lot of + * typecasts. + * */ struct Rect { - uint32_t x, y; - uint32_t width, height; - }; + uint32_t x; + uint32_t y; + uint32_t width; + uint32_t height; + } __attribute__((packed)); /** * Defines a position in the table diff --cc src/resize.c index 6d505dcd,a32e5755..d48dbdbb --- a/src/resize.c +++ b/src/resize.c @@@ -228,9 -264,9 +264,10 @@@ void resize_container(xcb_connection_t if (ws->height_factor[row] == 0) cols_without_hf++; - LOG("old_unoccupied_y = %d\n", old_unoccupied_y); + DLOG("old_unoccupied_y = %d\n", old_unoccupied_y); + + DLOG("Updating first (before = %f)\n", ws->height_factor[first]); + - LOG("Updating first (before = %f)\n", ws->height_factor[first]); /* Convert 0 (for default width_factor) to actual numbers */ if (ws->height_factor[first] == 0) old_height = (old_unoccupied_y / max(cols_without_hf, 1)); diff --cc src/workspace.c index d58bbaab,c950df8f..6da6034b --- a/src/workspace.c +++ b/src/workspace.c @@@ -411,37 -437,41 +437,69 @@@ void workspace_update_urgent_flag(Works if (!current->urgent) continue; - ws->urgent = true; - return; + urgent = true; + break; } - ws->urgent = false; + ws->urgent = urgent; + + if (old_flag != urgent) + ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"urgent\"}"); + } + + /* + * Returns the width of the workspace. + * + */ + int workspace_width(Workspace *ws) { + return ws->rect.width; + } + + /* + * Returns the effective height of the workspace (without the internal bar and + * without dock clients). + * + */ + int workspace_height(Workspace *ws) { + int height = ws->rect.height; + i3Font *font = load_font(global_conn, config.font); + + /* Reserve space for dock clients */ + Client *client; + SLIST_FOREACH(client, &(ws->output->dock_clients), dock_clients) + height -= client->desired_height; + + /* Space for the internal bar */ + if (!config.disable_workspace_bar) + height -= (font->height + 6); + + return height; } + +/* + * Returns the width of the workspace. + * + */ +int workspace_width(Workspace *ws) { + return ws->rect.width; +} + +/* + * Returns the effective height of the workspace (without the internal bar and + * without dock clients). + * + */ +int workspace_height(Workspace *ws) { + int height = ws->rect.height; + i3Font *font = load_font(global_conn, config.font); + + /* Reserve space for dock clients */ + Client *client; + SLIST_FOREACH(client, &(ws->screen->dock_clients), dock_clients) + height -= client->desired_height; + + /* Space for the internal bar */ + height -= (font->height + 6); + + return height; +}