mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-16 18:15:17 +00:00
add display accessors
we want to be able to access either all outputs, or the currently selected one (if any, else return the top one, which ought to be the GUI one if we have one).
This commit is contained in:
parent
1c5198bccd
commit
5c389ecdb5
@ -54,6 +54,12 @@ display_outputs_t *display_outputs;
|
||||
*/
|
||||
std::vector<display_output_base *> active_display_outputs;
|
||||
|
||||
/*
|
||||
* the list of the only current output, when inside draw_text,
|
||||
* else we iterate over each active outputs.
|
||||
*/
|
||||
std::vector<conky::display_output_base *> current_display_outputs;
|
||||
|
||||
namespace priv {
|
||||
void do_register_display_output(const std::string &name,
|
||||
display_output_base *output) {
|
||||
|
@ -130,6 +130,12 @@ class display_output_base {
|
||||
*/
|
||||
extern std::vector<display_output_base *> active_display_outputs;
|
||||
|
||||
/*
|
||||
* the list of the only current output, when inside draw_text,
|
||||
* else we iterate over each active outputs.
|
||||
*/
|
||||
extern std::vector<conky::display_output_base *> current_display_outputs;
|
||||
|
||||
/*
|
||||
* Use this to declare a display output that has been disabled during
|
||||
* compilation. We can then print a nice error message telling the used which
|
||||
@ -143,4 +149,29 @@ class disabled_display_output : public display_output_base {
|
||||
|
||||
} // namespace conky
|
||||
|
||||
// XXX: move to namespace?
|
||||
|
||||
static inline std::vector<conky::display_output_base *> &display_outputs() {
|
||||
if (conky::current_display_outputs.size())
|
||||
return conky::current_display_outputs;
|
||||
return conky::active_display_outputs;
|
||||
}
|
||||
|
||||
static inline conky::display_output_base *display_output() {
|
||||
if (conky::current_display_outputs.size())
|
||||
return conky::current_display_outputs[0];
|
||||
// XXX; not really what intended yet...
|
||||
return conky::active_display_outputs[0];
|
||||
// return nullptr;
|
||||
}
|
||||
|
||||
static inline void unset_display_output() {
|
||||
conky::current_display_outputs.clear();
|
||||
}
|
||||
|
||||
static inline void set_display_output(conky::display_output_base *output) {
|
||||
conky::current_display_outputs.clear();
|
||||
conky::current_display_outputs.push_back(output);
|
||||
}
|
||||
|
||||
#endif /* DISPLAY_OUTPUT_HH */
|
||||
|
Loading…
Reference in New Issue
Block a user