mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-28 01:28:30 +00:00
Apply clang-format.
This commit is contained in:
parent
cf16110c7a
commit
76b0f049bc
@ -27,8 +27,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
#include "logging.h"
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
#include "logging.h"
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
#include "x11.h"
|
#include "x11.h"
|
||||||
#endif /*BUILD_X11*/
|
#endif /*BUILD_X11*/
|
||||||
@ -87,59 +87,54 @@ unsigned int adjust_colours(unsigned int colour) {
|
|||||||
return colour;
|
return colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
#ifdef BUILD_WAYLAND
|
#ifdef BUILD_WAYLAND
|
||||||
static int hex_nibble_value(char c) {
|
static int hex_nibble_value(char c) {
|
||||||
if (c >= '0' && c <= '9') {
|
if (c >= '0' && c <= '9') {
|
||||||
return c - '0';
|
return c - '0';
|
||||||
} else if (c >= 'a' && c <= 'f') {
|
} else if (c >= 'a' && c <= 'f') {
|
||||||
return c - 'a' + 10;
|
return c - 'a' + 10;
|
||||||
} else if (c >= 'A' && c <= 'F') {
|
} else if (c >= 'A' && c <= 'F') {
|
||||||
return c - 'A' + 10;
|
return c - 'A' + 10;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
long manually_get_x11_color(const char *name) {
|
long manually_get_x11_color(const char *name) {
|
||||||
unsigned short r, g, b;
|
unsigned short r, g, b;
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
if (OsLookupColor(-1, name, len, &r, &g, &b)) {
|
if (OsLookupColor(-1, name, len, &r, &g, &b)) {
|
||||||
return 0x000000ff | ((r & 0xff) << 24) | ((g & 0xff) << 16) | ((b & 0xff) << 8);
|
return 0x000000ff | ((r & 0xff) << 24) | ((g & 0xff) << 16) |
|
||||||
}
|
((b & 0xff) << 8);
|
||||||
if (name[0] == '#') {
|
}
|
||||||
name++;
|
if (name[0] == '#') {
|
||||||
len--;
|
name++;
|
||||||
}
|
len--;
|
||||||
if (len == 6 || len == 8)
|
}
|
||||||
{
|
if (len == 6 || len == 8) {
|
||||||
unsigned char argb[4] = {0xff, 0, 0, 0};
|
unsigned char argb[4] = {0xff, 0, 0, 0};
|
||||||
for (size_t i = 0; i + 1 < len; i += 2) {
|
for (size_t i = 0; i + 1 < len; i += 2) {
|
||||||
int nib1 = hex_nibble_value(name[i]);
|
int nib1 = hex_nibble_value(name[i]);
|
||||||
int nib2 = hex_nibble_value(name[i+1]);
|
int nib2 = hex_nibble_value(name[i + 1]);
|
||||||
if (nib1 < 0 || nib2 < 0) {
|
if (nib1 < 0 || nib2 < 0) { goto err; }
|
||||||
goto err;
|
int val = (nib1 << 4) + nib2;
|
||||||
}
|
|
||||||
int val = (nib1 << 4) + nib2;
|
|
||||||
|
|
||||||
argb[3 - i / 2] = val;
|
argb[3 - i / 2] = val;
|
||||||
}
|
|
||||||
long out;
|
|
||||||
memcpy(static_cast<void*>(&out), argb, 4);
|
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
err:
|
long out;
|
||||||
NORM_ERR("can't parse X color '%s' (%d)", name, len);
|
memcpy(static_cast<void *>(&out), argb, 4);
|
||||||
return 0xFF00FF;
|
return out;
|
||||||
|
}
|
||||||
|
err:
|
||||||
|
NORM_ERR("can't parse X color '%s' (%d)", name, len);
|
||||||
|
return 0xFF00FF;
|
||||||
}
|
}
|
||||||
#endif /* BUILD_WAYLAND */
|
#endif /* BUILD_WAYLAND */
|
||||||
|
|
||||||
long get_x11_color(const char *name) {
|
long get_x11_color(const char *name) {
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
#ifdef BUILD_WAYLAND
|
#ifdef BUILD_WAYLAND
|
||||||
if (!display) {
|
if (!display) { return manually_get_x11_color(name); }
|
||||||
return manually_get_x11_color(name);
|
|
||||||
}
|
|
||||||
#endif /*BUILD_WAYLAND*/
|
#endif /*BUILD_WAYLAND*/
|
||||||
assert(display != nullptr);
|
assert(display != nullptr);
|
||||||
XColor color;
|
XColor color;
|
||||||
|
45
src/conky.cc
45
src/conky.cc
@ -154,7 +154,7 @@ const char builtin_config_magic[] = "==builtin==";
|
|||||||
|
|
||||||
#define MAX_IF_BLOCK_DEPTH 5
|
#define MAX_IF_BLOCK_DEPTH 5
|
||||||
|
|
||||||
//#define SIGNAL_BLOCKING
|
// #define SIGNAL_BLOCKING
|
||||||
#undef SIGNAL_BLOCKING
|
#undef SIGNAL_BLOCKING
|
||||||
|
|
||||||
/* debugging level, used by logging.h */
|
/* debugging level, used by logging.h */
|
||||||
@ -764,9 +764,7 @@ int get_border_total() {
|
|||||||
dpi_scale(border_width.get(*state));
|
dpi_scale(border_width.get(*state));
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_first_char(char* s) {
|
void remove_first_char(char *s) { memmove(s, s + 1, strlen(s)); }
|
||||||
memmove(s, s + 1, strlen(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int get_string_width_special(char *s, int special_index) {
|
static int get_string_width_special(char *s, int special_index) {
|
||||||
char *p, *final;
|
char *p, *final;
|
||||||
@ -1559,30 +1557,29 @@ static void draw_text() {
|
|||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
// XXX:only works if inside set_display_output()
|
// XXX:only works if inside set_display_output()
|
||||||
for (auto output : display_outputs()) {
|
for (auto output : display_outputs()) {
|
||||||
if (output && output->graphical()) {
|
if (output && output->graphical()) {
|
||||||
cur_y = text_start_y;
|
cur_y = text_start_y;
|
||||||
int bw = dpi_scale(border_width.get(*state));
|
int bw = dpi_scale(border_width.get(*state));
|
||||||
|
|
||||||
/* draw borders */
|
/* draw borders */
|
||||||
if (draw_borders.get(*state) && bw > 0) {
|
if (draw_borders.get(*state) && bw > 0) {
|
||||||
if (stippled_borders.get(*state) != 0) {
|
if (stippled_borders.get(*state) != 0) {
|
||||||
char ss[2] = {(char)dpi_scale(stippled_borders.get(*state)),
|
char ss[2] = {(char)dpi_scale(stippled_borders.get(*state)),
|
||||||
(char)dpi_scale(stippled_borders.get(*state))};
|
(char)dpi_scale(stippled_borders.get(*state))};
|
||||||
output->set_line_style(bw, false);
|
output->set_line_style(bw, false);
|
||||||
output->set_dashes(ss);
|
output->set_dashes(ss);
|
||||||
} else {
|
} else {
|
||||||
output->set_line_style(bw, true);
|
output->set_line_style(bw, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int offset = dpi_scale(border_inner_margin.get(*state)) + bw;
|
||||||
|
output->draw_rect(text_offset_x + text_start_x - offset,
|
||||||
|
text_offset_y + text_start_y - offset,
|
||||||
|
text_width + 2 * offset, text_height + 2 * offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = dpi_scale(border_inner_margin.get(*state)) + bw;
|
/* draw text */
|
||||||
output->draw_rect(text_offset_x + text_start_x - offset,
|
|
||||||
text_offset_y + text_start_y - offset,
|
|
||||||
text_width + 2 * offset,
|
|
||||||
text_height + 2 * offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw text */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setup_fonts();
|
setup_fonts();
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
|
@ -54,8 +54,8 @@
|
|||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
#endif /* BUILD_IRC */
|
#endif /* BUILD_IRC */
|
||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
#include "gui.h"
|
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
|
#include "gui.h"
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#ifdef BUILD_IBM
|
#ifdef BUILD_IBM
|
||||||
@ -750,7 +750,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
|||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(color, nullptr)
|
END OBJ(color, nullptr)
|
||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
if (out_to_gui(*state)) {
|
if (out_to_gui(*state)) {
|
||||||
obj->data.l =
|
obj->data.l =
|
||||||
arg != nullptr ? get_x11_color(arg) : default_color.get(*state);
|
arg != nullptr ? get_x11_color(arg) : default_color.get(*state);
|
||||||
set_current_text_color(obj->data.l);
|
set_current_text_color(obj->data.l);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -59,7 +59,7 @@ class display_output_wayland : public display_output_base {
|
|||||||
virtual int calc_text_width(const char *);
|
virtual int calc_text_width(const char *);
|
||||||
|
|
||||||
// GUI interface
|
// GUI interface
|
||||||
virtual void draw_string_at(int, int, const char *, int );
|
virtual void draw_string_at(int, int, const char *, int);
|
||||||
// X11 lookalikes
|
// X11 lookalikes
|
||||||
virtual void set_line_style(int, bool);
|
virtual void set_line_style(int, bool);
|
||||||
virtual void set_dashes(char *);
|
virtual void set_dashes(char *);
|
||||||
|
@ -49,9 +49,9 @@
|
|||||||
|
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
#include "display-x11.hh"
|
#include "display-x11.hh"
|
||||||
|
#include "gui.h"
|
||||||
#include "llua.h"
|
#include "llua.h"
|
||||||
#include "x11.h"
|
#include "x11.h"
|
||||||
#include "gui.h"
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#endif
|
#endif
|
||||||
@ -140,9 +140,7 @@ struct _x11_stuff_s {
|
|||||||
} x11_stuff;
|
} x11_stuff;
|
||||||
|
|
||||||
static void X11_create_window() {
|
static void X11_create_window() {
|
||||||
if (!window.window) {
|
if (!window.window) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
setup_fonts();
|
setup_fonts();
|
||||||
load_fonts(utf8_mode.get(*state));
|
load_fonts(utf8_mode.get(*state));
|
||||||
#ifdef BUILD_XFT
|
#ifdef BUILD_XFT
|
||||||
@ -225,8 +223,7 @@ bool display_output_x11::shutdown() { return false; }
|
|||||||
|
|
||||||
bool display_output_x11::main_loop_wait(double t) {
|
bool display_output_x11::main_loop_wait(double t) {
|
||||||
/* wait for X event or timeout */
|
/* wait for X event or timeout */
|
||||||
if(!display || !window.gc)
|
if (!display || !window.gc) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
if (XPending(display) == 0) {
|
if (XPending(display) == 0) {
|
||||||
fd_set fdsr;
|
fd_set fdsr;
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#include "gui.h"
|
|
||||||
#include "display-output.hh"
|
#include "display-output.hh"
|
||||||
|
#include "gui.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|
||||||
unsigned int selected_font = 0;
|
unsigned int selected_font = 0;
|
||||||
@ -86,16 +86,16 @@ void load_fonts(bool utf8) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int font_height() {
|
int font_height() {
|
||||||
//assert(selected_font < fonts.size());
|
// assert(selected_font < fonts.size());
|
||||||
return display_output()->font_height(selected_font);
|
return display_output()->font_height(selected_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
int font_ascent() {
|
int font_ascent() {
|
||||||
//assert(selected_font < fonts.size());
|
// assert(selected_font < fonts.size());
|
||||||
return display_output()->font_ascent(selected_font);
|
return display_output()->font_ascent(selected_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
int font_descent() {
|
int font_descent() {
|
||||||
//assert(selected_font < fonts.size());
|
// assert(selected_font < fonts.size());
|
||||||
return display_output()->font_descent(selected_font);
|
return display_output()->font_descent(selected_font);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ int check_mount(struct text_object *obj) {
|
|||||||
|
|
||||||
int update_meminfo(void) {
|
int update_meminfo(void) {
|
||||||
u_int total_pages, inactive_pages, free_pages, wire_pages, active_pages,
|
u_int total_pages, inactive_pages, free_pages, wire_pages, active_pages,
|
||||||
bufferspace, laundry_pages;
|
bufferspace, laundry_pages;
|
||||||
unsigned long swap_avail, swap_free;
|
unsigned long swap_avail, swap_free;
|
||||||
|
|
||||||
int pagesize = getpagesize();
|
int pagesize = getpagesize();
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
#include "x11.h"
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
#include "x11.h"
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
namespace conky {
|
namespace conky {
|
||||||
|
@ -27,11 +27,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "gui.h"
|
|
||||||
#include "wl.h"
|
#include "wl.h"
|
||||||
|
|
||||||
#ifdef BUILD_IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
@ -63,7 +63,6 @@ void x11_init_window(lua::state &l, bool own);
|
|||||||
|
|
||||||
/********************* <SETTINGS> ************************/
|
/********************* <SETTINGS> ************************/
|
||||||
|
|
||||||
|
|
||||||
priv::colour_setting background_colour("own_window_colour", 0);
|
priv::colour_setting background_colour("own_window_colour", 0);
|
||||||
|
|
||||||
bool out_to_gui(lua::state &l) {
|
bool out_to_gui(lua::state &l) {
|
||||||
@ -192,8 +191,8 @@ std::string gethostnamecxx() {
|
|||||||
/*
|
/*
|
||||||
* The order of these settings cannot be completely arbitrary. Some of them
|
* The order of these settings cannot be completely arbitrary. Some of them
|
||||||
* depend on others, and the setters are called in the order in which they are
|
* depend on others, and the setters are called in the order in which they are
|
||||||
* defined. The order should be: x11_display_name -> out_to_x -> everything colour
|
* defined. The order should be: x11_display_name -> out_to_x -> everything
|
||||||
* related
|
* colour related
|
||||||
* -> border_*, own_window_*, etc -> own_window ->
|
* -> border_*, own_window_*, etc -> own_window ->
|
||||||
* double_buffer -> imlib_cache_size
|
* double_buffer -> imlib_cache_size
|
||||||
*/
|
*/
|
||||||
|
@ -70,8 +70,7 @@ void imlib_cache_size_setting::lua_setter(lua::state &l, bool init) {
|
|||||||
|
|
||||||
Base::lua_setter(l, init);
|
Base::lua_setter(l, init);
|
||||||
|
|
||||||
if (display == nullptr || window.visual == nullptr)
|
if (display == nullptr || window.visual == nullptr) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (init && out_to_x.get(l)) {
|
if (init && out_to_x.get(l)) {
|
||||||
image_list_start = image_list_end = nullptr;
|
image_list_start = image_list_end = nullptr;
|
||||||
|
@ -578,8 +578,7 @@ void update_net_interfaces(FILE *net_dev_fp, bool is_first_update,
|
|||||||
for (unsigned int k = 0; k < conf.ifc_len / sizeof(struct ifreq); k++) {
|
for (unsigned int k = 0; k < conf.ifc_len / sizeof(struct ifreq); k++) {
|
||||||
struct net_stat *ns2;
|
struct net_stat *ns2;
|
||||||
|
|
||||||
ns2 = get_net_stat(conf.ifc_req[k].ifr_ifrn.ifrn_name,
|
ns2 = get_net_stat(conf.ifc_req[k].ifr_ifrn.ifrn_name, nullptr, NULL);
|
||||||
nullptr, NULL);
|
|
||||||
ns2->addr = conf.ifc_req[k].ifr_ifru.ifru_addr;
|
ns2->addr = conf.ifc_req[k].ifr_ifru.ifru_addr;
|
||||||
char temp_addr[18];
|
char temp_addr[18];
|
||||||
snprintf(temp_addr, sizeof(temp_addr), "%u.%u.%u.%u, ",
|
snprintf(temp_addr, sizeof(temp_addr), "%u.%u.%u.%u, ",
|
||||||
|
@ -370,9 +370,7 @@ const int MAXNUMGPU = 64;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Deleter for nv display to use with std::unique_ptr
|
// Deleter for nv display to use with std::unique_ptr
|
||||||
void close_nvdisplay(Display * dp) {
|
void close_nvdisplay(Display *dp) { XCloseDisplay(dp); }
|
||||||
XCloseDisplay(dp);
|
|
||||||
}
|
|
||||||
|
|
||||||
using unique_display_t = std::unique_ptr<Display, decltype(&close_nvdisplay)>;
|
using unique_display_t = std::unique_ptr<Display, decltype(&close_nvdisplay)>;
|
||||||
|
|
||||||
@ -758,7 +756,7 @@ static int cache_nvidia_value(TARGET_ID tid, ATTR_ID aid, Display *dpy,
|
|||||||
static int get_nvidia_value(TARGET_ID tid, ATTR_ID aid, int gid,
|
static int get_nvidia_value(TARGET_ID tid, ATTR_ID aid, int gid,
|
||||||
const char *arg) {
|
const char *arg) {
|
||||||
auto nvdpy = nvidia_display.get_nvdisplay();
|
auto nvdpy = nvidia_display.get_nvdisplay();
|
||||||
Display * dpy = nvdpy ? nvdpy.get() : display;
|
Display *dpy = nvdpy ? nvdpy.get() : display;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
// Check if the aid is cacheable
|
// Check if the aid is cacheable
|
||||||
@ -789,7 +787,7 @@ static int get_nvidia_value(TARGET_ID tid, ATTR_ID aid, int gid,
|
|||||||
static char *get_nvidia_string(TARGET_ID tid, ATTR_ID aid, int gid,
|
static char *get_nvidia_string(TARGET_ID tid, ATTR_ID aid, int gid,
|
||||||
const char *arg) {
|
const char *arg) {
|
||||||
auto nvdpy = nvidia_display.get_nvdisplay();
|
auto nvdpy = nvidia_display.get_nvdisplay();
|
||||||
Display * dpy = nvdpy ? nvdpy.get() : display;
|
Display *dpy = nvdpy ? nvdpy.get() : display;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
// Query nvidia interface
|
// Query nvidia interface
|
||||||
@ -962,7 +960,7 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
|||||||
int error_base;
|
int error_base;
|
||||||
|
|
||||||
auto nvdpy = nvidia_display.get_nvdisplay();
|
auto nvdpy = nvidia_display.get_nvdisplay();
|
||||||
Display * dpy = nvdpy ? nvdpy.get() : display;
|
Display *dpy = nvdpy ? nvdpy.get() : display;
|
||||||
|
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
NORM_ERR("%s: no display set (try setting nvidia_display)", __func__);
|
NORM_ERR("%s: no display set (try setting nvidia_display)", __func__);
|
||||||
@ -1066,7 +1064,7 @@ double get_nvidia_barval(struct text_object *obj) {
|
|||||||
int error_base;
|
int error_base;
|
||||||
|
|
||||||
auto nvdpy = nvidia_display.get_nvdisplay();
|
auto nvdpy = nvidia_display.get_nvdisplay();
|
||||||
Display * dpy = nvdpy ? nvdpy.get() : display;
|
Display *dpy = nvdpy ? nvdpy.get() : display;
|
||||||
|
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
NORM_ERR("%s: no display set (try setting nvidia_display)", __func__);
|
NORM_ERR("%s: no display set (try setting nvidia_display)", __func__);
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
#include "gui.h"
|
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
|
#include "gui.h"
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
@ -99,9 +99,7 @@ static void unhash_all_processes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct process *get_first_process() {
|
struct process *get_first_process() { return first_process; }
|
||||||
return first_process;
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_all_processes() {
|
void free_all_processes() {
|
||||||
struct process *next = nullptr, *pr = first_process;
|
struct process *next = nullptr, *pr = first_process;
|
||||||
|
22
src/wl.cc
22
src/wl.cc
@ -42,7 +42,7 @@ void out_to_wayland_setting::lua_setter(lua::state &l, bool init) {
|
|||||||
Base::lua_setter(l, init);
|
Base::lua_setter(l, init);
|
||||||
|
|
||||||
if (init && do_convert(l, -1).first) {
|
if (init && do_convert(l, -1).first) {
|
||||||
//init
|
// init
|
||||||
}
|
}
|
||||||
|
|
||||||
++s;
|
++s;
|
||||||
@ -52,7 +52,7 @@ void out_to_wayland_setting::cleanup(lua::state &l) {
|
|||||||
lua::stack_sentry s(l, -1);
|
lua::stack_sentry s(l, -1);
|
||||||
|
|
||||||
if (do_convert(l, -1).first) {
|
if (do_convert(l, -1).first) {
|
||||||
//deinit
|
// deinit
|
||||||
}
|
}
|
||||||
|
|
||||||
l.pop();
|
l.pop();
|
||||||
@ -63,7 +63,8 @@ priv::out_to_wayland_setting out_to_wayland;
|
|||||||
|
|
||||||
static const char NOT_IN_WAYLAND[] = "Not running in Wayland";
|
static const char NOT_IN_WAYLAND[] = "Not running in Wayland";
|
||||||
|
|
||||||
__attribute__((weak)) void print_monitor(struct text_object *obj, char *p, unsigned int p_max_size) {
|
__attribute__((weak)) void print_monitor(struct text_object *obj, char *p,
|
||||||
|
unsigned int p_max_size) {
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if (!out_to_wayland.get(*state)) {
|
if (!out_to_wayland.get(*state)) {
|
||||||
@ -73,8 +74,9 @@ __attribute__((weak)) void print_monitor(struct text_object *obj, char *p, unsig
|
|||||||
snprintf(p, p_max_size, "%d", -1);
|
snprintf(p, p_max_size, "%d", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) void print_monitor_number(struct text_object *obj, char *p,
|
__attribute__((weak)) void print_monitor_number(struct text_object *obj,
|
||||||
unsigned int p_max_size) {
|
char *p,
|
||||||
|
unsigned int p_max_size) {
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if (!out_to_wayland.get(*state)) {
|
if (!out_to_wayland.get(*state)) {
|
||||||
@ -84,7 +86,8 @@ __attribute__((weak)) void print_monitor_number(struct text_object *obj, char *p
|
|||||||
snprintf(p, p_max_size, "%d", -1);
|
snprintf(p, p_max_size, "%d", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) void print_desktop(struct text_object *obj, char *p, unsigned int p_max_size) {
|
__attribute__((weak)) void print_desktop(struct text_object *obj, char *p,
|
||||||
|
unsigned int p_max_size) {
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if (!out_to_wayland.get(*state)) {
|
if (!out_to_wayland.get(*state)) {
|
||||||
@ -94,8 +97,9 @@ __attribute__((weak)) void print_desktop(struct text_object *obj, char *p, unsig
|
|||||||
snprintf(p, p_max_size, "%d", -1);
|
snprintf(p, p_max_size, "%d", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) void print_desktop_number(struct text_object *obj, char *p,
|
__attribute__((weak)) void print_desktop_number(struct text_object *obj,
|
||||||
unsigned int p_max_size) {
|
char *p,
|
||||||
|
unsigned int p_max_size) {
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if (!out_to_wayland.get(*state)) {
|
if (!out_to_wayland.get(*state)) {
|
||||||
@ -106,7 +110,7 @@ __attribute__((weak)) void print_desktop_number(struct text_object *obj, char *p
|
|||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) void print_desktop_name(struct text_object *obj, char *p,
|
__attribute__((weak)) void print_desktop_name(struct text_object *obj, char *p,
|
||||||
unsigned int p_max_size) {
|
unsigned int p_max_size) {
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if (!out_to_wayland.get(*state)) {
|
if (!out_to_wayland.get(*state)) {
|
||||||
|
1580
src/x11-color.cc
1580
src/x11-color.cc
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,4 @@
|
|||||||
/* from xorg-server's oscolor.c */
|
/* from xorg-server's oscolor.c */
|
||||||
int OsLookupColor(int screen, const char *name, unsigned int len,
|
int OsLookupColor(int screen, const char *name, unsigned int len,
|
||||||
unsigned short *pred,
|
unsigned short *pred, unsigned short *pgreen,
|
||||||
unsigned short *pgreen,
|
|
||||||
unsigned short *pblue);
|
unsigned short *pblue);
|
||||||
|
11
src/x11.cc
11
src/x11.cc
@ -231,8 +231,8 @@ static void init_X11() {
|
|||||||
? dispstr.c_str()
|
? dispstr.c_str()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
if ((display = XOpenDisplay(disp)) == nullptr) {
|
if ((display = XOpenDisplay(disp)) == nullptr) {
|
||||||
std::string err = std::string("can't open display: ") +
|
std::string err =
|
||||||
XDisplayName(disp);
|
std::string("can't open display: ") + XDisplayName(disp);
|
||||||
#ifdef BUILD_WAYLAND
|
#ifdef BUILD_WAYLAND
|
||||||
fprintf(stderr, "%s\n", err.c_str());
|
fprintf(stderr, "%s\n", err.c_str());
|
||||||
return;
|
return;
|
||||||
@ -326,8 +326,7 @@ static Window find_desktop_window(Window *p_root, Window *p_desktop) {
|
|||||||
int format, i;
|
int format, i;
|
||||||
unsigned long nitems, bytes;
|
unsigned long nitems, bytes;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
if (!display)
|
if (!display) return 0;
|
||||||
return 0;
|
|
||||||
Window root = RootWindow(display, screen);
|
Window root = RootWindow(display, screen);
|
||||||
Window win;
|
Window win;
|
||||||
Window troot, parent, *children;
|
Window troot, parent, *children;
|
||||||
@ -803,9 +802,7 @@ void x11_init_window(lua::state &l __attribute__((unused)), bool own) {
|
|||||||
if (window.window == 0u) {
|
if (window.window == 0u) {
|
||||||
window.window = find_desktop_window(&window.root, &window.desktop);
|
window.window = find_desktop_window(&window.root, &window.desktop);
|
||||||
}
|
}
|
||||||
if (window.window == 0u) {
|
if (window.window == 0u) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.visual = DefaultVisual(display, screen);
|
window.visual = DefaultVisual(display, screen);
|
||||||
window.colourmap = DefaultColormap(display, screen);
|
window.colourmap = DefaultColormap(display, screen);
|
||||||
|
@ -77,7 +77,7 @@ struct conky_x11_window {
|
|||||||
|
|
||||||
#ifdef BUILD_XDBE
|
#ifdef BUILD_XDBE
|
||||||
XdbeBackBuffer back_buffer;
|
XdbeBackBuffer back_buffer;
|
||||||
#else /*BUILD_XDBE*/
|
#else /*BUILD_XDBE*/
|
||||||
Pixmap back_buffer;
|
Pixmap back_buffer;
|
||||||
#endif /*BUILD_XDBE*/
|
#endif /*BUILD_XDBE*/
|
||||||
#ifdef BUILD_XFT
|
#ifdef BUILD_XFT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user