1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-06 14:09:29 +00:00
conky/src/display-ncurses.hh
Tin Švagelj 6adf6b9dd4
Cleanup build flags, global namespace and includes (#1841)
- Separated displays so they don't have to all be included in build even when the features are disabled.
- Removed weird linker magic for display init and replaced it with straightforward (and faster) template functions that behave the same.
  - Replaced `disabled_display_output` classes with log messages.
- Add explicit compiler errors when feature dependent headers get included where they shouldn't (wl, x11).
- Switch BUILD_MOUSE_EVENTS dependency from OWN_WINDOW to BUILD_X11.
- Other minor improvements to some existing code which shouldn't affect behavior.
- Improve documentation.
- Remove X11 from unrelated headers.
  - This reaches 0% unneeded X11 polution in the sources.
  - Reenabled parts of window_type which would work in Wayland.
  - Remove unneeded guards.
- Display files are now no longer compiled if their features are disabled.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
2024-04-23 21:15:37 +00:00

76 lines
1.9 KiB
C++

/*
*
* Conky, a system monitor, based on torsmo
*
* Please see COPYING for details
*
* Copyright (C) 2018 François Revol 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_NCURSES_HH
#define DISPLAY_NCURSES_HH
#include "config.h"
#include <limits>
#include <string>
#include <type_traits>
#include "colours.h"
#include "display-console.hh"
#include "luamm.hh"
namespace conky {
/*
* A base class for ncurses display output.
*/
class display_output_ncurses : public display_output_console {
public:
explicit display_output_ncurses();
virtual ~display_output_ncurses() {}
// check if available and enabled in settings
virtual bool detect();
// connect to DISPLAY and other stuff
virtual bool initialize();
virtual bool shutdown();
virtual bool draw_line_inner_required() { return true; }
// drawing primitives
virtual void set_foreground_color(Colour c);
virtual void begin_draw_text();
virtual void end_draw_text();
virtual void draw_string(const char *s, int w);
virtual void line_inner_done();
virtual int getx();
virtual int gety();
virtual void gotox(int x);
virtual void gotoy(int y);
virtual void gotoxy(int x, int y);
virtual void flush();
// ncurses-specific
};
} // namespace conky
#endif /* DISPLAY_NCURSES_HH */