summaryrefslogtreecommitdiff
path: root/extra/lightbar
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-06-27 15:06:30 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-29 00:27:55 +0000
commit212969bbc4ddfb1f198d299e5621b333518df05e (patch)
tree1ebcedbe655432f59aff87029afc4d0edf1d5216 /extra/lightbar
parentf564c9de4df2b41648dd7bb400972fd0e902cce9 (diff)
downloadchrome-ec-212969bbc4ddfb1f198d299e5621b333518df05e.tar.gz
extra/lightbar/windows.c: Format with clang-format
BUG=b:236386294 BRANCH=none TEST=none Change-Id: I0545f6f73077099ebe5d7a777561772ef3ccfddb Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730183 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'extra/lightbar')
-rw-r--r--extra/lightbar/windows.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/extra/lightbar/windows.c b/extra/lightbar/windows.c
index 115074363c..cd12a8ffd0 100644
--- a/extra/lightbar/windows.c
+++ b/extra/lightbar/windows.c
@@ -42,8 +42,8 @@ void init_windows(void)
/* Get a colormap */
colormap_id = xcb_generate_id(c);
- xcb_create_colormap(c, XCB_COLORMAP_ALLOC_NONE,
- colormap_id, screen->root, screen->root_visual);
+ xcb_create_colormap(c, XCB_COLORMAP_ALLOC_NONE, colormap_id,
+ screen->root, screen->root_visual);
/* Create foreground GC */
foreground = xcb_generate_id(c);
@@ -57,16 +57,16 @@ void init_windows(void)
mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
values[0] = screen->black_pixel;
values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS;
- xcb_create_window(c, /* Connection */
- XCB_COPY_FROM_PARENT, /* depth */
- win, /* window Id */
- screen->root, /* parent window */
- 0, 0, /* x, y */
- win_w, win_h, /* width, height */
- 10, /* border_width */
+ xcb_create_window(c, /* Connection */
+ XCB_COPY_FROM_PARENT, /* depth */
+ win, /* window Id */
+ screen->root, /* parent window */
+ 0, 0, /* x, y */
+ win_w, win_h, /* width, height */
+ 10, /* border_width */
XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */
- screen->root_visual, /* visual */
- mask, values); /* masks */
+ screen->root_visual, /* visual */
+ mask, values); /* masks */
/* Map the window on the screen */
xcb_map_window(c, win);
@@ -88,10 +88,10 @@ void cleanup(void)
/* xcb likes 16-bit colors */
uint16_t leds[NUM_LEDS][3] = {
- {0xffff, 0x0000, 0x0000},
- {0x0000, 0xffff, 0x0000},
- {0x0000, 0x0000, 0xffff},
- {0xffff, 0xffff, 0x0000},
+ { 0xffff, 0x0000, 0x0000 },
+ { 0x0000, 0xffff, 0x0000 },
+ { 0x0000, 0x0000, 0xffff },
+ { 0xffff, 0xffff, 0x0000 },
};
pthread_mutex_t leds_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -101,10 +101,8 @@ void change_gc_color(uint16_t red, uint16_t green, uint16_t blue)
uint32_t values[2];
xcb_alloc_color_reply_t *reply;
- reply = xcb_alloc_color_reply(c,
- xcb_alloc_color(c, colormap_id,
- red, green, blue),
- NULL);
+ reply = xcb_alloc_color_reply(
+ c, xcb_alloc_color(c, colormap_id, red, green, blue), NULL);
assert(reply);
mask = XCB_GC_FOREGROUND;
@@ -116,8 +114,8 @@ void change_gc_color(uint16_t red, uint16_t green, uint16_t blue)
void update_window(void)
{
xcb_segment_t segments[] = {
- {0, 0, win_w, win_h},
- {0, win_h, win_w, 0},
+ { 0, 0, win_w, win_h },
+ { 0, win_h, win_w, 0 },
};
xcb_rectangle_t rect;
int w = win_w / NUM_LEDS;
@@ -135,8 +133,7 @@ void update_window(void)
rect.width = w;
rect.height = win_h;
- change_gc_color(copyleds[i][0],
- copyleds[i][1],
+ change_gc_color(copyleds[i][0], copyleds[i][1],
copyleds[i][2]);
xcb_poly_fill_rectangle(c, win, foreground, 1, &rect);
@@ -184,8 +181,6 @@ void setrgb(int led, int red, int green, int blue)
/*****************************************************************************/
/* lb_common stubs */
-
-
/* Brightness serves no purpose here. It's automatic on the Chromebook. */
static int brightness = 0xc0;
void lb_set_brightness(unsigned int newval)
@@ -238,14 +233,13 @@ void lb_hc_cmd_dump(struct ec_response_lightbar *out)
printf("lightbar is %s\n", fake_power ? "on" : "off");
memset(out, fake_power, sizeof(*out));
};
-void lb_hc_cmd_reg(const struct ec_params_lightbar *in) { };
+void lb_hc_cmd_reg(const struct ec_params_lightbar *in){};
int lb_power(int enabled)
{
return fake_power;
}
-
/*****************************************************************************/
/* Event handling stuff */
@@ -257,7 +251,6 @@ void *entry_windows(void *ptr)
int chg = 1;
while ((e = xcb_wait_for_event(c))) {
-
switch (e->response_type & ~0x80) {
case XCB_EXPOSE:
ev = (xcb_expose_event_t *)e;