Indent functions to standard
This commit is contained in:
parent
2d67a5c78e
commit
e3528ef3ec
48
src/dbus.c
48
src/dbus.c
@ -376,36 +376,36 @@ static void on_name_lost(GDBusConnection *connection,
|
||||
|
||||
static RawImage *get_raw_image_from_data_hint(GVariant *icon_data)
|
||||
{
|
||||
RawImage *image = g_malloc(sizeof(RawImage));
|
||||
GVariant *data_variant;
|
||||
gsize expected_len;
|
||||
RawImage *image = g_malloc(sizeof(RawImage));
|
||||
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);
|
||||
expected_len = (image->height - 1) * image->rowstride + image->width
|
||||
* ((image->n_channels * image->bits_per_sample + 7) / 8);
|
||||
|
||||
if (expected_len != g_variant_get_size (data_variant)) {
|
||||
fprintf(stderr, "Expected image data to be of length %" G_GSIZE_FORMAT
|
||||
" but got a " "length of %" G_GSIZE_FORMAT,
|
||||
expected_len,
|
||||
g_variant_get_size (data_variant));
|
||||
g_free(image);
|
||||
return NULL;
|
||||
}
|
||||
if (expected_len != g_variant_get_size (data_variant)) {
|
||||
fprintf(stderr, "Expected image data to be of length %" G_GSIZE_FORMAT
|
||||
" but got a " "length of %" G_GSIZE_FORMAT,
|
||||
expected_len,
|
||||
g_variant_get_size (data_variant));
|
||||
g_free(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image->data = (guchar *) g_memdup (g_variant_get_data (data_variant),
|
||||
image->data = (guchar *) g_memdup (g_variant_get_data (data_variant),
|
||||
g_variant_get_size (data_variant));
|
||||
|
||||
return image;
|
||||
return image;
|
||||
}
|
||||
|
||||
int initdbus(void)
|
||||
|
@ -185,9 +185,9 @@ void notification_free(notification *n)
|
||||
}
|
||||
|
||||
if (n->raw_icon) {
|
||||
if (n->raw_icon->data)
|
||||
g_free(n->raw_icon->data);
|
||||
g_free(n->raw_icon);
|
||||
if (n->raw_icon->data)
|
||||
g_free(n->raw_icon->data);
|
||||
g_free(n->raw_icon);
|
||||
}
|
||||
|
||||
g_free(n);
|
||||
@ -222,42 +222,42 @@ void notification_replace_single_field(char **haystack, char **needle,
|
||||
}
|
||||
|
||||
char *notification_extract_markup_urls(char **str_ptr) {
|
||||
char *start, *end, *replace_buf, *str, *urls = NULL, *url, *index_buf;
|
||||
int linkno = 1;
|
||||
char *start, *end, *replace_buf, *str, *urls = NULL, *url, *index_buf;
|
||||
int linkno = 1;
|
||||
|
||||
str = *str_ptr;
|
||||
while ((start = strstr(str, "<a href")) != NULL) {
|
||||
end = strstr(start, ">");
|
||||
if (end != NULL) {
|
||||
replace_buf = g_strndup(start, end - start + 1);
|
||||
url = extract_urls(replace_buf);
|
||||
if (url != NULL) {
|
||||
str = string_replace(replace_buf, "[", str);
|
||||
str = *str_ptr;
|
||||
while ((start = strstr(str, "<a href")) != NULL) {
|
||||
end = strstr(start, ">");
|
||||
if (end != NULL) {
|
||||
replace_buf = g_strndup(start, end - start + 1);
|
||||
url = extract_urls(replace_buf);
|
||||
if (url != NULL) {
|
||||
str = string_replace(replace_buf, "[", str);
|
||||
|
||||
index_buf = g_strdup_printf("[#%d]", linkno++);
|
||||
if (urls == NULL) {
|
||||
urls = g_strconcat(index_buf, " ", url, NULL);
|
||||
} else {
|
||||
char *tmp = urls;
|
||||
urls = g_strconcat(tmp, "\n", index_buf, " ", url, NULL);
|
||||
g_free(tmp);
|
||||
}
|
||||
index_buf = g_strdup_printf("[#%d]", linkno++);
|
||||
if (urls == NULL) {
|
||||
urls = g_strconcat(index_buf, " ", url, NULL);
|
||||
} else {
|
||||
char *tmp = urls;
|
||||
urls = g_strconcat(tmp, "\n", index_buf, " ", url, NULL);
|
||||
g_free(tmp);
|
||||
}
|
||||
|
||||
index_buf[0] = ' ';
|
||||
str = string_replace("</a>", index_buf, str);
|
||||
g_free(index_buf);
|
||||
g_free(url);
|
||||
index_buf[0] = ' ';
|
||||
str = string_replace("</a>", index_buf, str);
|
||||
g_free(index_buf);
|
||||
g_free(url);
|
||||
} else {
|
||||
str = string_replace(replace_buf, "", str);
|
||||
str = string_replace("</a>", "", str);
|
||||
}
|
||||
g_free(replace_buf);
|
||||
} else {
|
||||
str = string_replace(replace_buf, "", str);
|
||||
str = string_replace("</a>", "", str);
|
||||
break;
|
||||
}
|
||||
g_free(replace_buf);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*str_ptr = str;
|
||||
return urls;
|
||||
*str_ptr = str;
|
||||
return urls;
|
||||
}
|
||||
|
||||
/*
|
||||
|
18
src/x11/x.c
18
src/x11/x.c
@ -488,11 +488,11 @@ static colored_layout *r_init_shared(cairo_t *c, notification *n)
|
||||
|
||||
static colored_layout *r_create_layout_for_xmore(cairo_t *c, notification *n, int qlen)
|
||||
{
|
||||
colored_layout *cl = r_init_shared(c, n);
|
||||
cl->text = g_strdup_printf("(%d more)", qlen);
|
||||
cl->attr = NULL;
|
||||
pango_layout_set_text(cl->l, cl->text, -1);
|
||||
return cl;
|
||||
colored_layout *cl = r_init_shared(c, n);
|
||||
cl->text = g_strdup_printf("(%d more)", qlen);
|
||||
cl->attr = NULL;
|
||||
pango_layout_set_text(cl->l, cl->text, -1);
|
||||
return cl;
|
||||
}
|
||||
|
||||
static colored_layout *r_create_layout_from_notification(cairo_t *c, notification *n)
|
||||
@ -610,9 +610,9 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, colored_layou
|
||||
|
||||
bool use_padding = settings.notification_height <= (2 * settings.padding) + h;
|
||||
if (use_padding)
|
||||
dim.y += settings.padding;
|
||||
dim.y += settings.padding;
|
||||
else
|
||||
dim.y += (int) (ceil(bg_half_height) - pango_offset);
|
||||
dim.y += (int) (ceil(bg_half_height) - pango_offset);
|
||||
|
||||
if (cl->icon && settings.icon_position == icons_left) {
|
||||
cairo_move_to(c, settings.frame_width + cairo_image_surface_get_width(cl->icon) + 2 * settings.h_padding, bg_y + settings.padding + h/2 - h_text/2);
|
||||
@ -626,9 +626,9 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, colored_layou
|
||||
pango_cairo_update_layout(c, cl->l);
|
||||
pango_cairo_show_layout(c, cl->l);
|
||||
if (use_padding)
|
||||
dim.y += h + settings.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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user