~martijnbraam/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH Megapixels] Read slider value when changing from auto to manual

Details
Message ID
<20201221211257.62460-1-ciesielskimm@protonmail.com>
DKIM signature
missing
Download raw message
Patch: +20 -0
From: Michal Ciesielski <michal.ciesielski@smarteye.se>

The user might have moved the slider while in Auto. When exiting Auto
mode the value and the slider will be desynced. This change syncs the
value with the slider position when entering Manual mode.
---
 main.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/main.c b/main.c
index 4e8ff00..9b7b77c 100644
--- a/main.c
+++ b/main.c
@@ -454,6 +454,26 @@ on_control_auto_toggled(GtkToggleButton *widget, gpointer user_data)
	}

	if (has_changed) {
		// The slider might have been moved while Auto mode is active. When entering
		// Manual mode, first read the slider value to sync with those changes.
		double value = gtk_adjustment_get_value(widget);
		switch (current_control) {
		case USER_CONTROL_ISO:
			if (value != gain) {
				gain = (int)value;
			}
			break;
		case USER_CONTROL_SHUTTER: {
			// So far all sensors use exposure time in number of sensor rows
			int new_exposure =
				(int)(value / 360.0 * camera->capture_mode.height);
			if (new_exposure != exposure) {
				exposure = new_exposure;
			}
			break;
		}
		}

		update_io_pipeline();
		draw_controls();
	}
-- 
2.25.1
Reply to thread Export thread (mbox)