From e5b12877b9f0d2c0abfb9d32b896b2e4ca703e2a Mon Sep 17 00:00:00 2001 From: handsome0hell Date: Sat, 7 Mar 2020 21:08:35 +0800 Subject: [PATCH] use user specified permission. User settings should override default behavior. --- lib/awful/permissions/_common.lua | 8 ++++---- spec/awful/permissions_spec.lua | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/awful/permissions/_common.lua b/lib/awful/permissions/_common.lua index 368c95da..718d9028 100644 --- a/lib/awful/permissions/_common.lua +++ b/lib/awful/permissions/_common.lua @@ -20,10 +20,6 @@ local default_permissions = { } function module.check(object, class, request, context) - if not default_permissions[class] then return true end - if not default_permissions[class][request] then return true end - if default_permissions[class][request][context] == nil then return true end - local ret = nil if object._private.permissions and object._private.permissions[request] then @@ -32,6 +28,10 @@ function module.check(object, class, request, context) if ret ~= nil then return ret end + if not default_permissions[class] then return true end + if not default_permissions[class][request] then return true end + if default_permissions[class][request][context] == nil then return true end + return default_permissions[class][request][context] end diff --git a/spec/awful/permissions_spec.lua b/spec/awful/permissions_spec.lua index f02fde36..c35375cc 100644 --- a/spec/awful/permissions_spec.lua +++ b/spec/awful/permissions_spec.lua @@ -26,7 +26,7 @@ describe("awful.permissions.client_geometry_requests", function() local permissions = require("awful.permissions") it("removes x/y/width/height when immobilized", function() - local c = {} + local c = {_private={}} local s = stub.new(c, "geometry") permissions.client_geometry_requests(c, "ewmh", {})