-
Notifications
You must be signed in to change notification settings - Fork 3k
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
console.lua: update the select layout #15711
Conversation
33afa69
to
7bd0fda
Compare
Download the artifacts for this pull request: |
How do you ensure that the "tall characters" are at most 10% larger than normal characters, but not more? |
You don't, it's a heuristic. It works with the fonts I tried and can be increased if it doesn't work with some others. |
Well it was kasper's request to do it like this. I don't use background-box personally. |
LGTM |
7bd0fda
to
dfe0518
Compare
It's is improvement over current status, feel free to come up with better ideas for this problem. @guidocella said that |
It has appearance regression and not 100% improvement.
Here is a bounding box that doesn't require compute_bounds: You already know the total height of the box because you know the number of lines. The width can simply be the whole window width. |
It has appearance regression and not 100% improvement. See, I find separate buttons with separate background just as nice. We could compute bounds of longest string in selections, but it still means that we need to draw custom background and disable the style of default background, but I guess this can be done, wit tags for the events. |
This looks fine to me too by making them look like separate buttons and not drawing more background width than necessary for each item. We will also add Computing the longest width is too slow with something like 10k properties. And if you compute the width only of current matches, the background width would change as you scroll. |
Which one has larger appearance change, especially compared to regular console?
It's not nice when they have different width. As I already said no other menus look like this.
I don't see how is this complicated. You draw the selected item background over the whole background. And if you really think rounded corners are important enough here (and not just bringing it up for the sake of argument), you can draw them already, there is no need to wait for libass.
There is no problem if you make the background fixed width, like I originally mentioned. I will end my remark by pointing out that the uosc playlist selection menu uses the drawing methods I mentioned and looks much better than this PR. It additionally calculates the longest item's width, but we don't have to do that and instead keep it a constant width to avoid width calculation. |
I would prefer to not cover whole screen in background-box, just because we are too lazy to calculate the width of it. It will look obnoxious for short menu items. |
dfe0518
to
341173f
Compare
Updated as request. It disables the item shadow with background-box and draws a rectangle as wide as the longest item (the longest calculation is not perfect with unicode and proportional fonts but works in practice). The rectangle coloring is actually handled by background-box automatically. Also the background width no longer changes as you type or scroll.
I meant that we now have to draw 3 rectangles to not make the semitransparent selected rectangle overlap with the default one, but that's fine. |
bb63a9b
to
fc6be30
Compare
fc6be30
to
d537e91
Compare
It was just missing the closing ASS tag with non-nil font after I added the font. Also made it calculate the width even with outline-and-shadow so I can use it to position a scrollbar later. |
d537e91
to
b6e370f
Compare
Works. @na-na-hi: is this solution acceptable to you? |
b6e370f
to
c3c397a
Compare
Background looks OK, but the current width calculation is a little buggy and doesn't cover the whole width when it needs to. You can easily test with Also because the default font is proportional, it causes text overflow especially with Unicode.
We can copy what uosc does if we don't want to be lazy: keep a length cache for items (including regular and bold styles) so that the bounds don't need to be recomputed while selecting/scrolling. Alternatively we can always cover like 2/3 of the screen width and clip long lines. |
c3c397a
to
37b2d58
Compare
I tried to use the same alpha before but thought it decreases readability and works for the OSC because it's mostly buttons, set it to the same anyway but also made it configurable. Added menu_outline_size and menu_outline_color script-opts (as just border_size already exists, or should they be called menu_border?), but size is 0 by default, because I think it looks better without borders and it already has a shadow if you set --osd-shadow-offset (https://x.com/steveschoger/status/897849211110273024), and default bottombar OSC doesn't have a border like box. |
64e221f
to
213e7f1
Compare
I have already mentioned 2 other cases where the corner isn't rounded like OSD bar.
I think if someone only sees the sharp corner version of this PR they would also think it's nice too. Both sharp corners and rounded corners look better than the current state in isolation. The problem is that the image is not representative of user experience as a whole, and how it plays with other UI elements need to be considered.
Since
No, there is no need for democratization. But we should at least get the opinion of those who have ample experience related to the PR. In this case users with strong UI/UX design background and feedback experience. Consider the initial implementation of this PR and at the current state: it's a dramatic improvement in both appearance and usability, which wouldn't have happened if I wasn't here """stalling""" this PR by suggesting alternatives and taking uosc as a hint.
See above. There are ways to collect efficient feedbacks before merging, which is especially suitable for mpv development process since it's mostly clear which contributors are the ones to ask. macOS, Wayland, etc. parts of mpv already follow this kind of process, there is no reason why this can't be done for UI/UX.
What do you mean? Somehow adding new entries to a pure informational document like restore-osc.conf is bad, but YOLO changing the default UX is good? Please correct me if I misunderstood.
Doesn't mean feedback isn't needed or useful before merging. |
You are trying to get validation too hard.
No one said it looks better. People said it looks nice.
Could you elaborate what does this mean?
Sure buddy, all credit goes to you.
And who said this it is? I pinged you directly multiple times in this very PR. Don't try to act like I'm the bad guy here. I try to ping people on IRC for controversial changes, but I don't want to be nagging and force people to do things they don't want. Look this PR is open 3 weeks, mpv doesn't have this much of PR rotation to not expect interested people to comment on it.
And who said this it is? Guido is working at his own pace, making changes as he discover new ways to do thing. select/menu is new user experience, so it hardly break current UX. Arguably we changed some keybinds, which were further adjusted. Another non-ui example would be merging incomplete clipboard support, if you think it's bad, sorry for that. Either way most of the feedback we got were positive, but I might as well stop merging those changes and see where it gets us. |
OK, here is my worthless opinion: sharp corners look nice, round corners look nice too, i love mpv <3 Good now? Even though there is no way to transform opinions like this into actionable items to improve the PR in any way, unlike real feedbacks.
It means as it says. For example, I can put a pretty screenshot of a feature so that the PR looks good for the users who have seen the screenshot and "wow" without any further testing, but avoid mentioning that it's changing key bindings in a disruptive way, etc..
Be honest, if I stopped posting here after you approved with LGTM, would you have merged at that state?
Anyone can open PRs with any pace, but it doesn't mean those PRs also need to merged at the same fast pace. Fast changes don't mean they are beneficial for the users. It depends on what are the benefits and drawbacks of the PR. I think a PR can be merged if it's a net positive with zero drawbacks, and any PR with known drawbacks needs to take steps to minimize them before they can be merged. Of course, you won't be able to find any drawback if you don't do careful evaluations on the PR, and base your impression only on the positives. It does not matter whether it's my PR or someone else's PR. But you do you. If you really think, for example, incomplete clipboard support is an issue, then you don't have to merge it at that state. I am not the one who make the decision on whether or when any PR should merged, with or without the need for any feedback. There is no "block merge" button in my control panel. |
Don't act like I don't appreciate your feedback.
Ok, let's step back a bit, because this discussion will get nowhere. It was me who initially pointed out that rounded corners doesn't fit current OSC, here #15711 (review)
Only reason I didn't insist on disabling it, because I knew that everyone liked it. I myself think it would be better to have it rectangular for the OSC consistency, but even then it is 4 to 2 in favor of rounded corners. So you can pick and prod my approach to PRs, but I'm not the person to convince here.
I wouldn't because I didn't. If I wanted to merge it, I would approve and merge right away also look at the dates. Here is lil secret for you, approved prs get more incentive to get feedback from others. It may seem that I don't care, but I try my best.
Agreed, but what is your point?
See, this is the second time in the same message that you’ve tried to pin something on me that I haven’t done. If you disagree with me or something I did, please provide an example of what I actually did, rather than hypothetical "would-have-done" scenarios that never happened. I made mistakes, but who doesn't?
Any feedback until resolved one way or another is block merge. |
This is the difference:
I myself prefer softer looking corners. And also would like to have libass/libass#688 for If we consider consistency with OSC only (and On the other hand if we consider all modern DE, whether macOS, Windows 11, KDE, Gnome, they all provide rounded window corners by default. So floating window inside mpv with rounded corners would be consistent with top level window look and feel (incidentally I use |
Come on, do you think you made me discover uosc? I've already been comparing it for months and considering copying ideas from it e.g. #15346 (comment) #15499 (comment) #15608 (comment) (format quality selector idea copied from uosc) 2024-12-29 14:01:03 Samillion guido: lol, two oscs on top of each other: Samillion/ModernZ#282 (comment) (user preferring uosc's menus making me consider copying them). It was in fact kasper's idea to calculate the maximum width that allowed centering alignment, then the maximum width allowed implementing a horizontal hitbox and positioning a scrollbar (which I had already implemented with bottom left alignment before opening this PR - #15101 (comment)), then the scrollbar made me decide that it looked better with a background, and kasper also requested changing the background color of the selected item before opening this PR. On the other hand you suggested covering the whole window width, recalculating the width as you scroll which changes the background width as you scroll which no menu UI does (after saying yourself that we shouldn't do what no menu UI does), expanding the width as you type which no menu UI does, adding rounded corners to the bottom aligned OSC, which would be completely idiotic, for the sake of consistency with the menu as if blindly making everything consistent like a robot is more important than sane design or usability. And now you're wasting everyone's time arguing the irrelevant detail of rounded corners after everyone but you already expressed preference for rounded corners, so how about getting off your high horse. |
Sorry if there was any misunderstanding. I did not mean to say any particular PR merge is bad. Just suggesting to take steps to minilize drawbacks before PR merging. If you are already doing this, no worry.
Of course not, but you clearly did not have uosc in mind when you opened this PR, otherwise you would've taken hints from uosc from the start. Up until I mentioned uosc in this thread, you still insisted on your initial solution, and didn't want to draw background yourself instead of relying on libass: #15711 (comment) You also failed to take the hint I gave in my second and third replies in this PR. I knew from the start that uosc would solve all problems with the intial version of this PR perfectly, and most importantly, what techniques uosc used to solve it that we can borrow from, but I intentionally withheld it and deceided to give you some hints instead, trying to test if you can figure something out yourself. I outlined why the initial solution is bad and why self-drawing background can solve it. You did not come up with a solution to clip text overflow resulted from inexact longest width calculation with It's one thing to know what uosc is. It's another thing to know why uosc is the way it is, which from the exchanges in this thread, you clearly have no idea about.
OK, it's no doubt you had this thought when you saw that message. Why didn't you do that for this PR? Why did you reject my hints which are the steps necessary to implement uosc-like menus?
I don't know what's the point of this. If any, it only shows that kasper knows the principles of UI/UX better than you.
Come on, I only said this because you said it's too slow to calculate the exact width needed.
It's already doing it currently, so it won't be a regression. It's only a significant problem when the menu is centered, which I never asked for. I would prefer to keep the current bottom-left alignment personally.
"design or usability"? Right, all accounted for by the initial version of this PR. Correct me if I'm wrong, but I'm not seeing many useful inputs of "design or usability" from you. It's always about copying how XYZ tool does it on a surface level, and often times it's someone else who is pointing out the design and usability issues and whether it mekes sense in the context of mpv. Not to mention that you failed to demonstrate any good understanding of it even after copying uosc design. You were still arguing about scrollbar size needing to be perfectly mathematicallty accurate, not realizing that the very uosc you copied from "lies" about scrollbar size too.
The fact that you think rounded corners are an "irrelevant detail" shows that you're not standing on any high ground here. kasper elaborated reasons why rounded corners make sense, citing consistency principle in desktop environment sense. You didn't say anything other than "it looks nice". |
I already said it was kasper's specific request to do it like this and not my solution. I don't use background-box, so I didn't care that much to change it.
Please don't waste people's time playing games and give solutions directly if you have them.
What? I did come up with using clip.
What again? I did come up caching the width of the longest line. It's your solution of caching multiple lines as you scroll which was broken because the menu's width would change as you scroll.
I don't know when I said I know uosc well, when rather I said I don't use OSCs at all.
As I already said, I did it because kasper specifically requested this implementation on IRC, which was not my idea. It's getting really annoying debating with you when you're the only dev not aware of the conversion in the IRC development channel.
There was a misunderstanding here, what I said was that it's too slow to calculate it indipendently for each line.
Yeah because it's masters of design that suggest rounded corners on a bar aligned to a corner. I literally linked a tweet from a designer which influenced the decision to not add borders between the items or around the menu and to distantiate them.
And I changed it as soon as kasper agreed, unlike you who insisted on square corners after 4 other people preferred them rounded.
If it looks nice to everyone to you that's a perfectly good reason to do it. Changes everyone likes don't have to be justified to you. As if you gave more detailed reasons against the inital layout other than "it's not nice". |
To clarify my final thought: using a default rounded corner means a change in mpv's design language, which would be a commitment to implement rounded corner changes to at least OSD bar and OSD bar is a part of the default user experience and is something in mpv's control, so that can be changed now. There will be no other suggestions from me for the rounded corner change. Feel free to ignore this and merge when it's ready otherwise if it's not considered a blocker. |
In my opinion OSD bar is not compatible with OSC. It is good to have if you use mpv without OSC, but it is already not compatible with interface. |
I'd definitely like rounded corners on the OSD bar, even already suggested it in the previous PR, but it's work that needs to be done. |
Have you evaluated yourself whether that request makes sense and whether if there are better solutions for it? I don't think blindly taking requests without evaluation is a good idea. Otherwise mpv will become even a bigger mess because everyone's ideas can go in no matter how good or bad they are.
Not before I mentioned uosc in the PR. Otherwise, the text overflow issue should be fixed already before the layout change.
As mentioned several times before it's not the longest display width. And menu width changing literally isn't a problem for now because the status quo has the same problem, so no regression. Again, I have never asked the menu to be center aligned.
It's likely that you followed that tweet just because borderless "looks nice", because you have not taken a hint from other points outlined in that tweet, all of which enhance usability and readability. Where is the different background color for search bar? Where are the extra paddings? I noticed both of these issues immediately after the new layout was first posted, long before you posted that tweet. I didn't mention it because there were other more important issues need to be addressed first.
Stop going "kasper this, kasper that". Evaluate suggestions on their own merit. There is no need for his agreement to see why that suggestion makes sense.
Those who dislike it often don't show up immediately. It has happened countless of times before that there really isn't any consensus when disagreements show up only after the changes are merged and shoved down to their throats.
Consistency/familiarity was the reason mentioned. That screenshot by itself should be apparent. |
IMO the same can be said for other OSD text because they use borders instead of a background by default, like OSC. The OSD bar also needs a redesign to fit into the OSC design theme. |
I don't decide which ideas get in, evaluation is already what PRs are for, and I don't personally care about background-box, those who use it can argue it better which is exactly what happened.
Well duh? There was no custom background drawing before you mentioned uosc, so no need for clipping, which I added along with center alignment.
It's only the status quo if one was using the non-default background-box. It looked bad to someone like me not used to it.
I followed all of his advices since 2017, they are gold.
Not being implemented yet doesn't mean I haven't considered the hint. This PR is already huge without more additions, and it is not as simple as doing it in a web page when font and background colors are configurable which can make the input line look mismatched or decrease readability.
In the
Disagreeing is an evaluation. It is normal to be skeptical until more people agree.
No idea what the point here is as there will obviously people disliking whatever we do and whether it has good reasons or not. I've seen e.g. users complaining that left clicking track buttons should show a menu which was reverted. The majority of developers' preferences is the best guess of what is better. |
78dbba7
to
afbf7b3
Compare
Add a scrollbar to give a visual representation of the size and position in the items. It is not clickable. The counter is moved above the scrollbar to free up a line for an another item, simplify calculations, and prevent the selected item from jumping from the second to the first line as you type. In terminal output there is no easy way to draw a scrollbar to the right due to Unicode widths. This just moves the counter into the prompt.
Draw a background behind selectable items even with outline-and-shadow. This makes sense for a menu because you want it to be readable, select something and move on. It doesn't stay open while watching like OSD messages and subtitles, so it can cover more of the video. In fact this was probably the only menu without a background by default. Also the scrollbar without a background looked weird, and the background shows the new horizontal hit box. --osd-outline-color determines the background color with outline-and-shadow, while --osd-back-color determines the background color with background-box. Some transparency is added because using pure black is not recommended because it causes eye strain; alternatively --osd-outline-color could default to #222222. Drawing the background ourselves also allows making the corners rounded. Free-form text mode keeps using only background-box backgrounds if configured as covering the whole screen while searching stats key bindings would be bad. Searching history also doesn't add a background to not change the layout abruptly. When searching history with background-box, it preserves the alpha component of --osd-back-color.
This reverts commit ad0c29e. This should be unnecessary now that the menu has a visible horizontal and vertical hitbox, and was not discoverable anyway. Right click can be useful even while the console is open to pause or open a context menu. Requested in mpv-player#15145 (comment).
The default item also has the same background color but with transparency. Also stop bolding selections since inverted black and white backgrounds should be visible even with color blindness. It was annoying with proportional fonts because it misalignes similar strings. As mpv's default text colors are white on black border or background, --osd-selected-color's default of a bright yellow meant to be used with a black border becomes unreadable with the inverted white background. We could default to a dark --osd-selected-color and a a light --osd-selected-outline-color and use --osd-selected-outline-color as the selected back color. However in show-text commands having only the selected item with a different white border doesn't look good. This therefore adds indipendent selected_color and selected_back_color script-opts. --osd-selected-color is only used for completions and for the selected item when searching the command history with outline-and-shadow.
It's fine to call them menus now that they actually look like ones.
afbf7b3
to
25c7305
Compare
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.
I think all the actual issues were ironed out by now.
console.lua: improve the hovered item calculation with background-box
Follow up to c438732 which improved the calculation with the default outline-and-shadow. We can make the calculation accurate for background-box too without making semitransparent rectangle backgrounds overlap by adding margin between items.
We could calculate the height of each item to make them perfectly adjacent by rendering each one with compute_bounds, but that takes 15ms per render, so 20 lines would take 300ms, which is too slow.
Instead add a fixed 0.1 * opts.font_size to each item's height. This ensures the backgrounds don't overlap with tall CJK text or track circles and --osd-shadow-offset=0. Add this to outline-and-shadow too since it looks better with some margin between the items. Then add the rectangle offset to the height depending on the border style.