1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Convert old location format into new, so we are compatible again.

Fixes: #630
This commit is contained in:
Dave Davenport 2017-07-11 19:39:20 +02:00
parent 0d6bff9354
commit 5996303c08
2 changed files with 23 additions and 3 deletions

View file

@ -605,9 +605,9 @@ int config_sanity_check ( void )
config.menu_columns = 50;
found_error = TRUE;
}
if ( !( config.location >= WL_CENTER && config.location <= WL_WEST ) ) {
if ( !( config.location >= 0 && config.location <= 8) ) {
g_string_append_printf ( msg, "\t<b>config.location</b>=%d is invalid. Value should be between %d and %d.\n",
config.location, WL_CENTER, WL_WEST );
config.location, 0, 8);
config.location = WL_CENTER;
found_error = 1;
}

View file

@ -258,9 +258,29 @@ static void rofi_view_update_prompt ( RofiViewState *state )
/**
* Calculates the window position
*/
/** Convert the old location to the new location type.
* 123
* 804
* 765
*
* nw n ne
* w c e
* sw s se
*/
static const int loc_transtable[9] = {
WL_CENTER,
WL_NORTH|WL_WEST,
WL_NORTH,
WL_NORTH|WL_EAST,
WL_EAST,
WL_SOUTH|WL_EAST,
WL_SOUTH,
WL_SOUTH|WL_WEST,
WL_WEST
};
static void rofi_view_calculate_window_position ( RofiViewState *state )
{
int location = rofi_theme_get_position ( WIDGET ( state->main_window ), "location", config.location );
int location = rofi_theme_get_position ( WIDGET ( state->main_window ), "location", loc_transtable[config.location] );
int anchor = location;
if ( !listview_get_fixed_num_lines ( state->list_view ) ) {
anchor = location;