Merge pull request #3478 from Elv13/better_shims
Fix a few sequences template bugs
This commit is contained in:
commit
d5fae3f3dc
|
@ -74,6 +74,8 @@ This document was last updated at commit v4.3-197-g9085ed631.
|
|||
* Setting `awful.rules.rules` now append the rules to the existing set.
|
||||
Clearing the rules was never officially supported. If you *really* want the
|
||||
old behavior, use `awful.rules.rules = {}; awful.rules.rules = my_new_rules`.
|
||||
* `client:relative_move()` now default `nil` values to zero. The previous
|
||||
behavior made no sense.
|
||||
|
||||
<a name="v43"></a>
|
||||
# Awesome window manager framework version 4.3 changes
|
||||
|
|
|
@ -523,16 +523,16 @@ end
|
|||
--
|
||||
-- @method relative_move
|
||||
-- @see geometry
|
||||
-- @tparam[opt=c.x] number x The relative x coordinate.
|
||||
-- @tparam[opt=c.y] number y The relative y coordinate.
|
||||
-- @tparam[opt=c.width] number w The relative width.
|
||||
-- @tparam[opt=c.height] number h The relative height.
|
||||
-- @tparam[opt=0] number x The relative x coordinate.
|
||||
-- @tparam[opt=0] number y The relative y coordinate.
|
||||
-- @tparam[opt=0] number w The relative width.
|
||||
-- @tparam[opt=0] number h The relative height.
|
||||
function client.object.relative_move(self, x, y, w, h)
|
||||
local geometry = self:geometry()
|
||||
geometry['x'] = geometry['x'] + (x or geometry.x)
|
||||
geometry['y'] = geometry['y'] + (y or geometry.y)
|
||||
geometry['width'] = geometry['width'] + (w or geometry.width)
|
||||
geometry['height'] = geometry['height'] + (h or geometry.height)
|
||||
geometry['x'] = geometry['x'] + (x or 0)
|
||||
geometry['y'] = geometry['y'] + (y or 0)
|
||||
geometry['width'] = geometry['width'] + (w or 0)
|
||||
geometry['height'] = geometry['height'] + (h or 0)
|
||||
self:geometry(geometry)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ awful.placement = require("awful.placement")
|
|||
require("awful.ewmh")
|
||||
screen[1]:fake_resize(0, 0, 800, 480)
|
||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile)
|
||||
local original_geo, geo
|
||||
|
||||
function awful.spawn(name)
|
||||
client.gen_fake{class = name, name = name, x = 4, y=10, width = 60, height =50, screen=screen[1]}
|
||||
|
@ -22,6 +23,7 @@ module.add_event("Spawn a floating client.", function()
|
|||
client.get()[1].floating = true
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
--DOC_HIDE_START
|
||||
end)
|
||||
|
||||
|
@ -29,14 +31,25 @@ module.display_tags()
|
|||
|
||||
module.add_event("Move it.", function()
|
||||
--DOC_HIDE_END
|
||||
geo = client.get()[1]:geometry()
|
||||
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
|
||||
original_geo = geo --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
client.get()[1]:relative_move(100, 100)
|
||||
--DOC_NEWLINE
|
||||
|
||||
local geo = client.get()[1]:geometry()
|
||||
geo = client.get()[1]:geometry()
|
||||
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
|
||||
--DOC_NEWLINE
|
||||
|
||||
--DOC_HIDE_START
|
||||
assert(original_geo.width == geo.width)
|
||||
assert(original_geo.height == geo.height)
|
||||
assert(original_geo.x == geo.x - 100)
|
||||
assert(original_geo.y == geo.y - 100)
|
||||
original_geo.x, original_geo.y = geo.x, geo.y
|
||||
end)
|
||||
|
||||
module.display_tags()
|
||||
|
@ -46,10 +59,14 @@ module.add_event("Resize it.", function()
|
|||
client.get()[1]:relative_move(nil, nil, 100, 100)
|
||||
--DOC_NEWLINE
|
||||
|
||||
local geo = client.get()[1]:geometry()
|
||||
geo = client.get()[1]:geometry()
|
||||
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
|
||||
|
||||
--DOC_HIDE_START
|
||||
assert(original_geo.width == geo.width - 100)
|
||||
assert(original_geo.height == geo.height - 100)
|
||||
assert(original_geo.x == geo.x)
|
||||
assert(original_geo.y == geo.y)
|
||||
end)
|
||||
|
||||
module.display_tags()
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
Client geometry: 110 110 120 100
|
||||
Client geometry: 220 220 220 200
|
||||
Client geometry: 4 10 60 50
|
||||
Client geometry: 104 110 60 50
|
||||
Client geometry: 104 110 160 150
|
||||
|
|
|
@ -342,10 +342,11 @@ local function gen_fake_clients(tag, args)
|
|||
if not tag.client_geo then return end
|
||||
|
||||
for _, geom in ipairs(tag.client_geo) do
|
||||
local x = (geom.x*w)/sgeo.width
|
||||
local y = (geom.y*h)/sgeo.height
|
||||
local x = ( (geom.x - sgeo.x) * w)/sgeo.width
|
||||
local y = ( (geom.y - sgeo.y) * h)/sgeo.height
|
||||
local width = (geom.width*w)/sgeo.width
|
||||
local height = (geom.height*h)/sgeo.height
|
||||
|
||||
cr:set_source(color(geom.color or beautiful.bg_normal))
|
||||
cr:rectangle(x,y,width,height)
|
||||
cr:fill_preserve()
|
||||
|
@ -552,7 +553,7 @@ local function gen_screens(l, screens, args)
|
|||
|
||||
local ret = wibox.layout.manual()
|
||||
|
||||
local sreen_copies = {}
|
||||
local screen_copies = {}
|
||||
|
||||
-- Keep a copy because it can change.
|
||||
local rw, rh = root.size()
|
||||
|
@ -571,7 +572,7 @@ local function gen_screens(l, screens, args)
|
|||
scr_cpy[prop] = s[prop]
|
||||
end
|
||||
|
||||
table.insert(sreen_copies, scr_cpy)
|
||||
table.insert(screen_copies, scr_cpy)
|
||||
end
|
||||
|
||||
function ret:fit()
|
||||
|
@ -581,7 +582,7 @@ local function gen_screens(l, screens, args)
|
|||
end
|
||||
|
||||
-- Add the rulers.
|
||||
for _, s in ipairs(sreen_copies) do
|
||||
for _, s in ipairs(screen_copies) do
|
||||
ret:add_at(
|
||||
gen_ruler("vertical" , 1/screen_scale_factor, margins),
|
||||
{x=margins.left+s.x/screen_scale_factor, y =margins.top/2}
|
||||
|
@ -601,21 +602,28 @@ local function gen_screens(l, screens, args)
|
|||
end
|
||||
|
||||
-- Print an outline for the screens
|
||||
for k, s in ipairs(sreen_copies) do
|
||||
for k, s in ipairs(screen_copies) do
|
||||
s.widget = wibox.widget.base.make_widget()
|
||||
|
||||
local wb = gen_fake_taglist_wibar(screens[k].tags)
|
||||
wb.forced_width = s.width/screen_scale_factor
|
||||
|
||||
-- The clients have an absolute geometry, transform to relative.
|
||||
if screens[k].tags[1] then
|
||||
for _, geo in ipairs(screens[k].tags[1].client_geo) do
|
||||
geo.x = geo.x - s.x
|
||||
geo.y = geo.y - s.y
|
||||
local sel = nil
|
||||
|
||||
-- AwesomeWM always use the layout from the first selected tag.
|
||||
for _, t in ipairs(screens[k].tags) do
|
||||
if t.selected then
|
||||
sel = t
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local clients_w = gen_fake_clients(screens[k].tags[1], args)
|
||||
-- Fallback because some older examples don't select tags.
|
||||
if not sel then
|
||||
sel = screens[k].tags[1]
|
||||
end
|
||||
|
||||
local clients_w = gen_fake_clients(sel, args)
|
||||
|
||||
local content = wibox.widget {
|
||||
wb,
|
||||
|
@ -642,9 +650,9 @@ local function gen_screens(l, screens, args)
|
|||
end
|
||||
|
||||
function s.widget:after_draw_children(_, cr)
|
||||
if args.display_mouse and mouse.screen.index == s.index then
|
||||
local rel_x = mouse.coords().x - s.x
|
||||
local rel_y = mouse.coords().y - s.y
|
||||
if args.display_mouse and screens[k].cursor_screen == s.index then
|
||||
local rel_x = screens[k].cursor_position.x - s.x
|
||||
local rel_y = screens[k].cursor_position.y - s.y
|
||||
draw_mouse(cr, rel_x/screen_scale_factor+5, rel_y/screen_scale_factor+5)
|
||||
end
|
||||
end
|
||||
|
@ -699,6 +707,12 @@ local function gen_timeline(args)
|
|||
|
||||
l:add(gen_label("Begin"))
|
||||
|
||||
-- Run the some steps of the Initialization.
|
||||
client.emit_signal("scanning")
|
||||
|
||||
-- Finish the initialization.
|
||||
awesome.startup = false --luacheck: ignore
|
||||
|
||||
for _, event in ipairs(history) do
|
||||
local ret = event.callback()
|
||||
if event.event == "event" then
|
||||
|
@ -791,7 +805,11 @@ function module.display_tags()
|
|||
})
|
||||
assert(#st[#st].client_geo == #get_all_tag_clients(t))
|
||||
end
|
||||
table.insert(ret, {tags=st})
|
||||
table.insert(ret, {
|
||||
tags = st,
|
||||
cursor_screen = mouse.screen.index,
|
||||
cursor_position = gtable.clone(mouse.coords())
|
||||
})
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
|
|
@ -5,6 +5,8 @@ local clients = {}
|
|||
|
||||
local client, meta = awesome._shim_fake_class()
|
||||
|
||||
rawset(client, "_autotags", true)
|
||||
|
||||
-- Keep an history of the geometry for validation and images
|
||||
local function push_geometry(c)
|
||||
table.insert(c._old_geo, c:geometry())
|
||||
|
@ -227,15 +229,18 @@ function client.gen_fake(args)
|
|||
function ret:tags(new) --FIXME
|
||||
if new then
|
||||
ret._tags = new
|
||||
ret:emit_signal("property::tags")
|
||||
end
|
||||
|
||||
if ret._tags then
|
||||
return ret._tags
|
||||
end
|
||||
|
||||
for _, t in ipairs(root._tags) do
|
||||
if t.screen == ret.screen then
|
||||
return {t}
|
||||
if client._autotags then
|
||||
for _, t in ipairs(root._tags) do
|
||||
if t.screen == ret.screen then
|
||||
return {t}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -330,7 +335,6 @@ function client.gen_fake(args)
|
|||
return meta.__index(self, key)
|
||||
end,
|
||||
__newindex = function(self, key, value)
|
||||
|
||||
if properties["set_"..key] then
|
||||
return properties["set_"..key](self, value)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue