YggdrasilWM  0.1.1
A tiny window manager coded in C++
EventHandler.hpp
Go to the documentation of this file.
1 
33 #ifndef YGGDRASILWM_EVENTHANDLER_HPP
34 #define YGGDRASILWM_EVENTHANDLER_HPP
35 extern "C" {
36 #include <X11/Xutil.h>
37 }
38 #include "WindowManager.hpp"
39 #include "Bars/Bars.hpp"
40 #include <memory>
52 class BaseX11Wrapper;
53 class EventHandler {
54 public:
55  EventHandler(const EventHandler&) = delete;
56  EventHandler& operator=(const EventHandler&) = delete;
61  static void create();
66  static EventHandler * getInstance();
67  static void destroy();
81  void dispatchEvent(const XEvent& event);
82 private:
83  using handler = void (EventHandler::*)(const XEvent&);
84  handler eventHandlerArray[LASTEvent]{};
86  std::shared_ptr<BaseX11Wrapper> wrapper;
93  EventHandler();
103  void handleMapNotify(const XEvent& event);
112  void handleUnmapNotify(const XEvent& event);
119  void handleConfigureRequest(const XEvent& event);
125  void handleConfigureNotify(const XEvent& event);
133  void handleButtonPress(const XEvent& event);
139  void handleButtonRelease(const XEvent& event);
147  void handleKeyPress(const XEvent& event);
153  void handleKeyRelease(const XEvent& event);
159  void handleEnterNotify(const XEvent& event);
165  void handleLeaveNotify(const XEvent& event);
170  void handleExpose(const XEvent& event);
176  void handleFocusIn(const XEvent& event);
182  void handleFocusOut(const XEvent& event);
188  void handlePropertyNotify(const XEvent& event);
194  void handleClientMessage(const XEvent& event);
200  void handleDestroyNotify(const XEvent& event);
206  void handleReparentNotify(const XEvent& event);
215  void handleMapRequest(const XEvent& event);
222  void handleMotionNotify(const XEvent& event);
228  void handleUnknown(const XEvent& event);
234  void handleCreateNotify(const XEvent &event);
235 };
236 #endif //YGGDRASILWM_EVENTHANDLER_HPP
Bars class header file.
WindowManager class header.
Definition: baseX11Wrapper.hpp:37
EventHandler class. This class is responsible for handling the XEvents. It is a part of the WindowMan...
Definition: EventHandler.hpp:53
handler eventHandlerArray[LASTEvent]
Definition: EventHandler.hpp:84
void handleUnknown(const XEvent &event)
Handles the Unknown event.
Definition: EventHandler.cpp:390
void handleMapNotify(const XEvent &event)
Handles the MapNotify event. The MapNotify event is sent to a client when it is mapped....
Definition: EventHandler.cpp:126
void handleExpose(const XEvent &event)
This where the bar is drawn, other windows are ignored.
Definition: EventHandler.cpp:225
void handleCreateNotify(const XEvent &event)
Handles the CreateNotify event.
Definition: EventHandler.cpp:389
~EventHandler()
Destroy the Event handler:: Event handler object.
void handleLeaveNotify(const XEvent &event)
Handles the LeaveNotify event.
Definition: EventHandler.cpp:224
void handleButtonPress(const XEvent &event)
Handles the ButtonPress event. The ButtonPress event is sent to a client when a mouse button is press...
Definition: EventHandler.cpp:182
static void destroy()
Definition: EventHandler.cpp:392
void(EventHandler::*)(const XEvent &) handler
Definition: EventHandler.hpp:83
EventHandler(const EventHandler &)=delete
void handleUnmapNotify(const XEvent &event)
Handles the UnmapNotify event. The UnmapNotify event is sent to a client when it is unmapped....
Definition: EventHandler.cpp:141
void handleKeyPress(const XEvent &event)
Handles the KeyPress event. the handling of KeyPress event is delegated to the ConfigDataBindings obj...
Definition: EventHandler.cpp:211
void handleFocusOut(const XEvent &event)
Handles the FocusOut event. Changes the border color of the client.
Definition: EventHandler.cpp:250
void handleDestroyNotify(const XEvent &event)
Handles the DestroyNotify event.
Definition: EventHandler.cpp:280
EventHandler()
Definition: EventHandler.cpp:93
void handlePropertyNotify(const XEvent &event)
Handles the PropertyNotify event.
Definition: EventHandler.cpp:270
std::shared_ptr< BaseX11Wrapper > wrapper
Definition: EventHandler.hpp:86
void handleConfigureRequest(const XEvent &event)
Handles the ConfigureRequest event. The ConfigureRequest event is sent to a client when it requests a...
Definition: EventHandler.cpp:168
void handleMotionNotify(const XEvent &event)
Handles the MotionNotify event. this was previously used for dragging windows.r.
Definition: EventHandler.cpp:354
void handleConfigureNotify(const XEvent &event)
Handles the ConfigureNotify event.
Definition: EventHandler.cpp:180
static EventHandler * getInstance()
Get the Event handler:: Event handler object.
Definition: EventHandler.cpp:87
static void create()
create the Event handler:: Event handler object
Definition: EventHandler.cpp:81
void handleKeyRelease(const XEvent &event)
Handles the KeyRelease event.
Definition: EventHandler.cpp:216
EventHandler & operator=(const EventHandler &)=delete
void dispatchEvent(const XEvent &event)
Dispatches the event to the appropriate handler function. the eventHandlerArray is an array of pointe...
Definition: EventHandler.cpp:119
void handleMapRequest(const XEvent &event)
Handles the MapRequest event. The MapRequest event is sent to a client when it is mapped....
Definition: EventHandler.cpp:312
void handleEnterNotify(const XEvent &event)
Handles the EnterNotify event.
Definition: EventHandler.cpp:217
static EventHandler * instance_
Definition: EventHandler.hpp:85
void handleReparentNotify(const XEvent &event)
Handles the ReparentNotify event.
Definition: EventHandler.cpp:311
void handleFocusIn(const XEvent &event)
Handles the FocusIn event. Changes the border color of the client.
Definition: EventHandler.cpp:232
void handleClientMessage(const XEvent &event)
Handles the ClientMessage event.
Definition: EventHandler.cpp:274
void handleButtonRelease(const XEvent &event)
Handles the ButtonRelease event.
Definition: EventHandler.cpp:210