mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-03 04:23:42 -05:00
Create more consistent ordering of arguments
This commit is contained in:
parent
6978b146f0
commit
00a555b685
9 changed files with 15 additions and 15 deletions
|
@ -33,7 +33,7 @@ typedef enum
|
||||||
|
|
||||||
typedef void ( *switcher_free )( Switcher *data );
|
typedef void ( *switcher_free )( Switcher *data );
|
||||||
|
|
||||||
typedef char * ( *get_display_value )( unsigned int selected_line, const Switcher *data, int *state, int get_entry );
|
typedef char * ( *get_display_value )( const Switcher *sw, unsigned int selected_line, int *state, int get_entry );
|
||||||
|
|
||||||
typedef char * ( *get_completion )( const Switcher *sw, unsigned int selected_line );
|
typedef char * ( *get_completion )( const Switcher *sw, unsigned int selected_line );
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -203,13 +203,13 @@ static int combi_mode_match ( const Switcher *sw, char **tokens, int not_ascii,
|
||||||
abort ();
|
abort ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static char * combi_mgrv ( unsigned int selected_line, const Switcher *sw, int *state, int get_entry )
|
static char * combi_mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry )
|
||||||
{
|
{
|
||||||
CombiModePrivateData *pd = sw->private_data;
|
CombiModePrivateData *pd = sw->private_data;
|
||||||
if ( !get_entry ) {
|
if ( !get_entry ) {
|
||||||
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
||||||
if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
|
if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
|
||||||
pd->switchers[i]->mgrv ( selected_line - pd->starts[i], (void *) pd->switchers[i], state, FALSE );
|
pd->switchers[i]->mgrv ( pd->switchers[i], selected_line - pd->starts[i], state, FALSE );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ static char * combi_mgrv ( unsigned int selected_line, const Switcher *sw, int *
|
||||||
}
|
}
|
||||||
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
||||||
if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
|
if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
|
||||||
char * str = pd->switchers[i]->mgrv ( selected_line - pd->starts[i], (void *) pd->switchers[i], state, TRUE );
|
char * str = pd->switchers[i]->mgrv ( pd->switchers[i], selected_line - pd->starts[i], state, TRUE );
|
||||||
char * retv = g_strdup_printf ( "(%s) %s", pd->switchers[i]->name, str );
|
char * retv = g_strdup_printf ( "(%s) %s", pd->switchers[i]->name, str );
|
||||||
g_free ( str );
|
g_free ( str );
|
||||||
return retv;
|
return retv;
|
||||||
|
@ -247,7 +247,7 @@ static char * combi_get_completion ( const Switcher *sw, unsigned int index )
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int state;
|
int state;
|
||||||
str = pd->switchers[i]->mgrv ( index - pd->starts[i], (void *) pd->switchers[i], &state, TRUE );
|
str = pd->switchers[i]->mgrv ( pd->switchers[i], index - pd->starts[i], &state, TRUE );
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ static void parse_ranges ( char *input, struct range_pair **list, unsigned int *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *get_display_data ( unsigned int index, const Switcher *data, int *state, int get_entry )
|
static char *get_display_data ( const Switcher *data, unsigned int index, int *state, int get_entry )
|
||||||
{
|
{
|
||||||
Switcher *sw = (Switcher *) data;
|
Switcher *sw = (Switcher *) data;
|
||||||
DmenuModePrivateData *pd = (DmenuModePrivateData *) sw->private_data;
|
DmenuModePrivateData *pd = (DmenuModePrivateData *) sw->private_data;
|
||||||
|
|
|
@ -275,7 +275,7 @@ static void drun_mode_destroy ( Switcher *sw )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *mgrv ( unsigned int selected_line, const Switcher *sw, int *state, int get_entry )
|
static char *mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry )
|
||||||
{
|
{
|
||||||
DRunModePrivateData *pd = (DRunModePrivateData *) sw->private_data;
|
DRunModePrivateData *pd = (DRunModePrivateData *) sw->private_data;
|
||||||
*state |= MARKUP;
|
*state |= MARKUP;
|
||||||
|
|
|
@ -326,7 +326,7 @@ static void run_mode_destroy ( Switcher *sw )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *mgrv ( unsigned int selected_line, const Switcher *sw, G_GNUC_UNUSED int *state, int get_entry )
|
static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry )
|
||||||
{
|
{
|
||||||
const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data;
|
const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data;
|
||||||
return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL;
|
return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL;
|
||||||
|
|
|
@ -156,7 +156,7 @@ static void script_mode_destroy ( Switcher *sw )
|
||||||
sw->private_data = NULL;
|
sw->private_data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static char *mgrv ( unsigned int selected_line, const Switcher *sw, G_GNUC_UNUSED int *state, int get_entry )
|
static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry )
|
||||||
{
|
{
|
||||||
ScriptModePrivateData *rmpd = sw->private_data;
|
ScriptModePrivateData *rmpd = sw->private_data;
|
||||||
return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL;
|
return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL;
|
||||||
|
|
|
@ -376,7 +376,7 @@ static void ssh_mode_destroy ( Switcher *sw )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *mgrv ( unsigned int selected_line, const Switcher *sw, G_GNUC_UNUSED int *state, int get_entry )
|
static char *mgrv ( const Switcher *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, int get_entry )
|
||||||
{
|
{
|
||||||
SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data;
|
SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data;
|
||||||
return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL;
|
return get_entry ? g_strdup ( rmpd->cmd_list[selected_line] ) : NULL;
|
||||||
|
|
|
@ -559,7 +559,7 @@ static void window_mode_destroy ( Switcher *sw )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *mgrv ( unsigned int selected_line, const Switcher *sw, int *state, int get_entry )
|
static char *mgrv ( const Switcher *sw, unsigned int selected_line, int *state, int get_entry )
|
||||||
{
|
{
|
||||||
SwitcherModePrivateData *rmpd = sw->private_data;
|
SwitcherModePrivateData *rmpd = sw->private_data;
|
||||||
if ( window_client ( display, rmpd->ids->array[selected_line] )->demands ) {
|
if ( window_client ( display, rmpd->ids->array[selected_line] )->demands ) {
|
||||||
|
|
|
@ -649,7 +649,7 @@ static int menu_keyboard_navigation ( MenuState *state, KeySym key, unsigned int
|
||||||
str = state->sw->get_completion ( state->sw, state->line_map[state->selected] );
|
str = state->sw->get_completion ( state->sw, state->line_map[state->selected] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str = state->sw->mgrv ( state->line_map[state->selected], state->sw, &st, TRUE );
|
str = state->sw->mgrv ( state->sw, state->line_map[state->selected], &st, TRUE );
|
||||||
}
|
}
|
||||||
textbox_text ( state->text, str );
|
textbox_text ( state->text, str );
|
||||||
g_free ( str );
|
g_free ( str );
|
||||||
|
@ -771,7 +771,7 @@ static void filter_elements ( thread_state *t, G_GNUC_UNUSED gpointer user_data
|
||||||
t->state->line_map[t->start + t->count] = i;
|
t->state->line_map[t->start + t->count] = i;
|
||||||
if ( config.levenshtein_sort ) {
|
if ( config.levenshtein_sort ) {
|
||||||
// This is inefficient, need to fix it.
|
// This is inefficient, need to fix it.
|
||||||
char * str = t->state->sw->mgrv ( i, t->state->sw, &st, TRUE );
|
char * str = t->state->sw->mgrv ( t->state->sw, i, &st, TRUE );
|
||||||
t->state->distance[i] = levenshtein ( t->state->text->text, str );
|
t->state->distance[i] = levenshtein ( t->state->text->text, str );
|
||||||
g_free ( str );
|
g_free ( str );
|
||||||
}
|
}
|
||||||
|
@ -943,7 +943,7 @@ static void menu_draw ( MenuState *state, cairo_t *d )
|
||||||
{
|
{
|
||||||
TextBoxFontType type = ( ( ( i % state->max_rows ) & 1 ) == 0 ) ? NORMAL : ALT;
|
TextBoxFontType type = ( ( ( i % state->max_rows ) & 1 ) == 0 ) ? NORMAL : ALT;
|
||||||
int fstate = 0;
|
int fstate = 0;
|
||||||
char *text = state->sw->mgrv ( state->line_map[i + offset], state->sw, &fstate, TRUE );
|
char *text = state->sw->mgrv ( state->sw, state->line_map[i + offset], &fstate, TRUE );
|
||||||
TextBoxFontType tbft = fstate | ( ( i + offset ) == state->selected ? HIGHLIGHT : type );
|
TextBoxFontType tbft = fstate | ( ( i + offset ) == state->selected ? HIGHLIGHT : type );
|
||||||
textbox_font ( state->boxes[i], tbft );
|
textbox_font ( state->boxes[i], tbft );
|
||||||
textbox_text ( state->boxes[i], text );
|
textbox_text ( state->boxes[i], text );
|
||||||
|
@ -958,7 +958,7 @@ static void menu_draw ( MenuState *state, cairo_t *d )
|
||||||
for ( i = 0; i < max_elements; i++ ) {
|
for ( i = 0; i < max_elements; i++ ) {
|
||||||
TextBoxFontType type = ( ( ( i % state->max_rows ) & 1 ) == 0 ) ? NORMAL : ALT;
|
TextBoxFontType type = ( ( ( i % state->max_rows ) & 1 ) == 0 ) ? NORMAL : ALT;
|
||||||
int fstate = 0;
|
int fstate = 0;
|
||||||
state->sw->mgrv ( state->line_map[i + offset], state->sw, &fstate, FALSE );
|
state->sw->mgrv ( state->sw, state->line_map[i + offset], &fstate, FALSE );
|
||||||
TextBoxFontType tbft = fstate | ( ( i + offset ) == state->selected ? HIGHLIGHT : type );
|
TextBoxFontType tbft = fstate | ( ( i + offset ) == state->selected ? HIGHLIGHT : type );
|
||||||
textbox_font ( state->boxes[i], tbft );
|
textbox_font ( state->boxes[i], tbft );
|
||||||
textbox_draw ( state->boxes[i], d );
|
textbox_draw ( state->boxes[i], d );
|
||||||
|
|
Loading…
Reference in a new issue