From 8382fb0914e0db11047b7278020df23403e6025e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 26 Apr 2023 18:15:53 +0000 Subject: [PATCH] design changes --- README.md | 2 +- Resolutions.csv => resolutions.csv | 0 source/ubl-settings-video-strings.h | 43 + source/ubl-settings-video.c | 1131 +++++--- source/ubl-settings-video.h | 104 +- source/ubl-utils.c | 97 +- source/ubl-utils.h | 15 +- ubl-settings-video.desktop | 2 +- ubl-settings-video.glade | 3681 ++++++++++++++------------- 9 files changed, 2800 insertions(+), 2275 deletions(-) rename Resolutions.csv => resolutions.csv (100%) create mode 100644 source/ubl-settings-video-strings.h diff --git a/README.md b/README.md index f2222e2..457d749 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ubl-settings-video -# Видеокарта/Экран +# Настройки видеоадаптера и дисплея # Build In order to build ubl-settings-video you will need: diff --git a/Resolutions.csv b/resolutions.csv similarity index 100% rename from Resolutions.csv rename to resolutions.csv diff --git a/source/ubl-settings-video-strings.h b/source/ubl-settings-video-strings.h new file mode 100644 index 0000000..f15d6ef --- /dev/null +++ b/source/ubl-settings-video-strings.h @@ -0,0 +1,43 @@ +#define PARAMETER_DEFAULT_LABEL _("Default settings") +#define MONITOR_LABEL _("Monitor ") +#define SETTINGS_VIDEO_TITLE_LABEL _("Video adapter and display settings") +#define MONITOR_PORT_LABEL _("Port: ") +#define MONITOR_RESOLUTION_LABEL _("Resolution (px): ") +#define MONITOR_FREQUENCY_LABEL _("Frequency (Hz): ") +#define MONITOR_ROTATION_LABEL _("Rotation: ") +#define MONITOR_POSITION_LABEL _("Position: ") +#define MONITOR_SWITCH_OFF_LABEL _("Do not switch off display") +#define MONITOR_CVT_LABEL _("Create modeline for current resolution with CVT") +#define MONITOR_REDUCED_LABEL _("Use \"CVT Reduced Blanking\"") +#define MONITOR_GTF_LABEL _("Create modeline for current resolution with GTF") +#define MONITOR_MANUALLY_LABEL _("Configure manually through parameter line: ") +#define MONITOR_MAIN_DISPLAY_LABEL _("Main display") +#define MONITOR_UNSUPPORTED_LABEL _("Show unsupported") +#define MONITOR_ENABLED_LABEL _("Enabled") +#define MONITOR_LEFT_LABEL _("Left") +#define MONITOR_RIGHT_LABEL _("Right") +#define MONITOR_INVERTED_LABEL _("Inverted") +#define MONITOR_LEFT_POS_LABEL _("Left of") +#define MONITOR_RIGHT_POS_LABEL _("Right of") +#define MONITOR_ABOVE_POS_LABEL _("Above") +#define MONITOR_BELOW_POS_LABEL _("Below ") +#define MONITOR_NO_ROTATION_LABEL _("No rotation") +#define MONITOR_SAVE_LABEL _("Save") +#define MONITOR_CANCEL_LABEL _("Cancel") +#define MONITOR_CHOOSE_PORT_LABEL _("Choose port to configure") + + +#define MONITOR_POSITION_LEFT_PARAMETER _("lo:") +#define MONITOR_POSITION_RIGHT_PARAMETER _("ro:") +#define MONITOR_POSITION_ABOVE_PARAMETER _("ab:") +#define MONITOR_POSITION_BELOW_PARAMETER _("be:") + + +#define MONITOR_ROTATE_PARAMETER _("rotate:") +#define MONITOR_ROTATE_NORMAL_PARAMETER _("normal") +#define MONITOR_ROTATE_LEFT_PARAMETER _("left") +#define MONITOR_ROTATE_RIGHT_PARAMETER _("right") +#define MONITOR_ROTATE_INVERTED_PARAMETER _("invert") + +#define MONITOR_PORT_ERROR_LABEL _("Error: Port must be chosen to save") +#define MONITOR_PORT_SUCCESS_LABEL _("Monitor configuration succeedeed") \ No newline at end of file diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 5de3e3e..406d051 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -10,70 +10,130 @@ void yon_on_plug_removed(GtkSocket *self, gpointer user_data) { } -void on_close_subwindow(GtkWidget *self) +void on_subwindow_close(GtkWidget *self) { gtk_widget_destroy(gtk_widget_get_toplevel(self)); } -void on_save_window_configuration(GtkWidget *self, MonitorSettings *monitor){ - char *freq=NULL; - char *res=NULL; - char *rot=NULL; - char *entr=NULL; - char *def=NULL; - def=_("Default settings"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationMainRadio))==1) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main=1; - if (strcmp((freq=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationFrequencyCombo)))),def)!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=freq; - else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=NULL; - if (strcmp((res=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationResolutionCombo)))),def)!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=res; - else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=NULL; - if (strcmp((rot=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationRotationCombo)))),def)!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=rot; - else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=NULL; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationParameterLineCheck))){ - entr=yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(monitor->templateMonitorConfigurationParameterLineEntry))); - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=entr; +void on_monitor_config_save(GtkWidget *self, monitor_edit_window *window){ + monitorconfig *config = yon_dictionary_get_data(window->config,monitorconfig*); + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPortCombo))==0){ + _yon_ubl_status_box_render(videoconfig.status_render.box,videoconfig.status_render.icon,videoconfig.status_render.label,MONITOR_PORT_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + config->main=0; + config->enable=0; + config->position=0; + config->rotation=0; + config->dpms=0; + config->cvt=0; + config->reduced=0; + config->position_port=NULL; + config->port=NULL; + config->resolution=NULL; + config->frequency=NULL; + _yon_ubl_status_box_render(videoconfig.status_render.box,videoconfig.status_render.icon,videoconfig.status_render.label,MONITOR_PORT_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + config->port = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationPortCombo)); + window->config->key = yon_char_new(config->port); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationParameterLineCheck))==0){ + config->main = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationMainCheck)); + config->enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationEnableCheck)); + config->dpms = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineCVTCheck)); + config->cvt = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineCVTCheck)); + config->reduced = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationUseCVTReducedCheck)); + config->gtf = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineGTFCheck)); + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPosCombo))!=0 + &>k_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPortCombo))!=0){ + config->position = gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPosCombo)); + config->position_port = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationPositionPortCombo)); + + } + int rotation = gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationRotationCombo)); + if (rotation==1) config->rotation=rotation; + else if (rotation==2) config->rotation=rotation; + else if (rotation==3) config->rotation=rotation; + else config->rotation=0; + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationResolutionCombo))!=0) { + char *resolution = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationResolutionCombo)); + } + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationResolutionCombo))!=0) { + char *frequency = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationFrequencyCombo)); + } + yon_monitor_make_string(config); } else { - char *str=NULL; - str = ""; - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency!=NULL) - str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency,",")); - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution!=NULL) - str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution,",")); - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation!=NULL) - if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Right"))==0) - str=yon_char_get_augumented(str,"rotation:right,"); - else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Left"))==0) - str=yon_char_get_augumented(str,"rotation:left,"); - else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Invert"))==0) - str=yon_char_get_augumented(str,"rotation:invert,"); - else - str=yon_char_get_augumented(str,"rotation:normal,"); + char *stringparameters = (char*)gtk_entry_get_text(GTK_ENTRY(window->templateMonitorConfigurationParameterLineEntry)); + } + yon_monitor_view_update(); + on_subwindow_close(self); +} + +// void on_save_window_configuration(GtkWidget *self, MonitorSettings *monitor){ +// char *port=NULL; +// port=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationPortCombo)); +// if (!monitor->curconfig){ +// monitorconfig *confi = new(monitorconfig); +// if (!videoconfig.monitors) videoconfig.monitors=yon_dictionary_create_with_data(port,confi); +// else videoconfig.monitors=yon_dictionary_create_with_data_connected(videoconfig.monitors,port,confi); +// monitor->curconfig=videoconfig.monitors; +// } +// char *freq=NULL; +// char *res=NULL; +// char *rot=NULL; +// char *entr=NULL; +// char *def=NULL; +// def=_("Default settings"); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationMainRadio))==1) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main=1; +// if (strcmp((freq=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationFrequencyCombo)))),def)!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=freq; +// else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=NULL; +// if (strcmp((res=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationResolutionCombo)))),def)!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=res; +// else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=NULL; +// if (strcmp((rot=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationRotationCombo)))),def)!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=rot; +// else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=NULL; +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationParameterLineCheck))){ +// entr=yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(monitor->templateMonitorConfigurationParameterLineEntry))); +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=entr; +// } else { +// char *str=NULL; +// str = ""; +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency!=NULL) +// str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency,",")); +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution!=NULL) +// str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution,",")); +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation!=NULL) +// if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Right"))==0) +// str=yon_char_get_augumented(str,"rotation:right,"); +// else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Left"))==0) +// str=yon_char_get_augumented(str,"rotation:left,"); +// else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Invert"))==0) +// str=yon_char_get_augumented(str,"rotation:invert,"); +// else +// str=yon_char_get_augumented(str,"rotation:normal,"); - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main!=0) - str=yon_char_get_augumented(str,"primary,"); - if (strcmp(str,"")!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=str; +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main!=0) +// str=yon_char_get_augumented(str,"primary,"); +// if (strcmp(str,"")!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=str; - } - dictionary *dict=NULL; - for_dictionaries (dict,videoconfig.videoconfig){ - MonitorSettings *monitorsett=yon_dictionary_get_data(dict,MonitorSettings*); - if (monitorsett->curconfig==monitor->curconfig){ - yon_parse_monitor(monitorsett->curconfig,yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters); - gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoResolutionLabel),yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution); - if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==0) - gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitorsett->curconfig->data)->port)); - if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==1) - gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitorsett->curconfig->data)->port,"*"))); +// } +// dictionary *dict=NULL; +// // for_dictionaries (dict,videoconfig.videoconfig){ +// // MonitorSettings *monitorsett=yon_dictionary_get_data(dict,MonitorSettings*); +// // if (monitorsett->curconfig==monitor->curconfig){ +// // yon_parse_monitor(monitorsett->curconfig,yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters); +// // gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoResolutionLabel),yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution); +// // if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==0) +// // gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitorsett->curconfig->data)->port)); +// // if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==1) +// // gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitorsett->curconfig->data)->port,"*"))); - } - } - on_close_subwindow(self); -}; +// // } +// // } +// on_subwindow_close(self); +// }; void on_save_driver_configuration(GtkWidget *self,combo_tree *widgets){ GtkTreeIter iter; @@ -86,7 +146,7 @@ void on_save_driver_configuration(GtkWidget *self,combo_tree *widgets){ if (ret!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->combo),ret); - on_close_subwindow(self); + on_subwindow_close(self); } void on_sensitive_change(GtkWidget *self, GtkWidget *toggle) @@ -108,18 +168,15 @@ void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets) int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaLabel, !state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverCombo, !state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverButton, !state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverLabel, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDCombo, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDLabel, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaCombo, !state); } -void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors) -{ - gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); -} +// void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors) +// { +// gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); +// } char *yon_configuration_get_save_command(char *command){ char *str = NULL; @@ -141,7 +198,7 @@ char *yon_configuration_get_save_command(char *command){ for_dictionaries(dict,videoconfig.monitors){ if (yon_dictionary_get_data(dict,monitorconfig*)->stringparameters){ - str=yon_char_get_augumented(str, yon_config_make_save_parameter_with_multiple_arguments(yon_dictionary_get_data(dict,monitorconfig*)->stringparameters,yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[",dict->key),"]"),",")); + str=yon_char_get_augumented(str, yon_config_make_save_parameter_with_multiple_arguments(yon_dictionary_get_data(dict,monitorconfig*)->stringparameters,XORG_MONITOR(dict->key),",")); } } @@ -214,11 +271,10 @@ void on_configuration_save_global(GtkWidget *self, widgets_dict *widgets) void yon_update_config(widgets_dict *widgets) { - videoconfig.optirun = yon_char_get_augumented("", (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry))); - videoconfig.primusrun = yon_char_get_augumented("", (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry))); - // videoconfig.proprietary = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo))); - videoconfig.failsafenVidia = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo))); - videoconfig.failsafeATI = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo))); + videoconfig.optirun = yon_char_new( (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry))); + videoconfig.primusrun = yon_char_new( (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry))); + videoconfig.failsafenVidia = yon_char_new( gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo))); + videoconfig.failsafeATI = yon_char_new( gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo))); } void on_configuration_load_local(GtkWidget *self, widgets_dict *widgets) @@ -233,7 +289,7 @@ void on_configuration_load_local(GtkWidget *self, widgets_dict *widgets) int size = 0; char **rtn = yon_ubl_load_global_config(command, &size); char *param = NULL; - yon_config_init(rtn, size); + // yon_config_init(rtn, size); on_config_fill_interface(widgets); } @@ -249,53 +305,146 @@ void on_configuration_load_global(GtkWidget *self, widgets_dict *widgets) int size = 0; char **rtn = yon_ubl_load_global_config(command, &size); char *param = NULL; - yon_config_init(rtn, size); + // yon_config_init(rtn, size); on_config_fill_interface(widgets); } -int yon_config_init(char **parameters, int size) -{ - char *param = NULL; - dictionary *dct = NULL; - videoconfig.failsafenVidia = yon_config_get_parameter(parameters, size, "FAILSAFENVIDIA"); - videoconfig.failsafeATI = yon_config_get_parameter(parameters, size, "FAILSAFEATI"); - // videoconfig.proprietary = yon_config_get_parameter(parameters, size, "FAILSAFENVIDIA"); - videoconfig.optirun = yon_config_get_parameter(parameters, size, "OPTIRUN"); - videoconfig.primusrun = yon_config_get_parameter(parameters, size, "PRIMUSRUN"); - for_dictionaries(dct, videoconfig.monitors) - { - char *prm = yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[", dct->key), "]"); - param = yon_config_get_parameter(parameters, size, prm); - if (param) - { - yon_parse_monitor(dct, param); - } - else{ - yon_dictionary_get_data(dct,monitorconfig*)->frequency=NULL; - yon_dictionary_get_data(dct,monitorconfig*)->resolution=NULL; - yon_dictionary_get_data(dct,monitorconfig*)->main=0; - yon_dictionary_get_data(dct,monitorconfig*)->rotation=NULL; - yon_dictionary_get_data(dct,monitorconfig*)->stringparameters=NULL; +/**void on_monitor_delete(GtkWidget *self,monitor_view windowd) + * [EN] +*/ +void on_monitor_delete(GtkWidget *self,monitor_view windowd){ + monitor_window *window = yon_dictionary_get_data(windowd,monitor_window*); + if(window&&window->config){ + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(window->templateMonitorscreenOverlay)),window->templateMonitorscreenOverlay); + yon_dictionary_rip(windowd); + gtk_widget_destroy(window->templateMonitorscreenOverlay); + yon_dictionary_rip(window->config); + free(window); + } +} + +/**void on_monitor_switch(GtkWidget *self,monitor_window *window) + * [EN] +*/ +void on_monitor_switch(GtkWidget *self,monitor_window *window){ + if(window&&window->config){ + int *enable = &yon_dictionary_get_data(window->config,monitorconfig*)->enable; + *enable=!*enable; + gtk_widget_set_sensitive(window->templateMonitorImage,*enable); + } +} + +/**void on_monitor_add(GtkWidget *self,monitor_window *window) + * [EN] +*/ +void on_monitor_add(GtkWidget *self,monitor_window *window){ + if(window){ + videoconfig.monitors = yon_monitor_config_new(PARAMETER_DEFAULT_LABEL); + yon_monitor_view_new(videoconfig.monitors); + yon_monitor_view_draw_all(NULL); + } +} + +void on_monitor_configure(GtkWidget *self,monitor_window *window){ + if(window&&window->config){ + monitor_edit_window *monitors = new(monitor_edit_window); + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + monitors->templateMonitorConfigurationWindow = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationWindow")); + monitors->mainMonitorConfigurationBox = GTK_WIDGET(gtk_builder_get_object(builder, "mainMonitorConfigurationBox")); + monitors->templateMonitorConfigurationBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationBox")); + monitors->templateMonitorConfigurationEnableCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationEnableCheck")); + monitors->templateMonitorConfigurationPortLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortLabel")); + monitors->templateMonitorConfigurationPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortCombo")); + monitors->templateMonitorConfigurationMainCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMainCheck")); + monitors->templateMonitorConfigurationResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionLabel")); + monitors->templateMonitorConfigurationResolutionCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionCombo")); + monitors->templateMonitorConfigurationShowUnsupportedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationShowUnsupportedCheck")); + monitors->templateMonitorConfigurationFrequencyLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyLabel")); + monitors->templateMonitorConfigurationFrequencyCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyCombo")); + monitors->templateMonitorConfigurationRotationLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationLabel")); + // monitors->templateMonitorConfigurationDoNotSwitchOffLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffLabel")); + monitors->templateMonitorConfigurationRotationCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationCombo")); + monitors->templateMonitorConfigurationPositionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionLabel")); + monitors->templateMonitorConfigurationPositionPosCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPosCombo")); + monitors->templateMonitorConfigurationPositionPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPortCombo")); + + monitors->templateMonitorConfigurationModelineCVTCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineCVTCheck")); + monitors->templateMonitorConfigurationUseCVTReducedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationUseCVTReducedCheck")); + monitors->templateMonitorConfigurationModelineGTFCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineGTFCheck")); + monitors->templateMonitorConfigurationParameterLineCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineCheck")); + monitors->templateMonitorConfigurationParameterLineEntry = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineEntry")); + monitors->templateMonitorConfigurationCancelButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationCancelButton")); + monitors->templateMonitorConfigurationSaveButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationSaveButton")); + monitors->templateMonitorConfigurationDoNotSwitchOffCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffCheck")); + monitors->config=window->config; + + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_subwindow_close), NULL); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_monitor_config_save), monitors); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change_reversed), monitors->templateMonitorConfigurationBox); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change), monitors->templateMonitorConfigurationParameterLineEntry); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitors->templateMonitorConfigurationEnableCheck),yon_dictionary_get_data(monitors->config,monitorconfig*)->enable==1); + + + + gtk_window_set_title(GTK_WINDOW(monitors->templateMonitorConfigurationWindow),SETTINGS_VIDEO_TITLE_LABEL); + + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPortLabel),MONITOR_PORT_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel),MONITOR_RESOLUTION_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel),MONITOR_FREQUENCY_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel),MONITOR_ROTATION_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPositionLabel),MONITOR_POSITION_LABEL); + + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationEnableCheck),MONITOR_ENABLED_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainCheck),MONITOR_MAIN_DISPLAY_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationShowUnsupportedCheck),MONITOR_UNSUPPORTED_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),MONITOR_SWITCH_OFF_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineCVTCheck),MONITOR_CVT_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationUseCVTReducedCheck),MONITOR_REDUCED_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineGTFCheck),MONITOR_GTF_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck),MONITOR_MANUALLY_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationCancelButton),MONITOR_CANCEL_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationSaveButton),MONITOR_SAVE_LABEL); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPortCombo),MONITOR_CHOOSE_PORT_LABEL); + dictionary *dict=NULL; + for (int i=0;istringparameters) + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPortCombo),videoconfig.ports[i]); + } - yon_monitor_set_resolutions(dct); - } - if (videoconfig.videoconfig) - for_dictionaries(dct, videoconfig.videoconfig){ - MonitorSettings *settings=yon_dictionary_get_data(dct,MonitorSettings*); - if (((monitorconfig*)settings->curconfig->data)->port){ - if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->main==0) - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoNameLabel),yon_char_get_augumented("Monitor ",((monitorconfig*)settings->curconfig->data)->port)); - if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->main==1) - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoNameLabel),yon_char_get_augumented("Monitor ",yon_char_get_augumented(((monitorconfig*)settings->curconfig->data)->port,"*"))); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationPortCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationFrequencyCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_NO_ROTATION_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_LEFT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_RIGHT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_INVERTED_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationRotationCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_LEFT_POS_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_RIGHT_POS_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_ABOVE_POS_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_BELOW_POS_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationPositionPosCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPortCombo),PARAMETER_DEFAULT_LABEL); + for (int i=0;itemplateMonitorConfigurationPositionPortCombo),videoconfig.ports[i]); } - if (((monitorconfig*)settings->curconfig->data)->resolution) - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoResolutionLabel),((monitorconfig*)settings->curconfig->data)->resolution); - else - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoResolutionLabel),_("Default settings")); - + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationPositionPortCombo),0); + + yon_monitor_window_update(monitors); + + gtk_widget_show(monitors->templateMonitorConfigurationWindow); } } +/**void on_about() + * [EN] +*/ void on_about() { GtkBuilder *builder = gtk_builder_new_from_file(glade_path); @@ -309,34 +458,247 @@ void on_about() gtk_widget_show(window); } -void yon_parse_monitor(dictionary *monitor, char *string_of_settings) -{ - int size=0; - yon_dictionary_get_data(monitor,monitorconfig*)->stringparameters=string_of_settings; - char *param_string=yon_char_new(string_of_settings); - yon_char_divide_search(param_string,"=",1); - char **rtn = yon_char_parse(param_string,&size,","); - int check_code=-1; - if ((check_code=yon_char_parsed_check_exist(rtn,size,"primary"))!=-1){ - yon_dictionary_get_data(monitor,monitorconfig*)->main=1; - rtn=yon_char_parsed_shrink(rtn,&size,check_code); +void yon_monitor_window_update(monitor_edit_window *window){ + if (window){ + int found = yon_gtk_combo_box_text_find(window->templateMonitorConfigurationPortCombo, window->config->key); + if (found==-1) + found=0; + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPortCombo),found); + + found = yon_gtk_combo_box_text_find(window->templateMonitorConfigurationPositionPortCombo, yon_dictionary_get_data(window->config,monitorconfig*)->position_port); + if (found==-1) + found=0; + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPortCombo),found); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPosCombo),yon_dictionary_get_data(window->config,monitorconfig*)->position); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationRotationCombo),yon_dictionary_get_data(window->config,monitorconfig*)->rotation); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationDoNotSwitchOffCheck),yon_dictionary_get_data(window->config,monitorconfig*)->dpms); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationMainCheck),yon_dictionary_get_data(window->config,monitorconfig*)->main); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineCVTCheck),yon_dictionary_get_data(window->config,monitorconfig*)->cvt); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationUseCVTReducedCheck),yon_dictionary_get_data(window->config,monitorconfig*)->reduced); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineGTFCheck),yon_dictionary_get_data(window->config,monitorconfig*)->gtf); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationEnableCheck),yon_dictionary_get_data(window->config,monitorconfig*)->enable); + if(yon_dictionary_get_data(window->config,monitorconfig*)->stringparameters) + gtk_entry_set_text(GTK_ENTRY(window->templateMonitorConfigurationParameterLineEntry),yon_dictionary_get_data(window->config,monitorconfig*)->stringparameters); } - else - yon_dictionary_get_data(monitor,monitorconfig*)->main=0; - if ((check_code=yon_char_parsed_check_exist(rtn,size,"rotation"))!=-1){ - yon_dictionary_get_data(monitor,monitorconfig*)->rotation=rtn[check_code]; - rtn=yon_char_parsed_shrink(rtn,&size,check_code); +} + +/**void yon_monitor_view_draw_all(GtkWidget *cnt) + * [EN] +*/ +void yon_monitor_view_draw_all(GtkWidget *cnt){ + monitor_view dict=NULL; + GtkWidget *container=NULL; + if(!container&&cnt) container=cnt; + if(videoconfig.monitor_visuals){ + for_dictionaries(dict,videoconfig.monitor_visuals){ + monitor_window *window = yon_dictionary_get_data(dict,monitor_window*); + if (!container) container = gtk_widget_get_parent(window->templateMonitorscreenOverlay); + if(container){ + g_object_ref(G_OBJECT(window->templateMonitorscreenOverlay)); + gtk_container_remove(GTK_CONTAINER(container),window->templateMonitorscreenOverlay); + } + } + if (container) + for_dictionaries(dict,videoconfig.monitor_visuals){ + monitor_window *window = yon_dictionary_get_data(dict,monitor_window*); + if(dict->first==dict) {} + else gtk_box_pack_start(GTK_BOX(container),window->templateMonitorscreenOverlay,0,0,0); + } + monitor_window *window = yon_dictionary_get_data(videoconfig.monitor_visuals->first,monitor_window*); + gtk_box_pack_start(GTK_BOX(container),window->templateMonitorscreenOverlay,0,0,0); + } + yon_monitor_view_update(); +} + +/**void yon_monitor_view_setup(GtkWidget *container) + * [EN] +*/ +void yon_monitor_view_setup(GtkWidget *container){ + if(container){ + monitor_config config=NULL; + yon_monitor_view_new(NULL); + if (videoconfig.monitors){ + for_dictionaries(config,videoconfig.monitors){ + if (yon_dictionary_get_data(config,monitorconfig*)->stringparameters) + yon_monitor_view_new(config); + } + } + yon_monitor_view_draw_all(container); + } +} + +/**void yon_monitor_view_update() + * [EN] +*/ +void yon_monitor_view_update(){ + monitor_view dict=NULL; + for_dictionaries(dict,videoconfig.monitor_visuals){ + if(dict!=videoconfig.monitor_visuals->first){ + monitor_window *monitor = yon_dictionary_get_data(dict,monitor_window*); + monitorconfig *config = yon_dictionary_get_data(monitor->config,monitorconfig*); + if (strcmp(monitor->config->key,PARAMETER_DEFAULT_LABEL)!=0) + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoNameLabel),yon_char_get_augumented(MONITOR_LABEL,monitor->config->key)); + else + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoNameLabel),yon_char_get_augumented(MONITOR_LABEL,"")); + if (config->resolution) + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoResolutionLabel),config->resolution); + else + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoResolutionLabel),PARAMETER_DEFAULT_LABEL); + } } +} + +/**char *yon_monitor_make_string(monitorconfig* config) + * [EN] +*/ +char *yon_monitor_make_string(monitorconfig* config) +{ + int first=1; + char *main=""; + if (config->main==1){ + main="primary"; + first=0; + } + + char *enable=""; + if (config->enable==1) + if (first==1){ + enable="enable"; + first=0; + }else{ + enable=",enable"; + } else - yon_dictionary_get_data(monitor,monitorconfig*)->rotation=0; + if (first==1){ + enable="disable"; + first=0; + }else{ + enable=",disable"; + } + + char *position=""; + if (config->position==1) + if (first==1){ + position=yon_char_get_augumented("lo:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",lo:",config->position_port); + } + else if (config->position==2) + if (first==1){ + position=yon_char_get_augumented("ro:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",ro:",config->position_port); + } + else if (config->position==3) + if (first==1){ + position=yon_char_get_augumented("ab:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",ab:",config->position_port); + } + else if (config->position==4) + if (first==1){ + position=yon_char_get_augumented("be:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",be:",config->position_port); + } + + char *rotation=""; + if (config->rotation==0) + if (first==1){ + rotation="rotate:normal"; + first=0; + }else{ + rotation=",rotate:normal"; + } + else if (config->rotation==1) + if (first==1){ + rotation="rotate:left"; + first=0; + }else{ + rotation=",rotate:left"; + } + else if (config->rotation==2) + if (first==1){ + rotation="rotate:right"; + first=0; + }else{ + rotation=",rotate:right"; + } + else if (config->rotation==3) + if (first==1){ + rotation="rotate:invert"; + first=0; + }else{ + rotation=",rotate:invert"; + } + + char *dpms=""; + if (config->dpms==1) + if (first==1){ + dpms="dpms"; + first=0; + }else{ + dpms=",dpms"; + } + + char *cvt=""; + if (config->cvt==1) + if (first==1){ + cvt="cvt"; + first=0; + }else{ + cvt=",cvt"; + } + + char *reduced=""; + if (config->reduced==1) + if (first==1){ + reduced="reduced"; + first=0; + }else{ + reduced=",reduced"; + } + + char *gtf=""; + if (config->gtf==1) + if (first==1){ + gtf="gtf"; + first=0; + }else{ + gtf=",gtf"; + } + + char *resolution=""; + if(config->resolution) + if (first==1){ + resolution=config->resolution; + first=0; + }else{ + resolution=yon_char_get_augumented(",",config->resolution); + } + + + char *frequency=""; + if (config->frequency) + if (first==1){ + frequency=config->frequency; + first=0; + }else{ + frequency=yon_char_get_augumented(",",config->frequency); + } - for(int i=0;iresolution=yon_char_new(rtn[i]); - } + char *stringparameters=yon_char_unite("",main,resolution,frequency,enable,position,rotation,dpms,cvt,reduced,gtf,NULL); + config->stringparameters=yon_char_new(stringparameters); } +/**void on_config_fill_interface(widgets_dict *widgets) + * [EN] +*/ void on_config_fill_interface(widgets_dict *widgets) { gtk_widget_grab_focus(widgets->mainHeaderSettingsButton); @@ -345,7 +707,7 @@ void on_config_fill_interface(widgets_dict *widgets) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchOptirunCheck), 0); if (str) { - yon_char_divide_search((str = yon_char_new(videoconfig.optirun)), "=", 1); + yon_char_divide_search((str = yon_char_new(videoconfig.optirun)), "=", -1); gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry), str); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchOptirunCheck), 1); } @@ -358,19 +720,8 @@ void on_config_fill_interface(widgets_dict *widgets) gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry), str); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchPrismusunCheck), 1); } - gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo)); - // str = videoconfig.proprietary->key; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo), _("Don't use")); - int size=0; - char ** rtn = yon_config_load(get_proprietary_drivers_command,&size); - for (int driv=0;drivmainDriverProprietaryDriverCombo),drivr); - } - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverProprietaryDriverCombo), 0); gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo)); str = videoconfig.failsafenVidia; @@ -396,103 +747,93 @@ void on_config_fill_interface(widgets_dict *widgets) dictionary *dict = NULL; } +/**dictionary *yon_proprieary_get() + * [EN] +*/ dictionary *yon_proprieary_get(){ int size=0; char **rtn = yon_config_load(get_proprietary_drivers_command,&size); for (int i=0;idata,&size,":"); gtk_list_store_append(list,&iter); - gtk_list_store_set(list,&iter,0,dict->key,1,(char*)dict->data,-1); + gtk_list_store_set(list,&iter,1,str[1],2,str[2],3,str[3],4,str[4],-1); } } -void yon_setup_config() +/**void yon_setup_config(char *configcommand) + * [EN] +*/ +void yon_setup_config(char *configcommand) { - FILE *videoports = popen(get_ports_command, "r"); - char str[1000]; - while (fgets(str, 1000, videoports)) - { - printf("%s\n", str); - char *strng = yon_char_divide_search(str, "\n", 0); - monitorconfig *monitor = NULL; - monitor = malloc(sizeof(monitorconfig)); - monitor->port = yon_char_new(strng); - monitor->frequency=NULL; - monitor->frequency=NULL; - monitor->main=0; - monitor->resolution=NULL; - monitor->rotation=NULL; - monitor->stringparameters=NULL; - monitor->resolutionCapabilities=NULL; - videoconfig.list=NULL; - if (!videoconfig.monitors) - { - videoconfig.monitors = yon_dictionary_create_with_data(strng, monitor); - } - else - { - videoconfig.monitors = yon_dictionary_create_with_data_connected(videoconfig.monitors, strng, monitor); - } - memset(str, 0, 1000); - } + videoconfig.portssize=0; + videoconfig.ports=yon_config_load(get_ports_command,&videoconfig.portssize); + int size = 0; - char *command = load_drivers_local_command; + char *command = configcommand; dictionary *dct; - for_dictionaries(dct, videoconfig.monitors) + for(int i=0; idata)->port, "]")))); + command = yon_char_get_augumented(command, XORG_MONITOR(yon_char_divide_search(yon_char_new(videoconfig.ports[i]),"\n",-1))); } - char **rtn = yon_ubl_load_global_config(command, &size); + videoconfig.configsize=0; + videoconfig.loaded_config = yon_ubl_load_global_config(command, &videoconfig.configsize); char *param = NULL; + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"FAILSAFENVIDIA"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.failsafenVidia=yon_char_new(param); - yon_config_init(rtn, size); - // on_config_fill_interface(widgets); - // (param=yon_config_get_parameter(rtn,size,"OPTIRUN")) - if ((param = yon_config_get_parameter(rtn, size, "FAILSAFENVIDIA"))) - videoconfig.failsafenVidia = yon_char_new(param); - else - videoconfig.failsafenVidia = NULL; - if ((param = yon_config_get_parameter(rtn, size, "FAILSAFEATI"))) - videoconfig.failsafeATI = yon_char_new(param); - else - videoconfig.failsafeATI = NULL; - if ((param = yon_config_get_parameter(rtn, size, "OPTIRUN"))) - videoconfig.optirun = yon_char_new(param); - else - videoconfig.optirun = NULL; - if ((param = yon_config_get_parameter(rtn, size, "PRIMUSRUN"))) - videoconfig.primusrun = yon_char_new(param); - else - videoconfig.primusrun = NULL; + } + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"FAILSAFEATI"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.failsafeATI=yon_char_new(param); - for_dictionaries(dct, videoconfig.monitors) - { - char *prm = yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[", dct->key), "]"); - param = yon_config_get_parameter(rtn, size, prm); - if (param) - { - yon_parse_monitor(dct, param); - } } - yon_proprieary_get(); -} + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"OPTIRUN"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.optirun=yon_char_new(param); -void on_apps_chooser_open(GtkWidget *self, widgets_dict *widgets, int mode) -{ - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); // FILE *output=popen(""); + } + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"PRIMUSRUN"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.primusrun=yon_char_new(param); - printf("not implemented yet\n"); + } + for (int i=0;iProprietaryAcceptButton), _("Accept")); gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->propriearyTreeView),GTK_TREE_MODEL(videoconfig.list)); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Installed")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Package")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Supported Devices")); gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Driver")); gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDescriptionColumn), _("Description")); gtk_widget_show(widgets->window); - g_signal_connect(G_OBJECT(widgets->ProprietaryCloseButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); + g_signal_connect(G_OBJECT(widgets->ProprietaryCloseButton), "clicked", G_CALLBACK(on_subwindow_close), NULL); combo_tree *trcm=NULL; trcm=malloc(sizeof(combo_tree)); trcm->combo=comboe; @@ -526,143 +870,155 @@ driver_window *on_driver_window_open(GtkWidget *self, GtkWidget *comboe) g_signal_connect(G_OBJECT(widgets->ProprietaryAcceptButton), "clicked", G_CALLBACK(on_save_driver_configuration), trcm); } -void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings) -{ - int monitors_n = yon_check_for_monitors(); - MonitorSettings *monitors = NULL; - monitors = malloc(sizeof(MonitorSettings)); - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); - monitors->templateMonitorConfigurationWindow = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationWindow")); - monitors->templateMonitorConfigurationBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationBox")); - monitors->templateMonitorConfigurationMonitorLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMonitorLabel")); - monitors->templateMonitorConfigurationResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionLabel")); - monitors->templateMonitorConfigurationResolutionCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionCombo")); - monitors->templateMonitorConfigurationFrequencyLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyLabel")); - monitors->templateMonitorConfigurationFrequencyCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyCombo")); - monitors->templateMonitorConfigurationRotationCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationCombo")); - monitors->templateMonitorConfigurationRotationLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationLabel")); - monitors->templateMonitorConfigurationMainRadio = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMainCheck")); - monitors->templateMonitorConfigurationParameterLineCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineCheck")); - monitors->templateMonitorConfigurationParameterLineEntry = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineEntry")); - // monitors->templateMonitorConfigurationDoNotSwitchOffLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffLabel")); - monitors->templateMonitorConfigurationDoNotSwitchOffCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffCheck")); - monitors->templateMonitorConfigurationCancelButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationCancelButton")); - monitors->templateMonitorConfigurationSaveButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationSaveButton")); - - monitors->templateMonitorConfigurationEnableCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationEnableCheck")); - monitors->templateMonitorConfigurationPortLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortLabel")); - monitors->templateMonitorConfigurationPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortCombo")); - monitors->templateMonitorConfigurationShowUnsupportedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationShowUnsupportedCheck")); - monitors->templateMonitorConfigurationPositionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionLabel")); - monitors->templateMonitorConfigurationPositionPosCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPosCombo")); - monitors->templateMonitorConfigurationPositionPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPortCombo")); - monitors->templateMonitorConfigurationModelineCVTCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineCVTCheck")); - monitors->templateMonitorConfigurationUseCVTReducedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationUseCVTReducedCheck")); - monitors->templateMonitorConfigurationModelineGTFCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineGTFCheck")); - monitors->curconfig=settings->curconfig; - - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change_reversed), monitors->templateMonitorConfigurationBox); - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change), monitors->templateMonitorConfigurationParameterLineEntry); - - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_closed_configuration), monitors); - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_window_configuration), monitors); - - videoconfig.ports = yon_config_load(get_ports_command,&videoconfig.portssize); - - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationMonitorLabel), _("Monitor: ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPortLabel), _("Port: ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPositionLabel), _("Position: ")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationShowUnsupportedCheck), _("Show unsupported: ")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationEnableCheck), _("Enabled")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineCVTCheck), _("Create modeline for current resolution with CVT")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationUseCVTReducedCheck), _("Use \"CVT Reduced Blanking\" ")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineGTFCheck), _("Create modeline for current resolution with GTF")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel), _("Resolution (px): ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel), _("Frequency (Hz): ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel), _("Rotation: ")); - // gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationDoNotSwitchOffLabel),_("Do not switch display off")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainRadio), _("Main monitor")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck), _("through parameter line:")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationCancelButton), _("Cancel")); - gtk_widget_show(monitors->templateMonitorConfigurationWindow); - char *addln = NULL; - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitors->templateMonitorConfigurationMainRadio),((monitorconfig*)settings->curconfig->data)->main); - - addln = _("Default settings"); - int chosen=-1; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo), addln); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo), 0); - - addln = _("Default settings"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo), _("Default settings")); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationFrequencyCombo), 0); - - addln = _("Default settings"); - - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Default settings")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Left")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Right")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Invert")); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationRotationCombo), 0); - - - if (yon_dictionary_get_data(settings->curconfig,monitorconfig*)->resolutionCapabilities) - for (int res=0;rescurconfig,monitorconfig*)->resolution_size;res++){ - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),yon_dictionary_get_data(settings->curconfig,monitorconfig*)->resolutionCapabilities[res]); - } - if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->stringparameters){ - char *entry_text=yon_char_new(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->stringparameters); - yon_char_divide_search(entry_text,"=",1); - gtk_entry_set_text(GTK_ENTRY(monitors->templateMonitorConfigurationParameterLineEntry),entry_text); +/** monitor_config yon_monitor_config_new(char *port) + * [EN] +*/ +monitor_config yon_monitor_config_new(char *port){ + if (port){ + monitorconfig *monitor=new(monitorconfig); + monitor->main=0; + monitor->enable=0; + monitor->position=0; + monitor->port=NULL; + monitor->position_port=NULL; + monitor->resolution=NULL; + monitor->resolutionCapabilities=NULL; + monitor->frequency=NULL; + monitor->rotation=0; + monitor->stringparameters=NULL; + monitor->dpms=0; + monitor->resolution_size=0; + monitor->cvt=0; + monitor->reduced=0; + monitor->gtf=0; + + if (videoconfig.monitors) + videoconfig.monitors=yon_dictionary_create_with_data_connected(videoconfig.monitors,port,monitor); + else + videoconfig.monitors=yon_dictionary_create_with_data(port,monitor); + return videoconfig.monitors; } - if (((monitorconfig *)settings->curconfig->data)->resolution) - if ((chosen=yon_gtk_combo_box_text_find(monitors->templateMonitorConfigurationResolutionCombo,((monitorconfig *)settings->curconfig->data)->resolution))!=-1) - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo),chosen); } -MonitorSettings *yon_setup_monitor_settings() -{ - int monitors_n = yon_check_for_monitors(); - MonitorSettings *monitors = NULL; - monitors = malloc(sizeof(MonitorSettings) * monitors_n); - // videoconfig.videoconfig=videoconfig.videoconfig->first; - for (int i = 0; i < monitors_n; i++) - { - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); - monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); - monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); - monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); - monitors[i].templateMonitorImage = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorImage")); - monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); - monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); - monitors[i].templateMonitorDeleteButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorDeleteButton")); - monitors[i].templateMonitorSwitchButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorSwitchButton")); - monitors[i].curconfig = yon_dictionary_get_nth(videoconfig.monitors, i); - printf("%d\n", i); - if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==0) - gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitors[i].curconfig->data)->port)); - if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==1) - gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->port,"*"))); - char *res = yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->resolution, ""); - if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->enable==1) - gtk_widget_set_sensitive(monitors[i].templateMonitorImage,1); - if (!res) - res = _("Default settings"); - gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), res); - gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); - g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); - g_signal_connect(G_OBJECT(monitors[i].templateMonitorDeleteButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); - g_signal_connect(G_OBJECT(monitors[i].templateMonitorSwitchButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); - if (i==0) - videoconfig.videoconfig = yon_dictionary_create_with_data(((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); - else - videoconfig.videoconfig = yon_dictionary_create_with_data_connected(videoconfig.videoconfig,((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); - if (videoconfig.monitors->next) - videoconfig.monitors = videoconfig.monitors->next; +/**void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string) + * [EN] +*/ +void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string){ + if (port&&config_string){ + monitor->stringparameters=yon_char_new(config_string); + int size=0; + config_str cnf = yon_char_parse(config_string,&size,","); + if (yon_char_parsed_check_exist(cnf,size,"primary")!=-1) + monitor->main=1; + if (yon_char_parsed_check_exist(cnf,size,"enable")!=-1) + monitor->enable=1; + if (yon_char_parsed_check_exist(cnf,size,"disable")!=-1) + monitor->enable=0; + // if (yon_char_parsed_check_exist(cnf,size,"ignore")==1) + // monitor->enable=0; + if (yon_char_parsed_check_exist(cnf,size,"LeftOf:")!=-1) + monitor->position=1; + if (yon_char_parsed_check_exist(cnf,size,"lo:")!=-1) + monitor->position=1; + if (yon_char_parsed_check_exist(cnf,size,"RightOf:")!=-1) + monitor->position=2; + if (yon_char_parsed_check_exist(cnf,size,"ro:")!=-1) + monitor->position=2; + if (yon_char_parsed_check_exist(cnf,size,"Below:")!=-1) + monitor->position=4; + if (yon_char_parsed_check_exist(cnf,size,"be:")!=-1) + monitor->position=4; + if (yon_char_parsed_check_exist(cnf,size,"Above:")!=-1) + monitor->position=3; + if (yon_char_parsed_check_exist(cnf,size,"ab:")!=-1) + monitor->position=3; + if (yon_char_parsed_check_exist(cnf,size,"rotate:")!=-1) + monitor->rotation=0; + if (yon_char_parsed_check_exist(cnf,size,"dpms")!=-1) + monitor->dpms=1; + if (yon_char_parsed_check_exist(cnf,size,"nodpms")!=-1) + monitor->dpms=0; + if (yon_char_parsed_check_exist(cnf,size,"cvt")!=-1) + monitor->cvt=1; + if (yon_char_parsed_check_exist(cnf,size,"reduced")!=-1) + monitor->reduced=1; + if (yon_char_parsed_check_exist(cnf,size,"r")!=-1) + monitor->reduced=1; + if (yon_char_parsed_check_exist(cnf,size,"gtf")!=-1) + monitor->gtf=1; } - return monitors; } +// MonitorSettings *yon_setup_monitor_settings() +// { +// int monitors_n = videoconfig.portssize; +// MonitorSettings *monitors = NULL; +// monitors = malloc(sizeof(MonitorSettings) * (monitors_n+1)); +// // videoconfig.videoconfig=videoconfig.videoconfig->first; +// int i=0; +// if (videoconfig.monitors){ +// for (i = 0; i < monitors_n; i++) +// { +// GtkBuilder *builder = gtk_builder_new_from_file(glade_path); +// monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); +// monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); +// monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); +// monitors[i].templateMonitorImage = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorImage")); +// monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); +// monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); +// monitors[i].templateMonitorDeleteButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorDeleteButton")); +// monitors[i].templateMonitorSwitchButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorSwitchButton")); +// monitors[i].curconfig = yon_dictionary_get_nth(videoconfig.monitors, i); +// printf("%d\n", i); +// if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==0) +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitors[i].curconfig->data)->port)); +// if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==1) +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->port,"*"))); +// char *res = yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->resolution, ""); +// if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->enable==1) +// gtk_widget_set_sensitive(monitors[i].templateMonitorImage,1); +// if (!res) +// res = _("Default settings"); +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), res); +// gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorDeleteButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorSwitchButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// if (i==0) +// videoconfig.videoconfig = yon_dictionary_create_with_data(((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); +// else +// videoconfig.videoconfig = yon_dictionary_create_with_data_connected(videoconfig.videoconfig,((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); +// if (videoconfig.monitors->next) +// videoconfig.monitors = videoconfig.monitors->next; +// } +// } +// GtkBuilder *builder = gtk_builder_new_from_file(glade_path); +// monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); +// monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); +// monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); +// monitors[i].templateMonitorImage = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorImage")); +// monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); +// monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); +// monitors[i].templateMonitorDeleteButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorDeleteButton")); +// monitors[i].templateMonitorSwitchButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorSwitchButton")); +// monitors[i].templateMonitorInfoAddButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoAddButton")); +// gtk_widget_show(monitors[i].templateMonitorInfoAddButton); +// gtk_widget_hide(monitors[i].templateMonitorSwitchButton); +// gtk_widget_hide(monitors[i].templateMonitorDeleteButton); +// gtk_widget_hide(monitors[i].templateMonitorInfoConfigureButton); +// monitors[i].curconfig = NULL; +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), ""); +// gtk_widget_set_sensitive(monitors[i].templateMonitorImage,0); +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), ""); +// gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoAddButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// if (i==0) +// videoconfig.videoconfig = yon_dictionary_create_with_data("TEMPLATE",&monitors[i]); +// else +// videoconfig.videoconfig = yon_dictionary_create_with_data_connected(videoconfig.videoconfig,"TEMPLATE",&monitors[i]); +// return monitors; +// } + int yon_char_get_if_resolution(char *parsed_string){ char *left=NULL, *right=NULL; right=yon_char_new(parsed_string); @@ -673,31 +1029,38 @@ int yon_char_get_if_resolution(char *parsed_string){ return 0; } -int yon_check_for_monitors() -{ - GdkScreen *screen = gdk_screen_get_default(); - int monitors = gdk_display_get_n_monitors(gdk_screen_get_display(screen)); - return monitors; -} - -dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size) -{ - dictionary *dict = yon_dictionary_create_with_data("0", monitors[0].templateMonitorConfigurationBox); - for (int i = 1; i < size; i++) - { - dict = yon_dictionary_create_with_data_connected(dict, yon_char_from_int(i), monitors[i].templateMonitorConfigurationBox); - } - return dict; -} - -dictionary *yon_dictionary_pack_overlays(MonitorSettings *monitors, int size) -{ - dictionary *dict = yon_dictionary_create_with_data("0", monitors[0].templateMonitorscreenOverlay); - for (int i = 1; i < size; i++) - { - dict = yon_dictionary_create_with_data_connected(dict, yon_char_from_int(i), monitors[i].templateMonitorscreenOverlay); +void yon_monitor_view_new(monitor_config monitor){ + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + monitor_window *window = new(monitor_window); + window->templateMonitorscreenOverlay=yon_gtk_builder_get_widget(builder,"templateMonitorscreenOverlay"); + window->templateMonitorImage=yon_gtk_builder_get_widget(builder,"templateMonitorImage"); + window->templateMonitorInfoBox=yon_gtk_builder_get_widget(builder,"templateMonitorInfoBox"); + window->templateMonitorInfoNameLabel=yon_gtk_builder_get_widget(builder,"templateMonitorInfoNameLabel"); + window->templateMonitorInfoResolutionLabel=yon_gtk_builder_get_widget(builder,"templateMonitorInfoResolutionLabel"); + window->templateMonitorDeleteButton=yon_gtk_builder_get_widget(builder,"templateMonitorDeleteButton"); + window->templateMonitorSwitchButton=yon_gtk_builder_get_widget(builder,"templateMonitorSwitchButton"); + window->templateMonitorInfoConfigureButton=yon_gtk_builder_get_widget(builder,"templateMonitorInfoConfigureButton"); + window->templateMonitorInfoAddButton=yon_gtk_builder_get_widget(builder,"templateMonitorInfoAddButton"); + window->config=NULL; + gtk_overlay_add_overlay(GTK_OVERLAY(window->templateMonitorscreenOverlay),window->templateMonitorInfoBox); + if (monitor){ + window->config=monitor; + gtk_widget_hide(window->templateMonitorInfoAddButton); + g_signal_connect(G_OBJECT(window->templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_monitor_configure), window); + if (videoconfig.monitor_visuals) videoconfig.monitor_visuals = yon_dictionary_create_with_data_connected(videoconfig.monitor_visuals, window->config->key,window); + else videoconfig.monitor_visuals = yon_dictionary_create_with_data(window->config->key,window); + + g_signal_connect(G_OBJECT(window->templateMonitorDeleteButton), "clicked", G_CALLBACK(on_monitor_delete), videoconfig.monitor_visuals); + g_signal_connect(G_OBJECT(window->templateMonitorSwitchButton), "clicked", G_CALLBACK(on_monitor_switch), window); + } else { + gtk_widget_show(window->templateMonitorInfoAddButton); + gtk_widget_hide(window->templateMonitorDeleteButton); + gtk_widget_hide(window->templateMonitorSwitchButton); + gtk_widget_hide(window->templateMonitorInfoConfigureButton); + g_signal_connect(G_OBJECT(window->templateMonitorInfoAddButton), "clicked", G_CALLBACK(on_monitor_add), window); + if (videoconfig.monitor_visuals) videoconfig.monitor_visuals = yon_dictionary_create_with_data_connected(videoconfig.monitor_visuals, "GENERIC",window); + else videoconfig.monitor_visuals = yon_dictionary_create_with_data("GENERIC",window); } - return dict; } void yon_monitor_set_resolutions(dictionary *dict){ @@ -723,6 +1086,12 @@ void yon_monitor_set_resolutions(dictionary *dict){ } } +/** void yon_setup_widgets(widgets_dict *widgets) + * [EN] + * Sets up every element on main window + * [RU] + * + * */ void yon_setup_widgets(widgets_dict *widgets) { widgets->builder = gtk_builder_new_from_file(glade_path); @@ -738,12 +1107,9 @@ void yon_setup_widgets(widgets_dict *widgets) widgets->extraPrimusunChooseAppsButton = yon_gtk_builder_get_widget(widgets->builder, "extraPrimusunChooseAppsButton"); widgets->mainHeadBackgroundImage = yon_gtk_builder_get_widget(widgets->builder, "mainHeadBackgroundImage"); widgets->mainDriverAutomaticallyChooseCheck = yon_gtk_builder_get_widget(widgets->builder, "mainDriverAutomaticallyChooseCheck"); - widgets->mainDriverProprietaryDriverLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverLabel"); widgets->mainDriverFailsafeNvidiaLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeNvidiaLabel"); widgets->mainDriverFailsafeAMDLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeAMDLabel"); - widgets->mainDriverProprietaryDriverCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverCombo"); widgets->mainExtraFixGapCombo = yon_gtk_builder_get_widget(widgets->builder, "mainExtraFixGapCombo"); - widgets->mainDriverProprietaryDriverButton = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverButton"); widgets->mainDriverFailsafeNvidiaCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeNvidiaCombo"); widgets->mainDriverFailsafeAMDCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeAMDCombo"); widgets->mainDriverFrameLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFrameLabel"); @@ -793,6 +1159,8 @@ void yon_setup_widgets(widgets_dict *widgets) widgets->templateMonitorConfigurationDoNotSwitchOffLabel = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationDoNotSwitchOffLabel"); widgets->templateMonitorConfigurationDoNotSwitchOffCheck = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationDoNotSwitchOffCheck"); + videoconfig.list = GTK_LIST_STORE(gtk_builder_get_object(widgets-> builder, "liststore6")); + g_signal_connect(G_OBJECT(widgets->mainDriverAutomaticallyChooseCheck), "toggled", G_CALLBACK(on_auto_choose_drivers), widgets); // g_signal_connect(G_OBJECT(widgets->mainHybridGraphicsDiscreteCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets); g_signal_connect(G_OBJECT(widgets->mainExtraLaunchOptirunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->mainExtraLaunchOptirunEntry); @@ -801,9 +1169,8 @@ void yon_setup_widgets(widgets_dict *widgets) g_signal_connect(G_OBJECT(widgets->mainExtraLaunchPrismusunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->extraPrimusunChooseAppsButton); g_signal_connect(G_OBJECT(widgets->MainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); - g_signal_connect(G_OBJECT(widgets->mainDriverProprietaryDriverButton), "clicked", G_CALLBACK(on_driver_window_open), widgets->mainDriverProprietaryDriverCombo); - g_signal_connect(G_OBJECT(widgets->extraOptirunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); - g_signal_connect(G_OBJECT(widgets->extraPrimusunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); + // g_signal_connect(G_OBJECT(widgets->extraOptirunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); + // g_signal_connect(G_OBJECT(widgets->extraPrimusunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); g_signal_connect(G_OBJECT(widgets->mainHeaderSettingsAboutMenuItem), "activate", G_CALLBACK(on_about), NULL); g_signal_connect(G_OBJECT(widgets->mainHeaderSettingsDocumentationMenuItem), "activate", G_CALLBACK(on_about), NULL); @@ -815,7 +1182,6 @@ void yon_setup_widgets(widgets_dict *widgets) g_signal_connect(G_OBJECT(widgets->mainHeaderSaveGlobalMenuItem), "activate", G_CALLBACK(on_configuration_save_global), widgets); g_signal_connect(G_OBJECT(widgets->mainHeaderSaveLocalMenuItem), "activate", G_CALLBACK(on_configuration_save_local), widgets); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo), _("Don't use")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("Off")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("fbdev")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), _("Off")); @@ -824,7 +1190,6 @@ void yon_setup_widgets(widgets_dict *widgets) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo), _("1st variant. May cause perfomance drops in video games")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo), _("2nd variant. May not work on specific video cards")); gtk_label_set_text(GTK_LABEL(widgets->headInfoLabel), _("Video output configuration")); - gtk_label_set_text(GTK_LABEL(widgets->mainDriverProprietaryDriverLabel), _("Proprietary driver: ")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeNvidiaLabel), _("Failsafe driver nVidia: ")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeAMDLabel), _("Failsafe driver AMD/ATI: ")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverFrameLabel), _("Driver")); @@ -853,12 +1218,17 @@ void yon_setup_widgets(widgets_dict *widgets) // gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchThroughButton),_("Change")); yon_ubl_header_setup(widgets->mainHeadOverlay, widgets->headBox, widgets->mainHeadBackgroundImage, banner_path); // gtk_overlay_add_overlay(GTK_OVERLAY(widgets->mainHeadOverlay),widgets->headBox); + yon_monitor_view_setup(widgets->mainMonitorVisualConfigurationBox); + yon_monitor_view_update(); + videoconfig.status_render.icon=widgets->mainStatusIcon; + videoconfig.status_render.label=widgets->mainStatusLabel; + videoconfig.status_render.box=widgets->mainStatusBox; // gtk_image_set_from_file(GTK_IMAGE(widgets->mainHeadBackgroundImage),banner_path); - MonitorSettings *monitors = yon_setup_monitor_settings(); + // MonitorSettings *monitors = yon_setup_monitor_settings(); // videoconfig.monitors=yon_dictionary_pack_monitors(monitors,yon_check_for_monitors()); - widgets->overlays = yon_dictionary_pack_overlays(monitors, yon_check_for_monitors()); - yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays, widgets->mainMonitorVisualConfigurationBox, 0, 0, 0); + // widgets->overlays = yon_dictionary_pack_overlays(monitors); + // yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays, widgets->mainMonitorVisualConfigurationBox, 0, 0, 0); // yon_dictionary_gtk_pack_start_multiple_widgets(widgets->monitors,widgets->mainMonitorConfigurationBox,0,0,0); } @@ -870,11 +1240,10 @@ int main(int argc, char *argv[]) gtk_init(&argc, &argv); GError error; - // xfconf_init (&error); - // display_channel = xfconf_channel_new ("displays"); - yon_setup_config(); + yon_setup_config(load_drivers_local_command); widgets_dict widgets; yon_setup_widgets(&widgets); + yon_gtk_list_store_fill_with_proprietaries(videoconfig.list); gtk_widget_show(widgets.MainWindow); // yon_fill_ui(&widgets); yon_ubl_status_box_render(widgets.mainStatusBox, widgets.mainStatusIcon, widgets.mainStatusLabel, _("Configuration has been loaded"), BACKGROUND_IMAGE_SUCCESS_TYPE); diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index fc35e42..dccebb3 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -8,6 +8,7 @@ #include #include #include "ubl-utils.h" +#include "ubl-settings-video-strings.h" #ifndef UBL_SETINGS_VIDEO_H #define UBL_SETINGS_VIDEO_H @@ -29,9 +30,9 @@ #define get_resolutions_command "xrandr |grep -noP \"\\d+x+\\d+\"" -#define get_proprietary_drivers_command "cut -d, -f1- video-drivers.csv | grep -E \"-\"" +#define get_proprietary_drivers_command "cut -d, -f1- /usr/share/ubl-settings-video/csv/video-drivers.csv | grep -E \"-\"" -#define get_resolutions_supportable_command "cut -d, -f1- Resolutions.csv |sed 's/,/\t/g'" +#define get_resolutions_supportable_command "cut -d, -f1- /usr/share/ubl-settings-video/csv/resolutions.csv |sed 's/,/\t/g'" #define get_frequences_command "xrandr |grep -v -n \"[a-z][a-z]\" |sed 's/ * / /g' |cut -d' ' -f1,3-" @@ -49,6 +50,8 @@ #define remove_drivers_local_command "/usr/bin/ubconfig --target global remove video " +#define XORG_MONITOR(port) yon_char_get_augumented(" XORG_MONITOR[",yon_char_get_augumented(port,"] ")) + char *local; @@ -58,12 +61,25 @@ string version_application = "1.0"; #define _(String) gettext(String) +typedef dictionary* monitor_config; +typedef dictionary* proprietary_config; +typedef dictionary* monitor_view; + + +typedef struct { + GtkWidget *icon; + GtkWidget *box; + GtkWidget *label; +} render_data; + typedef struct { + config_str loaded_config; + int configsize; int autoChooseDrivers; - dictionary *videoconfig; - dictionary *monitors; - dictionary *proprietary; + monitor_view monitor_visuals; + monitor_config monitors; + proprietary_config proprietary; GtkListStore *list; char *failsafenVidia; char *failsafeATI; @@ -71,25 +87,30 @@ typedef struct char *optirun; char *primusrun; int gapfix; - int optiorprimus; - char **ports; + config_str ports; int portssize; - char **resolutions; + config_str resolutions; int resolutionssize; + render_data status_render; } config; typedef struct { int main; int enable; - char *position; + int position; + char *position_port; char *port; char *resolution; - char **resolutionCapabilities; + config_str resolutionCapabilities; char *frequency; - char *rotation; + int rotation; char *stringparameters; + int dpms; int resolution_size; + int cvt; + int reduced; + int gtf; } monitorconfig; typedef struct { @@ -174,43 +195,46 @@ typedef struct typedef struct { GtkWidget *templateMonitorConfigurationWindow; + GtkWidget *mainMonitorConfigurationBox; GtkWidget *templateMonitorConfigurationBox; - GtkWidget *templateMonitorConfigurationMonitorLabel; + GtkWidget *templateMonitorConfigurationEnableCheck; + GtkWidget *templateMonitorConfigurationPortLabel; + GtkWidget *templateMonitorConfigurationPortCombo; + GtkWidget *templateMonitorConfigurationMainCheck; GtkWidget *templateMonitorConfigurationResolutionLabel; GtkWidget *templateMonitorConfigurationResolutionCombo; + GtkWidget *templateMonitorConfigurationShowUnsupportedCheck; GtkWidget *templateMonitorConfigurationFrequencyLabel; GtkWidget *templateMonitorConfigurationFrequencyCombo; - GtkWidget *templateMonitorConfigurationRotationCombo; GtkWidget *templateMonitorConfigurationRotationLabel; - GtkWidget *templateMonitorConfigurationMainRadio; - GtkWidget *templateMonitorConfigurationParameterLineCheck; - GtkWidget *templateMonitorConfigurationParameterLineEntry; - GtkWidget *templateMonitorConfigurationDoNotSwitchOffLabel; - GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; - GtkWidget *templateMonitorConfigurationCancelButton; - GtkWidget *templateMonitorConfigurationSaveButton; - - GtkWidget *templateMonitorConfigurationEnableCheck; - GtkWidget *templateMonitorConfigurationPortLabel; - GtkWidget *templateMonitorConfigurationPortCombo; - GtkWidget *templateMonitorConfigurationShowUnsupportedCheck; + GtkWidget *templateMonitorConfigurationRotationCombo; GtkWidget *templateMonitorConfigurationPositionLabel; GtkWidget *templateMonitorConfigurationPositionPosCombo; GtkWidget *templateMonitorConfigurationPositionPortCombo; + GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; GtkWidget *templateMonitorConfigurationModelineCVTCheck; GtkWidget *templateMonitorConfigurationUseCVTReducedCheck; GtkWidget *templateMonitorConfigurationModelineGTFCheck; + GtkWidget *templateMonitorConfigurationParameterLineCheck; + GtkWidget *templateMonitorConfigurationParameterLineEntry; + GtkWidget *templateMonitorConfigurationCancelButton; + GtkWidget *templateMonitorConfigurationSaveButton; + + dictionary *config; +} monitor_edit_window; +typedef struct { GtkWidget *templateMonitorscreenOverlay; GtkWidget *templateMonitorImage; GtkWidget *templateMonitorInfoBox; GtkWidget *templateMonitorInfoNameLabel; GtkWidget *templateMonitorInfoResolutionLabel; - GtkWidget *templateMonitorInfoConfigureButton; GtkWidget *templateMonitorDeleteButton; GtkWidget *templateMonitorSwitchButton; - dictionary *curconfig; -} MonitorSettings; + GtkWidget *templateMonitorInfoConfigureButton; + GtkWidget *templateMonitorInfoAddButton; + monitor_config config; +} monitor_window; typedef struct { @@ -225,14 +249,10 @@ typedef struct GtkWidget *ProprietaryAcceptButton; } driver_window; -int yon_check_for_monitors(); -MonitorSettings *yon_setup_monitor_settings(); -dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size); -dictionary *yon_dictionary_pack_overlays(MonitorSettings *monitors, int size); -void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors); -void on_save_configuration(GtkWidget self, MonitorSettings *monitors); -int yon_config_init(char **parameters, int size); -void yon_parse_monitor(dictionary *monitor, char *string_of_settings); + +// void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors); +// void on_save_configuration(GtkWidget self, MonitorSettings *monitors); +void yon_parse_monitor(); void on_config_fill_interface(widgets_dict *widgets); void yon_update_config(widgets_dict *widgets); void on_configuration_save_global(GtkWidget *self, widgets_dict *widgets); @@ -241,4 +261,16 @@ void on_configuration_save__local(GtkWidget *self, widgets_dict *widgets); void yon_config_monitor_string_parse(char *parameters, int *size); int yon_char_get_if_resolution(char *parsed_string); void yon_monitor_set_resolutions(dictionary *dict); +monitor_config yon_monitor_config_new(char *port); +void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string); +void yon_monitor_view_new(monitor_config monitor); +// void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings); +void yon_monitor_view_draw_all(GtkWidget *cnt); +void on_monitor_configure(GtkWidget *self,monitor_window *window); +void on_monitor_add(GtkWidget *self,monitor_window *window); +void on_monitor_switch(GtkWidget *self,monitor_window *window); +void on_monitor_delete(GtkWidget *self,monitor_view windowd); +void yon_monitor_view_update(); +void yon_monitor_window_update(monitor_edit_window *window); +char *yon_monitor_make_string(monitorconfig* config); #endif \ No newline at end of file diff --git a/source/ubl-utils.c b/source/ubl-utils.c index b56e513..2870909 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -300,17 +300,19 @@ dictionary *yon_dictionary_rip(dictionary *dict) dictionary *yon_dictionary_get_nth(dictionary *dict, int place) { - dict = dict->first; - int i = 0; - for (i = 0; i < place; i++) - if (dict->next) - dict = dict->next; + if (dict){ + dict = dict->first; + int i = 0; + for (i = 0; i < place; i++) + if (dict->next) + dict = dict->next; + else + break; + if (i == place) + return dict; else - break; - if (i == place) - return dict; - else - return NULL; + return NULL; + } else return NULL; } // char functions @@ -342,10 +344,30 @@ char *yon_char_get_augumented(char *source, char *append) */ char *yon_char_new(char *chr) { - char *newchar = malloc(strlen(chr) + 1); - memset(newchar, 0, strlen(chr) + 1); - memcpy(newchar, chr, strlen(chr)); - return newchar; + if (chr){ + char *newchar = malloc(strlen(chr) + 1); + memset(newchar, 0, strlen(chr) + 1); + memcpy(newchar, chr, strlen(chr)); + return newchar; + } else + return NULL; +} + +// char *yon_char_unite(char *source, ...) + +char *yon_char_unite(char *source, ...){ + va_list arglist; + char *new_char=NULL; + char *unite_char=NULL; + new_char=yon_char_new(source); + va_start(arglist,source); + unite_char = va_arg(arglist,char*); + while(unite_char){ + new_char = yon_char_get_augumented(new_char,unite_char); + unite_char = va_arg(arglist,char*); + } + va_end(arglist); + return new_char; } /**[EN] @@ -407,7 +429,7 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) return cut; } else - return NULL; + return source; } } /**[EN] @@ -447,6 +469,7 @@ char **yon_char_parse(char *parameters, int *size, char *divider){ string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(param); i++; + if (strcmp(param,paramline)==0) break; } string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(paramline); @@ -606,7 +629,7 @@ apps *yon_apps_get_by_name(apps *applist, char *name, int size) return NULL; }; -char **yon_config_load(char *command, int *str_len) +config_str yon_config_load(char *command, int *str_len) { FILE *output = popen(command, "r"); char **output_strings = NULL; @@ -626,8 +649,13 @@ char **yon_config_load(char *command, int *str_len) i++; } } + if (i>0){ *str_len = i; return output_strings; + } else{ + *str_len=-1; + return NULL; + } } @@ -643,13 +671,17 @@ int yon_config_save(char *command) } /**[EN] - * char *yon_config_get_parameter(char **parameters, int size, char *param) + * char *yon_config_get_parameter(config parameters, int size, char *param) * Gets parameter from parameter list; * * [RU] */ -char *yon_config_get_parameter(char **parameters, int size, char *param) +char *yon_config_get_parameter(config_str parameters, int size, char *param) { + if (param[0]==' ') + yon_char_divide_search(param," ",-1); + param=yon_char_divide_search(yon_char_new(param)," ",-1); + char *str = NULL; for (int j = 0; j < size; j++) { @@ -828,24 +860,27 @@ int yon_launch(thread_output *thread) int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find){ - int active=gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); - char *str="-1"; - for (int i=0;strcmp(str,"")!=0;i++){ - gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box),i); - str=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box)); - if (!str) return -1; - if (strcmp(text_to_find,str)==0) return i; - } - return -1; + if (combo_box&&text_to_find){ + int active=gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); + char *str="-1"; + for (int i=0;strcmp(str,"")!=0;i++){ + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box),i); + str=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box)); + if (!str) return -1; + if (strcmp(text_to_find,str)==0) return i; + } + } return -1; } int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding) { - for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) - { - gtk_box_pack_start(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); - } + if (dict){ + for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) + { + gtk_box_pack_start(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); + } return 1; + }else return 0; } int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding) diff --git a/source/ubl-utils.h b/source/ubl-utils.h index ce50a8d..6efd808 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -15,6 +15,9 @@ #define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) +#define new(type) malloc(sizeof(type)) +#define new_arr(type,size) malloc(sizeof(type)*size) + #define yon_ubl_set_config_save_data_pointer(command) config_commands.config_save_data = command #define yon_ubl_load_global_config(command, size_pointer) yon_config_load(command, size_pointer) @@ -58,6 +61,7 @@ typedef struct apps int DualPluggable; } apps; +typedef char** config_str; // dictionary functions @@ -93,6 +97,8 @@ char *yon_char_get_augumented(char *source, char *append); char *yon_char_new(char *chr); +char *yon_char_unite(char *source, ...); + char *yon_cut(char *source, int size, int startpos); char *yon_char_divide(char *source, int dividepos); @@ -107,6 +113,8 @@ char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete) int yon_char_parsed_check_exist(char **parameters, int size, char *param); + + // parsing functions apps *yon_apps_scan_and_parse_desktops(int *sizef); @@ -115,11 +123,11 @@ void yon_apps_sort(apps *applist, int size); apps *yon_apps_get_by_name(apps *applist, char *name, int size); -char **yon_config_load(char *command, int *str_len); +config_str yon_config_load(char *command, int *str_len); int yon_config_save(char *command); -char *yon_config_get_parameter(char **parameters, int size, char *param); +char *yon_config_get_parameter(config_str parameters, int size, char *param); char *yon_config_make_save_parameter_with_multiple_arguments(char *parameter_string, char *config_parameter, char *divider); @@ -165,7 +173,7 @@ int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *de void yon_on_plug_added(GtkSocket *self, gpointer user_data); void yon_on_plug_removed(GtkSocket *self, gpointer user_data); -#endif + typedef enum { BACKGROUND_IMAGE_SUCCESS_TYPE, @@ -181,4 +189,5 @@ typedef enum void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass); +#endif #endif \ No newline at end of file diff --git a/ubl-settings-video.desktop b/ubl-settings-video.desktop index b2b9897..f12dc01 100644 --- a/ubl-settings-video.desktop +++ b/ubl-settings-video.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Encoding=UTF-8 Name=ubl-settings-video -Name[ru]=Настройки Видеоадаптера и дисплея +Name[ru]=Настройки видеоадаптера и дисплея GenericName=ubl-settings-video GenericName[ru]=Настройки Видеоадаптера и дисплея Comment=Application for managing video adapter and display settings diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 32faf42..d69248f 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -6,44 +6,6 @@ - - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True False @@ -137,99 +99,105 @@ - - 800 - 600 + + False - 800 - 600 + О Программе + False + True + center com.ublinux.ubl-settings-video + dialog + True + ubl-settings-video + 1.2 + Copyright © 2023 - UBSoft Software LLC + Settings for video output + https://ublinux.ru/ + Project Home Page + Это приложение распространяется без каких-либо гарантий. +Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. + UBGroup + UBGroup + com.ublinux.ubl-settings-video + True + gpl-2-0 + + + False + vertical + 2 + + + False + False + top + spread + + + False + False + 0 + + + + + + + + + + True + False - + + 90 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 69 + com.ublinux.ubl-settings-video + + + False + True + 0 + + + + True False - True - vertical True False - vertical - + True False + vertical - - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 25 - - - False - True - 0 - - - - + + 255 True False - start - 5 - 5 - 5 - 5 - 6 - 6 + Video output configuration + - + + True True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - - - 81 - True - False - - - True - False - start - - - -1 - - - - - False - True 0 @@ -237,1242 +205,694 @@ False True - 1 + 0 - - - 165 - True - True - 5 - 5 - 5 - 5 - external - - - True - False - - - True - True - 5 - - - True - False - 5 - 5 - 5 - 5 - 5 - vertical - - - True - False - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - - - True - False - vertical - - - Automatically choose and use driver - True - True - False - start - True - - - False - True - 0 - - - - - True - False - 5 - - - True - False - vertical - 5 - - - True - False - start - Proprietary driver: - 0 - - - False - True - 0 - - - - - True - False - start - Failsafe driver nVidia: - 0 - - - False - True - 1 - - - - - True - False - start - Failsafe driver AMD/ATI: - 0 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - False - 0 - - - True - True - 0 - - - - - True - True - True - image8 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - False - True - 1 - - - - - True - False - - - False - True - 2 - - - - - True - True - 1 - - - - - False - True - 1 - - - - - - - - - True - False - Driver - - - - - False - True - 0 - - - - - True - False - vertical - - - True - False - 0.019999999552965164 - in - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 10 - - - - - - False - True - 0 - - - - - - - True - False - Monitor configuration - - - - - True - True - 0 - - - - - True - True - 1 - - - - - True - False - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - - - True - False - - - discrete video only (AMD/ATI) - True - True - False - 5 - 5 - True - - - False - True - 1 - - - - - - - - - True - False - 0 - Hybrid graphics - - - - - False - True - 2 - - - - - True - False - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - - - True - False - vertical - - - True - False - 5 - - - True - False - vertical - 5 - - - Launch programms through optirun (nVidia): - True - True - False - True - - - False - True - 0 - - - - - Launch programs through primusun (nVidia): - True - True - False - True - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - True - steam - - - True - True - 0 - - - - - True - False - True - steam - - - True - True - 1 - - - - - True - True - 1 - - - - - True - False - vertical - 5 - - - True - False - True - True - image1 - - - False - True - 0 - - - - - True - False - True - True - image2 - - - False - True - 1 - - - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - 5 - 5 - - - True - False - Fix frame gap (nVidia): - 0 - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - False - True - 1 - - - - - - - - - True - False - Extra - - - - - False - True - 3 - - - - - - - True - False - Main Settings - - - False - - - - - True - True - 5 - 5 - 5 - 5 - - - True - False - 5 - 5 - 5 - 5 - 5 - vertical - 5 - - - True - True - 5 - liststore6 - 0 - True - 2 - - - - - - Package - - - - - Driver - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Supported Devices - - - - - True - True - 0 - - - - - True - False - center - 5 - - - Установить - True - True - True - image9 - - - False - True - end - 0 - - - - - Удалить - True - True - True - image11 - - - False - True - end - 1 - - - - - Подробнее - True - True - True - image10 - - - False - True - end - 2 - - - - - False - True - 1 - - - - - - - True - False - Driver Modules - - - False - - - - - True - False - 5 - 5 - 5 - 5 - 5 - vertical - 5 - - - True - True - 5 - liststore6 - 0 - True - 2 - - - - - - Package - - - - - Driver - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Supported Devices - - - - - True - True - 0 - - - - - True - False - center - 5 - - - Установить - True - True - True - image6 - - - False - True - end - 0 - - - - - Удалить - True - True - True - image7 - - - False - True - end - 1 - - - - - Подробнее - True - True - True - image12 - - - False - True - end - 2 - - - - - False - True - 1 - - - - - 1 - - - - - True - False - Drivers - - - 1 - False - - - - - - - - + + + True + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + True + 1 + + + + + True + False + document-edit-symbolic + + + True + False + dialog-information-symbolic + + + True + False + user-trash-symbolic + + + True + False + dialog-information-symbolic + + + True + False + system-shutdown-symbolic + + + True + False + user-trash-symbolic + + + False + value-increase-symbolic + + + True + False + document-edit-symbolic + + + True + False + open-menu-symbolic + + + + True + False + start + 3 + 3 + 10 + 20 + vertical + + + True + False + True + + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + + + + + + + False + True + 1 + + + + + True + False + 15 + + + True + True + True + image14 + + + + False + True + 0 + + + + + True + True + True + image13 + + + + False + True + 1 + + + + + True + True + True + end + image3 + + + + False + True + end + 2 + + + + + True + True + True + image15 + + + + False + True + 3 + + + + + False + True + 2 + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + False + True + com.ublinux.ubl-settings-video + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + vertical + + + True + False + 5 + + + Enabled + True + True + False + True + + + False + True + 0 + + + + + False + True + 1 + + + + + True + False + vertical + + + True + False + end + 5 + True + + + Save + True + True + True + image5 + + + False + True + end + 0 + + + + + Cancel + True + True + True + image4 + + + False + True + end + 1 + + + + + False + True + 0 + + + + + False + True + end + 2 + + + + + True + False + vertical + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Port - 1 + False + True + 0 - - + + True False - Drivers + 0 + True + True 1 - False - + + Main display True - False - 5 - 5 - 5 - 5 - 0 - none - - - True - False - 12 - - - True - False - - - True - False - start - 75 - appointment-new-symbolic - - - False - True - 0 - - - - - True - False - start - start - 10 - 5 - 10 - 10 - label - - - False - True - 1 - - - - - - - - - True - False - 5 - Devices and Drivers - - + True + False + True + False + True 2 - - + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Resolution (px): + + + False + True + 0 + + + + True False - Information + 0 + + + True + True + 1 + + + + + Show unsupported + True + True + False + True + False + True 2 - False + + False + True + 2 + + + + + True + False + 5 + + + True + False + Frequency (Hz): + + + False + True + 0 + + + + + True + False + 0 + + + True + True + 1 + + + + + False + True + 3 + + + + + True + False + 5 + + + True + False + Rotation: + + + False + True + 0 + + + + + True + False + 0 + + + True + True + 1 + + + + + False + True + 4 + - - - - - True - True - 2 - - - - - True - True - 0 - - - - - - - True - False - True - - - True - False - start - 5 - 5 - 5 - 5 - False - UBlinux Video Configuration - - - - - - - - True - False - 5 - 5 - 5 - 5 - 32 - com.ublinux.ubl-settings-video - - - - - True - False - - - True - True - False - True - LoadConfigurationMenu - none - - - True - False - + True False - 5 - 5 - 5 - 5 - Load + 5 + + + True + False + Position: + + + False + True + 0 + + + + + True + False + 5 + True + + + True + False + 0 + + + True + True + 0 + + + + + True + False + 0 + + + True + True + 1 + + + + + True + True + 1 + + False True - 0 + 5 - + + Do not switch off display True - False - pan-down-symbolic + True + False + True False True - 1 + 6 - - - - - False - True - 0 - - - - - 1 - - - - - True - False - - - True - True - False - True - True - SaveConfigurationMenu - none - - - True - False - + + Create modeline for current resolution with CVT True - False - 5 - 5 - 5 - 5 - Save - + True + False + True False True - 0 + 7 - + + Use "CVT Reduced Blanking"gshgrbehr True - False - pan-down-symbolic + True + False + True False True - 1 + 8 - - - - - False - True - 0 - - - - - True - True - False - True - True - SettingsMenu - none - - - - - - False - True - 1 - - - - - end - 3 - - - - - - - - False - О Программе - False - True - center - com.ublinux.ubl-settings-video - dialog - True - ubl-settings-video - 1.2 - Copyright © 2023 - UBSoft Software LLC - Settings for video output - https://ublinux.ru/ - Project Home Page - Это приложение распространяется без каких-либо гарантий. -Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. - UBGroup - UBGroup - com.ublinux.ubl-settings-video - True - gpl-2-0 - - - False - vertical - 2 - - - False - False - top - spread - - - False - False - 0 - - - - - - - - - - True - False - - - 90 - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 69 - com.ublinux.ubl-settings-video - - - False - True - 0 - - - - - True - False - - - True - False - - - True - False - vertical + + + Create modeline for current resolution with GTF + True + True + False + True + + + False + True + 9 + + + + + True + False + + + False + True + 10 + + + + + False + True + 0 + + - - 255 + True False - Video output configuration - - - - - - + 5 + 5 + vertical + 5 + + + Configure manually through parameter line: + True + True + False + True + + + False + True + 0 + + + + + True + False + True + center + 1920x1080 + + + True + True + 1 + + - True + False True - 0 + 1 False True - 0 + 3 @@ -1482,240 +902,169 @@ 0 - - - True - False - - - False - True - 1 - - - - True - True - 1 - + + + - - True - False - document-edit-symbolic - - + True False - dialog-information-symbolic + go-bottom-symbolic - + True False user-trash-symbolic - - True - False - dialog-information-symbolic - - + True False - system-shutdown-symbolic + go-bottom-symbolic - - True - False - user-trash-symbolic + + + + + + + + + + + + + - + True - False - start - 3 - 3 - 10 - 20 - vertical - - - True - False - Monitor - True - - - - - - - False - True - 0 - - - - - True - False - 5 - 5 - 1920x1200:60Hz - - - - - - - False - True - 1 - - + True True False - 15 + vertical - + True True - True - image14 - + 15 + 15 + 6 + multiple + horizontal + liststore5 + 1 + True + + + + 0 + + + + + 0 + True + word + + + 1 + + - False + True True 0 + + + + + True + False + 5 - + True - True - True - image13 - + False + 25 + applications-system False True - 1 + 0 - + True - True - True - end - image3 - + False + Settings False True - end - 2 + 1 - - False - True - 2 - - - - True - False - document-edit-symbolic - - - True - False - open-menu-symbolic - - - True - False - process-stop-symbolic + + - - True - False - emblem-ok-symbolic + + + + + + + + + + + + + - + + 800 + 600 False - True + 800 + 600 com.ublinux.ubl-settings-video - + True False + True vertical - + True False - 5 - 5 - 5 - 5 vertical - + True False - vertical - 5 - + True False - 5 - - - Enabled - True - True - False - True - - - False - True - 0 - - + 5 + 5 + 5 + 5 + 6 + 6 + 25 False @@ -1724,200 +1073,828 @@ - + True False - 5 - - - True - False - Port - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - Main display - True - True - False - True - - - False - True - 2 - - + start + 5 + 5 + 5 + 5 + 6 + 6 + + + + - False + True True 1 + + + False + True + 0 + + + + + True + False + vertical - + + 81 True False - 5 - + True False - Resolution (px): + start - False - True - 0 + -1 + + + False + True + 0 + + + + + False + True + 1 + + + + + True + True + 5 + + + 165 + True + True + 5 + 5 + 5 + 5 + external - + True False + + + True + False + 5 + 5 + 5 + 5 + 5 + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + vertical + + + Automatically choose and use driver + True + True + False + start + True + + + False + True + 0 + + + + + True + False + 5 + + + True + False + vertical + 5 + + + True + False + start + Failsafe driver nVidia: + 0 + + + False + True + 1 + + + + + True + False + start + Failsafe driver AMD/ATI: + 0 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + Driver + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 10 + + + + + + False + True + 0 + + + + + + + True + False + Monitor configuration + + + + + True + True + 0 + + + + + True + True + 1 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + + + discrete video only (AMD/ATI) + True + True + False + 5 + 5 + True + + + False + True + 1 + + + + + + + + + True + False + 0 + Hybrid graphics + + + + + False + True + 2 + + + + + True + False + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + vertical + + + True + False + 5 + + + True + False + vertical + 5 + + + Launch programms through optirun (nVidia): + True + True + False + True + + + False + True + 0 + + + + + Launch programs through primusun (nVidia): + True + True + False + True + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + True + steam + + + True + True + 0 + + + + + True + False + True + steam + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + vertical + 5 + + + True + False + True + True + image1 + + + False + True + 0 + + + + + True + False + True + True + image2 + + + False + True + 1 + + + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + 5 + + + True + False + Fix frame gap (nVidia): + 0 + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + Extra + + + + + False + True + 3 + + + + - - True - True - 1 - - - - - Show unsupported - True - True - False - True - - - False - True - 2 - - - False - True - 2 - - - + + True False - 5 - - - True - False - Frequency (Hz): - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - + Main Settings - False - True - 3 + False - + True - False - 5 - - - True - False - Rotation: - - - False - True - 0 - - + True + 5 + 5 + 5 + 5 + 5 + 5 - + True False + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + True + + + True + True + 5 + liststore6 + 1 + True + + + + + + Installed + + + + 0 + + + + + + + Package + + + + 1 + + + + + + + Driver + + + + 2 + + + + + + + Description + + + + 3 + + + + + + + Supported Devices + + + + 4 + + + + + + + + + True + True + 0 + + + + + True + False + center + 5 + + + Установить + True + True + True + image9 + + + False + True + end + 0 + + + + + Удалить + True + True + True + image11 + + + False + True + end + 1 + + + + + Подробнее + True + True + True + image10 + + + False + True + end + 2 + + + + + False + True + 1 + + - - True - True - 1 - - - - False - True - 4 - - - - - True - False - 5 - - + + True False - Position: + Driver Modules - False - True - 0 + False True False + 5 + 5 + 5 + 5 + 5 + vertical 5 - True - + True - False + True + + + True + True + 5 + liststore6 + 0 + True + 2 + + + + + + Installed + + + + 0 + + + + + + + Package + + + + 1 + + + + + + + Driver + + + + 2 + + + + + + + Description + + + + 3 + + + + + + + Supported Devices + + + + 4 + + + + + + True @@ -1926,338 +1903,398 @@ - + True False + center + 5 + + + Установить + True + True + True + image6 + + + False + True + end + 0 + + + + + Удалить + True + True + True + image7 + + + False + True + end + 1 + + + + + Подробнее + True + True + True + image12 + + + False + True + end + 2 + + - True + False True 1 - True - True 1 + + + True + False + Drivers + + + 1 + False + + + + + + + + - False - True - 5 - - - - - Do not switch off display - True - True - False - True - - - False - True - 6 - - - - - Create modeline for current resolution with CVT - True - True - False - True - - - False - True - 7 + 1 - - - Use "CVT Reduced Blanking"gshgrbehr + + True - True - False - True + False + Drivers - False - True - 8 + 1 + False - - Create modeline for current resolution with GTF + True - True - False - True + False + 5 + 5 + 5 + 5 + 5 + 5 + 0 + none + + + True + False + 12 + + + True + False + + + True + False + start + 75 + appointment-new-symbolic + + + False + True + 0 + + + + + True + False + start + start + 10 + 5 + 10 + 5 + 10 + 10 + label + + + False + True + 1 + + + + + + + + + True + False + 5 + 5 + Devices and Drivers + + - False - True - 9 + 2 - - + + True False + Information - False - True - 10 + 2 + False - False + True True - 0 + 2 + + + True + True + 0 + + + + + + + True + False + True + + + True + False + start + 5 + 5 + 5 + 5 + False + UBlinux Video Configuration + + + + + + + + True + False + 5 + 5 + 5 + 5 + 32 + com.ublinux.ubl-settings-video + + + + + True + False - + True - False - 5 - 5 - vertical - 5 - - - Configure manually through parameter line: - True - True - False - True - - - False - True - 0 - - + True + False + True + LoadConfigurationMenu + none - + True - False - True - center - 1920x1080 + False + + + True + False + 5 + 5 + 5 + 5 + Load + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + - - True - True - 1 - False True - 1 + 0 + + + 1 + + + + + True + False - + True - False - vertical + True + False + True + True + SaveConfigurationMenu + none True False - end - 5 - True - - Save + True - True - True - image5 + False + 5 + 5 + 5 + 5 + Save + False True - end 0 - - Cancel + True - True - True - image4 + False + pan-down-symbolic False True - end 1 - - False - True - 0 - False True - end - 2 + 0 - - - True - True - 0 - - - - - - - True - False - go-bottom-symbolic - - - True - False - user-trash-symbolic - - - True - False - system-run-symbolic - - - True - False - go-bottom-symbolic - - - - - - - - - - - - - - - - - True - True - - - True - False - vertical - - - True - True - 15 - 15 - 6 - multiple - horizontal - liststore5 - 1 - True - - - - 0 - - - - 0 - True - word + + True + True + False + True + True + SettingsMenu + none + + + - - 1 - + + False + True + 1 + - True - True - 0 - - - - - - - True - False - 5 - - - True - False - 25 - applications-system - - - False - True - 0 - - - - - True - False - Settings - - - False - True - 1 + end + 3 - - - - - - - - - - + + vertical + + + + + + + + + + + + + + + + + + + radiobutton