![]() |
YggdrasilWM
0.1.1
A tiny window manager coded in C++
|
Class to manage the bars This class is a singleton and is responsible for managing the bars instanciate with createInstance and initialize with init should be destroyed with destroy when the program ends Bars::run runs in a separate thread, so all data must be passed through the TSBarsData class that handle synchronization. More...
#include <Bars.hpp>

Public Member Functions | |
| Bars (const Bars &)=delete | |
| Bars & | operator= (const Bars &)=delete |
| ~Bars () | |
| void | init (std::shared_ptr< ConfigDataBars > configData, std::shared_ptr< TSBarsData > tsData, Display *display, Window root) |
| Initialize the Bars class. More... | |
| void | run () |
| Run the Bars class in a separate thread. More... | |
| void | start_thread () |
| unsigned int | getSpaceN () const |
| Get the spaceN value used to calculate the space left for the Layout Manager. More... | |
| unsigned int | getSpaceS () const |
| Get the spaceS value used to calculate the space left for the Layout Manager. More... | |
| unsigned int | getSpaceE () const |
| Get the spaceE value used to calculate the space left for the Layout Manager. More... | |
| unsigned int | getSpaceW () const |
| Get the spaceW value used to calculate the space left for the Layout Manager. More... | |
| const std::unordered_map< std::string, std::string > & | getData () const |
| bool | isBarWindow (Window window) |
| Check if the window is a bar window used to filter events in EventHandler. More... | |
| void | stop_thread () |
| Stop the thread (join) More... | |
| void | redraw () |
| Redraw the bars by calling the draw method of each bar. More... | |
| void | addPluginLocation (const std::string &location) |
| const std::set< std::string > & | getPluginsLocations () const |
| void * | getWidgetTypeHandle (const std::string &widgetType) |
| void | setWidgetTypeHandle (const std::string &widgetType, void *handle) |
| void | subscribeWidget (Widget *w) |
Static Public Member Functions | |
| static void | createInstance () |
| Create the singleton instance if the instance is already created, it will do nothing. More... | |
| static Bars & | getInstance () |
| Get the singleton instance if the instance is not created, it will create it. More... | |
| static void | destroy () |
| Destroy the singleton instance if the instance is not created, it will do nothing. More... | |
Private Member Functions | |
| Bars () | |
Private Attributes | |
| std::vector< std::unique_ptr< Bar > > | bars |
| std::vector< Window > | windows |
| std::shared_ptr< ConfigDataBars > | configData |
| std::shared_ptr< TSBarsData > | tsData |
| std::unordered_map< std::string, std::string > | data |
| Display * | display |
| Window | root |
| unsigned int | spaceN |
| unsigned int | spaceS |
| unsigned int | spaceE |
| unsigned int | spaceW |
| std::thread | barThread |
| std::set< std::string > | pluginsLocations |
| std::unordered_map< std::string, void * > | widgetTypeHandle |
| std::unordered_map< std::string, std::vector< Widget * > > | subscriptions |
Static Private Attributes | |
| static Bars * | instance = nullptr |
Class to manage the bars This class is a singleton and is responsible for managing the bars instanciate with createInstance and initialize with init should be destroyed with destroy when the program ends Bars::run runs in a separate thread, so all data must be passed through the TSBarsData class that handle synchronization.
|
delete |
| Bars::~Bars | ( | ) |
References bars, destroy(), Logger::GetInstance(), L_ERROR, Logger::Log(), and widgetTypeHandle.

|
private |
| void Bars::addPluginLocation | ( | const std::string & | location | ) |
|
static |
Create the singleton instance if the instance is already created, it will do nothing.
References Bars(), and instance.
Referenced by WindowManager::createBars(), and getInstance().


|
static |
Destroy the singleton instance if the instance is not created, it will do nothing.
References instance.
Referenced by WindowManager::Stop(), and ~Bars().

| const std::unordered_map< std::string, std::string > & Bars::getData | ( | ) | const |
|
static |
Get the singleton instance if the instance is not created, it will create it.
References createInstance(), and instance.
Referenced by WindowManager::createBars(), EventHandler::handleButtonPress(), EventHandler::handleDestroyNotify(), EventHandler::handleEnterNotify(), EventHandler::handleExpose(), EventHandler::handleMotionNotify(), EventHandler::handleUnmapNotify(), and WindowManager::Stop().


| const std::set< std::string > & Bars::getPluginsLocations | ( | ) | const |
References pluginsLocations.
| unsigned int Bars::getSpaceE | ( | ) | const |
Get the spaceE value used to calculate the space left for the Layout Manager.
References spaceE.
Referenced by WindowManager::createBars().

| unsigned int Bars::getSpaceN | ( | ) | const |
Get the spaceN value used to calculate the space left for the Layout Manager.
References spaceN.
Referenced by WindowManager::createBars().

| unsigned int Bars::getSpaceS | ( | ) | const |
Get the spaceS value used to calculate the space left for the Layout Manager.
References spaceS.
Referenced by WindowManager::createBars().

| unsigned int Bars::getSpaceW | ( | ) | const |
Get the spaceW value used to calculate the space left for the Layout Manager.
References spaceW.
Referenced by WindowManager::createBars().

| void * Bars::getWidgetTypeHandle | ( | const std::string & | widgetType | ) |
References Logger::GetInstance(), L_ERROR, Logger::Log(), and widgetTypeHandle.
Referenced by init().


| void Bars::init | ( | std::shared_ptr< ConfigDataBars > | configData, |
| std::shared_ptr< TSBarsData > | tsData, | ||
| Display * | display, | ||
| Window | root | ||
| ) |
Initialize the Bars class.
| configData | global bars configuration will pass the right config data to each bar |
| tsData | thread safe data to pass data between threads |
| display | to limit calls to WindowManager::getDisplay |
| root | to limit calls to WindowManager::getRoot |
References addPluginLocation(), bars, configData, display, Logger::GetInstance(), getWidgetTypeHandle(), L_ERROR, L_INFO, Logger::Log(), pluginsLocations, root, setWidgetTypeHandle(), spaceE, spaceN, spaceS, spaceW, subscribeWidget(), tsData, and windows.
Referenced by WindowManager::createBars().


| bool Bars::isBarWindow | ( | Window | window | ) |
Check if the window is a bar window used to filter events in EventHandler.
| window |
References windows.
| void Bars::redraw | ( | ) |
Redraw the bars by calling the draw method of each bar.
| msg | message to pass to the draw method (temporary arg for debug purpose) |
References bars.
Referenced by EventHandler::handleEnterNotify(), EventHandler::handleExpose(), and run().

| void Bars::run | ( | ) |
Run the Bars class in a separate thread.
References data, display, Logger::GetInstance(), WindowManager::getInstance(), L_ERROR, Logger::Log(), redraw(), subscriptions, and tsData.
Referenced by start_thread().


| void Bars::setWidgetTypeHandle | ( | const std::string & | widgetType, |
| void * | handle | ||
| ) |
| void Bars::start_thread | ( | ) |
References barThread, and run().
Referenced by WindowManager::createBars().


| void Bars::stop_thread | ( | ) |
Stop the thread (join)
References barThread.
Referenced by WindowManager::Stop().

| void Bars::subscribeWidget | ( | Widget * | w | ) |
References Widget::registerDataKey(), and subscriptions.
Referenced by init().


|
private |
Referenced by start_thread(), and stop_thread().
|
private |
Referenced by init().
|
staticprivate |
Yb dP 8 w 8 Yb dP 8b d8 YbdP .d88 .d88 .d88 8d8b .d88 d88b w 8 Yb db dP 8YbmdP8 YP 8 8 8 8 8 8 8P 8 8 Yb. 8 8 YbdPYbdP 8 " 8 88Y88 Y88Y88 8 `Y88 Y88P 8 8 YP YP 8 8 wwdP wwdP Yggdrasil Window Manager https://github.com/corecaps/YggdrasilWM Copyright (C) 2024 jgarcia jgarcia@student.42.fr corecaps@gmail.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Referenced by createInstance(), destroy(), and getInstance().
|
private |
Referenced by addPluginLocation(), getPluginsLocations(), and init().
|
private |
Referenced by init().
|
private |
Referenced by getSpaceE(), and init().
|
private |
Referenced by getSpaceN(), and init().
|
private |
Referenced by getSpaceS(), and init().
|
private |
Referenced by getSpaceW(), and init().
|
private |
Referenced by run(), and subscribeWidget().
|
private |
|
private |
Referenced by getWidgetTypeHandle(), setWidgetTypeHandle(), and ~Bars().
|
private |
Referenced by init(), and isBarWindow().