1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-10-02 15:09:07 +00:00
conky/src/gui.h
bi4k8 4a7bec5ba6
Premultiply background colors for X11 (#1421)
* initialize XColor/XftColor

this does not change behavior, but avoids passing uninitialized data to X/Xft functions

* gui, x11: move have_argb_visual to x11 files

this variable only has meaning with respect to X11

* x11: clear have_argb_visual if the setting changes to false

otherwise, we may try to use colors with alpha when we no longer requested a 32-bit visual

* x11: premultiply alpha of background colors

* x11: clean up set_foreground_color a bit

---------

Co-authored-by: bi4k8 <bi4k8@github>
2023-02-24 08:13:48 -05:00

135 lines
4.0 KiB
C++

/*
*
* Conky, a system monitor, based on torsmo
*
* Please see COPYING for details
*
* Copyright (c) 2005-2021 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
* 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/>.
*
*/
#pragma once
#include "config.h"
#ifdef BUILD_X11
#include "x11.h"
#endif /* BUILD_X11 */
#include "colour-settings.h"
#include "colours.h"
#include "setting.hh"
#ifdef BUILD_X11
extern Display *display;
#endif /* BUILD_X11 */
extern int display_width;
extern int display_height;
extern int screen;
extern int workarea[4];
extern char window_created;
void destroy_window(void);
void create_gc(void);
void set_struts(int);
bool out_to_gui(lua::state &l);
void print_monitor(struct text_object *, char *, unsigned int);
void print_monitor_number(struct text_object *, char *, unsigned int);
void print_desktop(struct text_object *, char *, unsigned int);
void print_desktop_number(struct text_object *, char *, unsigned int);
void print_desktop_name(struct text_object *, char *, unsigned int);
/* Num lock, Scroll lock, Caps Lock */
void print_key_num_lock(struct text_object *, char *, unsigned int);
void print_key_caps_lock(struct text_object *, char *, unsigned int);
void print_key_scroll_lock(struct text_object *, char *, unsigned int);
/* Keyboard layout and mouse speed in percentage */
void print_keyboard_layout(struct text_object *, char *, unsigned int);
void print_mouse_speed(struct text_object *, char *, unsigned int);
#ifdef BUILD_XDBE
void xdbe_swap_buffers(void);
#else
void xpmdb_swap_buffers(void);
#endif /* BUILD_XDBE */
/* alignments */
enum alignment {
TOP_LEFT,
TOP_RIGHT,
TOP_MIDDLE,
BOTTOM_LEFT,
BOTTOM_RIGHT,
BOTTOM_MIDDLE,
MIDDLE_LEFT,
MIDDLE_MIDDLE,
MIDDLE_RIGHT,
NONE
};
extern conky::simple_config_setting<alignment> text_alignment;
namespace priv {
class own_window_setting : public conky::simple_config_setting<bool> {
typedef conky::simple_config_setting<bool> Base;
protected:
virtual void lua_setter(lua::state &l, bool init);
public:
own_window_setting() : Base("own_window", false, false) {}
};
} // namespace priv
extern conky::simple_config_setting<int> head_index;
extern priv::colour_setting default_shade_color;
extern priv::colour_setting default_outline_color;
extern conky::range_config_setting<int> border_inner_margin;
extern conky::range_config_setting<int> border_outer_margin;
extern conky::range_config_setting<int> border_width;
extern conky::simple_config_setting<bool> forced_redraw;
#ifdef OWN_WINDOW
extern conky::simple_config_setting<bool> set_transparent;
extern conky::simple_config_setting<std::string> own_window_class;
extern conky::simple_config_setting<std::string> own_window_title;
extern conky::simple_config_setting<window_type> own_window_type;
struct window_hints_traits {
static const lua::Type type = lua::TSTRING;
typedef uint16_t Type;
static std::pair<Type, bool> convert(lua::state &l, int index,
const std::string &name);
};
extern conky::simple_config_setting<uint16_t, window_hints_traits>
own_window_hints;
#ifdef BUILD_ARGB
extern priv::colour_setting background_colour;
extern conky::simple_config_setting<bool> use_argb_visual;
/* range of 0-255 for alpha */
extern conky::range_config_setting<int> own_window_argb_value;
#endif /*BUILD_ARGB*/
#endif /*OWN_WINDOW*/
extern priv::own_window_setting own_window;