diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 45f9c08b..0a3af0b6 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -54,7 +54,6 @@ border_marked = "#91231C" awesome.font_set(font) awesome.colors_set({ fg = fg_normal, bg = bg_normal }) -awesome.resizehints_set(true) -- }}} @@ -327,6 +326,8 @@ function hook_manage(c) if floatings[c:name_get():lower()] then c:floating_set(true) end + -- Honor size hints + c:honorsizehints_set(true) end -- Hook function to execute when arranging the screen diff --git a/client.c b/client.c index ee79bdfb..6e8320da 100644 --- a/client.c +++ b/client.c @@ -1440,6 +1440,22 @@ luaA_client_floating_placement_set(lua_State *L) return 0; } +/** Define if awesome should respect client size hints when resizing + * windows in tiled mode. If you set this to true, you will experience gaps + * between windows, but they will have the best size they can have. + * \param L The Lua VM state. + * + * \luastack + * \lvalue A client. + * \lparam A boolean value, true to enable, false to disable. + */ +static int +luaA_honorsizehints_set(lua_State *L) +{ + client_t **c = luaA_checkudata(L, 1, "client"); + (*c)->honorsizehints = luaA_checkboolean(L, 2); + return 0; +} const struct luaL_reg awesome_client_methods[] = { @@ -1450,6 +1466,7 @@ const struct luaL_reg awesome_client_methods[] = }; const struct luaL_reg awesome_client_meta[] = { + { "honorsizehints_set", luaA_honorsizehints_set }, { "floating_placement_set", luaA_client_floating_placement_set }, { "titlebar_set", luaA_client_titlebar_set }, { "titlebar_get", luaA_client_titlebar_get }, diff --git a/layouts/fibonacci.c b/layouts/fibonacci.c index 6b3b2c76..87b25864 100644 --- a/layouts/fibonacci.c +++ b/layouts/fibonacci.c @@ -81,7 +81,7 @@ layout_fibonacci(int screen, int shape) } geometry.width -= 2 * c->border; geometry.height -= 2 * c->border; - client_resize(c, geometry, globalconf.resize_hints); + client_resize(c, geometry, c->honorsizehints); geometry.width += 2 * c->border; geometry.height += 2 * c->border; } diff --git a/layouts/magnifier.c b/layouts/magnifier.c index f76e3851..fc5cec29 100644 --- a/layouts/magnifier.c +++ b/layouts/magnifier.c @@ -51,7 +51,7 @@ layout_magnifier(int screen) geometry.height = area.height * curtags[0]->mwfact; geometry.x = area.x + (area.width - geometry.width) / 2; geometry.y = area.y + (area.height - geometry.height) / 2; - client_resize(focus, geometry, globalconf.resize_hints); + client_resize(focus, geometry, focus->honorsizehints); client_raise(focus); for(c = client_list_prev_cycle(&globalconf.clients, focus); @@ -76,7 +76,7 @@ layout_magnifier(int screen) { geometry.height -= 2 * c->border; geometry.width -= 2 * c->border; - client_resize(c, geometry, globalconf.resize_hints); + client_resize(c, geometry, c->honorsizehints); geometry.height += 2 * c->border; geometry.width += 2 * c->border; geometry.y += geometry.height; diff --git a/layouts/tile.c b/layouts/tile.c index 16ac6ddf..165fc711 100644 --- a/layouts/tile.c +++ b/layouts/tile.c @@ -109,7 +109,7 @@ _tile(int screen, const position_t position) geometry.width = mw - 2 * c->border; geometry.height = mh - 2 * c->border; - client_resize(c, geometry, globalconf.resize_hints); + client_resize(c, geometry, c->honorsizehints); } else { @@ -162,7 +162,7 @@ _tile(int screen, const position_t position) if(position == Bottom) geometry.y += mh; } - client_resize(c, geometry, globalconf.resize_hints); + client_resize(c, geometry, c->honorsizehints); } i++; } diff --git a/lua.c b/lua.c index a48f3a64..20551794 100644 --- a/lua.c +++ b/lua.c @@ -164,21 +164,6 @@ luaA_padding_set(lua_State *L) return 0; } -/** Define if awesome should respect applications size hints when resizing - * windows in tiled mode. If you set this to true, you will experience gaps - * between windows, but they will have the best size they can have. - * \param L The Lua VM state. - * - * \luastack - * \lparam A boolean value, true to enable, false to disable. - */ -static int -luaA_resizehints_set(lua_State *L) -{ - globalconf.resize_hints = luaA_checkboolean(L, 1); - return 0; -} - /** Get the screen count. * \param L The Lua VM state. * @@ -484,7 +469,6 @@ luaA_init(void) { "restart", luaA_restart }, { "padding_set", luaA_padding_set }, { "mouse_add", luaA_mouse_add }, - { "resizehints_set", luaA_resizehints_set }, { "font_set", luaA_font_set }, { "colors_set", luaA_colors_set }, { NULL, NULL } diff --git a/mouse.c b/mouse.c index e25a1e01..536750da 100644 --- a/mouse.c +++ b/mouse.c @@ -652,7 +652,7 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox) XCB_CURRENT_TIME, MOUSEMASK); } - if(globalconf.resize_hints && c->hassizehints) + if(c->hassizehints && c->honorsizehints) { int dx, dy; diff --git a/structs.h b/structs.h index 8450e736..96bd1f6f 100644 --- a/structs.h +++ b/structs.h @@ -280,6 +280,8 @@ struct client_t int basew, baseh, incw, inch, maxw, maxh, minw, minh; int minax, maxax, minay, maxay; bool hassizehints; + /** Respect resize hints */ + bool honorsizehints; int border, oldborder; /** True if the client does not want any border */ bool noborder; @@ -442,8 +444,6 @@ struct awesome_t } colors; /** Default font */ font_t *font; - /** Respect resize hints */ - bool resize_hints; struct { /** Command to execute when spawning a new client */