Cleanup whitespace

This commit is contained in:
o9000
2016-03-24 20:45:17 +01:00
parent d398795202
commit 7b6ce97940
24 changed files with 294 additions and 180 deletions

View File

@@ -134,7 +134,8 @@ void relayout_dynamic(Area *a, int level)
pos += panel_horizontal ? child->width + a->paddingx : child->height + a->paddingx;
}
} else if (a->alignment == ALIGN_RIGHT) {
int pos = (panel_horizontal ? a->posx + a->width : a->posy + a->height) - a->bg->border.width - a->paddingxlr;
int pos =
(panel_horizontal ? a->posx + a->width : a->posy + a->height) - a->bg->border.width - a->paddingxlr;
for (GList *l = g_list_last(a->children); l; l = l->prev) {
Area *child = ((Area *)l->data);
@@ -228,7 +229,16 @@ void draw_tree(Area *a)
}
if (a->pix)
XCopyArea(server.display, a->pix, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
XCopyArea(server.display,
a->pix,
((Panel *)a->panel)->temp_pmap,
server.gc,
0,
0,
a->width,
a->height,
a->posx,
a->posy);
for (GList *l = a->children; l; l = l->next)
draw_tree((Area *)l->data);
@@ -382,7 +392,16 @@ void draw(Area *a)
// Add layer of root pixmap (or clear pixmap if real_transparency==true)
if (server.real_transparency)
clear_pixmap(a->pix, 0, 0, a->width, a->height);
XCopyArea(server.display, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
XCopyArea(server.display,
((Panel *)a->panel)->temp_pmap,
a->pix,
server.gc,
a->posx,
a->posy,
a->width,
a->height,
0,
0);
} else {
a->_clear(a);
}
@@ -531,11 +550,8 @@ void mouse_over(Area *area, int pressed)
if (!pressed) {
new_state = area->has_mouse_over_effect ? MOUSE_OVER : MOUSE_NORMAL;
} else {
new_state = area->has_mouse_press_effect
? MOUSE_DOWN
: area->has_mouse_over_effect
? MOUSE_OVER
: MOUSE_NORMAL;
new_state =
area->has_mouse_press_effect ? MOUSE_DOWN : area->has_mouse_over_effect ? MOUSE_OVER : MOUSE_NORMAL;
}
}
@@ -547,7 +563,8 @@ void mouse_over(Area *area, int pressed)
mouse_over_area = area;
mouse_over_area->mouse_state = new_state;
mouse_over_area->pix = mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
mouse_over_area->pix =
mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
if (!mouse_over_area->pix)
mouse_over_area->_redraw_needed = TRUE;
panel_refresh = TRUE;
@@ -558,7 +575,8 @@ void mouse_out()
if (!mouse_over_area)
return;
mouse_over_area->mouse_state = MOUSE_NORMAL;
mouse_over_area->pix = mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
mouse_over_area->pix =
mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
if (!mouse_over_area->pix)
mouse_over_area->_redraw_needed = TRUE;
panel_refresh = TRUE;

View File

@@ -156,12 +156,7 @@ typedef enum Alignment {
ALIGN_RIGHT = 2,
} Alignment;
typedef enum MouseState {
MOUSE_NORMAL = 0,
MOUSE_OVER = 1,
MOUSE_DOWN = 2,
MOUSE_STATE_COUNT
} MouseState;
typedef enum MouseState { MOUSE_NORMAL = 0, MOUSE_OVER = 1, MOUSE_DOWN = 2, MOUSE_STATE_COUNT } MouseState;
struct Panel;

View File

@@ -248,7 +248,7 @@ void adjust_asb(DATA32 *data, int w, int h, float alpha_adjust, float satur_adju
continue;
int r = (argb >> 16) & 0xff;
int g = (argb >> 8) & 0xff;
int b = (argb) & 0xff;
int b = (argb)&0xff;
// Convert RGB to HSV
int cmax = MAX3(r, g, b);
@@ -392,9 +392,15 @@ void render_image(Drawable d, int x, int y)
imlib_context_set_blend(0);
imlib_render_image_on_drawable(0, 0);
Picture pict = XRenderCreatePicture(server.display, pixmap, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
Picture pict_drawable = XRenderCreatePicture(server.display, d, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
Picture pict_mask = XRenderCreatePicture(server.display, mask, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
Picture pict = XRenderCreatePicture(server.display,
pixmap,
XRenderFindStandardFormat(server.display, PictStandardARGB32),
0,
0);
Picture pict_drawable =
XRenderCreatePicture(server.display, d, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
Picture pict_mask =
XRenderCreatePicture(server.display, mask, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
XRenderComposite(server.display, PictOpOver, pict, pict_mask, pict_drawable, 0, 0, 0, 0, x, y, w, h);
XRenderFreePicture(server.display, pict_mask);
@@ -417,8 +423,8 @@ void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color
0.0,
0.0,
1.0 -
(1.0 - shadow_edge_alpha) *
sqrt((i * i + j * j) / (double)(shadow_size * shadow_size)));
(1.0 - shadow_edge_alpha) *
sqrt((i * i + j * j) / (double)(shadow_size * shadow_size)));
pango_cairo_update_layout(c, layout);
cairo_move_to(c, posx + i, posy + j);
pango_cairo_show_layout(c, layout);
@@ -520,7 +526,8 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r)
void clear_pixmap(Pixmap p, int x, int y, int w, int h)
{
Picture pict = XRenderCreatePicture(server.display, p, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
Picture pict =
XRenderCreatePicture(server.display, p, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
XRenderColor col;
col.red = col.green = col.blue = col.alpha = 0;
XRenderFillRectangle(server.display, PictOpSrc, pict, &col, x, y, w, h);
@@ -569,7 +576,7 @@ void get_text_size2(PangoFontDescription *font,
XFreePixmap(server.display, pmap);
}
#if !GLIB_CHECK_VERSION (2, 33, 4)
#if !GLIB_CHECK_VERSION(2, 33, 4)
GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data)
{
list = g_list_copy(list);

View File

@@ -13,14 +13,14 @@
#include <pango/pangocairo.h>
#include "area.h"
#define GREEN "\033[1;32m"
#define GREEN "\033[1;32m"
#define YELLOW "\033[1;33m"
#define RED "\033[1;31m"
#define BLUE "\033[1;34m"
#define RESET "\033[0m"
#define RED "\033[1;31m"
#define BLUE "\033[1;34m"
#define RESET "\033[0m"
#define MAX3(a, b, c) MAX(MAX(a, b), c)
#define MIN3(a, b, c) MIN(MIN(a, b), c)
#define MAX3(a, b, c) MAX(MAX(a, b), c)
#define MIN3(a, b, c) MIN(MIN(a, b), c)
// mouse actions
typedef enum MouseAction {
@@ -39,7 +39,7 @@ typedef enum MouseAction {
PREV_TASK
} MouseAction;
#define ALL_DESKTOPS 0xFFFFFFFF
#define ALL_DESKTOPS 0xFFFFFFFF
// Copies a file to another path
void copy_file(const char *path_src, const char *path_dest);
@@ -119,13 +119,17 @@ GSList *load_locations_from_env(GSList *locations, const char *var, ...);
GSList *slist_remove_duplicates(GSList *list, GCompareFunc eq, GDestroyNotify fr);
#define free_and_null(p) { free(p); p = NULL; }
#define free_and_null(p) \
{ \
free(p); \
p = NULL; \
}
#if !GLIB_CHECK_VERSION (2, 33, 4)
#if !GLIB_CHECK_VERSION(2, 33, 4)
GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data);
#endif
#if !GLIB_CHECK_VERSION (2, 38, 0)
#if !GLIB_CHECK_VERSION(2, 38, 0)
#define g_assert_null(expr) g_assert((expr) == NULL)
#endif

View File

@@ -199,7 +199,7 @@ void add_timeout_intern(int value_msec, int interval_msec, void (*_callback)(),
gint compare_timeouts(gconstpointer t1, gconstpointer t2)
{
return compare_timespecs(&((const timeout *)t1)->timeout_expires, &((const timeout *)t2)->timeout_expires);
return compare_timespecs(&((const timeout *)t1)->timeout_expires, &((const timeout *)t2)->timeout_expires);
}
gint compare_timespecs(const struct timespec *t1, const struct timespec *t2)
@@ -257,7 +257,7 @@ int align_with_existing_timeouts(timeout *t)
timeout *t2 = it->data;
if (t2->interval_msec > 0) {
if (t->interval_msec % t2->interval_msec == 0 || t2->interval_msec % t->interval_msec == 0) {
if (!multi_timeouts)
if (!multi_timeouts)
multi_timeouts = g_hash_table_new(0, 0);
if (!t->multi_timeout && !t2->multi_timeout) {
// both timeouts can be aligned, but there is no multi timeout for them

View File

@@ -22,9 +22,9 @@
enum uevent_action {
UEVENT_UNKNOWN = 0x01,
UEVENT_ADD = 0x02,
UEVENT_REMOVE = 0x04,
UEVENT_CHANGE = 0x08,
UEVENT_ADD = 0x02,
UEVENT_REMOVE = 0x04,
UEVENT_CHANGE = 0x08,
};
struct uevent_parameter {
@@ -41,7 +41,7 @@ struct uevent {
};
struct uevent_notify {
int action; /* bitfield */
int action; /* bitfield */
char *subsystem; /* NULL => any */
void *userdata;
@@ -56,15 +56,26 @@ void uevent_handler();
void uevent_register_notifier(struct uevent_notify *nb);
void uevent_unregister_notifier(struct uevent_notify *nb);
#else
static inline int uevent_init() {
static inline int uevent_init()
{
return -1;
}
static inline void uevent_cleanup() { }
static inline void uevent_handler() { }
static inline void uevent_cleanup()
{
}
static inline void uevent_register_notifier(struct uevent_notify *nb) { }
static inline void uevent_unregister_notifier(struct uevent_notify *nb) { }
static inline void uevent_handler()
{
}
static inline void uevent_register_notifier(struct uevent_notify *nb)
{
}
static inline void uevent_unregister_notifier(struct uevent_notify *nb)
{
}
#endif
#endif

View File

@@ -124,7 +124,8 @@ int get_window_desktop(Window win)
if (x < 0 || y < 0) {
int num_results;
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
long *x_screen_size =
server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
if (!x_screen_size)
return 0;
int x_screen_width = x_screen_size[0];
@@ -156,7 +157,8 @@ int get_window_desktop(Window win)
if (best_match < 0)
best_match = 0;
//fprintf(stderr, "window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
// fprintf(stderr, "window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??",
// best_match+1, x, y);
return best_match;
}
@@ -183,7 +185,8 @@ int get_window_monitor(Window win)
if (best_match < 0)
best_match = 0;
//fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
// fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win,
// get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
return best_match;
}