YggdrasilWM
0.1.1
A tiny window manager coded in C++
|
EventHandler class. This class is responsible for handling the XEvents. It is a part of the WindowManager class The event handlers functions are private and are called by the dispatchEvent function. More...
#include <EventHandler.hpp>
Public Member Functions | |
EventHandler (const EventHandler &)=delete | |
EventHandler & | operator= (const EventHandler &)=delete |
~EventHandler () | |
Destroy the Event handler:: Event handler object. More... | |
void | dispatchEvent (const XEvent &event) |
Dispatches the event to the appropriate handler function. the eventHandlerArray is an array of pointers to member functions of the EventHandler class. The array is initialized with the handleUnknown function. The array is then populated with the appropriate handler functions. More... | |
Static Public Member Functions | |
static void | create () |
create the Event handler:: Event handler object More... | |
static EventHandler * | getInstance () |
Get the Event handler:: Event handler object. More... | |
static void | destroy () |
Private Types | |
using | handler = void(EventHandler::*)(const XEvent &) |
Private Member Functions | |
EventHandler () | |
void | handleMapNotify (const XEvent &event) |
Handles the MapNotify event. The MapNotify event is sent to a client when it is mapped. The event handler retrieves the client from the WindowManager object and sets its mapped attribute to true. The event handler then logs the event. the client is restacked. More... | |
void | handleUnmapNotify (const XEvent &event) |
Handles the UnmapNotify event. The UnmapNotify event is sent to a client when it is unmapped. The event handler retrieves the client from the WindowManager object and sets its mapped attribute to false. The event handler then logs the event. More... | |
void | handleConfigureRequest (const XEvent &event) |
Handles the ConfigureRequest event. The ConfigureRequest event is sent to a client when it requests a change in its size, position, or stacking order. More... | |
void | handleConfigureNotify (const XEvent &event) |
Handles the ConfigureNotify event. More... | |
void | handleButtonPress (const XEvent &event) |
Handles the ButtonPress event. The ButtonPress event is sent to a client when a mouse button is pressed. More... | |
void | handleButtonRelease (const XEvent &event) |
Handles the ButtonRelease event. More... | |
void | handleKeyPress (const XEvent &event) |
Handles the KeyPress event. the handling of KeyPress event is delegated to the ConfigDataBindings object to avoid dependencies to the Binding class and the Command class. More... | |
void | handleKeyRelease (const XEvent &event) |
Handles the KeyRelease event. More... | |
void | handleEnterNotify (const XEvent &event) |
Handles the EnterNotify event. More... | |
void | handleLeaveNotify (const XEvent &event) |
Handles the LeaveNotify event. More... | |
void | handleExpose (const XEvent &event) |
This where the bar is drawn, other windows are ignored. More... | |
void | handleFocusIn (const XEvent &event) |
Handles the FocusIn event. Changes the border color of the client. More... | |
void | handleFocusOut (const XEvent &event) |
Handles the FocusOut event. Changes the border color of the client. More... | |
void | handlePropertyNotify (const XEvent &event) |
Handles the PropertyNotify event. More... | |
void | handleClientMessage (const XEvent &event) |
Handles the ClientMessage event. More... | |
void | handleDestroyNotify (const XEvent &event) |
Handles the DestroyNotify event. More... | |
void | handleReparentNotify (const XEvent &event) |
Handles the ReparentNotify event. More... | |
void | handleMapRequest (const XEvent &event) |
Handles the MapRequest event. The MapRequest event is sent to a client when it is mapped. The event handler retrieves the client from the WindowManager object and sets its mapped attribute to true. The event handler then logs the event. More... | |
void | handleMotionNotify (const XEvent &event) |
Handles the MotionNotify event. this was previously used for dragging windows.r. More... | |
void | handleUnknown (const XEvent &event) |
Handles the Unknown event. More... | |
void | handleCreateNotify (const XEvent &event) |
Handles the CreateNotify event. More... | |
Private Attributes | |
handler | eventHandlerArray [LASTEvent] {} |
std::shared_ptr< BaseX11Wrapper > | wrapper |
Static Private Attributes | |
static EventHandler * | instance_ = nullptr |
EventHandler class. This class is responsible for handling the XEvents. It is a part of the WindowManager class The event handlers functions are private and are called by the dispatchEvent function.
|
private |
|
delete |
|
default |
Destroy the Event handler:: Event handler object.
|
private |
References eventHandlerArray, WindowManager::getInstance(), WindowManager::getX11Wrapper(), handleButtonPress(), handleButtonRelease(), handleClientMessage(), handleConfigureNotify(), handleConfigureRequest(), handleDestroyNotify(), handleEnterNotify(), handleExpose(), handleFocusIn(), handleFocusOut(), handleKeyPress(), handleKeyRelease(), handleLeaveNotify(), handleMapNotify(), handleMapRequest(), handleMotionNotify(), handlePropertyNotify(), handleReparentNotify(), handleUnknown(), handleUnmapNotify(), and wrapper.
Referenced by create().
|
static |
create the Event handler:: Event handler object
References EventHandler(), and instance_.
Referenced by WindowManager::Run(), and WindowManager::testRun().
|
static |
void EventHandler::dispatchEvent | ( | const XEvent & | event | ) |
Dispatches the event to the appropriate handler function. the eventHandlerArray is an array of pointers to member functions of the EventHandler class. The array is initialized with the handleUnknown function. The array is then populated with the appropriate handler functions.
event | The XEvent to be dispatched. |
References eventHandlerArray, GetEventTypeName(), Logger::GetInstance(), L_WARNING, and Logger::Log().
Referenced by WindowManager::Run(), and WindowManager::testRun().
|
static |
Get the Event handler:: Event handler object.
References instance_.
Referenced by WindowManager::Run(), and WindowManager::testRun().
|
private |
Handles the ButtonPress event. The ButtonPress event is sent to a client when a mouse button is pressed.
event | The ButtonPress event to be handled. |
References WindowManager::getClient(), Bars::getInstance(), Logger::GetInstance(), WindowManager::getInstance(), L_INFO, Logger::Log(), and wrapper.
Referenced by EventHandler().
|
private |
Handles the ButtonRelease event.
event |
Referenced by EventHandler().
|
private |
Handles the ClientMessage event.
event |
References WindowManager::getDisplay(), WindowManager::getInstance(), WindowManager::getRoot(), and ewmh::handleMessage().
Referenced by EventHandler().
|
private |
Handles the ConfigureNotify event.
event |
Referenced by EventHandler().
|
private |
Handles the ConfigureRequest event. The ConfigureRequest event is sent to a client when it requests a change in its size, position, or stacking order.
event |
References WindowManager::getInstance(), and wrapper.
Referenced by EventHandler().
|
private |
|
private |
Handles the DestroyNotify event.
event |
References WindowManager::getActiveGroup(), WindowManager::getClientRef(), WindowManager::getClients(), Bars::getInstance(), Logger::GetInstance(), WindowManager::getInstance(), WindowManager::getRoot(), L_INFO, L_WARNING, Logger::Log(), WindowManager::setFocus(), and wrapper.
Referenced by EventHandler().
|
private |
Handles the EnterNotify event.
event |
References Bars::getInstance(), and Bars::redraw().
Referenced by EventHandler().
|
private |
This where the bar is drawn, other windows are ignored.
References Bars::getInstance(), and Bars::redraw().
Referenced by EventHandler().
|
private |
Handles the FocusIn event. Changes the border color of the client.
event |
References WindowManager::getClient(), Client::getFrame(), Client::getGroup(), Logger::GetInstance(), WindowManager::getInstance(), WindowManager::getRoot(), Client::getTitle(), L_INFO, Logger::Log(), WindowManager::setActiveWindow(), ewmh::updateActiveWindow(), and wrapper.
Referenced by EventHandler().
|
private |
Handles the FocusOut event. Changes the border color of the client.
event |
References WindowManager::getClient(), Client::getFrame(), Client::getGroup(), Logger::GetInstance(), WindowManager::getInstance(), WindowManager::getRoot(), Client::getTitle(), L_INFO, Logger::Log(), WindowManager::setActiveWindow(), ewmh::updateActiveWindow(), and wrapper.
Referenced by EventHandler().
|
private |
Handles the KeyPress event. the handling of KeyPress event is delegated to the ConfigDataBindings object to avoid dependencies to the Binding class and the Command class.
event |
References ConfigHandler::getConfigData(), ConfigHandler::GetInstance(), WindowManager::getInstance(), and wrapper.
Referenced by EventHandler().
|
private |
Handles the KeyRelease event.
event |
Referenced by EventHandler().
|
private |
Handles the LeaveNotify event.
event |
Referenced by EventHandler().
|
private |
Handles the MapNotify event. The MapNotify event is sent to a client when it is mapped. The event handler retrieves the client from the WindowManager object and sets its mapped attribute to true. The event handler then logs the event. the client is restacked.
event | The MapNotify event to be handled. |
References WindowManager::getClient(), Client::getFrame(), Logger::GetInstance(), WindowManager::getInstance(), Client::getTitle(), L_INFO, Logger::Log(), Client::restack(), and Client::setMapped().
Referenced by EventHandler().
|
private |
Handles the MapRequest event. The MapRequest event is sent to a client when it is mapped. The event handler retrieves the client from the WindowManager object and sets its mapped attribute to true. The event handler then logs the event.
event | The MapRequest event to be handled. |
References WindowManager::getClientRef(), Logger::GetInstance(), WindowManager::getInstance(), WindowManager::getRoot(), WindowManager::insertClient(), L_ERROR, L_INFO, Logger::Log(), WindowManager::setFocus(), and wrapper.
Referenced by EventHandler().
|
private |
Handles the MotionNotify event. this was previously used for dragging windows.r.
event |
References WindowManager::getClientRef(), Bars::getInstance(), and WindowManager::getInstance().
Referenced by EventHandler().
|
private |
Handles the PropertyNotify event.
event |
References Logger::GetInstance(), L_INFO, and Logger::Log().
Referenced by EventHandler().
|
private |
Handles the ReparentNotify event.
event |
Referenced by EventHandler().
|
private |
Handles the Unknown event.
event |
Referenced by EventHandler().
|
private |
Handles the UnmapNotify event. The UnmapNotify event is sent to a client when it is unmapped. The event handler retrieves the client from the WindowManager object and sets its mapped attribute to false. The event handler then logs the event.
event | The UnmapNotify event to be handled. |
References WindowManager::getClientRef(), WindowManager::getClients(), ConfigHandler::getConfigData(), WindowManager::getDisplay(), Bars::getInstance(), ConfigHandler::GetInstance(), Logger::GetInstance(), WindowManager::getInstance(), WindowManager::getRoot(), L_INFO, L_WARNING, and Logger::Log().
Referenced by EventHandler().
|
delete |
|
private |
Referenced by dispatchEvent(), and EventHandler().
|
staticprivate |
Referenced by create(), destroy(), and getInstance().
|
private |