1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-10 15:44:41 -05:00

Run indenter.

This commit is contained in:
Dave Davenport 2017-06-03 20:35:50 +02:00
parent 684211aba4
commit 9a62bfd172
23 changed files with 263 additions and 262 deletions

View file

@ -161,7 +161,8 @@ typedef struct
ThemeColor color;
} RofiHighlightColorStyle;
typedef union {
typedef union
{
/** integer */
int i;
/** Double */

View file

@ -54,7 +54,6 @@
#define DRUN_CACHE_FILE "rofi2.druncache"
/**
* Store extra information about the entry.
* Currently the executable and if it should run in terminal.
@ -460,8 +459,7 @@ static gpointer drun_icon_fetch ( gpointer data )
// this should be fine running in another thread.
DRunModePrivateData *pd = (DRunModePrivateData *) data;
DRunModeEntry *dr;
while ( ( dr = g_async_queue_pop ( pd->icon_fetch_queue )) != &(pd->quit_entry) )
{
while ( ( dr = g_async_queue_pop ( pd->icon_fetch_queue ) ) != &( pd->quit_entry ) ) {
if ( dr->icon_name == NULL ) {
continue;
}
@ -578,7 +576,9 @@ static void drun_mode_destroy ( Mode *sw )
if ( rmpd != NULL ) {
if ( rmpd->thread ) {
g_async_queue_lock ( rmpd->icon_fetch_queue );
while ( g_async_queue_try_pop_unlocked ( rmpd->icon_fetch_queue ) );
while ( g_async_queue_try_pop_unlocked ( rmpd->icon_fetch_queue ) ) {
;
}
// Make the thread quit.
g_async_queue_push_unlocked ( rmpd->icon_fetch_queue, ( gpointer ) & ( rmpd->quit_entry ) );
g_async_queue_unlock ( rmpd->icon_fetch_queue );

View file

@ -386,7 +386,8 @@ static ThemeWidget *rofi_theme_find ( ThemeWidget *widget, const char *name, con
if ( f != widget ) {
widget = f;
found = TRUE;
} else if ( exact ) {
}
else if ( exact ) {
break;
}
}
@ -521,7 +522,6 @@ static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char
return (RofiDistance){ def, ROFI_PU_PX, ROFI_HL_SOLID };
}
RofiDistance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def )
{
return _rofi_theme_get_distance ( widget, property, def, TRUE );

View file

@ -1484,7 +1484,6 @@ static void rofi_view_listview_mouse_activated_cb ( listview *lv, gboolean custo
state->skip_absorb = TRUE;
}
static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, const char *parent, const char *name )
{
char *defaults = NULL;
@ -1584,10 +1583,12 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
}
g_free ( strbutton );
}
} else if ( g_ascii_strncasecmp ( name, "textbox", 7) == 0 ){
}
else if ( g_ascii_strncasecmp ( name, "textbox", 7 ) == 0 ) {
textbox *t = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, str, TB_WRAP, NORMAL, "" );
box_add ( (box *) parent_widget, WIDGET ( t ), TRUE );
} else {
}
else {
wid = (widget *) box_create ( strbox, ROFI_ORIENTATION_VERTICAL );
box_add ( (box *) parent_widget, WIDGET ( wid ), TRUE );
//g_error("The widget %s does not exists. Invalid layout.", name);
@ -1630,7 +1631,6 @@ RofiViewState *rofi_view_create ( Mode *sw,
// Get active monitor size.
TICK_N ( "Get active monitor" );
state->main_window = box_create ( "window.box", ROFI_ORIENTATION_VERTICAL );
// Get children.
GList *list = rofi_theme_get_list ( WIDGET ( state->main_window ), "children", "mainbox" );
@ -1647,7 +1647,6 @@ RofiViewState *rofi_view_create ( Mode *sw,
state->overlay->widget.parent = WIDGET ( state->main_window );
widget_disable ( WIDGET ( state->overlay ) );
// filtered list
state->line_map = g_malloc0_n ( state->num_lines, sizeof ( unsigned int ) );
state->distance = (int *) g_malloc0_n ( state->num_lines, sizeof ( int ) );

View file

@ -50,7 +50,6 @@ struct _box
static void box_update ( widget *wid );
static int box_get_desired_width ( widget *wid )
{
box *b = (box *) wid;

View file

@ -37,12 +37,14 @@
#define DEFAULT_SPACING 2
typedef enum {
typedef enum
{
LISTVIEW = 0,
BARVIEW = 1,
} ViewType;
typedef enum {
typedef enum
{
LEFT_TO_RIGHT = 0,
RIGHT_TO_LEFT = 1
} MoveDirection;
@ -100,7 +102,8 @@ struct _listview
char *listview_name;
/** Barview */
struct {
struct
{
MoveDirection direction;
unsigned int cur_visible;
} barview;
@ -129,12 +132,12 @@ static unsigned int scroll_per_page_barview ( listview *lv )
if ( lv->selected < lv->last_offset ) {
offset = lv->selected;
lv->rchanged = TRUE;
} else if ( lv->selected >= (lv->last_offset + lv->barview.cur_visible ) ) {
}
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 )
{
@ -228,7 +231,8 @@ static void barview_draw ( widget *wid, cairo_t *draw )
first = FALSE;
lv->barview.cur_visible++;
}
} else {
}
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] ) );
@ -249,14 +253,12 @@ static void barview_draw ( widget *wid, cairo_t *draw )
}
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];
lv->boxes[sw] = temp;
}
}
lv->rchanged = FALSE;
}
@ -340,10 +342,10 @@ 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 )
{
if ( lv->type == LISTVIEW ) {
listview_draw ( wid, draw );
} else {
}
else {
barview_draw ( wid, draw );
}
}
@ -552,7 +554,8 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
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;
@ -663,10 +666,10 @@ static void listview_nav_page_prev_int ( listview *lv )
return;
}
if ( lv->type == BARVIEW ) {
if ( lv->last_offset == 0 ) {
lv->selected = 0;
} else {
}
else {
lv->selected = lv->last_offset - 1;
}
lv->barview.direction = RIGHT_TO_LEFT;

View file

@ -121,7 +121,8 @@ static WidgetTriggerActionResult textbox_editable_trigger_action ( widget *wid,
// Right of text, move to end.
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 );
@ -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 );
@ -919,8 +919,7 @@ int textbox_get_desired_width ( widget *wid )
}
RofiDistance w = rofi_theme_get_distance ( WIDGET ( tb ), "width", 0 );
int wi = distance_get_pixel ( w, ROFI_ORIENTATION_HORIZONTAL );
if ( wi > 0 )
{
if ( wi > 0 ) {
return wi;
}
int padding = widget_padding_get_left ( WIDGET ( tb ) );