1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 10:05:22 +00:00

Add <array> import

Update /doc

Signed-off-by: Tin <tin.svagelj@live.com>
This commit is contained in:
Tin 2023-11-08 04:25:16 +01:00 committed by Brenden Matthews
parent f6a08f79b4
commit e512405492
No known key found for this signature in database
GPG Key ID: 137B7AC2BDFD8DF0
3 changed files with 11 additions and 6 deletions

View File

@ -221,11 +221,10 @@ values:
- name: lua_mouse_hook
desc: |-
This function, if defined, will be called by Conky upon receiving mouse
events from X. Requires X support. A table containing event information
will be passed to this function as the first argument. Use this hook for
detecting mouse input and acting on it. Conky puts 'conky_' in front of
function_name to prevent accidental calls to the wrong function unless
you place 'conky_' in front of it yourself.
events from X or Wayland. A table containing event information will be
passed to this function as the first argument. Use this hook for detecting
mouse input and acting on it. Conky requires that the function declaration
has a 'conky_' prefix to prevent accidental calls to the wrong function.
args:
- function_name
- name: lowercase

View File

@ -66,6 +66,7 @@
#ifdef BUILD_MOUSE_EVENTS
#include "mouse-events.h"
#include <map>
#include <array>
#endif
#pragma GCC diagnostic ignored "-Wunused-parameter"

View File

@ -516,7 +516,12 @@ bool llua_mouse_hook(const EventT &ev) {
return false;
}
const std::string raw_hook_name = lua_mouse_hook.get(*state);
std::string hook_name = "conky_" + raw_hook_name;
std::string hook_name;
if (raw_hook_name.rfind("conky_", 0) == 0) {
hook_name = raw_hook_name;
} else {
hook_name = "conky_" + raw_hook_name;
}
int ty = lua_getglobal(lua_L, hook_name.c_str());
if (ty == LUA_TNIL) {