diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 279e7e9..c76f022 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -752,6 +752,7 @@ void on_monitor_config_save(GtkWidget *, monitor_edit_window *window){ char *target=NULL; int main_display=0; char *resolution = NULL; + const char *frequency = NULL; char *rotate = NULL; char *position = NULL; // int switch_off=0; @@ -763,8 +764,11 @@ void on_monitor_config_save(GtkWidget *, monitor_edit_window *window){ if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->PortCombo))){ target = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->PortCombo)); main_display = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->MainCheck)); - if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->ResolutionCombo))) - resolution = yon_char_divide_search(yon_char_new(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->ResolutionCombo)))," ",-1); + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->ResolutionCombo))){ + char *res_str = yon_char_new(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->ResolutionCombo))); + frequency = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->FrequencyCombo)); + resolution = yon_char_unite(yon_char_divide_search(res_str," ",-1),"x",frequency,NULL); + } int rot = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationCombo)); rotate = yon_char_append("rotate:",rot == 0?"normal":rot==1?"left":rot==2?"right":"invert"); int pos = gtk_combo_box_get_active(GTK_COMBO_BOX(window->PositionPosCombo)); @@ -816,9 +820,7 @@ void yon_monitor_parse(monitor_edit_window *window, char *string){ int parsed_size; config_str parsed = yon_char_parse(string,&parsed_size,","); if (parsed_size>0){ - int resolution = yon_gtk_combo_box_text_find(window->ResolutionCombo,parsed[0]); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->ResolutionCombo),resolution); - for (int i=1; iModelineCVTCheck),1); } else if (!strcmp(parsed[i],"gtf")){ @@ -881,6 +883,22 @@ void yon_monitor_parse(monitor_edit_window *window, char *string){ } + } else if (g_ascii_isdigit(parsed[i][0])&&strstr(parsed[i],"x")){ + if (yon_char_count(parsed[i],"x")>1){ + int pos = yon_char_find_last(parsed[i],'x'); + char *res = yon_char_divide(parsed[i],pos); + int resolution = yon_gtk_combo_box_text_find(window->FrequencyCombo,parsed[i]); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->FrequencyCombo),resolution==0?-1:resolution); + free(parsed[i]); + parsed[i]=res; + } + int resolution = yon_gtk_combo_box_text_find(window->ResolutionCombo,parsed[i]); + if (resolution == -1){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UnsupportedCheck),1); + while(gtk_events_pending()) gtk_main_iteration(); + } + resolution = yon_gtk_combo_box_text_find(window->ResolutionCombo,parsed[i]); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->ResolutionCombo),resolution==0?-1:resolution); } } }