Merge pull request #2478 from sigprof/fix-motif-hints

Fix c.requests_no_titlebar
This commit is contained in:
mergify[bot] 2018-11-12 16:37:19 +00:00 committed by GitHub
commit 563b7a47b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 4 deletions

View File

@ -221,7 +221,7 @@ sections.DOC_TITLEBARS = [[
sections.DOC_CSD_TITLEBARS = [[
For client side decorations, clients might request no titlebars via
Motif WM hints. To honor these hints, use:
`titlebars_enabled = function(c) return c.requests_no_titlebar end`
`titlebars_enabled = function(c) return not c.requests_no_titlebar end`
See `client.requests_no_titlebar` for more details.
]]

View File

@ -1144,7 +1144,7 @@ function client.object.get_requests_no_titlebar(c)
local hints = c.motif_wm_hints
if not hints then return false end
local decor = hints.deocrations
local decor = hints.decorations
if not decor then return false end
local result = not decor.title

View File

@ -3,10 +3,11 @@ local titlebar = require("awful.titlebar")
local rules = require("awful.rules")
local spawn = require("awful.spawn")
local tiny_client = {"lua", "-e", [[
local tiny_client_code_template = [[
local Gtk, class = require('lgi').require('Gtk'), 'client'
Gtk.init()
window = Gtk.Window {default_width=100, default_height=100, title='title'}
%s
window:set_wmclass(class, class)
local app = Gtk.Application {}
function app:on_activate()
@ -14,7 +15,13 @@ function app:on_activate()
window:show_all()
end
app:run {''}
]]}
]]
local tiny_client = {"lua", "-e", string.format(tiny_client_code_template, "")}
local tiny_client_undecorated = {"lua", "-e",
string.format(tiny_client_code_template, [[
window.decorated = false
]])
}
-- Use the test client props
rules.rules = {}
@ -85,6 +92,67 @@ local steps = {
c:kill()
return true
end,
function()
if #client.get() ~= 0 then return end
spawn(tiny_client_undecorated, {titlebars_enabled=true})
return true
end,
function()
if #client.get() ~= 1 then return end
local c = client.get()[1]
assert(c.width == 100 and c.height > 100)
assert(c._request_titlebars_called)
c:kill()
return true
end,
function()
if #client.get() ~= 0 then return end
spawn(tiny_client, {titlebars_enabled=function(c)
return not c.requests_no_titlebar
end})
return true
end,
function()
if #client.get() ~= 1 then return end
local c = client.get()[1]
assert(c.width == 100 and c.height > 100)
assert(c._request_titlebars_called)
c:kill()
return true
end,
function()
if #client.get() ~= 0 then return end
spawn(tiny_client_undecorated, {titlebars_enabled=function(c)
return not c.requests_no_titlebar
end})
return true
end,
function()
if #client.get() ~= 1 then return end
local c = client.get()[1]
assert(not c._request_titlebars_called)
assert(c.width == 100 and c.height == 100)
c:kill()
return true
end,
}