diff options
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig-utils.c | 25 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig-utils.h | 1 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig.c | 46 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplaylayout.c | 42 |
4 files changed, 51 insertions, 63 deletions
diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.c b/src/gtk+-2.x/ctkdisplayconfig-utils.c index d0aa1ad..40c9c7c 100644 --- a/src/gtk+-2.x/ctkdisplayconfig-utils.c +++ b/src/gtk+-2.x/ctkdisplayconfig-utils.c @@ -1651,31 +1651,6 @@ void display_remove_modes(nvDisplayPtr display) -/*! - * Sets all the modes on the display to the specified rotation - * - * \param[in] mode The display who's modes are to be modified - * \param[in] rotation The rotation to set - * - * \return TRUE if a new rotation was set for at least one mode, FALSE if all - * of the modes on the display were already set to the rotation given. - */ -Bool display_set_modes_rotation(nvDisplayPtr display, Rotation rotation) -{ - nvModePtr mode; - Bool modified = FALSE; - - for (mode = display->modes; mode; mode = mode->next) { - if (mode_set_rotation(mode, rotation)) { - modified = TRUE; - } - } - - return modified; -} - - - /** display_free() *************************************************** * * Frees memory used by a display diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.h b/src/gtk+-2.x/ctkdisplayconfig-utils.h index f59696a..1bc4f31 100644 --- a/src/gtk+-2.x/ctkdisplayconfig-utils.h +++ b/src/gtk+-2.x/ctkdisplayconfig-utils.h @@ -82,7 +82,6 @@ Bool display_has_modeline(nvDisplayPtr display, nvModeLinePtr modeline); Bool display_add_modelines_from_server(nvDisplayPtr display, nvGpuPtr gpu, gchar **err_str); void display_remove_modes(nvDisplayPtr display); -Bool display_set_modes_rotation(nvDisplayPtr display, Rotation rotation); /* Metamode functions */ diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c index d5022a7..b5a8646 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.c +++ b/src/gtk+-2.x/ctkdisplayconfig.c @@ -6193,6 +6193,8 @@ static void display_refresh_changed(GtkWidget *widget, gpointer user_data) gint idx; nvModeLinePtr modeline; nvDisplayPtr display; + Rotation old_rotation; + Reflection old_reflection; /* Get the modeline and display to set */ @@ -6201,6 +6203,9 @@ static void display_refresh_changed(GtkWidget *widget, gpointer user_data) display = ctk_display_layout_get_selected_display (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + /* Save the current rotation and reflection settings */ + old_rotation = display->cur_mode->rotation; + old_reflection = display->cur_mode->reflection; /* In Basic view, we assume the user most likely wants * to change which metamode is being used. @@ -6225,6 +6230,24 @@ static void display_refresh_changed(GtkWidget *widget, gpointer user_data) &display->cur_mode->viewPortIn, &display->cur_mode->viewPortOut); + /* If we are in Basic mode, apply the rotation and reflection settings from + * the previous mode to the new mode. + */ + if (!ctk_object->advanced_mode) { + + if (display->cur_mode->rotation != old_rotation) { + ctk_display_layout_set_display_rotation( + CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), + display, old_rotation); + } + + if (display->cur_mode->reflection != old_reflection) { + ctk_display_layout_set_display_reflection( + CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), + display, old_reflection); + } + } + /* Update the modename */ setup_display_modename(ctk_object); @@ -6247,6 +6270,8 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) gint last_idx; nvSelectedModePtr selected_mode; nvDisplayPtr display; + Rotation old_rotation; + Reflection old_reflection; /* Get the modeline and display to set */ @@ -6265,6 +6290,9 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) return; } + /* Save the current rotation and reflection settings */ + old_rotation = display->cur_mode->rotation; + old_reflection = display->cur_mode->reflection; /* In Basic view, we assume the user most likely wants * to change which metamode is being used. @@ -6300,6 +6328,24 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) NULL /* viewPortOut */); } + /* If we are in Basic mode, apply the rotation and reflection settings from + * the previous mode to the new mode. + */ + if (!ctk_object->advanced_mode) { + + if (display->cur_mode->rotation != old_rotation) { + ctk_display_layout_set_display_rotation( + CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), + display, old_rotation); + } + + if (display->cur_mode->reflection != old_reflection) { + ctk_display_layout_set_display_reflection( + CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), + display, old_reflection); + } + } + /* Update the UI */ setup_display_page(ctk_object); diff --git a/src/gtk+-2.x/ctkdisplaylayout.c b/src/gtk+-2.x/ctkdisplaylayout.c index 24f479d..93a4ddd 100644 --- a/src/gtk+-2.x/ctkdisplaylayout.c +++ b/src/gtk+-2.x/ctkdisplaylayout.c @@ -4460,9 +4460,7 @@ void ctk_display_layout_set_display_panning(CtkDisplayLayout *ctk_object, /*! * Sets the rotation orientation for the display. * - * In basic mode, this function will make all modes on the display have the - * same rotation. In advanced mode, only the current mode will have its - * rotation orientation modified. + * Only the current mode will have its rotation orientation modified. * * If a modification occurs, this function will call the modified_callback * handler registered, if any. @@ -4475,23 +4473,13 @@ void ctk_display_layout_set_display_rotation(CtkDisplayLayout *ctk_object, nvDisplayPtr display, Rotation rotation) { - Bool modified; - - if (!display->cur_mode || !display->cur_mode->modeline) { return; } - if (ctk_object->advanced_mode) { - /* In advanced mode, only set the rotation of the current mode */ - modified = mode_set_rotation(display->cur_mode, rotation); - } else { - /* In basic mode, make all the modes have the same rotation */ - modified = display_set_modes_rotation(display, rotation); - } + if (mode_set_rotation(display->cur_mode, rotation)) { - if (modified) { /* Update the layout */ ctk_display_layout_update(ctk_object); @@ -4508,9 +4496,7 @@ void ctk_display_layout_set_display_rotation(CtkDisplayLayout *ctk_object, /*! * Sets the reflection orientation for the display. * - * In basic mode, this function will make all modes on the display have the - * same reflection. In advanced mode, only the current mode will have its - * reflection orientation modified. + * Only the current mode will have its reflection orientation modified. * * If a modification occurs, this function will call the modified_callback * handler registered, if any. @@ -4523,33 +4509,15 @@ void ctk_display_layout_set_display_reflection(CtkDisplayLayout *ctk_object, nvDisplayPtr display, Reflection reflection) { - Bool modified = FALSE; - - if (!display->cur_mode || !display->cur_mode->modeline) { return; } - if (ctk_object->advanced_mode) { - /* In advanced mode, only set the reflection of the current mode */ - if (display->cur_mode->reflection != reflection) { - modified = TRUE; - } - display->cur_mode->reflection = reflection; - } else { - nvModePtr mode; + if (display->cur_mode->reflection != reflection) { - /* In basic mode, make all the modes have the same reflection */ - for (mode = display->modes; mode; mode = mode->next) { - if (mode->reflection != reflection) { - mode->reflection = reflection; - modified = TRUE; - } - } - } + display->cur_mode->reflection = reflection; - if (modified) { /* Update the layout */ ctk_display_layout_update(ctk_object); |