ConfigDataBindings class. This class is used to handle the bindings configuration it instanciates the bindings in a vector it handle grabbing keys and handle keypress events.
More...
#include <ConfigDataBindings.hpp>
|
| ConfigDataBindings () |
|
| ~ConfigDataBindings () override |
|
void | configInit (const Json::Value &root_) override |
| Parse the Json::Value object to initialize the bindings Instanciate the bindings in a vector. More...
|
|
void | initKeycodes (Display *display, BaseX11Wrapper *x11Wrapper) |
| Initialize the keycodes This method is called by the WindowManager to initialize the keycodes after the display and the x11Wrapper are initialized. More...
|
|
Json::Value | configSave () override |
| Build a Json::Value object with the configuration. More...
|
|
void | grabKeys (Display *display, Window window) |
| Grab the keys from the bindings GrabKeys is called on the root window on initialisation of the WindowManager and then on each new window creation that is managed by the WindowManager. More...
|
|
void | handleKeypressEvent (const XKeyEvent *event) |
| Handle the keypress event This method is called by the EventManager to avoid handling bindings and their interface in the EventHandle class. More...
|
|
const std::vector< Binding * > & | getBindings () const |
|
ConfigDataBindings class. This class is used to handle the bindings configuration it instanciates the bindings in a vector it handle grabbing keys and handle keypress events.
◆ ConfigDataBindings()
ConfigDataBindings::ConfigDataBindings |
( |
| ) |
|
std::vector< Binding * > bindings_
Definition: ConfigDataBindings.hpp:86
◆ ~ConfigDataBindings()
ConfigDataBindings::~ConfigDataBindings |
( |
| ) |
|
|
override |
◆ configInit()
void ConfigDataBindings::configInit |
( |
const Json::Value & |
root_ | ) |
|
|
overridevirtual |
Parse the Json::Value object to initialize the bindings Instanciate the bindings in a vector.
- Parameters
-
root_ | the Json::Value object containing the bindings |
Implements ConfigDataBase.
33 std::vector<std::string> modKeys = root.getMemberNames();
34 for (
auto &modKey : modKeys) {
35 Json::Value bindings = root[modKey];
36 for (
auto &binding : bindings) {
37 std::string key = binding[
"Key"].asString();
38 std::string command = binding[
"Action"].asString();
39 std::string arg = binding[
"Argument"].asString();
41 b->init(modKey, key, command, arg);
@ L_INFO
Definition: Logger.hpp:49
Binding store a binding to a command object.
Definition: Binding.hpp:39
virtual void Log(const std::string &message, LogLevel level) const
Log a message This method logs a message to the log file or stream. The message is only logged if the...
Definition: Logger.cpp:73
static Logger * GetInstance()
Get the Logger object.
Definition: Logger.cpp:41
References bindings_, Logger::GetInstance(), L_INFO, and Logger::Log().
◆ configSave()
Json::Value ConfigDataBindings::configSave |
( |
| ) |
|
|
overridevirtual |
Build a Json::Value object with the configuration.
- Returns
- Json::Value Object with the current runtime configuration
Implements ConfigDataBase.
◆ getBindings()
const std::vector< Binding * > & ConfigDataBindings::getBindings |
( |
| ) |
const |
◆ grabKeys()
void ConfigDataBindings::grabKeys |
( |
Display * |
display, |
|
|
Window |
window |
|
) |
| |
Grab the keys from the bindings GrabKeys is called on the root window on initialisation of the WindowManager and then on each new window creation that is managed by the WindowManager.
- Parameters
-
58 XGrabKey(display, binding->getKeyCode(), binding->getModMask(), window,
true, GrabModeAsync, GrabModeAsync);
References bindings_.
◆ handleKeypressEvent()
void ConfigDataBindings::handleKeypressEvent |
( |
const XKeyEvent * |
event | ) |
|
Handle the keypress event This method is called by the EventManager to avoid handling bindings and their interface in the EventHandle class.
- Parameters
-
event | must be converted to const XKeyEvent *event |
64 unsigned int keyCode =
event->keycode;
67 modOk =
event->state & binding->getModMask();
68 if (binding->getKeyCode() == keyCode && modOk) {
69 if (binding->getCommandName() ==
"Grow") {
70 binding->execute(event);
72 binding->execute(
nullptr);
79 + binding->getCommandName()
References bindings_, Logger::GetInstance(), L_INFO, and Logger::Log().
◆ initKeycodes()
void ConfigDataBindings::initKeycodes |
( |
Display * |
display, |
|
|
BaseX11Wrapper * |
x11Wrapper |
|
) |
| |
Initialize the keycodes This method is called by the WindowManager to initialize the keycodes after the display and the x11Wrapper are initialized.
- Parameters
-
89 binding->init_keycode(display,x11Wrapper);
References bindings_.
◆ bindings_
std::vector<Binding *> ConfigDataBindings::bindings_ |
|
private |
The documentation for this class was generated from the following files: