desktop-shell: Fix broken clock indentation
This commit is contained in:
+12
-14
@@ -294,7 +294,6 @@ panel_launcher_button_handler(struct widget *widget,
|
|||||||
panel_launcher_activate(launcher);
|
panel_launcher_activate(launcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
panel_clock_tick(struct panel_clock *clock)
|
panel_clock_tick(struct panel_clock *clock)
|
||||||
{
|
{
|
||||||
@@ -306,10 +305,11 @@ panel_clock_tick(struct panel_clock *clock)
|
|||||||
timeinfo = localtime(&rawtime);
|
timeinfo = localtime(&rawtime);
|
||||||
strftime(string, 124, "%a %b %d, %I:%M:%S %p", timeinfo);
|
strftime(string, 124, "%a %b %d, %I:%M:%S %p", timeinfo);
|
||||||
|
|
||||||
if (0 == strcmp(string, clock->string))
|
if (strcmp(string, clock->string) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
strncpy(clock->string, string, 126);
|
strncpy(clock->string, string, 126);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +334,6 @@ panel_clock_redraw_handler(struct widget *widget, void *data)
|
|||||||
struct rectangle allocation;
|
struct rectangle allocation;
|
||||||
cairo_text_extents_t extents;
|
cairo_text_extents_t extents;
|
||||||
cairo_font_extents_t font_extents;
|
cairo_font_extents_t font_extents;
|
||||||
|
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm * timeinfo;
|
struct tm * timeinfo;
|
||||||
|
|
||||||
@@ -344,7 +343,8 @@ panel_clock_redraw_handler(struct widget *widget, void *data)
|
|||||||
|
|
||||||
widget_get_allocation(widget, &allocation);
|
widget_get_allocation(widget, &allocation);
|
||||||
|
|
||||||
if (allocation.width == 0) return;
|
if (allocation.width == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
surface = window_get_surface(clock->panel->window);
|
surface = window_get_surface(clock->panel->window);
|
||||||
cr = cairo_create(surface);
|
cr = cairo_create(surface);
|
||||||
@@ -362,10 +362,12 @@ panel_clock_redraw_handler(struct widget *widget, void *data)
|
|||||||
cairo_set_font_size(cr, 14);
|
cairo_set_font_size(cr, 14);
|
||||||
cairo_text_extents(cr, clock->string, &extents);
|
cairo_text_extents(cr, clock->string, &extents);
|
||||||
cairo_font_extents (cr, &font_extents);
|
cairo_font_extents (cr, &font_extents);
|
||||||
cairo_move_to(cr, allocation.x + 5, allocation.y + 3*(allocation.height>>2) + 1);
|
cairo_move_to(cr, allocation.x + 5,
|
||||||
|
allocation.y + 3 * (allocation.height >> 2) + 1);
|
||||||
cairo_set_source_rgb(cr, 0, 0, 0);
|
cairo_set_source_rgb(cr, 0, 0, 0);
|
||||||
cairo_show_text(cr, clock->string);
|
cairo_show_text(cr, clock->string);
|
||||||
cairo_move_to(cr, allocation.x + 4, allocation.y + 3*(allocation.height>>2));
|
cairo_move_to(cr, allocation.x + 4,
|
||||||
|
allocation.y + 3 * (allocation.height >> 2));
|
||||||
cairo_set_source_rgb(cr, 1, 1, 1);
|
cairo_set_source_rgb(cr, 1, 1, 1);
|
||||||
cairo_show_text(cr, clock->string);
|
cairo_show_text(cr, clock->string);
|
||||||
cairo_destroy(cr);
|
cairo_destroy(cr);
|
||||||
@@ -375,9 +377,9 @@ static int
|
|||||||
clock_timer_reset(struct panel_clock *clock)
|
clock_timer_reset(struct panel_clock *clock)
|
||||||
{
|
{
|
||||||
struct itimerspec its;
|
struct itimerspec its;
|
||||||
|
|
||||||
its.it_interval.tv_sec = 1;
|
its.it_interval.tv_sec = 1;
|
||||||
its.it_interval.tv_nsec = 0;
|
its.it_interval.tv_nsec = 0;
|
||||||
|
|
||||||
its.it_value.tv_sec = 1;
|
its.it_value.tv_sec = 1;
|
||||||
its.it_value.tv_nsec = 0;
|
its.it_value.tv_nsec = 0;
|
||||||
if (timerfd_settime(clock->clock_fd, 0, &its, NULL) < 0) {
|
if (timerfd_settime(clock->clock_fd, 0, &its, NULL) < 0) {
|
||||||
@@ -407,16 +409,12 @@ panel_add_clock(struct panel *panel)
|
|||||||
clock->clock_fd = timerfd;
|
clock->clock_fd = timerfd;
|
||||||
|
|
||||||
clock->clock_task.run = clock_func;
|
clock->clock_task.run = clock_func;
|
||||||
display_watch_fd(
|
display_watch_fd(window_get_display(panel->window), clock->clock_fd,
|
||||||
window_get_display(panel->window),
|
EPOLLIN, &clock->clock_task);
|
||||||
clock->clock_fd,
|
|
||||||
EPOLLIN,
|
|
||||||
&clock->clock_task);
|
|
||||||
clock_timer_reset(clock);
|
clock_timer_reset(clock);
|
||||||
|
|
||||||
clock->widget = widget_add_widget(panel->widget, clock);
|
clock->widget = widget_add_widget(panel->widget, clock);
|
||||||
widget_set_redraw_handler(clock->widget,
|
widget_set_redraw_handler(clock->widget, panel_clock_redraw_handler);
|
||||||
panel_clock_redraw_handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user