YggdrasilWM  0.1.1
A tiny window manager coded in C++
Client.hpp
Go to the documentation of this file.
1 
28 #ifndef YGGDRASILWM_CLIENT_HPP
29 #define YGGDRASILWM_CLIENT_HPP
30 extern "C" {
31 #include <X11/Xlib.h>
32 }
33 #include <string>
34 #include <memory>
35 
36 class Group;
37 class LayoutManager;
38 class BaseX11Wrapper;
39 
47 class Client {
48 public:
60  Client(Display *display,
61  Window root,
62  Window window,
63  std::shared_ptr<Group> group,
64  unsigned long inActiveColor,
65  int borderSize,
66  std::shared_ptr<BaseX11Wrapper> wrapper);
71  ~Client();
77  void frame();
82  void unframe();
88  [[nodiscard]] Window getWindow() const;
94  [[nodiscard]] std::shared_ptr<Group> getGroup() const;
101  void move(int x, int y);
108  void resize(unsigned int width,unsigned int height);
114  bool isFramed() const;
120  void setMapped(bool mapped);
126  bool isMapped() const;
132  const std::string &getTitle() const;
138  const std::string &getClass() const;
144  Window getFrame() const;
149  void restack();
150  void setGroup(std::shared_ptr<Group> g);
151 private:
152  Display *display_;
153  Window root_;
154  Window window_;
155  Window frame_;
156  unsigned int border_width;
157  unsigned long border_color;
158  bool framed;
159  bool mapped{};
160  std::string title_;
161  std::string class_;
162  std::weak_ptr<Group> group_;
163  std::shared_ptr<BaseX11Wrapper> wrapper;
164 };
165 #endif //YGGDRASILWM_CLIENT_HPP
Definition: baseX11Wrapper.hpp:37
The Client class is responsible for managing the client windows. It creates a frame around the client...
Definition: Client.hpp:47
Window root_
Definition: Client.hpp:153
const std::string & getTitle() const
Client::getTitle() return the title of the client, the title is get during the construction of the cl...
Definition: Client.cpp:203
std::shared_ptr< BaseX11Wrapper > wrapper
Definition: Client.hpp:163
bool mapped
Definition: Client.hpp:159
Window getWindow() const
Client::getWindow return the window attribute of the client.
Definition: Client.cpp:175
bool framed
Definition: Client.hpp:158
Window frame_
Definition: Client.hpp:155
Client(Display *display, Window root, Window window, std::shared_ptr< Group > group, unsigned long inActiveColor, int borderSize, std::shared_ptr< BaseX11Wrapper > wrapper)
Client constructor.get window class and title.
Definition: Client.cpp:39
void frame()
Client::frame create a frame around the client window, Map the frame, Add the window to the save set ...
Definition: Client.cpp:96
std::string class_
Definition: Client.hpp:161
const std::string & getClass() const
Client::getClass() return the class of the client, the class is get during the construction of the cl...
Definition: Client.cpp:204
void move(int x, int y)
: Client::move move the client window to the given position
Definition: Client.cpp:178
Display * display_
Definition: Client.hpp:152
void setGroup(std::shared_ptr< Group > g)
Definition: Client.cpp:206
~Client()
Client destructor Destroy the Client object & the Frame Window it needed.
Definition: Client.cpp:86
unsigned int border_width
Definition: Client.hpp:156
void setMapped(bool mapped)
Client::setMapped() set the mapped status of the client.
Definition: Client.cpp:202
void restack()
Client::restack() restack the client window to avoid the frame to get in front of the client.
Definition: Client.cpp:154
Window getFrame() const
Client::getFrame() return the frame Window of the client.
Definition: Client.cpp:199
std::string title_
Definition: Client.hpp:160
bool isFramed() const
Client::isFramed() check if the client is framed.
Definition: Client.cpp:200
unsigned long border_color
Definition: Client.hpp:157
void unframe()
Client::unframe unframe the client window by removing the frame and reparenting the window to the roo...
Definition: Client.cpp:164
bool isMapped() const
Client::isMapped() check if the client is mapped.
Definition: Client.cpp:201
Window window_
Definition: Client.hpp:154
std::weak_ptr< Group > group_
Definition: Client.hpp:162
std::shared_ptr< Group > getGroup() const
return the group of the client
Definition: Client.cpp:205
void resize(unsigned int width, unsigned int height)
Client::resize resize the client window to the given size.
Definition: Client.cpp:189
Groups are defined in the config file. Each group use a specific layout manager and manage it's list ...
Definition: Group.hpp:60
LayoutManager class Interface for the layout managers.
Definition: LayoutManager.hpp:42