1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-11 16:38:55 +00:00
conky/src/x11.h

164 lines
3.5 KiB
C
Raw Normal View History

/*
2010-01-06 19:45:19 -08:00
*
* Conky, a system monitor, based on torsmo
*
* Please see COPYING for details
*
2021-02-27 09:14:19 -06:00
* Copyright (c) 2005-2021 Brenden Matthews, Philip Kovacs, et. al.
2010-01-06 19:45:19 -08:00
* (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/>.
*
*/
#ifdef BUILD_X11
#ifndef X11_H_
#define X11_H_
#include <X11/Xatom.h>
2018-12-20 21:20:43 -05:00
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvariadic-macros"
#include <X11/Xlib.h>
2018-12-20 21:20:43 -05:00
#pragma GCC diagnostic pop
#ifdef BUILD_XFT
#include <X11/Xft/Xft.h>
#endif
#ifdef BUILD_XDBE
#include <X11/extensions/Xdbe.h>
#endif
2010-03-11 11:28:12 +01:00
#include "colours.h"
#include "setting.hh"
2010-02-24 20:51:33 +01:00
#define ATOM(a) XInternAtom(display, #a, False)
#ifdef OWN_WINDOW
2010-02-26 18:48:57 +01:00
enum window_type {
TYPE_NORMAL = 0,
TYPE_DOCK,
TYPE_PANEL,
TYPE_DESKTOP,
TYPE_OVERRIDE
};
2010-03-02 20:30:15 +01:00
enum window_hints {
HINT_UNDECORATED = 0,
HINT_BELOW,
HINT_ABOVE,
HINT_STICKY,
HINT_SKIP_TASKBAR,
HINT_SKIP_PAGER
};
#define SET_HINT(mask, hint) (mask |= (1 << (hint)))
#define TEST_HINT(mask, hint) (mask & (1 << (hint)))
#endif
extern Display *display;
struct conky_x11_window {
Window root, window, desktop;
Drawable drawable;
Visual *visual;
Colormap colourmap;
GC gc;
#ifdef BUILD_XDBE
XdbeBackBuffer back_buffer;
2022-12-24 09:44:03 -05:00
#else /*BUILD_XDBE*/
Pixmap back_buffer;
#endif /*BUILD_XDBE*/
#ifdef BUILD_XFT
XftDraw *xftdraw;
#endif /*BUILD_XFT*/
int width;
int height;
#ifdef OWN_WINDOW
int x;
int y;
#endif
};
extern struct conky_x11_window window;
void destroy_window(void);
void create_gc(void);
void set_transparent_background(Window win);
void get_x11_desktop_info(Display *current_display, Atom atom);
void set_struts(int);
void x11_init_window(lua::state &l, bool own);
#ifdef BUILD_XDBE
2009-08-05 15:41:29 -06:00
void xdbe_swap_buffers(void);
#else
void xpmdb_swap_buffers(void);
#endif /* BUILD_XDBE */
2009-08-05 15:41:29 -06:00
namespace priv {
class out_to_x_setting : public conky::simple_config_setting<bool> {
typedef conky::simple_config_setting<bool> Base;
protected:
virtual void lua_setter(lua::state &l, bool init);
virtual void cleanup(lua::state &l);
public:
out_to_x_setting() : Base("out_to_x", true, false) {}
};
2018-08-08 15:02:05 +02:00
#ifdef BUILD_XDBE
class use_xdbe_setting : public conky::simple_config_setting<bool> {
typedef conky::simple_config_setting<bool> Base;
bool set_up(lua::state &l);
protected:
virtual void lua_setter(lua::state &l, bool init);
public:
use_xdbe_setting() : Base("double_buffer", false, false) {}
};
2018-08-08 15:02:05 +02:00
#else
class use_xpmdb_setting : public conky::simple_config_setting<bool> {
typedef conky::simple_config_setting<bool> Base;
bool set_up(lua::state &l);
protected:
virtual void lua_setter(lua::state &l, bool init);
public:
use_xpmdb_setting() : Base("double_buffer", false, false) {}
};
2018-08-08 15:02:05 +02:00
#endif
} /* namespace priv */
extern priv::out_to_x_setting out_to_x;
2010-04-21 19:33:39 +02:00
#ifdef BUILD_XFT
extern conky::simple_config_setting<bool> use_xft;
2010-04-21 19:33:39 +02:00
#endif
2010-04-23 21:54:40 +02:00
#ifdef BUILD_XDBE
extern priv::use_xdbe_setting use_xdbe;
#else
extern priv::use_xpmdb_setting use_xpmdb;
2010-04-23 21:54:40 +02:00
#endif
#endif /*X11_H_*/
#endif /* BUILD_X11 */