2010-01-07 03:45:19 +00:00
|
|
|
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
|
|
|
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
|
|
|
*
|
|
|
|
* Conky, a system monitor, based on torsmo
|
|
|
|
*
|
|
|
|
* Please see COPYING for details
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005-2010 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/>.
|
|
|
|
*
|
|
|
|
*/
|
2009-07-28 21:44:22 +00:00
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2008-06-14 18:41:12 +00:00
|
|
|
#ifndef X11_H_
|
|
|
|
#define X11_H_
|
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_XFT
|
2008-06-14 18:41:12 +00:00
|
|
|
#include <X11/Xft/Xft.h>
|
|
|
|
#endif
|
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_XDBE
|
2008-06-14 18:41:12 +00:00
|
|
|
#include <X11/extensions/Xdbe.h>
|
|
|
|
#endif
|
|
|
|
|
2010-02-24 19:51:33 +00:00
|
|
|
#include "setting.hh"
|
|
|
|
|
2008-06-14 18:41:12 +00:00
|
|
|
#define ATOM(a) XInternAtom(display, #a, False)
|
|
|
|
|
|
|
|
#ifdef OWN_WINDOW
|
2010-02-26 17:48:57 +00:00
|
|
|
enum window_type {
|
2008-06-14 18:41:12 +00:00
|
|
|
TYPE_NORMAL = 0,
|
|
|
|
TYPE_DOCK,
|
2009-06-13 21:36:28 +00:00
|
|
|
TYPE_PANEL,
|
2008-06-14 18:41:12 +00:00
|
|
|
TYPE_DESKTOP,
|
|
|
|
TYPE_OVERRIDE
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
struct conky_window {
|
2008-06-14 18:41:12 +00:00
|
|
|
Window root, window, desktop;
|
|
|
|
Drawable drawable;
|
2009-07-08 08:09:06 +00:00
|
|
|
Visual *visual;
|
|
|
|
Colormap colourmap;
|
2008-06-14 18:41:12 +00:00
|
|
|
GC gc;
|
2009-07-08 08:09:06 +00:00
|
|
|
long border_inner_margin, border_outer_margin, border_width;
|
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_XDBE
|
2008-06-14 18:41:12 +00:00
|
|
|
XdbeBackBuffer back_buffer;
|
|
|
|
#endif
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_XFT
|
2008-06-14 18:41:12 +00:00
|
|
|
XftDraw *xftdraw;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
#ifdef OWN_WINDOW
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
unsigned long hints;
|
|
|
|
#endif
|
2009-08-07 07:24:24 +00:00
|
|
|
};
|
2008-06-14 18:41:12 +00:00
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_XDBE
|
2008-06-14 18:41:12 +00:00
|
|
|
extern int use_xdbe;
|
|
|
|
#endif
|
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_XFT
|
2008-06-14 18:41:12 +00:00
|
|
|
extern int use_xft;
|
|
|
|
#endif
|
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#if defined(BUILD_ARGB) && defined(OWN_WINDOW)
|
2010-02-26 17:29:46 +00:00
|
|
|
/* true if use_argb_visual=true and argb visual was found*/
|
|
|
|
extern bool have_argb_visual;
|
2010-02-03 21:36:04 +00:00
|
|
|
#endif
|
2010-01-01 23:01:51 +00:00
|
|
|
|
2008-06-14 18:41:12 +00:00
|
|
|
extern Display *display;
|
|
|
|
extern int display_width;
|
|
|
|
extern int display_height;
|
|
|
|
extern int screen;
|
|
|
|
|
|
|
|
extern int workarea[4];
|
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
extern struct conky_window window;
|
2009-11-21 14:45:00 +00:00
|
|
|
extern char window_created;
|
2009-08-07 07:24:24 +00:00
|
|
|
|
2009-04-01 17:06:31 +00:00
|
|
|
void init_X11(const char*);
|
2010-02-26 17:38:15 +00:00
|
|
|
void init_window(int width, int height, int back_colour, char **argv, int argc);
|
2009-05-20 03:34:43 +00:00
|
|
|
void destroy_window(void);
|
2008-06-14 18:41:12 +00:00
|
|
|
void create_gc(void);
|
2010-02-27 21:28:33 +00:00
|
|
|
void set_transparent_background(Window win);
|
2009-07-14 14:57:51 +00:00
|
|
|
void get_x11_desktop_info(Display *display, Atom atom);
|
2009-06-13 21:36:28 +00:00
|
|
|
void set_struts(int);
|
2008-06-14 18:41:12 +00:00
|
|
|
|
2009-11-25 22:56:19 +00:00
|
|
|
void print_monitor(struct text_object *, char *, int);
|
|
|
|
void print_monitor_number(struct text_object *, char *, int);
|
|
|
|
void print_desktop(struct text_object *, char *, int);
|
|
|
|
void print_desktop_number(struct text_object *, char *, int);
|
|
|
|
void print_desktop_name(struct text_object *, char *, int);
|
2009-11-29 20:20:32 +00:00
|
|
|
void free_desktop_info(void);
|
2009-11-25 22:56:19 +00:00
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_XDBE
|
2009-08-05 21:41:29 +00:00
|
|
|
void xdbe_swap_buffers(void);
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_XDBE */
|
2009-08-05 21:41:29 +00:00
|
|
|
|
2010-02-24 19:51:33 +00:00
|
|
|
/* alignments */
|
|
|
|
enum alignment {
|
|
|
|
TOP_LEFT,
|
|
|
|
TOP_RIGHT,
|
|
|
|
TOP_MIDDLE,
|
|
|
|
BOTTOM_LEFT,
|
|
|
|
BOTTOM_RIGHT,
|
|
|
|
BOTTOM_MIDDLE,
|
|
|
|
MIDDLE_LEFT,
|
|
|
|
MIDDLE_MIDDLE,
|
|
|
|
MIDDLE_RIGHT,
|
|
|
|
NONE
|
|
|
|
};
|
|
|
|
|
2010-02-25 20:11:39 +00:00
|
|
|
extern conky::config_setting<alignment> text_alignment;
|
2010-02-25 21:28:34 +00:00
|
|
|
extern conky::config_setting<bool> out_to_x;
|
2010-02-24 19:51:33 +00:00
|
|
|
|
2010-02-26 13:37:34 +00:00
|
|
|
#ifdef OWN_WINDOW
|
|
|
|
extern conky::config_setting<bool> own_window;
|
2010-02-26 17:38:15 +00:00
|
|
|
extern conky::config_setting<bool> set_transparent;
|
2010-02-26 16:42:56 +00:00
|
|
|
extern conky::config_setting<std::string> own_window_class;
|
2010-02-26 17:09:55 +00:00
|
|
|
extern conky::config_setting<std::string> own_window_title;
|
2010-02-26 17:48:57 +00:00
|
|
|
extern conky::config_setting<window_type> own_window_type;
|
2010-02-26 17:29:46 +00:00
|
|
|
#ifdef BUILD_ARGB
|
|
|
|
extern conky::config_setting<bool> use_argb_visual;
|
2010-02-27 21:28:33 +00:00
|
|
|
|
|
|
|
/* range of 0-255 for alpha */
|
|
|
|
extern conky::config_setting<int, conky::range_checking_accessors<int>> own_window_argb_value;
|
2010-02-26 13:37:34 +00:00
|
|
|
#endif
|
2010-02-26 17:29:46 +00:00
|
|
|
#endif /*OWN_WINDOW*/
|
2010-02-26 13:37:34 +00:00
|
|
|
|
2008-06-14 18:41:12 +00:00
|
|
|
#endif /*X11_H_*/
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|