Skip to content

Commit

Permalink
Add <array> import
Browse files Browse the repository at this point in the history
Update /doc

Signed-off-by: Tin <[email protected]>
  • Loading branch information
Caellian committed Nov 8, 2023
1 parent e595547 commit cc9e2a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 4 additions & 5 deletions doc/config_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/display-wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#ifdef BUILD_MOUSE_EVENTS
#include "mouse-events.h"
#include <map>
#include <array>
#endif

#pragma GCC diagnostic ignored "-Wunused-parameter"
Expand Down
7 changes: 6 additions & 1 deletion src/llua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cc9e2a7

Please sign in to comment.