summaryrefslogtreecommitdiffstats
path: root/source/widgets
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-03 20:35:50 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-03 20:35:50 +0200
commit9a62bfd17284a424cafd4ce649076127eafc2f5d (patch)
treeb2c89cc4ba6917388aafd2f050f9ec55f723f4db /source/widgets
parent684211aba4353a15436533d5782dc02e00c3f72e (diff)
Run indenter.
Diffstat (limited to 'source/widgets')
-rw-r--r--source/widgets/box.c19
-rw-r--r--source/widgets/listview.c131
-rw-r--r--source/widgets/textbox.c81
3 files changed, 116 insertions, 115 deletions
diff --git a/source/widgets/box.c b/source/widgets/box.c
index 7986cdd3..bd1e1cc8 100644
--- a/source/widgets/box.c
+++ b/source/widgets/box.c
@@ -39,23 +39,22 @@
struct _box
{
- widget widget;
+ widget widget;
RofiOrientation type;
- int max_size;
+ int max_size;
// RofiPadding between elements
- RofiDistance spacing;
+ RofiDistance spacing;
- GList *children;
+ GList *children;
};
static void box_update ( widget *wid );
-
static int box_get_desired_width ( widget *wid )
{
box *b = (box *) wid;
int spacing = distance_get_pixel ( b->spacing, b->type );
- int width = 0;
+ int width = 0;
if ( b->type == ROFI_ORIENTATION_HORIZONTAL ) {
int active_widgets = 0;
for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
@@ -91,7 +90,7 @@ static int box_get_desired_height ( widget *wid )
box *b = (box *) wid;
int spacing = distance_get_pixel ( b->spacing, b->type );
int height = 0;
- if ( b->type == ROFI_ORIENTATION_VERTICAL) {
+ if ( b->type == ROFI_ORIENTATION_VERTICAL ) {
int active_widgets = 0;
for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
widget * child = (widget *) iter->data;
@@ -197,8 +196,8 @@ static void hori_calculate_size ( box *b )
widget * child = (widget *) iter->data;
if ( child->enabled && child->expand == FALSE ) {
widget_resize ( child,
- widget_get_desired_width ( child ), //child->w,
- rem_height );
+ widget_get_desired_width ( child ), //child->w,
+ rem_height );
}
}
b->max_size = 0;
@@ -340,7 +339,7 @@ box * box_create ( const char *name, RofiOrientation type )
b->widget.get_desired_width = box_get_desired_width;
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
- b->type = rofi_theme_get_orientation ( WIDGET (b), "orientation",b->type );
+ b->type = rofi_theme_get_orientation ( WIDGET ( b ), "orientation", b->type );
b->spacing = rofi_theme_get_distance ( WIDGET ( b ), "spacing", DEFAULT_SPACING );
return b;
diff --git a/source/widgets/listview.c b/source/widgets/listview.c
index ec46b53c..b0425ac8 100644
--- a/source/widgets/listview.c
+++ b/source/widgets/listview.c
@@ -37,21 +37,23 @@
#define DEFAULT_SPACING 2
-typedef enum {
+typedef enum
+{
LISTVIEW = 0,
BARVIEW = 1,
} ViewType;
-typedef enum {
- LEFT_TO_RIGHT = 0,
- RIGHT_TO_LEFT = 1
+typedef enum
+{
+ LEFT_TO_RIGHT = 0,
+ RIGHT_TO_LEFT = 1
} MoveDirection;
struct _listview
{
- widget widget;
+ widget widget;
- ViewType type;
+ ViewType type;
// RChanged
// Text needs to be repainted.
@@ -100,9 +102,10 @@ struct _listview
char *listview_name;
/** Barview */
- struct {
- MoveDirection direction;
- unsigned int cur_visible;
+ struct
+ {
+ MoveDirection direction;
+ unsigned int cur_visible;
} barview;
};
@@ -127,14 +130,14 @@ static unsigned int scroll_per_page_barview ( listview *lv )
// selected row is always visible.
// If selected is visible do not scroll.
if ( lv->selected < lv->last_offset ) {
- offset = lv->selected;
+ offset = lv->selected;
lv->rchanged = TRUE;
- } else if ( lv->selected >= (lv->last_offset + lv->barview.cur_visible ) ) {
- offset = lv->selected;
+ }
+ else if ( lv->selected >= ( lv->last_offset + lv->barview.cur_visible ) ) {
+ offset = lv->selected;
lv->rchanged = TRUE;
}
return offset;
-
}
static unsigned int scroll_per_page ( listview * lv )
{
@@ -194,14 +197,14 @@ static void update_element ( listview *lv, unsigned int tb, unsigned int index,
static void barview_draw ( widget *wid, cairo_t *draw )
{
unsigned int offset = 0;
- listview *lv = (listview *) wid;
- offset = scroll_per_page_barview ( lv );
+ listview *lv = (listview *) wid;
+ offset = scroll_per_page_barview ( lv );
lv->last_offset = offset;
int spacing_hori = distance_get_pixel ( lv->spacing, ROFI_ORIENTATION_HORIZONTAL );
- int left_offset = widget_padding_get_left ( wid );
- int right_offset = lv->widget.w - widget_padding_get_right( wid );
- int top_offset = widget_padding_get_top ( wid );
+ int left_offset = widget_padding_get_left ( wid );
+ int right_offset = lv->widget.w - widget_padding_get_right ( wid );
+ int top_offset = widget_padding_get_top ( wid );
if ( lv->cur_elements > 0 ) {
// Set new x/y possition.
unsigned int max = MIN ( lv->cur_elements, lv->req_elements - offset );
@@ -209,13 +212,13 @@ static void barview_draw ( widget *wid, cairo_t *draw )
int first = TRUE;
int width = lv->widget.w;
lv->barview.cur_visible = 0;
- width -= widget_padding_get_padding_width ( wid );
+ width -= widget_padding_get_padding_width ( wid );
if ( lv->barview.direction == LEFT_TO_RIGHT ) {
- for ( unsigned int i = 0; i < max&& width > 0; i++ ) {
+ for ( unsigned int i = 0; i < max && width > 0; i++ ) {
update_element ( lv, i, i + offset, TRUE );
- int twidth = textbox_get_desired_width ( WIDGET(lv->boxes[i]));
+ int twidth = textbox_get_desired_width ( WIDGET ( lv->boxes[i] ) );
if ( twidth >= width ) {
- if ( ! first ) {
+ if ( !first ) {
break;
}
twidth = width;
@@ -223,17 +226,18 @@ static void barview_draw ( widget *wid, cairo_t *draw )
textbox_moveresize ( lv->boxes[i], left_offset, top_offset, twidth, lv->element_height );
widget_draw ( WIDGET ( lv->boxes[i] ), draw );
- width -= twidth + spacing_hori;
+ width -= twidth + spacing_hori;
left_offset += twidth + spacing_hori;
- first = FALSE;
- lv->barview.cur_visible++ ;
+ first = FALSE;
+ lv->barview.cur_visible++;
}
- } else {
- for ( unsigned int i = 0; i < lv->cur_elements && width > 0 && i <= offset; i++ ) {
- update_element ( lv, i, offset-i, TRUE );
- int twidth = textbox_get_desired_width ( WIDGET ( lv->boxes[i] ));
+ }
+ else {
+ for ( unsigned int i = 0; i < lv->cur_elements && width > 0 && i <= offset; i++ ) {
+ update_element ( lv, i, offset - i, TRUE );
+ int twidth = textbox_get_desired_width ( WIDGET ( lv->boxes[i] ) );
if ( twidth >= width ) {
- if ( ! first ) {
+ if ( !first ) {
break;
}
twidth = width;
@@ -242,21 +246,19 @@ static void barview_draw ( widget *wid, cairo_t *draw )
textbox_moveresize ( lv->boxes[i], right_offset, top_offset, twidth, lv->element_height );
widget_draw ( WIDGET ( lv->boxes[i] ), draw );
- width -= twidth + spacing_hori;
+ width -= twidth + spacing_hori;
right_offset -= spacing_hori;
- first = FALSE;
- lv->barview.cur_visible++ ;
+ first = FALSE;
+ lv->barview.cur_visible++;
}
- offset -= lv->barview.cur_visible-1;
+ offset -= lv->barview.cur_visible - 1;
lv->last_offset = offset;
- for ( unsigned int i = 0; i < (lv->barview.cur_visible/2); i++)
- {
+ for ( unsigned int i = 0; i < ( lv->barview.cur_visible / 2 ); i++ ) {
void * temp = lv->boxes[i];
- int sw = lv->barview.cur_visible-i-1;
- lv->boxes[i] = lv->boxes[sw];
+ int sw = lv->barview.cur_visible - i - 1;
+ lv->boxes[i] = lv->boxes[sw];
lv->boxes[sw] = temp;
}
-
}
lv->rchanged = FALSE;
}
@@ -295,10 +297,10 @@ static void listview_draw ( widget *wid, cairo_t *draw )
int left_offset = widget_padding_get_left ( wid );
int top_offset = widget_padding_get_top ( wid );
/*
- if ( lv->scrollbar->widget.index == 0 ) {
+ if ( lv->scrollbar->widget.index == 0 ) {
left_offset += spacing_hori + lv->scrollbar->widget.w;
- }
- */
+ }
+ */
if ( lv->cur_elements > 0 && lv->max_rows > 0 ) {
// Set new x/y possition.
unsigned int max = MIN ( lv->cur_elements, lv->req_elements - offset );
@@ -339,11 +341,11 @@ static WidgetTriggerActionResult listview_element_trigger_action ( widget *wid,
static void _listview_draw ( widget *wid, cairo_t *draw )
{
- listview *lv = (listview *)wid;
- if ( lv->type == LISTVIEW )
- {
+ listview *lv = (listview *) wid;
+ if ( lv->type == LISTVIEW ) {
listview_draw ( wid, draw );
- } else {
+ }
+ else {
barview_draw ( wid, draw );
}
}
@@ -401,7 +403,7 @@ unsigned int listview_get_selected ( listview *lv )
void listview_set_selected ( listview *lv, unsigned int selected )
{
if ( lv && lv->req_elements > 0 ) {
- lv->selected = MIN ( selected, lv->req_elements - 1 );
+ lv->selected = MIN ( selected, lv->req_elements - 1 );
lv->barview.direction = LEFT_TO_RIGHT;
widget_queue_redraw ( WIDGET ( lv ) );
}
@@ -429,7 +431,7 @@ static void listview_resize ( widget *wid, short w, short h )
}
widget_resize ( WIDGET ( lv->scrollbar ), widget_get_width ( WIDGET ( lv->scrollbar ) ), height );
- if ( lv->type == BARVIEW ) {
+ if ( lv->type == BARVIEW ) {
lv->max_elements = lv->menu_lines;
}
@@ -547,12 +549,13 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
lv->fixed_num_lines = rofi_theme_get_boolean ( WIDGET ( lv ), "fixed-height", config.fixed_num_lines );
lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE );
lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse );
- lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle );
+ lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle );
- lv->type = rofi_theme_get_boolean ( WIDGET (lv) , "barview", FALSE );
+ lv->type = rofi_theme_get_boolean ( WIDGET ( lv ), "barview", FALSE );
if ( lv->type == LISTVIEW ) {
listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", FALSE ) );
- } else {
+ }
+ else {
listview_set_show_scrollbar ( lv, FALSE );
}
return lv;
@@ -585,7 +588,7 @@ static void listview_nav_down_int ( listview *lv )
if ( lv->req_elements == 0 || ( lv->selected == ( lv->req_elements - 1 ) && !lv->cycle ) ) {
return;
}
- lv->selected = lv->selected < lv->req_elements - 1 ? MIN ( lv->req_elements - 1, lv->selected + 1 ) : 0;
+ lv->selected = lv->selected < lv->req_elements - 1 ? MIN ( lv->req_elements - 1, lv->selected + 1 ) : 0;
lv->barview.direction = LEFT_TO_RIGHT;
widget_queue_redraw ( WIDGET ( lv ) );
}
@@ -620,8 +623,8 @@ void listview_nav_left ( listview *lv )
if ( lv == NULL ) {
return;
}
- if ( lv->type == BARVIEW ){
- listview_nav_up_int(lv);
+ if ( lv->type == BARVIEW ) {
+ listview_nav_up_int ( lv );
return;
}
if ( lv->selected >= lv->max_rows ) {
@@ -634,8 +637,8 @@ void listview_nav_right ( listview *lv )
if ( lv == NULL ) {
return;
}
- if ( lv->type == BARVIEW ){
- listview_nav_down_int(lv);
+ if ( lv->type == BARVIEW ) {
+ listview_nav_down_int ( lv );
return;
}
if ( ( lv->selected + lv->max_rows ) < lv->req_elements ) {
@@ -662,12 +665,12 @@ static void listview_nav_page_prev_int ( listview *lv )
if ( lv == NULL ) {
return;
}
- if ( lv->type == BARVIEW ){
-
- if ( lv->last_offset == 0 ){
+ if ( lv->type == BARVIEW ) {
+ if ( lv->last_offset == 0 ) {
lv->selected = 0;
- } else {
- lv->selected = lv->last_offset-1;
+ }
+ else {
+ lv->selected = lv->last_offset - 1;
}
lv->barview.direction = RIGHT_TO_LEFT;
widget_queue_redraw ( WIDGET ( lv ) );
@@ -691,8 +694,8 @@ static void listview_nav_page_next_int ( listview *lv )
return;
}
if ( lv->type == BARVIEW ) {
- unsigned int new = lv->last_offset+lv->barview.cur_visible;
- lv->selected = MIN ( new, lv->req_elements-1);
+ unsigned int new = lv->last_offset + lv->barview.cur_visible;
+ lv->selected = MIN ( new, lv->req_elements - 1 );
lv->barview.direction = LEFT_TO_RIGHT;
widget_queue_redraw ( WIDGET ( lv ) );
@@ -746,7 +749,7 @@ static int listview_get_desired_height ( widget *wid )
h = MIN ( lv->menu_lines, lv->max_displayed_lines );
}
}
- if ( lv->type == BARVIEW ){
+ if ( lv->type == BARVIEW ) {
h = MIN ( h, 1 );
}
if ( h == 0 ) {
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index 0f966d32..071fd7a1 100644
--- a/source/widgets/textbox.c
+++ b/source/widgets/textbox.c
@@ -69,7 +69,7 @@ typedef struct TBFontConfig
/** Font metrics */
PangoFontMetrics *metrics;
/** height */
- double height;
+ double height;
}TBFontConfig;
/** HashMap of previously parsed font descriptions. */
@@ -119,9 +119,10 @@ static WidgetTriggerActionResult textbox_editable_trigger_action ( widget *wid,
x -= widget_padding_get_left ( wid );
gint max = textbox_get_font_width ( tb );
// Right of text, move to end.
- if ( x >= max ){
+ if ( x >= max ) {
textbox_cursor_end ( tb );
- } else if ( x > 0 ) {
+ }
+ else if ( x > 0 ) {
// If in range, get index.
pango_layout_xy_to_index ( tb->layout, x * PANGO_SCALE, y * PANGO_SCALE, &i, NULL );
textbox_cursor ( tb, i );
@@ -148,7 +149,7 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags,
tb->widget.get_width = textbox_get_width;
tb->widget.get_height = _textbox_get_height;
tb->widget.get_desired_height = textbox_get_desired_height;
- tb->widget.get_desired_width = textbox_get_desired_width;
+ tb->widget.get_desired_width = textbox_get_desired_width;
tb->flags = flags;
tb->changed = FALSE;
@@ -158,7 +159,7 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags,
tb->metrics = p_metrics;
const char * font = rofi_theme_get_string ( WIDGET ( tb ), "font", NULL );
- tb->left_offset = textbox_get_estimated_char_height();
+ tb->left_offset = textbox_get_estimated_char_height ();
if ( font ) {
TBFontConfig *tbfc = g_hash_table_lookup ( tbfc_cache, font );
@@ -167,7 +168,7 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags,
tbfc->pfd = pango_font_description_from_string ( font );
if ( helper_validate_font ( tbfc->pfd, font ) ) {
tbfc->metrics = pango_context_get_metrics ( p_context, tbfc->pfd, NULL );
- tbfc->height = pango_font_metrics_get_ascent ( tbfc->metrics ) + pango_font_metrics_get_descent ( tbfc->metrics );
+ tbfc->height = pango_font_metrics_get_ascent ( tbfc->metrics ) + pango_font_metrics_get_descent ( tbfc->metrics );
// Cast away consts. (*yuck*) because table_insert does not know it is const.
g_hash_table_insert ( tbfc_cache, (char *) font, tbfc );
@@ -181,8 +182,8 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags,
if ( tbfc ) {
// Update for used font.
pango_layout_set_font_description ( tb->layout, tbfc->pfd );
- tb->metrics = tbfc->metrics;
- tb->left_offset = (tbfc->height)/(double)PANGO_SCALE;
+ tb->metrics = tbfc->metrics;
+ tb->left_offset = ( tbfc->height ) / (double) PANGO_SCALE;
}
}
if ( ( tb->flags & TB_ICON ) != TB_ICON ) {
@@ -193,8 +194,8 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags,
pango_layout_set_wrap ( tb->layout, PANGO_WRAP_WORD_CHAR );
}
- const char *txt = rofi_theme_get_string ( WIDGET ( tb ), "str", text);
- textbox_text ( tb, txt? txt: "" );
+ const char *txt = rofi_theme_get_string ( WIDGET ( tb ), "str", text );
+ textbox_text ( tb, txt ? txt : "" );
textbox_cursor_end ( tb );
// auto height/width modes get handled here
@@ -207,8 +208,8 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags,
tb->widget.trigger_action = textbox_editable_trigger_action;
}
- tb->yalign = rofi_theme_get_double ( WIDGET ( tb ), "vertical-align" , 0.0);
- tb->yalign = MAX ( 0, MIN ( 1.0, tb->yalign));
+ tb->yalign = rofi_theme_get_double ( WIDGET ( tb ), "vertical-align", 0.0 );
+ tb->yalign = MAX ( 0, MIN ( 1.0, tb->yalign ) );
// Enabled by default
tb->widget.enabled = rofi_theme_get_boolean ( WIDGET ( tb ), "enabled", TRUE );
@@ -280,21 +281,21 @@ static void __textbox_update_pango_text ( textbox *tb )
}
const char *textbox_get_visible_text ( const textbox *tb )
{
- if ( tb == NULL ){
+ if ( tb == NULL ) {
return NULL;
}
return pango_layout_get_text ( tb->layout );
}
PangoAttrList *textbox_get_pango_attributes ( textbox *tb )
{
- if ( tb == NULL ){
+ if ( tb == NULL ) {
return NULL;
}
return pango_layout_get_attributes ( tb->layout );
}
void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list )
{
- if ( tb == NULL ){
+ if ( tb == NULL ) {
return;
}
pango_layout_set_attributes ( tb->layout, list );
@@ -303,7 +304,7 @@ void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list )
// set the default text to display
void textbox_text ( textbox *tb, const char *text )
{
- if ( tb == NULL ){
+ if ( tb == NULL ) {
return;
}
g_free ( tb->text );
@@ -343,7 +344,7 @@ void textbox_icon ( textbox *tb, cairo_surface_t *icon )
// within the parent handled auto width/height modes
void textbox_moveresize ( textbox *tb, int x, int y, int w, int h )
{
- unsigned int offset = tb->left_offset*1.2 + (( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0);
+ unsigned int offset = tb->left_offset * 1.2 + ( ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0 );
if ( tb->flags & TB_AUTOWIDTH ) {
pango_layout_set_width ( tb->layout, -1 );
w = textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( WIDGET ( tb ) ) + offset;
@@ -404,7 +405,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
return;
}
textbox *tb = (textbox *) wid;
- unsigned int offset = tb->left_offset*1.2 + (( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0);
+ unsigned int offset = tb->left_offset * 1.2 + ( ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0 );
if ( tb->changed ) {
__textbox_update_pango_text ( tb );
@@ -416,21 +417,21 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
int y = top + ( pango_font_metrics_get_ascent ( tb->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE;
// draw Icon
- if ( (tb->flags&TB_ICON) == TB_ICON && tb->icon != NULL ) {
+ if ( ( tb->flags & TB_ICON ) == TB_ICON && tb->icon != NULL ) {
int iconheight = tb->left_offset;
- cairo_save(draw);
+ cairo_save ( draw );
/*int iconw = cairo_image_surface_get_width (tb->icon);*/
- int iconh = cairo_image_surface_get_height (tb->icon);
- double scale = (double)iconheight / iconh;
+ int iconh = cairo_image_surface_get_height ( tb->icon );
+ double scale = (double) iconheight / iconh;
- cairo_translate(draw, x, y);
- cairo_scale(draw, scale, scale);
- cairo_set_source_surface(draw, tb->icon, 0,0);
- cairo_paint(draw);
- cairo_restore(draw);
+ cairo_translate ( draw, x, y );
+ cairo_scale ( draw, scale, scale );
+ cairo_set_source_surface ( draw, tb->icon, 0, 0 );
+ cairo_paint ( draw );
+ cairo_restore ( draw );
}
- x+=offset;
+ x += offset;
if ( tb->flags & TB_RIGHT ) {
int line_width = 0;
@@ -444,9 +445,9 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
}
if ( tb->yalign > 0.001 ) {
- int height = (pango_font_metrics_get_ascent ( tb->metrics ) + pango_font_metrics_get_descent ( tb->metrics ))/PANGO_SCALE;
+ int height = ( pango_font_metrics_get_ascent ( tb->metrics ) + pango_font_metrics_get_descent ( tb->metrics ) ) / PANGO_SCALE;
int bottom = widget_padding_get_bottom ( WIDGET ( tb ) );
- top = (tb->widget.h - bottom - height -top)*tb->yalign+top;
+ top = ( tb->widget.h - bottom - height - top ) * tb->yalign + top;
}
rofi_theme_get_color ( WIDGET ( tb ), "foreground", draw );
@@ -470,7 +471,6 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
cairo_fill ( draw );
}
-
// Set ARGB
// We need to set over, otherwise subpixel hinting wont work.
cairo_set_operator ( draw, CAIRO_OPERATOR_OVER );
@@ -478,7 +478,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
pango_cairo_show_layout ( draw, tb->layout );
if ( ( tb->flags & TB_INDICATOR ) == TB_INDICATOR && ( tb->tbft & ( SELECTED ) ) ) {
- cairo_arc ( draw, tb->left_offset*1.2 + DOT_OFFSET / 2.0, tb->widget.h / 2.0, 2.0, 0, 2.0 * M_PI );
+ cairo_arc ( draw, tb->left_offset * 1.2 + DOT_OFFSET / 2.0, tb->widget.h / 2.0, 2.0, 0, 2.0 * M_PI );
cairo_fill ( draw );
}
}
@@ -710,7 +710,7 @@ static void textbox_cursor_del_sol ( textbox *tb )
}
static void textbox_cursor_del_word ( textbox *tb )
{
- if ( tb && tb->cursor >= 0 ) {
+ if ( tb && tb->cursor >= 0 ) {
int cursor = tb->cursor;
textbox_cursor_inc_word ( tb );
if ( cursor < tb->cursor ) {
@@ -799,9 +799,9 @@ gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len )
// Filter When alt/ctrl is pressed do not accept the character.
- gboolean used_something = FALSE;
+ gboolean used_something = FALSE;
const gchar *w, *n, *e;
- for ( w = pad, n = g_utf8_next_char(w), e = w + pad_len ; w < e ; w = n, n = g_utf8_next_char(n) ) {
+ for ( w = pad, n = g_utf8_next_char ( w ), e = w + pad_len; w < e; w = n, n = g_utf8_next_char ( n ) ) {
if ( g_unichar_iscntrl ( g_utf8_get_char ( w ) ) ) {
continue;
}
@@ -880,7 +880,7 @@ int textbox_get_font_width ( const textbox *tb )
{
PangoRectangle rect;
pango_layout_get_pixel_extents ( tb->layout, NULL, &rect );
- return rect.width+rect.x;
+ return rect.width + rect.x;
}
/** Caching for the expected character height. */
@@ -913,14 +913,13 @@ int textbox_get_estimated_height ( const textbox *tb, int eh )
int textbox_get_desired_width ( widget *wid )
{
textbox *tb = (textbox *) wid;
- unsigned int offset = tb->left_offset*1.2 + (( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0);
+ unsigned int offset = tb->left_offset * 1.2 + ( ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0 );
if ( wid->expand && tb->flags & TB_AUTOWIDTH ) {
return textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( wid ) + offset;
}
- RofiDistance w = rofi_theme_get_distance ( WIDGET ( tb ), "width", 0 );
- int wi = distance_get_pixel ( w, ROFI_ORIENTATION_HORIZONTAL );
- if ( wi > 0 )
- {
+ RofiDistance w = rofi_theme_get_distance ( WIDGET ( tb ), "width", 0 );
+ int wi = distance_get_pixel ( w, ROFI_ORIENTATION_HORIZONTAL );
+ if ( wi > 0 ) {
return wi;
}
int padding = widget_padding_get_left ( WIDGET ( tb ) );