forked from brndnmtthws/conky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial stubbing of display backends
Hopefully this will lead the way to adding support for things like Wayland and Haiku graphics, cf. brndnmtthws#56. We define a display_output_base class that display backends can derive from to implement display-specific calls.
- Loading branch information
Showing
12 changed files
with
754 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* | ||
* Conky, a system monitor, based on torsmo | ||
* | ||
* Please see COPYING for details | ||
* | ||
* Copyright (C) 2010 Pavel Labath et al. | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
#include <config.h> | ||
|
||
#include "conky.h" | ||
#include "display-console.hh" | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
#include <unordered_map> | ||
|
||
namespace conky { | ||
namespace { | ||
|
||
conky::display_output_console console_output("console"); | ||
|
||
} // namespace | ||
|
||
namespace priv { | ||
|
||
|
||
} // namespace priv | ||
|
||
display_output_console::display_output_console(const std::string &name_) | ||
: display_output_base(name_) { | ||
// lowest priority, it's a fallback | ||
priority = 0; | ||
} | ||
|
||
bool display_output_console::detect() { | ||
if (out_to_stdout.get(*state) || out_to_stderr.get(*state)) { | ||
std::cerr << "Display output '" << name << "' enabled in config." << std::endl; | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
bool display_output_console::initialize() { | ||
return true; | ||
} | ||
|
||
bool display_output_console::shutdown() { | ||
return true; | ||
} | ||
|
||
} // namespace conky | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* | ||
* Conky, a system monitor, based on torsmo | ||
* | ||
* Please see COPYING for details | ||
* | ||
* Copyright (C) 2010 Pavel Labath et al. | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
#ifndef DISPLAY_CONSOLE_HH | ||
#define DISPLAY_CONSOLE_HH | ||
|
||
#include <limits> | ||
#include <string> | ||
#include <type_traits> | ||
|
||
#include "luamm.hh" | ||
#include "display-output.hh" | ||
|
||
namespace conky { | ||
|
||
/* | ||
* A base class for console display output. | ||
*/ | ||
class display_output_console : public display_output_base { | ||
|
||
public: | ||
|
||
explicit display_output_console(const std::string &name_); | ||
|
||
virtual ~display_output_console() {} | ||
|
||
// check if available and enabled in settings | ||
virtual bool detect(); | ||
// connect to DISPLAY and other stuff | ||
virtual bool initialize(); | ||
virtual bool shutdown(); | ||
|
||
// console-specific | ||
}; | ||
|
||
} // namespace conky | ||
|
||
#endif /* DISPLAY_CONSOLE_HH */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* | ||
* Conky, a system monitor, based on torsmo | ||
* | ||
* Please see COPYING for details | ||
* | ||
* Copyright (C) 2010 Pavel Labath et al. | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
#include <config.h> | ||
|
||
#include "conky.h" | ||
#include "display-http.hh" | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
#include <unordered_map> | ||
|
||
namespace conky { | ||
namespace { | ||
|
||
#ifdef BUILD_HTTP | ||
conky::display_output_http http_output; | ||
#else | ||
conky::disabled_display_output http_output_disabled("http", "BUILD_HTTP"); | ||
#endif | ||
|
||
} // namespace | ||
|
||
namespace priv { | ||
|
||
|
||
} // namespace priv | ||
|
||
#ifdef BUILD_HTTP | ||
|
||
display_output_http::display_output_http() | ||
: display_output_base("http") { | ||
priority = 1; | ||
} | ||
|
||
bool display_output_http::detect() { | ||
/* TODO: | ||
if (out_to_http.get(*state)) { | ||
std::cerr << "Display output '" << name << "' enabled in config." << std::endl; | ||
return true; | ||
} | ||
*/ | ||
return false; | ||
} | ||
|
||
bool display_output_http::initialize() { | ||
return false; | ||
} | ||
|
||
bool display_output_http::shutdown() { | ||
return false; | ||
} | ||
|
||
#endif | ||
|
||
} // namespace conky | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* | ||
* Conky, a system monitor, based on torsmo | ||
* | ||
* Please see COPYING for details | ||
* | ||
* Copyright (C) 2010 Pavel Labath et al. | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
#ifndef DISPLAY_HTTP_HH | ||
#define DISPLAY_HTTP_HH | ||
|
||
#include <limits> | ||
#include <string> | ||
#include <type_traits> | ||
|
||
#include "luamm.hh" | ||
#include "display-output.hh" | ||
|
||
namespace conky { | ||
|
||
/* | ||
* A base class for HTTP display output. | ||
*/ | ||
class display_output_http : public display_output_base { | ||
|
||
public: | ||
|
||
explicit display_output_http(); | ||
|
||
virtual ~display_output_http() {} | ||
|
||
// check if available and enabled in settings | ||
virtual bool detect(); | ||
// connect to DISPLAY and other stuff | ||
virtual bool initialize(); | ||
virtual bool shutdown(); | ||
|
||
// HTTP-specific | ||
}; | ||
|
||
} // namespace conky | ||
|
||
#endif /* DISPLAY_HTTP_HH */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* | ||
* Conky, a system monitor, based on torsmo | ||
* | ||
* Please see COPYING for details | ||
* | ||
* Copyright (C) 2010 Pavel Labath et al. | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
#include <config.h> | ||
|
||
#include "conky.h" | ||
#include "nc.h" | ||
#include "display-ncurses.hh" | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
#include <unordered_map> | ||
|
||
namespace conky { | ||
namespace { | ||
|
||
#ifdef BUILD_NCURSES | ||
conky::display_output_ncurses ncurses_output; | ||
#else | ||
conky::disabled_display_output ncurses_output_disabled("ncurses", "BUILD_NCURSES"); | ||
#endif | ||
|
||
} // namespace | ||
|
||
namespace priv { | ||
|
||
|
||
} // namespace priv | ||
|
||
#ifdef BUILD_NCURSES | ||
|
||
display_output_ncurses::display_output_ncurses() | ||
: display_output_console("ncurses") { | ||
priority = 1; | ||
} | ||
|
||
bool display_output_ncurses::detect() { | ||
if (out_to_ncurses.get(*state)) { | ||
std::cerr << "Display output '" << name << "' enabled in config." << std::endl; | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
bool display_output_ncurses::initialize() { | ||
return false; | ||
} | ||
|
||
bool display_output_ncurses::shutdown() { | ||
return false; | ||
} | ||
|
||
#endif /* BUILD_NCURSES */ | ||
|
||
} // namespace conky | ||
|
Oops, something went wrong.