mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-09 23:48:48 +00:00
Actually allow more than one display-output at once
We already do this like with HTTP+stdout.
This commit is contained in:
parent
7c8d486b9f
commit
ef957bfb91
11
src/conky.cc
11
src/conky.cc
@ -1098,8 +1098,9 @@ static void draw_string(const char *s) {
|
|||||||
#ifdef BUILD_NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
if (out_to_ncurses.get(*state) && draw_mode == FG) { printw("%s", s); }
|
if (out_to_ncurses.get(*state) && draw_mode == FG) { printw("%s", s); }
|
||||||
#endif /* BUILD_NCURSES */
|
#endif /* BUILD_NCURSES */
|
||||||
if (conky::active_display_output != nullptr && draw_mode == FG)
|
if (conky::active_display_outputs.size() && draw_mode == FG)
|
||||||
conky::active_display_output->draw_string(s, width_of_s);
|
for (auto output : conky::active_display_outputs)
|
||||||
|
output->draw_string(s, width_of_s);
|
||||||
int tbs = text_buffer_size.get(*state);
|
int tbs = text_buffer_size.get(*state);
|
||||||
memset(tmpstring1, 0, tbs);
|
memset(tmpstring1, 0, tbs);
|
||||||
memset(tmpstring2, 0, tbs);
|
memset(tmpstring2, 0, tbs);
|
||||||
@ -1657,8 +1658,7 @@ static int draw_line(char *s, int special_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void draw_text() {
|
static void draw_text() {
|
||||||
if (conky::active_display_output)
|
for (auto output : conky::active_display_outputs) output->begin_draw_text();
|
||||||
conky::active_display_output->begin_draw_text();
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
if (out_to_x.get(*state)) {
|
if (out_to_x.get(*state)) {
|
||||||
cur_y = text_start_y;
|
cur_y = text_start_y;
|
||||||
@ -1693,8 +1693,7 @@ static void draw_text() {
|
|||||||
attron(COLOR_PAIR(COLOR_WHITE));
|
attron(COLOR_PAIR(COLOR_WHITE));
|
||||||
#endif /* BUILD_NCURSES */
|
#endif /* BUILD_NCURSES */
|
||||||
for_each_line(text_buffer, draw_line);
|
for_each_line(text_buffer, draw_line);
|
||||||
if (conky::active_display_output)
|
for (auto output : conky::active_display_outputs) output->end_draw_text();
|
||||||
conky::active_display_output->end_draw_text();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_stuff() {
|
static void draw_stuff() {
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace conky {
|
namespace conky {
|
||||||
namespace {
|
namespace {
|
||||||
@ -46,9 +47,8 @@ display_outputs_t *display_outputs;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* The selected and active display output.
|
* The selected and active display output.
|
||||||
* XXX: do we want to support multiple outputs???
|
|
||||||
*/
|
*/
|
||||||
display_output_base *active_display_output = nullptr;
|
std::vector<display_output_base *> active_display_outputs;
|
||||||
|
|
||||||
namespace priv {
|
namespace priv {
|
||||||
void do_register_display_output(const std::string &name,
|
void do_register_display_output(const std::string &name,
|
||||||
@ -94,6 +94,7 @@ bool initialize_display_outputs() {
|
|||||||
sort(outputs.begin(), outputs.end(), &display_output_base::priority_compare);
|
sort(outputs.begin(), outputs.end(), &display_output_base::priority_compare);
|
||||||
|
|
||||||
for (auto output : outputs) {
|
for (auto output : outputs) {
|
||||||
|
if (output->priority < 0) continue;
|
||||||
std::cerr << "Testing display output '" << output->name << "'... "
|
std::cerr << "Testing display output '" << output->name << "'... "
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
if (output->detect()) {
|
if (output->detect()) {
|
||||||
@ -103,18 +104,20 @@ bool initialize_display_outputs() {
|
|||||||
std::cerr << "Initialized display output '" << output->name << "'... "
|
std::cerr << "Initialized display output '" << output->name << "'... "
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
output->is_active = true;
|
output->is_active = true;
|
||||||
active_display_output = output;
|
active_display_outputs.push_back(output);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (active_display_outputs.size()) return true;
|
||||||
|
|
||||||
std::cerr << "Unable to find a usable display output." << std::endl;
|
std::cerr << "Unable to find a usable display output." << std::endl;
|
||||||
return true; // false;
|
return true; // false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shutdown_display_outputs() {
|
bool shutdown_display_outputs() {
|
||||||
if (active_display_output) { return active_display_output->shutdown(); }
|
bool ret = true;
|
||||||
return false;
|
for (auto output : active_display_outputs) ret = output->shutdown();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace conky
|
} // namespace conky
|
||||||
|
@ -85,10 +85,9 @@ class display_output_base {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The selected and active display output.
|
* The selected and active display outputs.
|
||||||
* XXX: do we want to support multiple outputs???
|
|
||||||
*/
|
*/
|
||||||
extern display_output_base *active_display_output;
|
extern std::vector<display_output_base *> active_display_outputs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use this to declare a display output that has been disabled during
|
* Use this to declare a display output that has been disabled during
|
||||||
|
Loading…
x
Reference in New Issue
Block a user