-
Notifications
You must be signed in to change notification settings - Fork 58
Slider widget for options window #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… the new slider widget.
…o allow direct defaulting/resetting.
…alue is displayed.
Nice work @bendoughty, I really like it. A few initial comments:
|
… correctly at different UI scaling levels.
Thank you for taking the time to test out the widget, I really appreciate the constructive feedback 😊
|
Thanks for making the changes, looks good. The following patch fixes the Android with scaling. It also replaces the cm_destroy() call with the poorly named cm_post_show_check() that close the context menu window rather then destroy it. We could remove the #def around it too. android-patch.txt One other thing I realised while testing, other widgets use sound for actions. What do you think about adding sounds for the slider? At least for clicks, but what about dragging. For the Gnome desktop, you get sounds for clicks, and a sound when you stop dragging. Both could potentially be based on mouse up events but there's nothing the the window/widget framework to provide such events; adding that would be a fair sized change. If you apply the Android patch, and assuming we pick up the sound thing later, are you ready for this to be merged? |
elconfig.c
Outdated
widget_width = slider_width; | ||
widget_id = slider_add_extended(window_id, elconfig_free_widget_id++, NULL, | ||
#ifdef ANDROID | ||
window_width - right_margin - 2.0f * widget_width, current_y, 2.0f * widget_width, 2.0f * line_height, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, the width and x position scaling should be removed to avoid making the widget too wide.
elconfig.c
Outdated
widget_width = slider_width; | ||
widget_id = slider_add_extended(window_id, elconfig_free_widget_id++, NULL, | ||
#ifdef ANDROID | ||
window_width - right_margin - 2.0f * widget_width, current_y, 2.0f * widget_width, 2.0f * line_height, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, the width and x position scaling should be removed to avoid making the widget too wide.
elconfig.c
Outdated
|
||
#ifdef ANDROID | ||
if (cm_valid(CM_INIT_VALUE)) | ||
cm_destroy(CM_INIT_VALUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, suggest replacing if () cm_destroy() with cm_post_show_check(1)
elconfig.c
Outdated
|
||
#ifdef ANDROID | ||
if (cm_valid(CM_INIT_VALUE)) | ||
cm_destroy(CM_INIT_VALUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, suggest replacing if () cm_destroy() with cm_post_show_check(1)
elconfig.c
Outdated
@@ -2151,14 +2220,23 @@ static void call_option_menu(var_struct *option) | |||
cm_set_colour(cm_id, CM_GREY, 201.0/256.0, 254.0/256.0, 203.0/256.0); | |||
cm_set(cm_id, option->name, context_option_handler); | |||
cm_grey_line(cm_id, 0, 1); | |||
add_cm_current_value_line(cm_options_current_str, option, *(float*)option->var); | |||
cm_grey_line(cm_id, 1, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cm_grey_line(cm_id, 1, 1) is harmless at this stage but could be moved to the add_cm_current_value_line() function or made conditional on the return value.
Thank you very much for the patch, I have applied it and also made the change in call_option_menu that you recommended 😊 Re: an action sound for the slider, this is actually something I have also been wondering about. Although a perfect implementation is not currently possible, I agree that it is better to at least have something in place for clicks. I have added a confirmationary do_click_sound to the onclick handler. This results in a "click!" when the slider is clicked (and, weirdly, at the beginning of a drag). If you are happy with this then I am happy for the merge to go ahead! |
All merged. Thanks very much for adding this function. |
Here’s a PR for a new “slider” widget type I have been working on. It is intended for use in the options window as the first part of an effort to make that area of the interface less cluttered and more intuitive for the user.
As is typically the case with UI sliders, the absolute value of the option is now no longer directly shown to the user within the interface. To make this a little more palatable to those who may miss it, I have added an extra line to the right-click context menu which displays the current value of the option. This change applies to slider options only.
I have updated some candidate options to use the new option type, these are very conservative changes based on Human Interface Guidelines from Gnome and Apple (thanks for the guidance, @pjbroad!). If the new widget type is approved I am happy to make adjustments to these selections as discussion progresses 😊
It would be useful if android folks could have a play around with the new widget, as I unfortunately do not possess a device capable of running the android client.
Screen.Recording.2025-02-26.at.08.33.11.mov