diff --git a/CMakeLists.txt b/CMakeLists.txt index dc48f86c9..3bc50557c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,12 +71,6 @@ set(AWE_SRCS ${SOURCE_DIR}/common/xembed.c ${SOURCE_DIR}/common/xutil.c ${SOURCE_DIR}/common/xcursor.c - ${SOURCE_DIR}/layouts/fibonacci.c - ${SOURCE_DIR}/layouts/floating.c - ${SOURCE_DIR}/layouts/magnifier.c - ${SOURCE_DIR}/layouts/fair.c - ${SOURCE_DIR}/layouts/max.c - ${SOURCE_DIR}/layouts/tile.c ${SOURCE_DIR}/widgets/graph.c ${SOURCE_DIR}/widgets/progressbar.c ${SOURCE_DIR}/widgets/textbox.c @@ -117,16 +111,6 @@ target_link_libraries(${PROJECT_AWECLIENT_NAME} ${AWESOMECLIENT_LIBRARIES}) # {{{ Generated sources -file(GLOB LAYOUTGEN_DEPS ${SOURCE_DIR}/layouts/*.h) -add_custom_command( - COMMAND ${SOURCE_DIR}/build-utils/layoutgen.sh - ARGS > ${BUILD_DIR}/layoutgen.h - OUTPUT ${BUILD_DIR}/layoutgen.h - WORKING_DIRECTORY ${SOURCE_DIR} - DEPENDS ${LAYOUTGEN_DEPS} - COMMENT "Generating layoutgen.h" - VERBATIM) - add_custom_command( COMMAND ${SOURCE_DIR}/build-utils/widgetgen.sh ARGS > ${BUILD_DIR}/widgetgen.h @@ -177,7 +161,6 @@ add_custom_command( add_custom_target(generated_sources DEPENDS ${BUILD_DIR}/widgetgen.h - ${BUILD_DIR}/layoutgen.h ${BUILD_DIR}/common/atoms-intern.h ${BUILD_DIR}/common/atoms-extern.h ${BUILD_DIR}/common/tokenize.c diff --git a/awesome.doxygen.in b/awesome.doxygen.in index dba151585..4df2775c8 100644 --- a/awesome.doxygen.in +++ b/awesome.doxygen.in @@ -95,8 +95,6 @@ FILE_PATTERNS = *.c \ common/*.h \ widgets/*.c \ widgets/*.h \ - layouts/*.c \ - layouts/*.h RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 83a2d43cb..e196aeaec 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -30,18 +30,16 @@ modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. layouts = { - "tile", - "tileleft", - "tilebottom", - "tiletop", - "fairh", - "fairv", - "magnifier", - "max", - "fullscreen", - "spiral", - "dwindle", - "floating" + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, + awful.layout.suit.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating } -- Table of clients that should be set floating. The index may be either @@ -78,7 +76,7 @@ for s = 1, screen.count() do tags[s] = {} -- Create 9 tags per screen. for tagnumber = 1, 9 do - tags[s][tagnumber] = tag({ name = tagnumber, layout = layouts[1] }) + tags[s][tagnumber] = tag(tagnumber) -- Add tags to screen one by one tags[s][tagnumber].screen = s end @@ -320,7 +318,7 @@ end) -- Hook function to execute when the mouse enters a client. awful.hooks.mouse_enter.register(function (c) -- Sloppy focus, but disabled for magnifier layout - if awful.layout.get(c.screen) ~= "magnifier" + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier and awful.client.focus.filter(c) then client.focus = c end @@ -378,8 +376,8 @@ end) -- Hook function to execute when arranging the screen. -- (tag switch, new client, etc) awful.hooks.arrange.register(function (screen) - local layout = awful.layout.get(screen) - if layout then + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) else mylayoutbox[screen].image = nil diff --git a/build-utils/layoutgen.sh b/build-utils/layoutgen.sh deleted file mode 100755 index db8e41afd..000000000 --- a/build-utils/layoutgen.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -top_srcdir="${1-.}" -echo "/* This file is autogenerated by" `basename $0` "*/" -echo -for file in ${top_srcdir}/layouts/*.h -do - shortname=`echo $file | cut -f2- -d/` - echo "#include \"${shortname}\"" -done -echo -echo "const name_func_link_t LayoutList[] =" -echo "{" -for file in ${top_srcdir}/layouts/*.h -do - echo " /* $file */" - grep '^layout_t layout_' $file | cut -d' ' -f2 | cut -d\; -f1 | while read layout - do - shortname=`echo $layout | cut -d _ -f2-` - echo " {\"$shortname\", sizeof(\"$shortname\") - 1, $layout}," - done -done - -echo " {NULL, 0, NULL}" -echo "};" diff --git a/client.c b/client.c index 37a9600c5..babddda95 100644 --- a/client.c +++ b/client.c @@ -29,7 +29,7 @@ #include "titlebar.h" #include "systray.h" #include "property.h" -#include "layouts/floating.h" +#include "wibox.h" #include "common/markup.h" #include "common/atoms.h" @@ -625,10 +625,6 @@ client_resize(client_t *c, area_t geometry, bool hints) { int new_screen; area_t area; - layout_t *layout = layout_get_current(c->screen); - - if(c->titlebar && c->titlebar->isvisible && !client_isfloating(c) && layout != layout_floating) - geometry = titlebar_geometry_remove(c->titlebar, c->border, geometry); if(hints) geometry = client_geometry_hints(c, geometry); @@ -668,12 +664,10 @@ client_resize(client_t *c, area_t geometry, bool hints) /* save the floating geometry if the window is floating but not * maximized */ if(client_isfloating(c) - || layout_get_current(new_screen) == layout_floating - || layout_get_current(c->screen) == layout_floating) - if(!c->isfullscreen && !c->ismaxvert && !c->ismaxhoriz) - c->geometries.floating = geometry; + && !(c->isfullscreen || c->ismaxvert || c->ismaxhoriz)) + c->geometries.floating = geometry; - titlebar_update_geometry_floating(c); + titlebar_update_geometry(c); /* The idea is to give a client a resize even when banned. */ /* We just have to move the (x,y) to keep it out of the viewport. */ @@ -1171,13 +1165,7 @@ client_setborder(client_t *c, int width) xcb_configure_window(globalconf.connection, c->win, XCB_CONFIG_WINDOW_BORDER_WIDTH, &w); - if(client_isvisible(c, c->screen)) - { - if(client_isfloating(c) || layout_get_current(c->screen) == layout_floating) - titlebar_update_geometry_floating(c); - else - globalconf.screens[c->screen].need_arrange = true; - } + client_need_arrange(c); hooks_property(c, "border_width"); } @@ -1339,30 +1327,30 @@ luaA_client_handlegeom(lua_State *L, bool full) client_t **c = luaA_checkudata(L, 1, "client"); if(lua_gettop(L) == 2) - if(client_isfloating(*c) - || layout_get_current((*c)->screen) == layout_floating) - { - area_t geometry; + { + area_t geometry; - luaA_checktable(L, 2); - geometry.x = luaA_getopt_number(L, 2, "x", (*c)->geometry.x); - geometry.y = luaA_getopt_number(L, 2, "y", (*c)->geometry.y); - if(client_isfixed(*c)) - { - geometry.width = (*c)->geometry.width; - geometry.height = (*c)->geometry.height; - } - else - { - geometry.width = luaA_getopt_number(L, 2, "width", (*c)->geometry.width); - geometry.height = luaA_getopt_number(L, 2, "height", (*c)->geometry.height); - } - if(full) - geometry = titlebar_geometry_remove((*c)->titlebar, - (*c)->border, - geometry); - client_resize(*c, geometry, (*c)->honorsizehints); + luaA_checktable(L, 2); + geometry.x = luaA_getopt_number(L, 2, "x", (*c)->geometry.x); + geometry.y = luaA_getopt_number(L, 2, "y", (*c)->geometry.y); + if(client_isfixed(*c)) + { + geometry.width = (*c)->geometry.width; + geometry.height = (*c)->geometry.height; } + else + { + geometry.width = luaA_getopt_number(L, 2, "width", (*c)->geometry.width); + geometry.height = luaA_getopt_number(L, 2, "height", (*c)->geometry.height); + } + + if(full) + geometry = titlebar_geometry_remove((*c)->titlebar, + (*c)->border, + geometry); + + client_resize(*c, geometry, (*c)->honorsizehints); + } if(full) return luaA_pusharea(L, titlebar_geometry_add((*c)->titlebar, diff --git a/common/tokenize.gperf b/common/tokenize.gperf index e7887eddd..c47bbf61e 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -7,8 +7,6 @@ border_color border_padding border_width bottom -bottomleft -bottomright button center char @@ -16,7 +14,6 @@ class client color Control -coords conffile Ctrl cursor @@ -39,9 +36,6 @@ icon icon_name image instance -invert -label -layout left len line @@ -59,10 +53,7 @@ Mod4 Mod5 mouse_enter mouse_leave -mwfact name -ncol -nmaster on ontop opacity @@ -81,7 +72,6 @@ selected shadow shadow_offset Shift -show_icons size_hints skip_taskbar south @@ -92,8 +82,6 @@ ticks_count ticks_gap titlebar top -topleft -topright transient_for true type diff --git a/event.c b/event.c index 77ac2e281..6c5804223 100644 --- a/event.c +++ b/event.c @@ -39,7 +39,6 @@ #include "luaa.h" #include "systray.h" #include "screen.h" -#include "layouts/floating.h" #include "common/atoms.h" extern awesome_t globalconf; @@ -267,7 +266,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)), if(geometry.x != c->geometry.x || geometry.y != c->geometry.y || geometry.width != c->geometry.width || geometry.height != c->geometry.height) { - if(client_isfloating(c) || layout_get_current(c->screen) == layout_floating) + if(client_isfloating(c)) { client_resize(c, geometry, false); if(client_hasstrut(c)) diff --git a/layout.c b/layout.c index 56565c59f..d4093dbcc 100644 --- a/layout.c +++ b/layout.c @@ -19,7 +19,7 @@ * */ -#include "client.h" +#include "layout.h" #include "tag.h" #include "window.h" #include "screen.h" @@ -33,7 +33,6 @@ static void arrange(int screen) { client_t *c; - layout_t *curlay = layout_get_current(screen); int phys_screen = screen_virttophys(screen); xcb_query_pointer_cookie_t qp_c; xcb_query_pointer_reply_t *qp_r; @@ -47,8 +46,12 @@ arrange(int screen) client_ban(c); } - if(curlay) - curlay(screen); + /* call hook */ + if(globalconf.hooks.arrange != LUA_REFNIL) + { + lua_pushnumber(globalconf.L, screen + 1); + luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 1, 0); + } qp_c = xcb_query_pointer_unchecked(globalconf.connection, xutil_screen_get(globalconf.connection, @@ -70,13 +73,6 @@ arrange(int screen) /* reset status */ globalconf.screens[screen].need_arrange = false; - - /* call hook */ - if(globalconf.hooks.arrange != LUA_REFNIL) - { - lua_pushnumber(globalconf.L, screen + 1); - luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 1, 0); - } } /** Refresh the screen disposition @@ -92,21 +88,4 @@ layout_refresh(void) arrange(screen); } -/** Get current layout used on screen. - * \param screen Virtual screen number. - * \return layout used on that screen - */ -layout_t * -layout_get_current(int screen) -{ - layout_t *l = NULL; - tag_t **curtags = tags_get_current(screen); - - if(curtags[0]) - l = curtags[0]->layout; - p_delete(&curtags); - - return l; -} - // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layout.h b/layout.h index 2ceffb459..fcaa2507f 100644 --- a/layout.h +++ b/layout.h @@ -22,12 +22,6 @@ #ifndef AWESOME_LAYOUT_H #define AWESOME_LAYOUT_H -#include "common/list.h" -#include "common/util.h" - -typedef void (layout_t)(int); - -layout_t * layout_get_current(int); void layout_refresh(void); #endif diff --git a/layouts/fair.c b/layouts/fair.c deleted file mode 100644 index e238e966c..000000000 --- a/layouts/fair.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * fair.c - fair layout - * - * Copyright © 2008 Alex Cornejo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include "screen.h" -#include "tag.h" -#include "client.h" -#include "layouts/fair.h" -#include "common/util.h" - -extern awesome_t globalconf; - -static void -layout_fair(int screen, const orientation_t orientation) -{ - int strips=1, cells = 1, - strip = 0, cell = 0, n = 0, - full_strips; - client_t *c; - area_t geometry, area; - - area = screen_area_get(screen, - &globalconf.screens[screen].wiboxes, - &globalconf.screens[screen].padding, - true); - - for(c = globalconf.clients ; c; c = c->next) - if(IS_TILED(c, screen)) - ++n; - - if(n > 0) - { - while(cells * cells < n) - ++cells; - - strips = (cells * (cells - 1) >= n) ? cells - 1 : cells; - full_strips = n - strips * (cells - 1); - - for(c = globalconf.clients; c; c = c->next) - if(IS_TILED(c, screen)) - { - if (((orientation == East) && (n > 2)) - || ((orientation == South) && (n <= 2))) - { - geometry.width = area.width / cells; - geometry.height = area.height / strips; - geometry.x = area.x + cell * geometry.width; - geometry.y = area.y + strip * geometry.height; - } - else - { - geometry.width = area.width / strips; - geometry.height = area.height / cells; - geometry.x = area.x + strip * geometry.width; - geometry.y = area.y + cell * geometry.height; - } - geometry.width -= 2 * c->border; - geometry.height -= 2 * c->border; - - client_resize(c, geometry, c->honorsizehints); - - if(++cell == cells) - { - cell = 0; - if(++strip == full_strips) - cells--; - } - } - } -} - -void -layout_fairh(int screen) -{ - layout_fair(screen, East); -} - -void -layout_fairv(int screen) -{ - layout_fair(screen, South); -} - -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/fair.h b/layouts/fair.h deleted file mode 100644 index 853dbc15b..000000000 --- a/layouts/fair.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * fair.h - fair layout header - * - * Copyright © 2008 Alex Cornejo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef AWESOME_FAIR_H -#define AWESOME_FAIR_H - -#include "layout.h" - -layout_t layout_fairh; -layout_t layout_fairv; - -#endif -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/fibonacci.c b/layouts/fibonacci.c deleted file mode 100644 index 577c19282..000000000 --- a/layouts/fibonacci.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * fibonacci.c - fibonacci layout - * - * Copyright © 2007-2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include "screen.h" -#include "tag.h" -#include "client.h" -#include "layouts/fibonacci.h" - -extern awesome_t globalconf; - -static void -layout_fibonacci(int screen, int shape) -{ - int n = 0, i = 0; - client_t *c; - area_t geometry, area; - geometry = area = screen_area_get(screen, - &globalconf.screens[screen].wiboxes, - &globalconf.screens[screen].padding, - true); - - for(c = globalconf.clients; c; c = c->next) - if(IS_TILED(c, screen)) - n++; - for(c = globalconf.clients; c; c = c->next) - if(IS_TILED(c, screen)) - { - if((i % 2 && geometry.height / 2 > 2 * c->border) - || (!(i % 2) && geometry.width / 2 > 2 * c->border)) - { - if(i < n - 1) - { - if(i % 2) - geometry.height /= 2; - else - geometry.width /= 2; - if((i % 4) == 2 && !shape) - geometry.x += geometry.width; - else if((i % 4) == 3 && !shape) - geometry.y += geometry.height; - } - if((i % 4) == 0) - { - if(shape) - geometry.y += geometry.height; - else - geometry.y -= geometry.height; - } - else if((i % 4) == 1) - geometry.x += geometry.width; - else if((i % 4) == 2) - geometry.y += geometry.height; - else if((i % 4) == 3) - { - if(shape) - geometry.x += geometry.width; - else - geometry.x -= geometry.width; - } - if(i == 0) - geometry.y = area.y; - i++; - } - geometry.width -= 2 * c->border; - geometry.height -= 2 * c->border; - client_resize(c, geometry, c->honorsizehints); - geometry.width += 2 * c->border; - geometry.height += 2 * c->border; - } -} - -void -layout_spiral(int screen) -{ - layout_fibonacci(screen, 0); -} - -void -layout_dwindle(int screen) -{ - layout_fibonacci(screen, 1); -} - -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/fibonacci.h b/layouts/fibonacci.h deleted file mode 100644 index 2a0286f6f..000000000 --- a/layouts/fibonacci.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * fibonacci.h - fibonacci layout header - * - * Copyright © 2007-2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef AWESOME_FIBONACCI_H -#define AWESOME_FIBONACCI_H - -#include "layout.h" - -layout_t layout_spiral; -layout_t layout_dwindle; - -#endif -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/floating.c b/layouts/floating.c deleted file mode 100644 index f702c6577..000000000 --- a/layouts/floating.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * floating.c - floating layout - * - * Copyright © 2007-2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include "client.h" -#include "tag.h" -#include "layouts/floating.h" - -extern awesome_t globalconf; - -void -layout_floating(int screen) -{ - client_t *c; - - for(c = globalconf.clients; c; c = c->next) - if(client_isvisible(c, screen) && !c->isfullscreen) - client_resize(c, c->geometries.floating, false); -} -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/floating.h b/layouts/floating.h deleted file mode 100644 index 1b4c60d4b..000000000 --- a/layouts/floating.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * floating.h - floating layout header - * - * Copyright © 2007-2008 Julien Danjou - * Copyright © 2007 Alexandru E. Ungur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef AWESOME_FLOATING_H -#define AWESOME_FLOATING_H - -#include "layout.h" - -layout_t layout_floating; - -#endif -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/magnifier.c b/layouts/magnifier.c deleted file mode 100644 index 4fba8f522..000000000 --- a/layouts/magnifier.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * magnifier.c - magnifier layout - * - * Copyright © 2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include - -#include "client.h" -#include "tag.h" -#include "screen.h" -#include "layouts/magnifier.h" - -extern awesome_t globalconf; - -void -layout_magnifier(int screen) -{ - int n = 0; - client_t *c, *focus; - tag_t **curtags = tags_get_current(screen); - area_t geometry, area = screen_area_get(screen, - &globalconf.screens[screen].wiboxes, - &globalconf.screens[screen].padding, - true); - - focus = globalconf.screens[screen].client_focus; - - /* Find parent of this window, if it has one. */ - if (!IS_TILED(focus, screen) && focus && focus->transient_for) - do { - focus = focus->transient_for; - } while (focus->transient_for != NULL); - - /* If focused window is not tiled, take the first one which is tiled. */ - if(!IS_TILED(focus, screen)) - for(focus = globalconf.clients; focus && !IS_TILED(focus, screen); focus = focus->next); - - /* No windows is tiled, nothing to do. */ - if(!focus) - goto bailout; - - for(c = client_list_prev_cycle(&globalconf.clients, focus); - c && c != focus; - c = client_list_prev_cycle(&globalconf.clients, c)) - if(IS_TILED(c, screen) && c != focus) - n++; - - if(n) - { - geometry.width = area.width * sqrt(curtags[0]->mwfact); - geometry.height = area.height * sqrt(curtags[0]->mwfact); - geometry.x = area.x + (area.width - geometry.width) / 2; - geometry.y = area.y + (area.height - geometry.height) / 2; - } - else - { - /* No other clients. */ - geometry = area; - geometry.width -= 2 * focus->border; - geometry.height -= 2 * focus->border; - } - client_resize(focus, geometry, focus->honorsizehints); - client_raise(focus); - - /* bailout when there is only one window */ - if (!n) - goto bailout; - - geometry.x = area.x; - geometry.y = area.y; - geometry.height = area.height / n; - geometry.width = area.width; - - for(c = client_list_prev_cycle(&globalconf.clients, focus); - c && c != focus; - c = client_list_prev_cycle(&globalconf.clients, c)) - if(IS_TILED(c, screen) && c != focus) - { - geometry.height -= 2 * c->border; - geometry.width -= 2 * c->border; - client_resize(c, geometry, c->honorsizehints); - geometry.height += 2 * c->border; - geometry.width += 2 * c->border; - geometry.y += geometry.height; - } - -bailout: - p_delete(&curtags); -} -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/magnifier.h b/layouts/magnifier.h deleted file mode 100644 index aaac0722a..000000000 --- a/layouts/magnifier.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * magnifier.h - magnifier layout header - * - * Copyright © 2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef AWESOME_LAYOUTS_MAGNIFIER_H -#define AWESOME_LAYOUTS_MAGNIFIER_H - -#include "layout.h" - -layout_t layout_magnifier; - -#endif -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/max.c b/layouts/max.c deleted file mode 100644 index b2805c8e6..000000000 --- a/layouts/max.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * max.c - max layout - * - * Copyright © 2007-2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include "tag.h" -#include "screen.h" -#include "client.h" -#include "layouts/max.h" - -extern awesome_t globalconf; - -static void -layout_fmax(int screen, bool fs) -{ - client_t *c; - int phys_screen = screen_virttophys(screen); - area_t area = screen_area_get(screen, - fs ? NULL : &globalconf.screens[screen].wiboxes, - fs ? NULL : &globalconf.screens[screen].padding, - true); - - for(c = globalconf.clients; c; c = c->next) - if(IS_TILED(c, screen)) - { - area.width -= 2 * c->border; - area.height -= 2 * c->border; - client_resize(c, area, false); - area.width += 2 * c->border; - area.height += 2 * c->border; - } - - if(IS_TILED(globalconf.screens[phys_screen].client_focus, screen)) - client_raise(globalconf.screens[phys_screen].client_focus); -} - -void -layout_max(int screen) -{ - return layout_fmax(screen, false); -} - -void -layout_fullscreen(int screen) -{ - return layout_fmax(screen, true); -} - -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/max.h b/layouts/max.h deleted file mode 100644 index e3aab3a32..000000000 --- a/layouts/max.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * max.h - max layout header - * - * Copyright © 2007-2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef AWESOME_MAX_H -#define AWESOME_MAX_H - -#include "layout.h" - -layout_t layout_max; -layout_t layout_fullscreen; - -#endif -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/tile.c b/layouts/tile.c deleted file mode 100644 index b4d4c1e78..000000000 --- a/layouts/tile.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * tile.c - tile layout - * - * Copyright © 2007-2008 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include - -#include "screen.h" -#include "tag.h" -#include "client.h" -#include "layouts/tile.h" -#include "common/util.h" - -extern awesome_t globalconf; - -static void -_tile(int screen, const position_t position) -{ - /* windows area geometry */ - int wah = 0, waw = 0, wax = 0, way = 0; - /* master size */ - unsigned int mw = 0, mh = 0; - int n, i, masterwin = 0, otherwin = 0; - int real_ncol = 1, win_by_col = 1, current_col = 0; - int small_ncol, adj_win_by_col; - area_t area, geometry = { 0, 0, 0, 0 }; - client_t *c; - tag_t **curtags = tags_get_current(screen); - - area = screen_area_get(screen, - &globalconf.screens[screen].wiboxes, - &globalconf.screens[screen].padding, - true); - - for(n = 0, c = globalconf.clients; c; c = c->next) - if(IS_TILED(c, screen)) - n++; - - wah = area.height; - waw = area.width; - wax = area.x; - way = area.y; - - masterwin = MIN(n, curtags[0]->nmaster); - - otherwin = MAX(n - masterwin, 0); - - if(curtags[0]->nmaster) - switch(position) - { - case Right: - case Left: - mh = masterwin ? wah / masterwin : wah; - mw = otherwin ? waw * curtags[0]->mwfact : waw; - break; - default: - mh = otherwin ? wah * curtags[0]->mwfact : wah; - mw = masterwin ? waw / masterwin : waw; - break; - } - else - mh = mw = 0; - - real_ncol = curtags[0]->ncol > 0 ? MIN(otherwin, curtags[0]->ncol) : MIN(otherwin, 1); - - for(i = 0, c = globalconf.clients; c; c = c->next) - { - if(!IS_TILED(c, screen)) - continue; - - if(i < curtags[0]->nmaster) - { - switch(position) - { - case Right: - geometry.y = way + i * mh; - geometry.x = wax; - break; - case Left: - geometry.y = way + i * mh; - geometry.x = wax + (waw - mw); - break; - case Top: - geometry.x = wax + i * mw; - geometry.y = way + (wah - mh); - break; - case Bottom: - default: - geometry.x = wax + i * mw; - geometry.y = way; - break; - break; - } - - geometry.width = mw - 2 * c->border; - geometry.height = mh - 2 * c->border; - - client_resize(c, geometry, c->honorsizehints); - } - else - { - win_by_col = otherwin / real_ncol; - small_ncol = (win_by_col + 1) * real_ncol - otherwin; - adj_win_by_col = current_col < small_ncol ? 0 : 1; - - if((i - curtags[0]->nmaster) && - (i - curtags[0]->nmaster + small_ncol * adj_win_by_col) - % (win_by_col + adj_win_by_col) == 0 && - current_col < real_ncol - 1) - current_col++; - - adj_win_by_col = current_col < small_ncol ? 0 : 1; - - if(position == Right || position == Left) - { - if(otherwin <= real_ncol) - geometry.height = wah - 2 * c->border; - else - geometry.height = (wah / (win_by_col + adj_win_by_col)) - - 2 * c->border; - - geometry.width = (waw - mw) / real_ncol - 2 * c->border; - - if(otherwin <= real_ncol || - (i - curtags[0]->nmaster + small_ncol * adj_win_by_col) - % (win_by_col + adj_win_by_col) == 0) - geometry.y = way; - else - geometry.y = way + - ((i - curtags[0]->nmaster + - small_ncol * adj_win_by_col) % - (win_by_col + adj_win_by_col)) * - (geometry.height + 2 * c->border); - - geometry.x = wax + current_col * (geometry.width + 2 * c->border); - - if(position == Right) - geometry.x += mw; - } - else - { - if(otherwin <= real_ncol) - geometry.width = waw - 2 * c->border; - else - geometry.width = (waw / (win_by_col + adj_win_by_col)) - - 2 * c->border; - - geometry.height = (wah - mh) / real_ncol - 2 * c->border; - - if(otherwin <= real_ncol || - (i - curtags[0]->nmaster + small_ncol * adj_win_by_col) - % (win_by_col + adj_win_by_col) == 0) - geometry.x = wax; - else - geometry.x = wax + - ((i - curtags[0]->nmaster + - small_ncol * adj_win_by_col) % - (win_by_col + adj_win_by_col)) * - (geometry.width + 2 * c->border); - - geometry.y = way + current_col * (geometry.height + 2 * c->border); - - if(position == Bottom) - geometry.y += mh; - } - client_resize(c, geometry, c->honorsizehints); - } - i++; - } - - p_delete(&curtags); -} - -void -layout_tile(int screen) -{ - _tile(screen, Right); -} - -void -layout_tileleft(int screen) -{ - _tile(screen, Left); -} - -void -layout_tilebottom(int screen) -{ - _tile(screen, Bottom); -} - -void -layout_tiletop(int screen) -{ - _tile(screen, Top); -} - -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layouts/tile.h b/layouts/tile.h deleted file mode 100644 index 72b91bbe4..000000000 --- a/layouts/tile.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * tile.h - tile layout - * - * Copyright © 2007-2008 Julien Danjou - * Copyright © 2007 Ross Mohn - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef AWESOME_TILE_H -#define AWESOME_TILE_H - -#include "layout.h" - -layout_t layout_tile; -layout_t layout_tileleft; -layout_t layout_tilebottom; -layout_t layout_tiletop; - -#endif -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/layout.lua.in b/lib/awful/layout.lua.in deleted file mode 100644 index a1f23bfa9..000000000 --- a/lib/awful/layout.lua.in +++ /dev/null @@ -1,53 +0,0 @@ ---------------------------------------------------------------------------- --- @author Julien Danjou <julien@danjou.info> --- @copyright 2008 Julien Danjou --- @release @AWESOME_VERSION@ ---------------------------------------------------------------------------- - --- Grab environment we need -local ipairs = ipairs -local tag = require("awful.tag") - ---- Layout module for awful -module("awful.layout") - ---- Get the current layout name. --- @param screen The screen number. -function get(screen) - local t = tag.selected(screen) - if t then - return t.layout - end -end - ---- Change the layout of the current tag. --- @param layouts A table of layouts. --- @param i Relative index. -function inc(layouts, i) - local t = tag.selected() - local number_of_layouts = 0 - local rev_layouts = {} - for i, v in ipairs(layouts) do - rev_layouts[v] = i - number_of_layouts = number_of_layouts + 1 - end - if t then - local cur_layout = get() - local new_layout_index = (rev_layouts[cur_layout] + i) % number_of_layouts - if new_layout_index == 0 then - new_layout_index = number_of_layouts - end - t.layout = layouts[new_layout_index] - end -end - ---- Set the layout of the current tag by name. --- @param layout Layout name. -function set(layout) - local t = tag.selected() - if t then - t.layout = layout - end -end - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in new file mode 100644 index 000000000..4b0bd40fe --- /dev/null +++ b/lib/awful/layout/init.lua.in @@ -0,0 +1,90 @@ +--------------------------------------------------------------------------- +-- @author Julien Danjou <julien@danjou.info> +-- @copyright 2008 Julien Danjou +-- @release @AWESOME_VERSION@ +--------------------------------------------------------------------------- + +-- Grab environment we need +local ipairs = ipairs +local tag = require("awful.tag") +local util = require("awful.util") +local suit = require("awful.layout.suit") +local capi = +{ + hooks = hooks, + screen = screen +} +local hooks = require("awful.hooks") + +--- Layout module for awful +module("awful.layout") + +--- Get the current layout. +-- @param screen The screen number. +-- @return The layout function. +function get(screen) + local t = tag.selected(screen) + return tag.getproperty(t, "layout") or suit.tile +end + +--- Change the layout of the current tag. +-- @param layouts A table of layouts. +-- @param i Relative index. +function inc(layouts, i) + local t = tag.selected() + if t then + local curlayout = get() + local curindex + local rev_layouts = {} + for k, v in ipairs(layouts) do + if v == curlayout then + curindex = k + break + end + end + if curindex then + local newindex = util.cycle(#layouts, curindex + i) + set(layouts[newindex]) + end + end +end + +--- Set the layout function of the current tag. +-- @param layout Layout name. +function set(layout) + local t = tag.selected() + tag.setproperty(t, "layout", layout) + capi.hooks.arrange()(t.screen) +end + +-- Register an arrange hook. +local function on_arrange (screen) + local t = tag.selected(screen) + local l = tag.getproperty(t, "layout") or suit.tile + l(screen) +end + +local layouts_name = +{ + [suit.tile] = "tile", + [suit.tile.left] = "tileleft", + [suit.tile.bottom] = "tilebottom", + [suit.tile.top] = "tiletop", + [suit.fair] = "fairv", + [suit.fair.horizontal] = "fairh", + [suit.max] = "max", + [suit.max.fullscreen] = "fullscreen", + [suit.magnifier] = "magnifier", + [suit.floating] = "floating" +} + +--- Get the current layout name. +-- @param layout the layout name. +-- @return The layout name. +function getname(layout) + return layouts_name[layout] +end + +hooks.arrange.register(on_arrange) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/layout/suit/fair.lua.in b/lib/awful/layout/suit/fair.lua.in new file mode 100644 index 000000000..6b879fb35 --- /dev/null +++ b/lib/awful/layout/suit/fair.lua.in @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------- +-- @author Julien Danjou <julien@danjou.info> +-- @copyright 2008 Julien Danjou +-- @release @AWESOME_VERSION@ +--------------------------------------------------------------------------- + +-- Grab environment we need +local setmetatable = setmetatable +local ipairs = ipairs +local math = math +local client = require("awful.client") +local capi = +{ + screen = screen +} + +--- Fair layouts module for awful +module("awful.layout.suit.fair") + +local function fair(screen, orientation) + local wa = capi.screen[screen].workarea + local cls = client.tiled(screen) + + if #cls > 0 then + local cells = math.floor(math.sqrt(#cls)) + local strips = math.ceil(#cls / cells) + + local cell = 0 + local strip = 0 + for k, c in ipairs(cls) do + local g = {} + if orientation == "east" then + if #cls < (strips * cells) and strip == strips - 1 then + g.width = wa.width / (cells - ((strips * cells) - #cls)) + else + g.width = wa.width / cells + end + g.height = wa.height / strips + + g.x = wa.x + cell * g.width + g.y = wa.y + strip * g.height + + else + if #cls < (strips * cells) and strip == strips - 1 then + g.height = wa.height / (cells - ((strips * cells) - #cls)) + else + g.height = wa.height / cells + end + g.width = wa.width / strips + + g.x = wa.x + strip * g.width + g.y = wa.y + cell * g.height + end + + g.width = g.width - 2 * c.border_width + g.height = g.height - 2 * c.border_width + + c:fullgeometry(g) + + cell = cell + 1 + if cell == cells then + cell = 0 + strip = strip + 1 + end + end + end +end +--- Horizontal fair layout. +-- @param screen The screen to arrange. +function horizontal(screen) + return fair(screen, "east") +end + +-- Vertical fair layout. +-- @param screen The screen to arrange. +local function fairv(_, screen) + return fair(screen, "south") +end + +setmetatable(_M, { __call = fairv }) diff --git a/lib/awful/layout/suit/floating.lua.in b/lib/awful/layout/suit/floating.lua.in new file mode 100644 index 000000000..d19038042 --- /dev/null +++ b/lib/awful/layout/suit/floating.lua.in @@ -0,0 +1,17 @@ +--------------------------------------------------------------------------- +-- @author Gregor Best +-- @copyright 2008 Gregor Best +-- @release @AWESOME_VERSION@ +--------------------------------------------------------------------------- + +-- Grab environment we need +local setmetatable = setmetatable + +--- Dummy function for floating layout +module("awful.layout.suit.floating") + +local function floating(_, screen) + return nil +end + +setmetatable(_M, { __call = floating }) diff --git a/lib/awful/layout/suit/init.lua.in b/lib/awful/layout/suit/init.lua.in new file mode 100644 index 000000000..ae83edf43 --- /dev/null +++ b/lib/awful/layout/suit/init.lua.in @@ -0,0 +1,8 @@ +require("awful.layout.suit.max") +require("awful.layout.suit.tile") +require("awful.layout.suit.fair") +require("awful.layout.suit.floating") +require("awful.layout.suit.magnifier") + +--- Suits for awful +module("awful.layout.suit") diff --git a/lib/awful/layout/suit/magnifier.lua.in b/lib/awful/layout/suit/magnifier.lua.in new file mode 100644 index 000000000..72f2763c5 --- /dev/null +++ b/lib/awful/layout/suit/magnifier.lua.in @@ -0,0 +1,83 @@ +--------------------------------------------------------------------------- +-- @author Julien Danjou <julien@danjou.info> +-- @copyright 2008 Julien Danjou +-- @release @AWESOME_VERSION@ +--------------------------------------------------------------------------- + +-- Grab environment we need +local setmetatable = setmetatable +local ipairs = ipairs +local math = math +local tag = require("awful.tag") +local capi = +{ + client = client, + screen = screen +} +local client = require("awful.client") + +--- Magnifier layout module for awful +module("awful.layout.suit.magnifier") + +local function magnifier(_, screen) + -- Fullscreen? + local area = capi.screen[screen].workarea + local cls = client.tiled(screen) + local focus = capi.client.focus + local t = tag.selected() + local mwfact = tag.getmwfact(t) + + if not focus and #cls > 0 then + focus = cls[1] + end + + -- Abort if no clients are present + if not focus then + return + end + + -- Find parent of this window, if it has one. + while focus.transient_for do + focus = focus.transient_for + end + + -- If focused window is not tiled, take the first one which is tiled. + if client.floating.get(focus) then + focus = cls[1] + end + + local geometry = {} + if #cls - 1 > 0 then + geometry.width = area.width * math.sqrt(mwfact) + geometry.height = area.height * math.sqrt(mwfact) + geometry.x = area.x + (area.width - geometry.width) / 2 + geometry.y = area.y + (area.height - geometry.height) /2 + else + geometry.x = area.x + geometry.y = area.y + geometry.width = area.width - 2 * focus.border_width + geometry.height = area.height - 2 * focus.border_width + end + focus:fullgeometry(geometry) + focus:raise() + + if #cls - 1 > 0 then + geometry.x = area.x + geometry.y = area.y + geometry.height = area.height / (#cls - 1) + geometry.width = area.width + + for k, c in ipairs(cls) do + if c ~= focus then + geometry.height = geometry.height - 2 * c.border_width + geometry.width = geometry.width - 2 * c.border_width + c:fullgeometry(geometry) + geometry.height = geometry.height + 2 * c.border_width + geometry.width = geometry.width + 2 * c.border_width + geometry.y = geometry.y + geometry.height + end + end + end +end + +setmetatable(_M, { __call = magnifier }) diff --git a/lib/awful/layout/suit/max.lua.in b/lib/awful/layout/suit/max.lua.in new file mode 100644 index 000000000..73c40e031 --- /dev/null +++ b/lib/awful/layout/suit/max.lua.in @@ -0,0 +1,51 @@ +--------------------------------------------------------------------------- +-- @author Julien Danjou <julien@danjou.info> +-- @copyright 2008 Julien Danjou +-- @release @AWESOME_VERSION@ +--------------------------------------------------------------------------- + +-- Grab environment we need +local setmetatable = setmetatable +local pairs = pairs +local client = require("awful.client") +local capi = +{ + screen = screen +} + +--- Maximized and fullscreen layouts module for awful +module("awful.layout.suit.max") + +local function fmax(screen, fs) + -- Fullscreen? + local area + if fs then + area = capi.screen[screen].geometry + else + area = capi.screen[screen].workarea + end + + for k, c in pairs(client.visible(screen)) do + if not c.floating then + area.width = area.width - 2 * c.border_width + area.height = area.height - 2 * c.border_width + c:fullgeometry(area) + area.width = area.width + 2 * c.border_width + area.height = area.height + 2 * c.border_width + end + end +end + +--- Maximized layout. +-- @param screen The screen to arrange. +local function max(_, screen) + return fmax(screen, false) +end + +--- Fullscreen layout. +-- @param screen The screen to arrange. +function fullscreen(screen) + return fmax(screen, true) +end + +setmetatable(_M, { __call = max }) diff --git a/lib/awful/layout/suit/tile.lua.in b/lib/awful/layout/suit/tile.lua.in new file mode 100644 index 000000000..e703f1007 --- /dev/null +++ b/lib/awful/layout/suit/tile.lua.in @@ -0,0 +1,168 @@ +--------------------------------------------------------------------------- +-- @author Julien Danjou <julien@danjou.info> +-- @copyright 2008 Julien Danjou +-- @release @AWESOME_VERSION@ +--------------------------------------------------------------------------- + +-- Grab environment we need +local setmetatable = setmetatable +local ipairs = ipairs +local math = math +local client = require("awful.client") +local tag = require("awful.tag") +local capi = +{ + screen = screen +} + +--- Tiled layouts module for awful +module("awful.layout.suit.tile") + +local function tile(_, screen, position) + if not position then position = "right" end + local t = tag.selected() + local nmaster = tag.getnmaster(t) + local mwfact = tag.getmwfact(t) + local ncol = tag.getncol(t) + + local wa = capi.screen[screen].workarea + local cls = client.tiled(screen) + + local masterwin = math.min(#cls, nmaster) + local otherwin = math.max(#cls - masterwin, 0); + + local mh, mw + if nmaster > 0 then + if position == "right" or position == "left" then + if masterwin > 0 then + mh = wa.height / masterwin + else + mh = wa.height + end + if otherwin > 0 then + mw = wa.width * mwfact + else + mw = wa.width + end + else + if otherwin > 0 then + mh = wa.height * mwfact + else + mh = wa.height + end + if masterwin > 0 then + mw = wa.width / masterwin + else + mw = wa.width + end + end + else + mh = 0 + mw = 0 + end + + local real_ncol + if ncol > 0 then + real_ncol = math.min(otherwin, ncol) + else + real_ncol = math.min(otherwin, 1) + end + + for i, c in ipairs(cls) do + local geometry = {} + + -- Master windows + if i <= nmaster then + if position == "right" then + geometry.y = wa.y + (i - 1) * mh + geometry.x = wa.x + elseif position == "left" then + geometry.y = wa.y + (i - 1) * mh + geometry.x = wa.x + (wa.width - mw) + elseif position == "top" then + geometry.x = wa.x + (i - 1) * mw + geometry.y = wa.y + (wa.height - mh) + else + geometry.x = wa.x + (i - 1) * mw + geometry.y = wa.y + end + + geometry.width = mw - 2 * c.border_width + geometry.height = mh - 2 * c.border_width + + -- Slave windows + else + local win_by_col = math.ceil(otherwin / real_ncol) + real_ncol = math.ceil(otherwin / win_by_col) + local current_col = math.floor((i - 1 - nmaster) / win_by_col) + + if position == "right" or position == "left" then + if otherwin <= real_ncol then + geometry.height = wa.height - 2 * c.border_width + elseif (otherwin % win_by_col) ~= 0 and (current_col == real_ncol - 1) then + geometry.height = math.floor(wa.height / (otherwin % win_by_col)) - 2 * c.border_width + else + geometry.height = math.floor(wa.height / win_by_col) - 2 * c.border_width + end + + geometry.width = math.floor((wa.width - mw) / real_ncol) - 2 * c.border_width + + if otherwin <= real_ncol then + geometry.y = wa.y + else + geometry.y = wa.y + ((i - 1 - nmaster) % win_by_col) * + (geometry.height + 2 * c.border_width) + end + geometry.x = wa.x + current_col * (geometry.width + 2 * c.border_width) + + if position == "right" then + geometry.x = geometry.x + mw + end + else + if otherwin <= real_ncol then + geometry.width = wa.width - 2 * c.border_width + elseif (otherwin % win_by_col) ~= 0 and (current_col == real_ncol - 1) then + geometry.width = math.floor(wa.width / (otherwin % win_by_col)) - 2 * c.border_width + else + geometry.width = math.floor(wa.width / win_by_col) - 2 * c.border_width + end + + geometry.height = math.floor((wa.height - mh) / real_ncol) - 2 * c.border_width + + if otherwin <= real_ncol then + geometry.x = wa.x + else + geometry.x = wa.x + ((i - 1 - nmaster) % win_by_col) * + (geometry.width + 2 * c.border_width) + end + + geometry.y = wa.y + current_col * (geometry.height + 2 * c.border_width) + + if position == "bottom" then + geometry.y = geometry.y + mh + end + end + end + c:fullgeometry(geometry) + end +end + +--- The main tile algo, on left. +-- @param screen The screen number to tile. +function left(screen) + return tile(nil, screen, "left") +end + +--- The main tile algo, on bottom. +-- @param screen The screen number to tile. +function bottom(screen) + return tile(nil, screen, "bottom") +end + +--- The main tile algo, on top. +-- @param screen The screen number to tile. +function top(screen) + return tile(nil, screen, "top") +end + +setmetatable(_M, { __call = tile }) diff --git a/lib/awful/mouse.lua.in b/lib/awful/mouse.lua.in index 4d4cd68d0..85a08235f 100644 --- a/lib/awful/mouse.lua.in +++ b/lib/awful/mouse.lua.in @@ -109,16 +109,16 @@ function client.move(c, snap) for k, v in ipairs(mouse.buttons) do if v then local lay = layout.get(c.screen) - if lay == "floating" or c.floating then + if lay == layout.suit.floating or c.floating then local x = mouse.x - dist_x local y = mouse.y - dist_y c:fullgeometry(client.snap(c, snap, x, y)) - if layout.get(c.screen) ~= "floating" and not c.floating then + if layout.get(c.screen) ~= layout.suit.floating and not c.floating then hooks.property.register(ug) end - elseif lay ~= "magnifier" then + elseif lay ~= layout.suit.magnifier then c.screen = capi.mouse.screen - if layout.get(c.screen) ~= "floating" then + if layout.get(c.screen) ~= layout.suit.floating then local c_u_m = capi.mouse.client_under_pointer() if c_u_m and not c_u_m.floating then if c_u_m ~= c then @@ -200,7 +200,7 @@ local function client_resize_magnifier(c, corner) -- New master width factor local mwfact = dist / maxdist_pow - tag.setmwfact(math.min(math.max(0.01, mwfact), 0.99), c.screen) + tag.setmwfact(math.min(math.max(0.01, mwfact), 0.99), tag.selected(c.screen)) return true end end @@ -210,15 +210,15 @@ end local function client_resize_tiled(c, lay) local wa = capi.screen[c.screen].workarea - local mwfact = tag.selected(c.screen).mwfact + local mwfact = tag.getmwfact() local cursor - if lay == "tile" then + if lay == layout.suit.tile then capi.mouse.coords({ x = wa.x + wa.width * mwfact }) cursor = "sb_h_double_arrow" - elseif lay == "tileleft" then + elseif lay == layout.suit.tile.left then capi.mouse.coords({ x = wa.x + wa.width * (1 - mwfact) }) cursor = "sb_h_double_arrow" - elseif lay == "tilebottom" then + elseif lay == layout.suit.tile.bottom then capi.mouse.coords({ y = wa.y + wa.height * mwfact }) cursor = "sb_v_double_arrow" else @@ -233,17 +233,17 @@ local function client_resize_tiled(c, lay) local fact_y = (mouse.y - wa.y) / wa.height local mwfact - if lay == "tile" then + if lay == layout.suit.tile then mwfact = fact_x - elseif lay == "tileleft" then + elseif lay == layout.suit.tile.left then mwfact = 1 - fact_x - elseif lay == "tilebottom" then + elseif lay == layout.suit.tile.bottom then mwfact = fact_y else mwfact = 1 - fact_y end - tag.setmwfact(math.min(math.max(mwfact, 0.01), 0.99), c.screen) + tag.setmwfact(math.min(math.max(mwfact, 0.01), 0.99), tag.selected(c.screen)) return true end end @@ -332,14 +332,14 @@ function client.resize(c, corner) local lay = layout.get(c.screen) - if lay == "floating" or c.floating then + if lay == layout.suit.floating or c.floating then return client_resize_floating(c, corner) - elseif lay == "tile" - or lay == "tileleft" - or lay == "tilebottom" - or lay == "tiletop" then + elseif lay == layout.suit.tile + or lay == layout.suit.tile.left + or lay == layout.suit.tile.top + or lay == layout.suit.tile.bottom then return client_resize_tiled(c, lay) - elseif lay == "magnifier" then + elseif lay == layout.suit.magnifier then return client_resize_magnifier(c, corner) end end diff --git a/lib/awful/placement.lua.in b/lib/awful/placement.lua.in index adbb4259c..3ef70bd7f 100644 --- a/lib/awful/placement.lua.in +++ b/lib/awful/placement.lua.in @@ -128,7 +128,7 @@ function no_overlap(c) local geometry = c:geometry() local fullgeometry = c:fullgeometry() for i, cl in pairs(cls) do - if cl ~= c and (cl.floating or layout == "floating") then + if cl ~= c and (cl.floating or layout == layout.suit.floating) then areas = area_remove(areas, cl:fullgeometry()) end end diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 0aad55a9d..42ffdb5ad 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -5,15 +5,17 @@ --------------------------------------------------------------------------- -- Grab environment we need -local hooks = require("awful.hooks") local util = require("awful.util") local pairs = pairs local ipairs = ipairs +local otable = otable local capi = { + hooks = hooks, screen = screen, mouse = mouse } +local hooks = require("awful.hooks") --- Tag module for awful module("awful.tag") @@ -23,6 +25,7 @@ local data = {} data.history = {} data.history.past = {} data.history.current = {} +data.tags = otable() -- History functions history = {} @@ -98,57 +101,66 @@ end --- Set master width factor. -- @param mwfact Master width factor. --- @param screen Optional screen number. -function setmwfact(mwfact, screen) - local t = selected(screen) - if t then - t.mwfact = mwfact - end +function setmwfact(mwfact, t) + local t = t or selected() + setproperty(t, "mwfact", mwfact) + capi.hooks.arrange()(t.screen) end --- Increase master width factor. -- @param add Value to add to master width factor. -function incmwfact(add) - local t = selected() - if t then - t.mwfact = t.mwfact + add - end +function incmwfact(add, t) + setmwfact(getmwfact(t) + add) +end + +--- Get master width factor. +-- @param t Optional tag. +function getmwfact(t) + local t = t or selected() + return getproperty(t, "mwfact") or 0.5 end --- Set the number of master windows. -- @param nmaster The number of master windows. -function setnmaster(nmaster) - local t = selected() - if t then - t.nmaster = nmaster - end +-- @param t Optional tag. +function setnmaster(nmaster, t) + local t = t or selected() + setproperty(t, "nmaster", nmaster) + capi.hooks.arrange()(t.screen) +end + +--- Get the number of master windows. +-- @param t Optional tag. +function getnmaster(t) + local t = t or selected() + return getproperty(t, "nmaster") or 1 end --- Increase the number of master windows. -- @param add Value to add to number of master windows. -function incnmaster(add) - local t = selected() - if t then - t.nmaster = t.nmaster + add - end +function incnmaster(add, t) + setnmaster(getnmaster(t) + add) end --- Set number of column windows. -- @param ncol The number of column. -function setncol(ncol) - local t = selected() - if t then - t.ncol = ncol - end +function setncol(ncol, t) + local t = t or selected() + setproperty(t, "ncol", ncol) + capi.hooks.arrange()(t.screen) +end + +--- Get number of column windows. +-- @param t Optional tag. +function getncol(t) + local t = t or selected() + return getproperty(t, "ncol") or 1 end --- Increase number of column windows. -- @param add Value to add to number of column windows. -function incncol(add) - local t = selected() - if t then - t.ncol = t.ncol + add - end +function incncol(add, t) + setncol(getncol(t) + add) end --- View no tag. @@ -201,7 +213,41 @@ function viewmore(tags, screen) end end +local function hook_tags(screen, tag, action) + if action == "remove" then + data.tags[tag] = nil + elseif action == "add" then + data.tags[tag] = {} + end +end + +--- Get a tag property. +-- @param tag The tag. +-- @param prop The property name. +-- @return The property. +function getproperty(tag, prop) + if data.tags[tag] then + return data.tags[tag][prop] + end +end + +--- Set a tag property. +-- This properties are internal to awful. Some are used to draw taglist, or to +-- handle layout, etc. +-- @param tag The tag. +-- @param prop The property name. +-- @param value The value. +-- @return True if the value has been set, false otherwise. +function setproperty(tag, prop, value) + if data.tags[tag] then + data.tags[tag][prop] = value + return true + end + return false +end + -- Register standards hooks hooks.arrange.register(history.update) +hooks.tags.register(hook_tags) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/luaa.c b/luaa.c index 2c736c662..6022a3355 100644 --- a/luaa.c +++ b/luaa.c @@ -48,7 +48,6 @@ #include "screen.h" #include "event.h" #include "mouse.h" -#include "layouts/tile.h" #include "common/socket.h" #include "common/buffer.h" @@ -979,7 +978,7 @@ bailout: /* Assure there's at least one tag */ for(screen = 0; screen < globalconf.nscreen; screen++) if(!globalconf.screens[screen].tags.len) - tag_append_to_screen(tag_new("default", sizeof("default") - 1, layout_tile, 0.5, 1, 0), + tag_append_to_screen(tag_new("default", sizeof("default") - 1), &globalconf.screens[screen]); return ret; } diff --git a/mouse.c b/mouse.c index 0ed88adb0..9afb027e9 100644 --- a/mouse.c +++ b/mouse.c @@ -24,10 +24,6 @@ #include "common/tokenize.h" #include "screen.h" #include "tag.h" -#include "titlebar.h" -#include "layouts/floating.h" -#include "layouts/tile.h" -#include "layouts/magnifier.h" #include "common/xcursor.h" extern awesome_t globalconf; diff --git a/screen.c b/screen.c index 73626e273..d6ff24abd 100644 --- a/screen.c +++ b/screen.c @@ -30,7 +30,6 @@ #include "client.h" #include "widget.h" #include "wibox.h" -#include "layouts/tile.h" extern awesome_t globalconf; @@ -462,7 +461,7 @@ luaA_screen_tags(lua_State *L) { luaA_warn(L, "screen %d has no tag, taking last resort action and adding default tag\n", s->index); - tag_append_to_screen(tag_new("default", sizeof("default") - 1, layout_tile, 0.5, 1, 0), s); + tag_append_to_screen(tag_new("default", sizeof("default") - 1), s); return 1; } } diff --git a/structs.h b/structs.h index a0eed2e6c..92ab082ec 100644 --- a/structs.h +++ b/structs.h @@ -27,7 +27,6 @@ #include "config.h" #include "luaa.h" -#include "layout.h" #include "swindow.h" #include "keybinding.h" #include "common/xutil.h" @@ -240,14 +239,6 @@ struct tag int screen; /** true if selected */ bool selected; - /** Current tag layout */ - layout_t *layout; - /** Master width factor */ - double mwfact; - /** Number of master windows */ - int nmaster; - /** Number of columns in tile layout */ - int ncol; /** clients in this tag */ client_array_t clients; }; diff --git a/tag.c b/tag.c index 7af7b6fca..cf65a46ae 100644 --- a/tag.c +++ b/tag.c @@ -25,8 +25,6 @@ #include "ewmh.h" #include "widget.h" -#include "layoutgen.h" - extern awesome_t globalconf; DO_LUA_NEW(extern, tag_t, tag, "tag", tag_ref) @@ -48,34 +46,19 @@ tag_view(tag_t *tag, bool view) /** Create a new tag. Parameters values are checked. * \param name Tag name. * \param len Tag name length. - * \param layout Layout to use. - * \param mwfact Master width factor. - * \param nmaster Number of master windows. - * \param ncol Number of columns for slaves windows. * \return A new tag with all these parameters. */ tag_t * -tag_new(const char *name, ssize_t len, layout_t *layout, double mwfact, int nmaster, int ncol) +tag_new(const char *name, ssize_t len) { tag_t *tag; tag = p_new(tag_t, 1); a_iso2utf8(&tag->name, name, len); - tag->layout = layout; /* to avoid error */ tag->screen = SCREEN_UNDEF; - tag->mwfact = mwfact; - if(tag->mwfact <= 0 || tag->mwfact >= 1) - tag->mwfact = 0.5; - - if((tag->nmaster = nmaster) < 0) - tag->nmaster = 1; - - if((tag->ncol = ncol) < 1) - tag->ncol = 1; - return tag; } @@ -262,39 +245,16 @@ tag_view_only_byindex(int screen, int dindex) /** Create a new tag. * \param L The Lua VM state. - * * \luastack - * \lparam A table with at least a name attribute. - * Optional attributes are: mwfact, ncol, nmaster and layout. + * \lparam A name. * \lreturn A new tag object. */ static int luaA_tag_new(lua_State *L) { - size_t len, laylen; - tag_t *tag; - int ncol, nmaster; - const char *name, *lay; - double mwfact; - layout_t *layout; - - luaA_checktable(L, 2); - - if(!(name = luaA_getopt_lstring(L, 2, "name", NULL, &len))) - luaL_error(L, "object tag must have a name"); - - mwfact = luaA_getopt_number(L, 2, "mwfact", 0.5); - ncol = luaA_getopt_number(L, 2, "ncol", 1); - nmaster = luaA_getopt_number(L, 2, "nmaster", 1); - lay = luaA_getopt_lstring(L, 2, "layout", "tile", &laylen); - - layout = name_func_lookup(lay, laylen, LayoutList); - - tag = tag_new(name, len, - layout, - mwfact, nmaster, ncol); - - return luaA_tag_userdata_new(L, tag); + size_t len; + const char *name = luaL_checklstring(L, 2, &len); + return luaA_tag_userdata_new(L, tag_new(name, len)); } /** Get or set the clients attached to this tag. @@ -345,9 +305,6 @@ luaA_tag_clients(lua_State *L) * \lfield screen Screen number of the tag. * \lfield layout Tag layout. * \lfield selected True if the client is selected to be viewed. - * \lfield mwfact Master width factor. - * \lfield nmaster Number of master windows. - * \lfield ncol Number of column for slave windows. */ static int luaA_tag_index(lua_State *L) @@ -371,21 +328,9 @@ luaA_tag_index(lua_State *L) return 0; lua_pushnumber(L, (*tag)->screen + 1); break; - case A_TK_LAYOUT: - lua_pushstring(L, name_func_rlookup((*tag)->layout, LayoutList)); - break; case A_TK_SELECTED: lua_pushboolean(L, (*tag)->selected); break; - case A_TK_MWFACT: - lua_pushnumber(L, (*tag)->mwfact); - break; - case A_TK_NMASTER: - lua_pushnumber(L, (*tag)->nmaster); - break; - case A_TK_NCOL: - lua_pushnumber(L, (*tag)->ncol); - break; default: return 0; } @@ -402,17 +347,18 @@ luaA_tag_newindex(lua_State *L) { size_t len; tag_t **tag = luaA_checkudata(L, 1, "tag"); - const char *buf, *attr = luaL_checklstring(L, 2, &len); - double d; - int i, screen; - layout_t *l; + const char *attr = luaL_checklstring(L, 2, &len); switch(a_tokenize(attr, len)) { + int screen; + case A_TK_NAME: - buf = luaL_checklstring(L, 3, &len); - p_delete(&(*tag)->name); - a_iso2utf8(&(*tag)->name, buf, len); + { + const char *buf = luaL_checklstring(L, 3, &len); + p_delete(&(*tag)->name); + a_iso2utf8(&(*tag)->name, buf, len); + } break; case A_TK_SCREEN: if(!lua_isnil(L, 3)) @@ -429,51 +375,10 @@ luaA_tag_newindex(lua_State *L) if(screen != SCREEN_UNDEF) tag_append_to_screen(*tag, &globalconf.screens[screen]); break; - case A_TK_LAYOUT: - buf = luaL_checklstring(L, 3, &len); - l = name_func_lookup(buf, len, LayoutList); - if(l) - (*tag)->layout = l; - else - { - luaA_warn(L, "unknown layout: %s", buf); - return 0; - } - break; case A_TK_SELECTED: if((*tag)->screen != SCREEN_UNDEF) tag_view(*tag, luaA_checkboolean(L, 3)); return 0; - case A_TK_MWFACT: - d = luaL_checknumber(L, 3); - if(d > 0 && d < 1) - (*tag)->mwfact = d; - else - { - luaA_warn(L, "bad value, must be between 0 and 1"); - return 0; - } - break; - case A_TK_NMASTER: - i = luaL_checknumber(L, 3); - if(i >= 0) - (*tag)->nmaster = i; - else - { - luaA_warn(L, "bad value, must be greater than 0"); - return 0; - } - break; - case A_TK_NCOL: - i = luaL_checknumber(L, 3); - if(i >= 1) - (*tag)->ncol = i; - else - { - luaA_warn(L, "bad value, must be greater than 1"); - return 0; - } - break; default: return 0; } diff --git a/tag.h b/tag.h index 4f04c085c..88eb7cc03 100644 --- a/tag.h +++ b/tag.h @@ -26,11 +26,8 @@ #include "client.h" #include "common/refcount.h" -/** Check if a client is tiled */ -#define IS_TILED(client, screen) (client && !client_isfloating(client) && client_isvisible(client, screen)) - /* Contructor, destructor and referencors */ -tag_t *tag_new(const char *, ssize_t, layout_t *, double, int, int); +tag_t *tag_new(const char *, ssize_t); static inline void tag_delete(tag_t **tag) diff --git a/themes/default/layouts/dwindle.png b/themes/default/layouts/dwindle.png deleted file mode 100644 index 943ece5bd..000000000 Binary files a/themes/default/layouts/dwindle.png and /dev/null differ diff --git a/themes/default/layouts/dwindlew.png b/themes/default/layouts/dwindlew.png deleted file mode 100644 index 36de1baef..000000000 Binary files a/themes/default/layouts/dwindlew.png and /dev/null differ diff --git a/themes/default/layouts/spiral.png b/themes/default/layouts/spiral.png deleted file mode 100644 index a24faf563..000000000 Binary files a/themes/default/layouts/spiral.png and /dev/null differ diff --git a/themes/default/layouts/spiralw.png b/themes/default/layouts/spiralw.png deleted file mode 100644 index f34ceb0b5..000000000 Binary files a/themes/default/layouts/spiralw.png and /dev/null differ diff --git a/themes/default/theme.in b/themes/default/theme.in index 9e172c05f..a8b933311 100644 --- a/themes/default/theme.in +++ b/themes/default/theme.in @@ -51,13 +51,11 @@ titlebar_close_button_focus = @AWESOME_THEMES_PATH@/default/titlebar/closer.png wallpaper_cmd = awsetbg @AWESOME_THEMES_PATH@/default/background.png # You can use your own layout icons like this: -layout_dwindle = @AWESOME_THEMES_PATH@/default/layouts/dwindlew.png layout_fairh = @AWESOME_THEMES_PATH@/default/layouts/fairhw.png layout_fairv = @AWESOME_THEMES_PATH@/default/layouts/fairvw.png layout_floating = @AWESOME_THEMES_PATH@/default/layouts/floatingw.png layout_magnifier = @AWESOME_THEMES_PATH@/default/layouts/magnifierw.png layout_max = @AWESOME_THEMES_PATH@/default/layouts/maxw.png -layout_spiral = @AWESOME_THEMES_PATH@/default/layouts/spiralw.png layout_tilebottom = @AWESOME_THEMES_PATH@/default/layouts/tilebottomw.png layout_tileleft = @AWESOME_THEMES_PATH@/default/layouts/tileleftw.png layout_tile = @AWESOME_THEMES_PATH@/default/layouts/tilew.png diff --git a/themes/sky/layouts/dwindle.png b/themes/sky/layouts/dwindle.png deleted file mode 100644 index 22568afc0..000000000 Binary files a/themes/sky/layouts/dwindle.png and /dev/null differ diff --git a/themes/sky/layouts/spiral.png b/themes/sky/layouts/spiral.png deleted file mode 100644 index aca8033fe..000000000 Binary files a/themes/sky/layouts/spiral.png and /dev/null differ diff --git a/themes/sky/theme.in b/themes/sky/theme.in index bcf70aabe..f0cb43787 100644 --- a/themes/sky/theme.in +++ b/themes/sky/theme.in @@ -21,14 +21,12 @@ border_focus = #729fcf border_marked = #eeeeec # IMAGES -layout_dwindle = @AWESOME_THEMES_PATH@/sky/layouts/dwindle.png layout_fairh = @AWESOME_THEMES_PATH@/sky/layouts/fairh.png layout_fairv = @AWESOME_THEMES_PATH@/sky/layouts/fairv.png layout_floating = @AWESOME_THEMES_PATH@/sky/layouts/floating.png layout_magnifier = @AWESOME_THEMES_PATH@/sky/layouts/magnifier.png layout_max = @AWESOME_THEMES_PATH@/sky/layouts/max.png layout_fullscreen = @AWESOME_THEMES_PATH@/sky/layouts/fullscreen.png -layout_spiral = @AWESOME_THEMES_PATH@/sky/layouts/spiral.png layout_tilebottom = @AWESOME_THEMES_PATH@/sky/layouts/tilebottom.png layout_tileleft = @AWESOME_THEMES_PATH@/sky/layouts/tileleft.png layout_tile = @AWESOME_THEMES_PATH@/sky/layouts/tile.png diff --git a/titlebar.c b/titlebar.c index 9fd70bf37..510b65ed6 100644 --- a/titlebar.c +++ b/titlebar.c @@ -210,7 +210,7 @@ titlebar_client_attach(client_t *c, wibox_t *t) t->need_update = true; /* This may seem useless, but it's the cleanest way to avoid seeing titlebars for banned clients. */ - titlebar_update_geometry_floating(c); + titlebar_update_geometry(c); if(t->isvisible) xcb_map_window(globalconf.connection, t->sw.window); @@ -342,7 +342,7 @@ luaA_titlebar_newindex(lua_State *L, wibox_t *titlebar, awesome_token_t tok) titlebar->position = position; if((c = client_getbytitlebar(titlebar))) { - titlebar_update_geometry_floating(c); + titlebar_update_geometry(c); /* call geometry hook for client because some like to * set titlebar width in that hook, which make sense */ hooks_property(c, "geometry"); diff --git a/titlebar.h b/titlebar.h index 441134eee..460a5b48f 100644 --- a/titlebar.h +++ b/titlebar.h @@ -118,19 +118,18 @@ titlebar_geometry_remove(wibox_t *t, int border, area_t geometry) return geometry; } -/** Update the titlebar geometry for a tiled client. +/** Update the titlebar geometry for a client. * \param c The client. - * \param geometry The geometry the client will receive. */ static inline void -titlebar_update_geometry_tiled(client_t *c, area_t geometry) +titlebar_update_geometry(client_t *c) { area_t geom; if(!c->titlebar) return; - titlebar_geometry_compute(c, geometry, &geom); + titlebar_geometry_compute(c, c->geometry, &geom); /* Can't actually move titlebar right now, but we will resize it. */ if(c->isbanned) { @@ -149,14 +148,5 @@ titlebar_update_geometry_tiled(client_t *c, area_t geometry) wibox_moveresize(c->titlebar, geom); } -/** Update the titlebar geometry for a floating client. - * \param c The client. - */ -static inline void -titlebar_update_geometry_floating(client_t *c) -{ - return titlebar_update_geometry_tiled(c, c->geometry); -} - #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/wibox.c b/wibox.c index f2321d645..cbdc84897 100644 --- a/wibox.c +++ b/wibox.c @@ -919,7 +919,7 @@ luaA_wibox_newindex(lua_State *L) wibox_position_update(*wibox); break; case WIBOX_TYPE_TITLEBAR: - titlebar_update_geometry_floating(client_getbytitlebar(*wibox)); + titlebar_update_geometry(client_getbytitlebar(*wibox)); break; } break;