mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-15 17:47:09 +00:00
Apply clang-format
.
This commit is contained in:
parent
4e1e815fdd
commit
a39015b7bd
@ -34,7 +34,8 @@ void colour_setting::lua_setter(lua::state &l, bool init) {
|
||||
}
|
||||
} // namespace priv
|
||||
|
||||
priv::colour_setting color[COLORS_CUSTOM] = {{"color0", white_argb32}, {"color1", white_argb32},
|
||||
priv::colour_setting color[COLORS_CUSTOM] = {
|
||||
{"color0", white_argb32}, {"color1", white_argb32},
|
||||
{"color2", white_argb32}, {"color3", white_argb32},
|
||||
{"color4", white_argb32}, {"color5", white_argb32},
|
||||
{"color6", white_argb32}, {"color7", white_argb32},
|
||||
|
@ -23,8 +23,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#include "colours.h"
|
||||
#include "config.h"
|
||||
#include "setting.hh"
|
||||
|
||||
namespace priv {
|
||||
|
@ -29,10 +29,10 @@
|
||||
#ifndef _COLOURS_H
|
||||
#define _COLOURS_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#ifdef BUILD_X11
|
||||
#include "x11.h"
|
||||
#endif /* BUILD_X11 */
|
||||
|
12
src/conky.cc
12
src/conky.cc
@ -1432,16 +1432,22 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) {
|
||||
break;
|
||||
#endif /* BUILD_GUI */
|
||||
case FG:
|
||||
if (draw_mode == FG) { set_foreground_color(Colour::from_argb32(current->arg)); }
|
||||
if (draw_mode == FG) {
|
||||
set_foreground_color(Colour::from_argb32(current->arg));
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef BUILD_GUI
|
||||
case BG:
|
||||
if (draw_mode == BG) { set_foreground_color(Colour::from_argb32(current->arg)); }
|
||||
if (draw_mode == BG) {
|
||||
set_foreground_color(Colour::from_argb32(current->arg));
|
||||
}
|
||||
break;
|
||||
|
||||
case OUTLINE:
|
||||
if (draw_mode == OUTLINE) { set_foreground_color(Colour::from_argb32(current->arg)); }
|
||||
if (draw_mode == OUTLINE) {
|
||||
set_foreground_color(Colour::from_argb32(current->arg));
|
||||
}
|
||||
break;
|
||||
|
||||
case OFFSET:
|
||||
|
@ -37,9 +37,9 @@
|
||||
#include <sys/utsname.h> /* struct uname_s */
|
||||
#include <csignal>
|
||||
#include <memory>
|
||||
#include "colours.h"
|
||||
#include "common.h" /* at least for struct dns_data */
|
||||
#include "luamm.hh"
|
||||
#include "colours.h"
|
||||
|
||||
#if defined(HAS_MCHECK_H)
|
||||
#include <mcheck.h>
|
||||
|
32
src/core.cc
32
src/core.cc
@ -32,8 +32,8 @@
|
||||
#include "algebra.h"
|
||||
#include "bsdapm.h"
|
||||
#include "build.h"
|
||||
#include "colours.h"
|
||||
#include "colour-settings.h"
|
||||
#include "colours.h"
|
||||
#include "combine.h"
|
||||
#include "diskio.h"
|
||||
#include "entropy.h"
|
||||
@ -767,34 +767,44 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
obj->callbacks.print = &new_fg;
|
||||
#ifdef BUILD_GUI
|
||||
END OBJ(color0, nullptr) Colour c = color[0].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color1, nullptr) Colour c = color[1].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color2, nullptr) Colour c = color[2].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color3, nullptr) Colour c = color[3].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color4, nullptr) Colour c = color[4].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color5, nullptr) Colour c = color[5].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color6, nullptr) Colour c = color[6].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color7, nullptr) Colour c = color[7].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color8, nullptr) Colour c = color[8].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(color9, nullptr) Colour c = color[9].get(*state);
|
||||
obj->data.l = c.to_argb32(); set_current_text_color(c);
|
||||
obj->data.l = c.to_argb32();
|
||||
set_current_text_color(c);
|
||||
obj->callbacks.print = &new_fg;
|
||||
END OBJ(font, nullptr) scan_font(obj, arg);
|
||||
obj->callbacks.print = &new_font;
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "conky.h"
|
||||
#include "colours.h"
|
||||
#include "conky.h"
|
||||
#include "display-ncurses.hh"
|
||||
#include "gui.h"
|
||||
#include "nc.h"
|
||||
@ -81,8 +81,7 @@ Colour ncurses_colors[COLORS_BUILTIN + COLORS_CUSTOM] = {
|
||||
int best_nccolor = 0;
|
||||
for (int nccolor = 0; nccolor < COLORS_BUILTIN + COLORS_CUSTOM; nccolor++) {
|
||||
const Colour& other = ncurses_colors[nccolor];
|
||||
int diff = abs(c.red - other.red) +
|
||||
abs(c.green - other.green) +
|
||||
int diff = abs(c.red - other.red) + abs(c.green - other.green) +
|
||||
abs(c.blue - other.blue);
|
||||
|
||||
if (diff < mindiff) {
|
||||
@ -116,7 +115,8 @@ bool display_output_ncurses::detect() {
|
||||
bool display_output_ncurses::initialize() {
|
||||
for (int i = 0; i < COLORS_CUSTOM; i++) {
|
||||
Colour c = color[i].get(*state);
|
||||
init_color(COLORS_BUILTIN + i, (1000*c.red)/255, (1000*c.green)/255, (1000*c.blue)/255);
|
||||
init_color(COLORS_BUILTIN + i, (1000 * c.red) / 255, (1000 * c.green) / 255,
|
||||
(1000 * c.blue) / 255);
|
||||
ncurses_colors[COLORS_BUILTIN + i] = c;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "luamm.hh"
|
||||
#include "colours.h"
|
||||
#include "luamm.hh"
|
||||
|
||||
namespace conky {
|
||||
|
||||
|
@ -523,9 +523,9 @@ bool display_output_wayland::main_loop_wait(double t) {
|
||||
bool scale_changed = global_window->scale != global_window->pending_scale;
|
||||
|
||||
/* resize window if it isn't right size */
|
||||
if ((fixed_size == 0) && (text_width + 2 * border_total != width ||
|
||||
text_height + 2 * border_total != height ||
|
||||
scale_changed)) {
|
||||
if ((fixed_size == 0) &&
|
||||
(text_width + 2 * border_total != width ||
|
||||
text_height + 2 * border_total != height || scale_changed)) {
|
||||
/* clamp text_width to configured maximum */
|
||||
if (maximum_width.get(*state)) {
|
||||
int mw = global_window->scale * maximum_width.get(*state);
|
||||
@ -671,8 +671,7 @@ void display_output_wayland::set_foreground_color(Colour c) {
|
||||
current_color.alpha = own_window_argb_value.get(*state);
|
||||
#endif /* BUILD_ARGB */
|
||||
if (global_window->cr) {
|
||||
cairo_set_source_rgba(global_window->cr,
|
||||
current_color.red / 255.0,
|
||||
cairo_set_source_rgba(global_window->cr, current_color.red / 255.0,
|
||||
current_color.green / 255.0,
|
||||
current_color.blue / 255.0,
|
||||
current_color.alpha / 255.0);
|
||||
@ -813,11 +812,8 @@ void display_output_wayland::clear_text(int exposures) {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
cairo_set_source_rgba(window->cr,
|
||||
color.red / 255.0,
|
||||
color.green / 255.0,
|
||||
color.blue / 255.0,
|
||||
color.alpha / 255.0);
|
||||
cairo_set_source_rgba(window->cr, color.red / 255.0, color.green / 255.0,
|
||||
color.blue / 255.0, color.alpha / 255.0);
|
||||
cairo_set_operator(window->cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint(window->cr);
|
||||
cairo_restore(window->cr);
|
||||
@ -841,7 +837,8 @@ int display_output_wayland::font_descent(unsigned int f) {
|
||||
return pango_fonts[f].metrics.descent;
|
||||
}
|
||||
|
||||
void display_output_wayland::setup_fonts(void) { /* Nothing to do here */ }
|
||||
void display_output_wayland::setup_fonts(void) { /* Nothing to do here */
|
||||
}
|
||||
|
||||
void display_output_wayland::set_font(unsigned int f) {
|
||||
assert(f < pango_fonts.size());
|
||||
@ -1045,8 +1042,8 @@ void window_allocate_buffer(struct window *window) {
|
||||
|
||||
int scale = window->pending_scale;
|
||||
struct shm_pool *pool;
|
||||
pool = shm_pool_create(window->shm, data_length_for_shm_surface(
|
||||
&window->rectangle, scale));
|
||||
pool = shm_pool_create(
|
||||
window->shm, data_length_for_shm_surface(&window->rectangle, scale));
|
||||
if (!pool) {
|
||||
fprintf(stderr, "could not allocate shm pool\n");
|
||||
return;
|
||||
@ -1127,7 +1124,8 @@ void window_resize(struct window *window, int width, int height) {
|
||||
|
||||
void window_commit_buffer(struct window *window) {
|
||||
assert(window->cairo_surface != nullptr);
|
||||
wl_surface_set_buffer_scale(global_window->surface, global_window->pending_scale);
|
||||
wl_surface_set_buffer_scale(global_window->surface,
|
||||
global_window->pending_scale);
|
||||
wl_surface_attach(window->surface,
|
||||
get_buffer_from_cairo_surface(window->cairo_surface), 0, 0);
|
||||
/* repaint all the pixels in the surface, change size to only repaint changed
|
||||
|
@ -51,8 +51,8 @@
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "conky.h"
|
||||
#include "colours.h"
|
||||
#include "conky.h"
|
||||
#include "display-x11.hh"
|
||||
#include "gui.h"
|
||||
#include "llua.h"
|
||||
@ -612,7 +612,8 @@ void display_output_x11::set_foreground_color(Colour c) {
|
||||
current_color.alpha = own_window_argb_value.get(*state);
|
||||
}
|
||||
#endif /* BUILD_ARGB */
|
||||
XSetForeground(display, window.gc, current_color.to_x11_color(display, screen));
|
||||
XSetForeground(display, window.gc,
|
||||
current_color.to_x11_color(display, screen));
|
||||
}
|
||||
|
||||
int display_output_x11::calc_text_width(const char *s) {
|
||||
|
@ -599,7 +599,6 @@ void x11_init_window(lua::state &l __attribute__((unused)), bool own) {
|
||||
0,
|
||||
0};
|
||||
|
||||
|
||||
XWMHints wmHint;
|
||||
Atom xa;
|
||||
|
||||
@ -630,7 +629,8 @@ void x11_init_window(lua::state &l __attribute__((unused)), bool own) {
|
||||
if (own_window_type.get(l) == TYPE_UTILITY) {
|
||||
XRectangle rect;
|
||||
XserverRegion region = XFixesCreateRegion(display, &rect, 1);
|
||||
XFixesSetWindowShapeRegion(display, window.window, ShapeInput, 0, 0, region);
|
||||
XFixesSetWindowShapeRegion(display, window.window, ShapeInput, 0, 0,
|
||||
region);
|
||||
XFixesDestroyRegion(display, region);
|
||||
}
|
||||
#endif /* BUILD_XFIXES */
|
||||
|
Loading…
Reference in New Issue
Block a user