Skip to content

Commit

Permalink
Fixed indent
Browse files Browse the repository at this point in the history
  • Loading branch information
jchtt committed May 12, 2020
1 parent 879ef82 commit 88e5f9b
Show file tree
Hide file tree
Showing 18 changed files with 279 additions and 270 deletions.
30 changes: 15 additions & 15 deletions config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ Settings config = {
.modi = "run,ssh",
#endif
/** Border width around the window. */
.menu_bw = 1,
.menu_bw = 1,
/** The width of the switcher. (0100 in % > 100 in pixels) */
.menu_width = 50,
.menu_width = 50,
/** Maximum number of options to show. */
.menu_lines = 15,
.menu_lines = 15,
/** Number of columns */
.menu_columns = 1,
.menu_columns = 1,
/** Font */
.menu_font = "mono 12",

Expand Down Expand Up @@ -82,11 +82,11 @@ Settings config = {
*/
.location = WL_CENTER,
/** Padding between elements */
.padding = 5,
.padding = 5,
/** Y offset */
.y_offset = 0,
.y_offset = 0,
/** X offset */
.x_offset = 0,
.x_offset = 0,
/** Always show config.menu_lines lines, even if less lines are available */
.fixed_num_lines = TRUE,
/** Do not use history */
Expand All @@ -102,7 +102,7 @@ Settings config = {
/** Cycle through in the element list */
.cycle = TRUE,
/** Height of an element in #chars */
.element_height = 1,
.element_height = 1,
/** Sidebar mode, show the modi */
.sidebar_mode = FALSE,
/** auto select */
Expand All @@ -129,8 +129,8 @@ Settings config = {
/** Monitor */
.monitor = "-5",
/** set line margin */
.line_margin = 2,
.line_padding = 1,
.line_margin = 2,
.line_padding = 1,
/** Set filter */
.filter = NULL,
/** Separator style: dash/solid */
Expand All @@ -139,10 +139,10 @@ Settings config = {
.hide_scrollbar = FALSE,
.fullscreen = FALSE,
.fake_transparency = FALSE,
.dpi = -1,
.threads = 0,
.scroll_method = 0,
.scrollbar_width = 8,
.dpi = -1,
.threads = 0,
.scroll_method = 0,
.scrollbar_width = 8,
.fake_background = "screenshot",
.window_format = "{w} {c} {t}",
.click_to_exit = TRUE,
Expand All @@ -153,7 +153,7 @@ Settings config = {
.color_urgent = NULL,
.color_window = NULL,
.plugin_path = PLUGIN_PATH,
.max_history_size = 25,
.max_history_size = 25,
.combi_hide_mode_prefix = FALSE,
/** Combi format display */
.combi_display_format = "{mode} {element}",
Expand Down
2 changes: 1 addition & 1 deletion data/uncrustify.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ align_var_struct_span = 3
align_right_cmt_span = 3
align_pp_define_span = 3
align_pp_define_gap = 4
align_number_left = TRUE
align_number_right = TRUE
align_typedef_span = 5
align_typedef_gap = 3

Expand Down
11 changes: 5 additions & 6 deletions include/rofi-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,29 @@ typedef enum
ROFI_DISTANCE_MODIFIER_GROUP,
} RofiDistanceModifier;

typedef struct RofiDistanceUnit
typedef struct RofiDistanceUnit
{
/** Distance */
double distance;
double distance;
/** Unit type of the distance */
RofiPixelUnit type;
RofiPixelUnit type;

/** Type */
RofiDistanceModifier modtype;
RofiDistanceModifier modtype;

/** Modifier */
struct RofiDistanceUnit *left;

/** Modifier */
struct RofiDistanceUnit *right;

} RofiDistanceUnit;

typedef struct
{
/** Base */
RofiDistanceUnit base;
/** Style of the line (optional)*/
RofiLineStyle style;
RofiLineStyle style;
} RofiDistance;

/**
Expand Down
1 change: 0 additions & 1 deletion include/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ double rofi_theme_get_double ( const widget *widget, const char *property, doub
*/
void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t *d );


/**
* @param widget The widget to query
* @param property The property to query.
Expand Down
1 change: 0 additions & 1 deletion include/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ void rofi_capture_screenshot ( void );
*/
void rofi_view_set_window_title ( const char * title );


/**
* set ellipsize mode to start.
*/
Expand Down
84 changes: 42 additions & 42 deletions source/dialogs/combi.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef struct
{
Mode *mode;
gboolean disable;
gboolean print_newline;
gboolean print_newline;
} CombiMode;

typedef struct
Expand All @@ -72,8 +72,8 @@ static void combi_mode_parse_switchers ( Mode *sw )
const char * const sep = ",#";
// Split token on ','. This modifies switcher_str.

GHashTable *ht;
ht = g_hash_table_new ( g_str_hash, g_str_equal );
GHashTable *ht;
ht = g_hash_table_new ( g_str_hash, g_str_equal );

for ( char *token = strtok_r ( switcher_str, sep, &savept ); token != NULL;
token = strtok_r ( NULL, sep, &savept ) ) {
Expand All @@ -83,20 +83,20 @@ static void combi_mode_parse_switchers ( Mode *sw )

Mode *mode = rofi_collect_modi_search ( token );
if ( mode ) {
pd->switchers[pd->num_switchers].disable = FALSE;
pd->switchers[pd->num_switchers].mode = mode;
pd->switchers[pd->num_switchers].print_newline = TRUE;
g_hash_table_insert( ht, token, &( pd->switchers[pd->num_switchers++] ) );
/* g_hash_table_insert( ht, token, pd->switchers + pd->num_switchers ); */
pd->switchers[pd->num_switchers].disable = FALSE;
pd->switchers[pd->num_switchers].mode = mode;
pd->switchers[pd->num_switchers].print_newline = TRUE;
g_hash_table_insert ( ht, token, &( pd->switchers[pd->num_switchers++] ) );
/* g_hash_table_insert( ht, token, pd->switchers + pd->num_switchers ); */
}
else {
// If not build in, use custom switchers.
Mode *sw = script_switcher_parse_setup ( token );
if ( sw != NULL ) {
pd->switchers[pd->num_switchers].disable = FALSE;
pd->switchers[pd->num_switchers].mode = sw;
pd->switchers[pd->num_switchers].print_newline = TRUE;
g_hash_table_insert( ht, token, &( pd->switchers[pd->num_switchers++] ) );
pd->switchers[pd->num_switchers].disable = FALSE;
pd->switchers[pd->num_switchers].mode = sw;
pd->switchers[pd->num_switchers].print_newline = TRUE;
g_hash_table_insert ( ht, token, &( pd->switchers[pd->num_switchers++] ) );
}
else {
// Report error, don't continue.
Expand All @@ -109,17 +109,17 @@ static void combi_mode_parse_switchers ( Mode *sw )
savept = NULL;
for ( char *token = strtok_r ( config.combi_no_linebreak_modi, sep, &savept ); token != NULL;
token = strtok_r ( NULL, sep, &savept ) ) {
CombiMode *mode = g_hash_table_lookup ( ht, token );
if ( mode != NULL ) {
mode->print_newline = FALSE;
}
else {
g_warning ( "%s is in -combi-no-linebreak-modi but not in -combi-modi.", token );
}
}
CombiMode *mode = g_hash_table_lookup ( ht, token );
if ( mode != NULL ) {
mode->print_newline = FALSE;
}
else {
g_warning ( "%s is in -combi-no-linebreak-modi but not in -combi-modi.", token );
}
}
// Free string that was modified by strtok_r
g_free ( switcher_str );
g_hash_table_destroy( ht );
g_hash_table_destroy ( ht );
}

static int combi_mode_init ( Mode *sw )
Expand Down Expand Up @@ -179,11 +179,11 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
CombiModePrivateData *pd = mode_get_private_data ( sw );

if ( input[0][0] == '!' ) {
int switcher = -1;
int switcher = -1;
// Implement strchrnul behaviour.
char *eob = g_utf8_strchr ( input[0], -1,' ' );
char *eob = g_utf8_strchr ( input[0], -1, ' ' );
if ( eob == NULL ) {
eob = &(input[0][strlen(input[0])]);
eob = &( input[0][strlen ( input[0] )] );
}
ssize_t bang_len = g_utf8_pointer_to_offset ( input[0], eob ) - 1;
if ( bang_len > 0 ) {
Expand All @@ -208,11 +208,11 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
return mretv & MENU_LOWER_MASK;
}

unsigned offset = 0;
unsigned offset = 0;
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
if ( pd->switchers[i].disable ) {
offset += pd->lengths[i];
}
if ( pd->switchers[i].disable ) {
offset += pd->lengths[i];
}
if ( selected_line >= pd->starts[i] &&
selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
return mode_result ( pd->switchers[i].mode, mretv, input, selected_line - pd->starts[i] );
Expand All @@ -236,9 +236,9 @@ static int combi_mode_match ( const Mode *sw, rofi_int_matcher **tokens, unsigne
static char * combi_mgrv ( const Mode *sw, unsigned int selected_line, int *state, GList **attr_list, int get_entry )
{
CombiModePrivateData *pd = mode_get_private_data ( sw );
if (config.markup_combi) {
*state |= MARKUP;
}
if ( config.markup_combi ) {
*state |= MARKUP;
}
if ( !get_entry ) {
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
Expand All @@ -254,16 +254,16 @@ static char * combi_mgrv ( const Mode *sw, unsigned int selected_line, int *stat
char * str = retv = mode_get_display_value ( pd->switchers[i].mode, selected_line - pd->starts[i], state, attr_list, TRUE );
const char *dname = mode_get_display_name ( pd->switchers[i].mode );
if ( !config.combi_hide_mode_prefix ) {
char *dname_markup = g_markup_escape_text ( dname, -1 );
char *opt_linebreak = g_strdup(pd->switchers[i].print_newline ? "\n" : config.combi_no_linebreak_str);
retv = helper_string_replace_if_exists( config.combi_display_format,
"{mode}", dname_markup,
"{linebreak}", opt_linebreak,
"{element}", str,
NULL );
char *dname_markup = g_markup_escape_text ( dname, -1 );
char *opt_linebreak = g_strdup ( pd->switchers[i].print_newline ? "\n" : config.combi_no_linebreak_str );
retv = helper_string_replace_if_exists ( config.combi_display_format,
"{mode}", dname_markup,
"{linebreak}", opt_linebreak,
"{element}", str,
NULL );
g_free ( str );
g_free ( dname_markup );
g_free ( opt_linebreak );
g_free ( dname_markup );
g_free ( opt_linebreak );
}

if ( attr_list != NULL ) {
Expand Down Expand Up @@ -321,10 +321,10 @@ static char * combi_preprocess_input ( Mode *sw, const char *input )
}
if ( input != NULL && input[0] == '!' ) {
// Implement strchrnul behaviour.
const char *eob = g_utf8_strchr ( input, -1, ' ' );
const char *eob = g_utf8_strchr ( input, -1, ' ' );
if ( eob == NULL ) {
// Set it to end.
eob = &(input[strlen(input)]);
eob = &( input[strlen ( input )] );
}
ssize_t bang_len = g_utf8_pointer_to_offset ( input, eob ) - 1;
if ( bang_len > 0 ) {
Expand Down
1 change: 0 additions & 1 deletion source/dialogs/dmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ int dmenu_switcher_dialog ( void )
find_arg_str ( "-p", &( dmenu_mode.display_name ) );
RofiViewState *state = rofi_view_create ( &dmenu_mode, input, menu_flags, dmenu_finalize );


if ( find_arg ( "-keep-right" ) >= 0 ) {
rofi_view_ellipsize_start ( state );
}
Expand Down
2 changes: 1 addition & 1 deletion source/dialogs/drun.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static gboolean drun_helper_eval_cb ( const GMatchInfo *info, GString *res, gpoi
case 'm':
break;
case '%':
g_string_append(res, "%");
g_string_append ( res, "%" );
break;
case 'k':
if ( e->e->path ) {
Expand Down
Loading

0 comments on commit 88e5f9b

Please sign in to comment.