From 5996303c082a01e066947cf8c7f7820b45318c04 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 11 Jul 2017 19:39:20 +0200 Subject: [PATCH] Convert old location format into new, so we are compatible again. Fixes: #630 --- source/helper.c | 4 ++-- source/view.c | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/source/helper.c b/source/helper.c index 6ef7498d..792c8608 100644 --- a/source/helper.c +++ b/source/helper.c @@ -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, "\tconfig.location=%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; } diff --git a/source/view.c b/source/view.c index 70d8668e..43a258cd 100644 --- a/source/view.c +++ b/source/view.c @@ -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;