tests/_client.lua: Improve error with Gtk 2 (#1506)

In Gtk 2, the "first" argument to set_geometry_hints() is not optional.
However, this code does not provide any argument here. Improve the error
message in this case by checking for Gtk 3.

Reference: https://github.com/awesomeWM/awesome/issues/1495
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-02-02 22:30:04 +01:00 committed by Daniel Hahler
parent 5439c34723
commit d494b87fb7
1 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,9 @@ local function open_window(class, title, options)
window:set_startup_id(options.snid) window:set_startup_id(options.snid)
end end
if options.resize_increment then if options.resize_increment then
-- This requires Gtk3, but fails with an obscure message with Gtk2.
-- Produce a better error message instead.
assert(tonumber(require("lgi").Gtk._version) >= 3, "Gtk 3 required, but not found")
local geom = Gdk.Geometry { local geom = Gdk.Geometry {
width_inc = 200, width_inc = 200,
height_inc = 200, height_inc = 200,