client: honor size hints is now by client

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-25 15:42:07 +02:00
parent 92797c11b9
commit 6ec76c3b97
8 changed files with 27 additions and 25 deletions

View File

@ -54,7 +54,6 @@ border_marked = "#91231C"
awesome.font_set(font) awesome.font_set(font)
awesome.colors_set({ fg = fg_normal, bg = bg_normal }) 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 if floatings[c:name_get():lower()] then
c:floating_set(true) c:floating_set(true)
end end
-- Honor size hints
c:honorsizehints_set(true)
end end
-- Hook function to execute when arranging the screen -- Hook function to execute when arranging the screen

View File

@ -1440,6 +1440,22 @@ luaA_client_floating_placement_set(lua_State *L)
return 0; 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[] = 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[] = const struct luaL_reg awesome_client_meta[] =
{ {
{ "honorsizehints_set", luaA_honorsizehints_set },
{ "floating_placement_set", luaA_client_floating_placement_set }, { "floating_placement_set", luaA_client_floating_placement_set },
{ "titlebar_set", luaA_client_titlebar_set }, { "titlebar_set", luaA_client_titlebar_set },
{ "titlebar_get", luaA_client_titlebar_get }, { "titlebar_get", luaA_client_titlebar_get },

View File

@ -81,7 +81,7 @@ layout_fibonacci(int screen, int shape)
} }
geometry.width -= 2 * c->border; geometry.width -= 2 * c->border;
geometry.height -= 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.width += 2 * c->border;
geometry.height += 2 * c->border; geometry.height += 2 * c->border;
} }

View File

@ -51,7 +51,7 @@ layout_magnifier(int screen)
geometry.height = area.height * curtags[0]->mwfact; geometry.height = area.height * curtags[0]->mwfact;
geometry.x = area.x + (area.width - geometry.width) / 2; geometry.x = area.x + (area.width - geometry.width) / 2;
geometry.y = area.y + (area.height - geometry.height) / 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); client_raise(focus);
for(c = client_list_prev_cycle(&globalconf.clients, focus); for(c = client_list_prev_cycle(&globalconf.clients, focus);
@ -76,7 +76,7 @@ layout_magnifier(int screen)
{ {
geometry.height -= 2 * c->border; geometry.height -= 2 * c->border;
geometry.width -= 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.height += 2 * c->border;
geometry.width += 2 * c->border; geometry.width += 2 * c->border;
geometry.y += geometry.height; geometry.y += geometry.height;

View File

@ -109,7 +109,7 @@ _tile(int screen, const position_t position)
geometry.width = mw - 2 * c->border; geometry.width = mw - 2 * c->border;
geometry.height = mh - 2 * c->border; geometry.height = mh - 2 * c->border;
client_resize(c, geometry, globalconf.resize_hints); client_resize(c, geometry, c->honorsizehints);
} }
else else
{ {
@ -162,7 +162,7 @@ _tile(int screen, const position_t position)
if(position == Bottom) if(position == Bottom)
geometry.y += mh; geometry.y += mh;
} }
client_resize(c, geometry, globalconf.resize_hints); client_resize(c, geometry, c->honorsizehints);
} }
i++; i++;
} }

16
lua.c
View File

@ -164,21 +164,6 @@ luaA_padding_set(lua_State *L)
return 0; 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. /** Get the screen count.
* \param L The Lua VM state. * \param L The Lua VM state.
* *
@ -484,7 +469,6 @@ luaA_init(void)
{ "restart", luaA_restart }, { "restart", luaA_restart },
{ "padding_set", luaA_padding_set }, { "padding_set", luaA_padding_set },
{ "mouse_add", luaA_mouse_add }, { "mouse_add", luaA_mouse_add },
{ "resizehints_set", luaA_resizehints_set },
{ "font_set", luaA_font_set }, { "font_set", luaA_font_set },
{ "colors_set", luaA_colors_set }, { "colors_set", luaA_colors_set },
{ NULL, NULL } { NULL, NULL }

View File

@ -652,7 +652,7 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox)
XCB_CURRENT_TIME, MOUSEMASK); XCB_CURRENT_TIME, MOUSEMASK);
} }
if(globalconf.resize_hints && c->hassizehints) if(c->hassizehints && c->honorsizehints)
{ {
int dx, dy; int dx, dy;

View File

@ -280,6 +280,8 @@ struct client_t
int basew, baseh, incw, inch, maxw, maxh, minw, minh; int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int minax, maxax, minay, maxay; int minax, maxax, minay, maxay;
bool hassizehints; bool hassizehints;
/** Respect resize hints */
bool honorsizehints;
int border, oldborder; int border, oldborder;
/** True if the client does not want any border */ /** True if the client does not want any border */
bool noborder; bool noborder;
@ -442,8 +444,6 @@ struct awesome_t
} colors; } colors;
/** Default font */ /** Default font */
font_t *font; font_t *font;
/** Respect resize hints */
bool resize_hints;
struct struct
{ {
/** Command to execute when spawning a new client */ /** Command to execute when spawning a new client */