Skip to content

Commit

Permalink
Merge pull request #3879 from Elv13/2023_xmas_commits_pr1
Browse files Browse the repository at this point in the history
Fix the documentation warnings
  • Loading branch information
Elv13 committed Jan 21, 2024
2 parents 7707618 + b5a5f7c commit e6f5c79
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 31 deletions.
26 changes: 12 additions & 14 deletions docs/config.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,13 @@ local summarize = {
readonly = {index = 8, title = "read only" , count = false},
}

local no_prefix = {
property = true,
signal = true,
clientruleproperty = true,
deprecatedproperty = true,
}

local delimiter_for_tag = {
usebeautiful = { "table class='widget_list' border=1", "table", "tr", "tr", {"Theme variable", "Usage"}},
propbeautiful = { "table class='widget_list' border=1", "table", "tr", "tr", {"Theme variable", "Usage"}},
Expand Down Expand Up @@ -2126,7 +2133,11 @@ local function global_init(_ldoc)
-- Decorate the item with our customizations.
init_custom_types(item)

-- print(item.description)
-- Remove the "namespace" from the signals and properties
if no_prefix[item.type] then
local name = item.name:match("%.([^.]+)$")
item.name = name ~= "" and name or item.name
end

if item.summary and not detect_markdown_footguns(item.summary) then
print(
Expand Down Expand Up @@ -2247,13 +2258,6 @@ local function compare_module_name(input, module)
return false
end

local no_prefix = {
property = true,
signal = true,
clientruleproperty = true,
deprecatedproperty = true,
}

-- These modules merge the doc of their `awful` siblings.
local coreclassmap = {
tag = "tag<span class='listplusign'> and awful.tag</span>",
Expand Down Expand Up @@ -2366,12 +2370,6 @@ custom_display_name_handler = function(item, default_handler)
item:build_return_groups()
end

-- Remove the "namespace" from the signals and properties
if no_prefix[item.type] then
local name = item.name:match("%.([^.]+)$")
return name ~= "" and name or item.name
end

-- Handle the left sidebar modules.
if item.type == "coreclassmod" and coreclassmap[item.name] then
return coreclassmap[item.name]
Expand Down
7 changes: 4 additions & 3 deletions lib/awful/screenshot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,15 @@ end
-- @tparam[opt=nil] screen|nil screen
-- @propemits true false
-- @see mouse.screen
-- @see awful.screen.focused
-- @see screen.focused
-- @see screen.primary

--- Get screenshot client.
--
-- @property client
-- @tparam[opt=nil] client|nil client
-- @tparam[opt=nil] client|nil client The client.
-- @propemits true false
-- @see mouse.client
-- @see mouse.current_client
-- @see client.focus

--- Get screenshot geometry.
Expand Down Expand Up @@ -891,6 +891,7 @@ end
-- @method reject
-- @tparam[opt=nil] string||nil reason The reason why it was rejected. This is
-- passed to the `"snipping::cancelled"` signal.
-- @noreturn
-- @emits snipping::cancelled

function module:reject(reason)
Expand Down
1 change: 1 addition & 0 deletions lib/gears/shape.lua
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ end
-- @tparam number height The shape height
-- @tparam[opt=5] number x_offset The shadow area horizontal offset.
-- @tparam[opt=5] number y_offset The shadow area vertical offset.
-- @noreturn
function module.solid_rectangle_shadow(cr, w, h, x_offset, y_offset)
x_offset, y_offset = x_offset or 5, y_offset or 5
w, h = w - math.abs(x_offset), h - math.abs(y_offset)
Expand Down
1 change: 1 addition & 0 deletions tests/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ${TOP_SOURCE_DIR}/lib/?/init.lua\\;\
${TOP_SOURCE_DIR}/lib/?\\;\
${TOP_SOURCE_DIR}/themes/?.lua\\;\
${TOP_SOURCE_DIR}/themes/?\\;\
${TOP_SOURCE_DIR}/tests/examples/?.lua\\;\
${LUA_PATH_}")

# Add the C API shims.
Expand Down
1 change: 0 additions & 1 deletion tests/examples/sequences/client/jump_to_urgent1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local beautiful = require("beautiful")
require("awful.ewmh")
screen[1]._resize {x = 0, width = 160, height = 90}
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile)
beautiful.bg_urgent = "#ff0000"

function awful.spawn(name, properties)
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, tags = properties.tags}
Expand Down
2 changes: 2 additions & 0 deletions tests/examples/shims/beautiful.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ local module = {
bg_normal = "#6181FF7D",
bg_focus = "#AA00FF7D",
bg_highlight = "#AA00FF7D",
bg_urgent = "#FF00377D",
fg_urgent = "#FFFFFFFF",
border_color = "#6181FF" ,
border_width = 1.5 ,

Expand Down
86 changes: 73 additions & 13 deletions tests/examples/shims/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,64 @@ local client, meta = awesome._shim_fake_class()

rawset(client, "_autotags", true)

-- Make sure `awful.client` properties like `floating` get handled by the
-- miss handler rather than set directly on the object. The reason it's done
-- than way is ancient and convoluted.
local native_property_defaults = {
-- Layers.
ontop = false,
below = false,
above = false,
sticky = false,
urgent = false,
modal = false,
focusable = true,
hidden = false,

-- Other properties.
name = "",
transient_for = nil,
skip_taskbar = false,
type = "normal",
class = "",
instance = "",
role = "",
pid = 1,
leader_window = nil,
machine = "",
icon_name = "",
screen = nil,
minimized = false,
motif_wm_hints = {},
group_window = nil,
icon = nil,
icon_sizes = {},
size_hints_honor = true,
size_hints = {},
startup_id = nil,
valid = true,

-- The shims can't really handle those properly.
shape_bounding = nil,
content = nil,
shape_clip = nil,
shape_input = nil,
client_shape_bounding = nil,
client_shape_clip = nil,

-- Those have special code.
maximized = nil,
fullscreen = nil,
maximized_horizontal = nil,
maximized_vertical = nil,

-- Those are not really native, but it simplify the shims a lot.
x = 0,
y = 0,
width = 1,
height = 1,
}

-- Keep an history of the geometry for validation and images
local function push_geometry(c)
table.insert(c._old_geo, c:geometry())
Expand Down Expand Up @@ -76,9 +134,9 @@ function client.gen_fake(args)
awesome._forward_class(ret, client)

ret._private = {}
ret.type = "normal"
ret.valid = true
ret.size_hints = {}
ret.type = native_property_defaults.type
ret.valid = native_property_defaults.valid
ret.size_hints = native_property_defaults.size_hints
ret._border_width = 1
ret._tags = args and args.tags or nil
ret.icon_sizes = {{16,16}}
Expand All @@ -95,9 +153,11 @@ function client.gen_fake(args)
-- be `nil`.
ret.transient_for = false

-- Apply all properties
-- Apply the native (capi) properties.
for k,v in pairs(args or {}) do
ret[k] = v
if native_property_defaults[k] then
ret[k] = v
end
end

-- Tests should always set a geometry, but just in case
Expand Down Expand Up @@ -295,14 +355,7 @@ function client.gen_fake(args)
ret.drawable = ret

-- Make sure the layer properties are not `nil`
local defaults = {
ontop = false,
below = false,
above = false,
sticky = false,
urgent = false,
focusable = true,
}
local defaults = setmetatable({}, {__index = native_property_defaults})

-- Declare the deprecated buttons and keys methods.
function ret:_keys(new)
Expand Down Expand Up @@ -352,6 +405,13 @@ function client.gen_fake(args)
end
})

-- Apply non-native (`awful.client`) properties.
for k,v in pairs(args or {}) do
if (not native_property_defaults[k]) and (not rawget(ret, k)) then
ret[k] = v
end
end

client.emit_signal("request::manage", ret)

--TODO v6 remove this.
Expand Down

0 comments on commit e6f5c79

Please sign in to comment.