Skip to content

Commit 66ec890

Browse files
authored
Merge branch 'awesomeWM:master' into FeZoli-patch-1
2 parents d42d7de + 375d9d7 commit 66ec890

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

lib/awful/menu.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ menu.menu_keys = { up = { "Up", "k" },
108108
down = { "Down", "j" },
109109
back = { "Left", "h" },
110110
exec = { "Return" },
111-
enter = { "Right", "l" },
111+
enter = { "Right", "l", "KP_Enter" },
112112
close = { "Escape" } }
113113

114114

lib/gears/string.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function gstring.query_to_pattern(q)
8787
return s
8888
end
8989

90+
9091
--- Split separates a string containing a delimiter into the list of
9192
-- substrings between that delimiter.
9293
-- @tparam string str String to be splitted
@@ -110,6 +111,33 @@ function gstring.split(str, delimiter)
110111
return result
111112
end
112113

114+
115+
--- Pattern split separates a string by a pattern to the table of substrings.
116+
-- @tparam string str String to be splitted
117+
-- @tparam string[opt="\n"] pattern Pattern the target string will
118+
-- be splitted by.
119+
-- @treturn table A list of substrings.
120+
-- @staticfct gears.string.split
121+
function gstring.psplit(str, pattern)
122+
pattern = pattern or "\n"
123+
local result = {}
124+
if #pattern == 0 then
125+
for index = 1, #str do
126+
result[#result+1] = str:sub(index, index)
127+
end
128+
return result
129+
end
130+
local pos = 1
131+
for match in str:gmatch(pattern) do
132+
local start_pos, end_pos = str:find(match, pos, true)
133+
result[#result+1] = str:sub(pos, start_pos-1)
134+
pos = end_pos+1
135+
end
136+
result[#result+1] = str:sub(pos, #str)
137+
return result
138+
end
139+
140+
113141
--- Check if a string starts with another string.
114142
-- @DOC_text_gears_string_startswith_EXAMPLE@
115143
-- @tparam string str String to search

lib/naughty/dbus.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ local function sendNotificationClosed(notificationId, reason)
6969
if reason <= 0 then
7070
reason = cst.notification_closed_reason.undefined
7171
end
72+
if reason == cst.notification_closed_reason.dismissed_by_user then
73+
sendActionInvoked(notificationId, "default")
74+
end
7275
if bus_connection then
7376
bus_connection:emit_signal(nil, "/org/freedesktop/Notifications",
7477
"org.freedesktop.Notifications", "NotificationClosed",

objects/drawable.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ drawable_set_geometry(lua_State *L, int didx, area_t geom)
141141
area_t old = d->geometry;
142142
d->geometry = geom;
143143

144-
bool size_changed = (old.width != geom.width) || (old.height != geom.height);
145-
if (size_changed)
144+
bool area_changed = !AREA_EQUAL(old, geom);
145+
if (area_changed)
146146
drawable_unset_surface(d);
147-
if (size_changed && geom.width > 0 && geom.height > 0)
147+
if (area_changed && geom.width > 0 && geom.height > 0)
148148
{
149149
d->pixmap = xcb_generate_id(globalconf.connection);
150150
xcb_create_pixmap(globalconf.connection, globalconf.default_depth, d->pixmap,
@@ -155,7 +155,7 @@ drawable_set_geometry(lua_State *L, int didx, area_t geom)
155155
luaA_object_emit_signal(L, didx, "property::surface", 0);
156156
}
157157

158-
if (!AREA_EQUAL(old, geom))
158+
if (area_changed)
159159
luaA_object_emit_signal(L, didx, "property::geometry", 0);
160160
if (old.x != geom.x)
161161
luaA_object_emit_signal(L, didx, "property::x", 0);

spec/gears/string_spec.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ describe("gears.string", function()
5757
assert.is_same(gstring.split("foo.", "."), {"foo", ""})
5858
assert.is_same(gstring.split("foo.bar", "."), {"foo", "bar"})
5959
end)
60+
61+
describe("psplit", function()
62+
assert.is_same(gstring.psplit("", ""), {})
63+
assert.is_same(gstring.psplit(".", ""), {"."})
64+
assert.is_same(gstring.psplit("foo", ""), {"f", "o", "o"})
65+
assert.is_same(gstring.psplit("foo.", ""), {"f", "o", "o", "."})
66+
assert.is_same(gstring.psplit("foo.bar", "%."), {"foo", "bar"})
67+
68+
assert.is_same(gstring.psplit("", "."), {""})
69+
assert.is_same(gstring.psplit("a", "."), {"", ""})
70+
assert.is_same(gstring.psplit("foo", "."), {"", "", "", ""})
71+
assert.is_same(gstring.psplit("foo.", "%W"), {"foo", ""})
72+
assert.is_same(gstring.psplit(".foo.2.5.bar.73", "%.%d"), {".foo", "", ".bar", "3"})
73+
end)
6074
end)
6175

6276
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

0 commit comments

Comments
 (0)