Improve whitespace handling
This commit is contained in:
parent
fc4f0a4238
commit
bd8fd8b1d2
24
src/dbus.c
24
src/dbus.c
@ -114,7 +114,7 @@ static void on_get_capabilities(GDBusConnection *connection,
|
||||
g_variant_builder_add(builder, "s", "body");
|
||||
g_variant_builder_add(builder, "s", "body-hyperlinks");
|
||||
|
||||
if(settings.markup != MARKUP_NO)
|
||||
if (settings.markup != MARKUP_NO)
|
||||
g_variant_builder_add(builder, "s", "body-markup");
|
||||
|
||||
value = g_variant_new("(as)", builder);
|
||||
@ -421,15 +421,15 @@ static RawImage *get_raw_image_from_data_hint(GVariant *icon_data)
|
||||
GVariant *data_variant;
|
||||
gsize expected_len;
|
||||
|
||||
g_variant_get (icon_data,
|
||||
"(iiibii@ay)",
|
||||
&image->width,
|
||||
&image->height,
|
||||
&image->rowstride,
|
||||
&image->has_alpha,
|
||||
&image->bits_per_sample,
|
||||
&image->n_channels,
|
||||
&data_variant);
|
||||
g_variant_get(icon_data,
|
||||
"(iiibii@ay)",
|
||||
&image->width,
|
||||
&image->height,
|
||||
&image->rowstride,
|
||||
&image->has_alpha,
|
||||
&image->bits_per_sample,
|
||||
&image->n_channels,
|
||||
&data_variant);
|
||||
|
||||
expected_len = (image->height - 1) * image->rowstride + image->width
|
||||
* ((image->n_channels * image->bits_per_sample + 7) / 8);
|
||||
@ -444,8 +444,8 @@ static RawImage *get_raw_image_from_data_hint(GVariant *icon_data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image->data = (guchar *) g_memdup (g_variant_get_data (data_variant),
|
||||
g_variant_get_size (data_variant));
|
||||
image->data = (guchar *) g_memdup(g_variant_get_data(data_variant),
|
||||
g_variant_get_size(data_variant));
|
||||
g_variant_unref(data_variant);
|
||||
|
||||
return image;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "utils.h"
|
||||
#include "x11/x.h"
|
||||
|
||||
|
||||
/*
|
||||
* print a human readable representation
|
||||
* of the given notification to stdout.
|
||||
|
@ -41,7 +41,7 @@ static int cmdline_find_option(const char *key);
|
||||
section_t *new_section(const char *name)
|
||||
{
|
||||
for (int i = 0; i < section_count; i++) {
|
||||
if(!strcmp(name, sections[i].name)) {
|
||||
if (!strcmp(name, sections[i].name)) {
|
||||
die("Duplicated section in dunstrc detected.\n", -1);
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,6 @@ char *clean_value(const char *value)
|
||||
s[strlen(s) - 1] = '\0';
|
||||
|
||||
return s;
|
||||
|
||||
}
|
||||
|
||||
int load_ini_file(FILE *fp)
|
||||
@ -443,13 +442,11 @@ char *option_get_path(const char *ini_section,
|
||||
val = cmdline_get_path(cmdline_key, NULL, description);
|
||||
}
|
||||
|
||||
|
||||
if (val) {
|
||||
return val;
|
||||
} else {
|
||||
return ini_get_path(ini_section, ini_key, def);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char *option_get_string(const char *ini_section,
|
||||
@ -464,13 +461,11 @@ char *option_get_string(const char *ini_section,
|
||||
val = cmdline_get_string(cmdline_key, NULL, description);
|
||||
}
|
||||
|
||||
|
||||
if (val) {
|
||||
return val;
|
||||
} else {
|
||||
return ini_get_string(ini_section, ini_key, def);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gint64 option_get_time(const char *ini_section,
|
||||
|
@ -139,7 +139,7 @@ void load_settings(char *cmdline_config_path)
|
||||
//Use markup if set
|
||||
//Use default if settings.markup not set yet
|
||||
// (=>c empty&&!allow_markup)
|
||||
if(c){
|
||||
if (c) {
|
||||
settings.markup = parse_markup_mode(c);
|
||||
} else if (!settings.markup) {
|
||||
settings.markup = defaults.markup;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
char *string_replace_char(char needle, char replacement, char *haystack) {
|
||||
char *current = haystack;
|
||||
while ((current = strchr (current, needle)) != NULL)
|
||||
while ((current = strchr(current, needle)) != NULL)
|
||||
*current++ = replacement;
|
||||
return haystack;
|
||||
}
|
||||
@ -34,7 +34,7 @@ char *string_replace_at(char *buf, int pos, int len, const char *repl)
|
||||
memcpy(tmp + pos, repl, repl_len);
|
||||
memmove(tmp + pos + repl_len, buf + pos + len, buf_len - (pos + len) + 1);
|
||||
|
||||
if(tmp != buf) {
|
||||
if (tmp != buf) {
|
||||
g_free(buf);
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,6 @@ void xinerama_update()
|
||||
XFree(info);
|
||||
}
|
||||
|
||||
|
||||
void screen_update_fallback()
|
||||
{
|
||||
alloc_screen_ar(1);
|
||||
@ -177,7 +176,6 @@ void screen_update_fallback()
|
||||
|
||||
screens[0].dim.w = DisplayWidth(xctx.dpy, screen);
|
||||
screens[0].dim.h = DisplayHeight(xctx.dpy, screen);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -297,7 +295,7 @@ static Window get_focused_window(void)
|
||||
&bytes_after,
|
||||
&prop_return);
|
||||
if (prop_return) {
|
||||
focused = *(Window *) prop_return;
|
||||
focused = *(Window *)prop_return;
|
||||
XFree(prop_return);
|
||||
}
|
||||
|
||||
|
23
src/x11/x.c
23
src/x11/x.c
@ -111,14 +111,13 @@ static color_t calculate_foreground_color(color_t bg)
|
||||
|
||||
int signedness = darken ? -1 : 1;
|
||||
|
||||
color.r = _apply_delta(color.r, c_delta *signedness);
|
||||
color.g = _apply_delta(color.g, c_delta *signedness);
|
||||
color.b = _apply_delta(color.b, c_delta *signedness);
|
||||
color.r = _apply_delta(color.r, c_delta * signedness);
|
||||
color.g = _apply_delta(color.g, c_delta * signedness);
|
||||
color.b = _apply_delta(color.b, c_delta * signedness);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
static color_t x_get_separator_color(colored_layout *cl, colored_layout *cl_next)
|
||||
{
|
||||
switch (settings.sep_color) {
|
||||
@ -200,7 +199,7 @@ static bool is_readable_file(const char *filename)
|
||||
|
||||
const char *get_filename_ext(const char *filename) {
|
||||
const char *dot = strrchr(filename, '.');
|
||||
if(!dot || dot == filename) return "";
|
||||
if (!dot || dot == filename) return "";
|
||||
return dot + 1;
|
||||
}
|
||||
|
||||
@ -630,7 +629,7 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, colored_layou
|
||||
if (use_padding)
|
||||
dim.y += h + settings.padding;
|
||||
else
|
||||
dim.y += (int) (floor(bg_half_height) + pango_offset);
|
||||
dim.y += (int)(floor(bg_half_height) + pango_offset);
|
||||
|
||||
if (settings.separator_height > 0 && !last) {
|
||||
color_t sep_color = x_get_separator_color(cl, cl_next);
|
||||
@ -648,7 +647,7 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, colored_layou
|
||||
}
|
||||
cairo_move_to(c, settings.h_padding, dim.y);
|
||||
|
||||
if (cl->icon) {
|
||||
if (cl->icon) {
|
||||
unsigned int image_width = cairo_image_surface_get_width(cl->icon),
|
||||
image_height = cairo_image_surface_get_height(cl->icon),
|
||||
image_x,
|
||||
@ -660,9 +659,9 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, colored_layou
|
||||
image_x = bg_width - settings.h_padding - image_width + settings.frame_width;
|
||||
}
|
||||
|
||||
cairo_set_source_surface (c, cl->icon, image_x, image_y);
|
||||
cairo_rectangle (c, image_x, image_y, image_width, image_height);
|
||||
cairo_fill (c);
|
||||
cairo_set_source_surface(c, cl->icon, image_x, image_y);
|
||||
cairo_rectangle(c, image_x, image_y, image_width, image_height);
|
||||
cairo_fill(c);
|
||||
}
|
||||
|
||||
return dim;
|
||||
@ -703,7 +702,6 @@ void x_win_draw(void)
|
||||
cairo_destroy(c);
|
||||
cairo_surface_destroy(image_surface);
|
||||
r_free_layouts(layouts);
|
||||
|
||||
}
|
||||
|
||||
static void x_win_move(int width, int height)
|
||||
@ -732,7 +730,6 @@ static void x_win_move(int width, int height)
|
||||
XResizeWindow(xctx.dpy, xctx.win, width, height);
|
||||
}
|
||||
|
||||
|
||||
xctx.window_dim.x = x;
|
||||
xctx.window_dim.y = y;
|
||||
xctx.window_dim.h = height;
|
||||
@ -1036,7 +1033,6 @@ void x_setup(void)
|
||||
x_win_setup();
|
||||
x_cairo_setup();
|
||||
x_shortcut_grab(&settings.history_ks);
|
||||
|
||||
}
|
||||
|
||||
static void x_set_wm(Window win)
|
||||
@ -1210,7 +1206,6 @@ KeySym x_shortcut_string_to_mask(const char *str)
|
||||
fprintf(stderr, "Warning: Unknown Modifier: %s\n", str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
|
||||
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
|
||||
#define FONT_HEIGHT_BORDER 2
|
||||
#define DEFFONT "Monospace-11"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user