Merge branch 'struts' of https://github.com/psychon/awesome
This commit is contained in:
commit
6c3ac979a4
|
@ -1797,6 +1797,8 @@ client_set_sticky(lua_State *L, int cidx, bool s)
|
||||||
{
|
{
|
||||||
c->sticky = s;
|
c->sticky = s;
|
||||||
banning_need_update();
|
banning_need_update();
|
||||||
|
if(strut_has_value(&c->strut))
|
||||||
|
screen_update_workarea(c->screen);
|
||||||
luaA_object_emit_signal(L, cidx, "property::sticky", 0);
|
luaA_object_emit_signal(L, cidx, "property::sticky", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
#include "screen.h"
|
||||||
#include "banning.h"
|
#include "banning.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "ewmh.h"
|
#include "ewmh.h"
|
||||||
|
@ -277,6 +278,8 @@ tag_view(lua_State *L, int udx, bool view)
|
||||||
{
|
{
|
||||||
tag->selected = view;
|
tag->selected = view;
|
||||||
banning_need_update();
|
banning_need_update();
|
||||||
|
foreach(screen, globalconf.screens)
|
||||||
|
screen_update_workarea(*screen);
|
||||||
|
|
||||||
luaA_object_emit_signal(L, udx, "property::selected", 0);
|
luaA_object_emit_signal(L, udx, "property::selected", 0);
|
||||||
}
|
}
|
||||||
|
@ -318,6 +321,7 @@ tag_client(lua_State *L, client_t *c)
|
||||||
client_array_append(&t->clients, c);
|
client_array_append(&t->clients, c);
|
||||||
ewmh_client_update_desktop(c);
|
ewmh_client_update_desktop(c);
|
||||||
banning_need_update();
|
banning_need_update();
|
||||||
|
screen_update_workarea(c->screen);
|
||||||
|
|
||||||
tag_client_emit_signal(t, c, "tagged");
|
tag_client_emit_signal(t, c, "tagged");
|
||||||
}
|
}
|
||||||
|
@ -336,6 +340,7 @@ untag_client(client_t *c, tag_t *t)
|
||||||
client_array_take(&t->clients, i);
|
client_array_take(&t->clients, i);
|
||||||
banning_need_update();
|
banning_need_update();
|
||||||
ewmh_client_update_desktop(c);
|
ewmh_client_update_desktop(c);
|
||||||
|
screen_update_workarea(c->screen);
|
||||||
tag_client_emit_signal(t, c, "untagged");
|
tag_client_emit_signal(t, c, "untagged");
|
||||||
luaA_object_unref(L, t);
|
luaA_object_unref(L, t);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local placement = require("awful.placement")
|
local placement = require("awful.placement")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local wibar = require("awful.wibar")
|
local wibar = require("awful.wibar")
|
||||||
|
local test_client = require("_client")
|
||||||
|
|
||||||
local steps = {}
|
local steps = {}
|
||||||
|
|
||||||
|
@ -317,5 +318,78 @@ check_maximize()
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Now test again with a real client
|
||||||
|
|
||||||
|
local c
|
||||||
|
table.insert(steps, function()
|
||||||
|
-- I'm lazy, so get rid of all the wiboxes that have struts
|
||||||
|
parent.visible = false
|
||||||
|
small.visible = false
|
||||||
|
bwibar.visible = false
|
||||||
|
lwibar.visible = false
|
||||||
|
rwibar.visible = false
|
||||||
|
screen.primary.mywibox.visible = false
|
||||||
|
|
||||||
|
-- Spawn a client to test things with
|
||||||
|
assert(#client.get() == 0)
|
||||||
|
test_client()
|
||||||
|
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Given a geometry and a workarea, test that the given struts are applied
|
||||||
|
local function test_workarea(geo, wa, left, right, top, bottom)
|
||||||
|
-- Get the line number from where we were called (helps debugging)
|
||||||
|
local line = debug.getinfo(2).currentline
|
||||||
|
|
||||||
|
assert(geo.x + left == wa.x,
|
||||||
|
string.format("%d + %d == %d called from line %d", geo.x, left, wa.x, line))
|
||||||
|
assert(geo.y + top == wa.y,
|
||||||
|
string.format("%d + %d == %d called from line %d", geo.y, top, wa.y, line))
|
||||||
|
assert(geo.width - left - right == wa.width,
|
||||||
|
string.format("%d - %d - %d == %d called from line %d", geo.width, left, right, wa.width, line))
|
||||||
|
assert(geo.height - top - bottom == wa.height,
|
||||||
|
string.format("%d - %d - %d == %d called from line %d", geo.height, top, bottom, wa.height, line))
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(steps, function()
|
||||||
|
if #client.get() ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
c = client.get()[1]
|
||||||
|
assert(c)
|
||||||
|
assert(c:isvisible())
|
||||||
|
|
||||||
|
-- Test some simple struts
|
||||||
|
c:struts { left = 50 }
|
||||||
|
test_workarea(c.screen.geometry, c.screen.workarea, 50, 0, 0, 0)
|
||||||
|
|
||||||
|
-- A tag switch should make the client no longer apply
|
||||||
|
screen.primary.tags[2]:view_only()
|
||||||
|
test_workarea(c.screen.geometry, c.screen.workarea, 0, 0, 0, 0)
|
||||||
|
|
||||||
|
-- But sticky clients always 'count'
|
||||||
|
c.sticky = true
|
||||||
|
test_workarea(c.screen.geometry, c.screen.workarea, 50, 0, 0, 0)
|
||||||
|
|
||||||
|
c.sticky = false
|
||||||
|
test_workarea(c.screen.geometry, c.screen.workarea, 0, 0, 0, 0)
|
||||||
|
|
||||||
|
-- And switch back to the right tag
|
||||||
|
c.first_tag:view_only()
|
||||||
|
test_workarea(c.screen.geometry, c.screen.workarea, 50, 0, 0, 0)
|
||||||
|
|
||||||
|
-- What if we move the client to another tag?
|
||||||
|
c:tags{ screen.primary.tags[2] }
|
||||||
|
test_workarea(c.screen.geometry, c.screen.workarea, 0, 0, 0, 0)
|
||||||
|
|
||||||
|
-- Move it back to the selected tag
|
||||||
|
c:tags{ screen.primary.tags[1] }
|
||||||
|
test_workarea(c.screen.geometry, c.screen.workarea, 50, 0, 0, 0)
|
||||||
|
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
require("_runner").run_steps(steps)
|
require("_runner").run_steps(steps)
|
||||||
|
|
Loading…
Reference in New Issue