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
feat!: fix appearance of --frame transparent
and deprecate neovide_background_color
.
#2168
Conversation
9f18887
to
1c83456
Compare
@fredizzimo I have to say, things are much simpler than I think. We don't have to draw the title bar ourselves. Here is a style mask on macos So things get simple. We always specify Then the problem becomes how do we adjust old configs. I think we can deprecate all related macos specific configs in the doc and try to leave them there if possible so people won't get surprised that old configs not work. I want to deprecate the two macos specific |
1c83456
to
c264387
Compare
@crupest, that's great news! We actually discussed the deprecation of I think we should just show a message with the link to the appropriate issue and documentation here, for people that tries to use it. The |
@fredizzimo My network environment does not allow me to access discord. I'm sorry I can't synchronize with you guys there. I have merged I think I'll have plenty of time to deal with this this weekend. During this period, I'll also complete the documentation change in the pr. |
@crupest, I'm not a macOS user, so I cant tell how useful or useless the options are. But by reading the description I do think they are quite useless, especially if the transparency follows neovide transparency automatically. So from my point of view you can go ahead remove them. Maybe the same strategy could be applied to that too, with a message referring to an issue, so that we possibly can add them back based on feedback. |
OK. That's great! I'll complete the rest works soon. Best regards! |
e0191d7
to
0d73139
Compare
@fredizzimo Almost everything is done except one thing. macos seems not to deliver mouse events on title bar to system if it is transparent, which means if you click on title bar (except the title bar text), the mouse events are passed to neovide and the window does not zoom as expected. However, window move works but it also trigger neovide mouse handling at the same time. I tried to hack on Here are the screenshots of the final effects. Here is the bug mentioned above. Screen.Recording.2023-12-09.at.20.55.17-1.mov |
I don't know if it's possible, but maybe it's possible to make the text field as wide as the titlebar? Even if the actual visible text doesn't take up all the space. Or some other invisible title bar elements? It would be rather easy to ignore all events in a certain area in the |
That's a good idea. I'll try to put a native invisible control there and handle the zoom. |
@fredizzimo It's a little awkward for me to misunderstand a lot of things. I should have tried the Here are the our implementations,
So everything is just a composition of complicated things. I think we have to sort these again. I think we can leave 3 final choices:
I will revise my codes to reflect these new options tomorrow. As for the title bar problem, I have investigated a long time. The way of putting a native control is infeasible. We have so little ability to interact with native platform, especially for macos, which use obj-c but not pure-c api. And it requires to use obj-c api to do the event handling and other related things. We can use the rust library objc but it only makes the code ugly and unmaintainable. (Maybe there is other library?) Logically, in this case, title bar is under our control and we then have the duty to manage that area. But it in turn breaks our current codes a lot. I'll keep searching for solutions tomorrow. Just to leave a note here. I'm really new to macos developing. And if somebody has any experience on this, I'll be very glad to learn from you! UPDATE: |
No, problems, this is complicated, and I don't think anyone actually understands it, that's why we have these issues opened for months without any comments about implementation ideas. I have problems even imaging the concepts since I don't use macOS. As for the objc, winit uses https://github.com/madsmtm/objc2, so I guess that's about as good as it gets. And talking about winit, it's possible that some of these things might make more sense to implement there, or at least port it there later. Edit: I forgot to say, from what I have seen, the macOS documentation itself is some of the worst I have seen... |
@fredizzimo I have a good news to share with you. The method of using a stub view at titlebar works perfectly. I have already pushed the working codes. I'll do code clean tomorrow and then I think we can merge. Cheers🍺. |
And I will also try to improve macos specific code, use better apis and make code as clean as I can do. |
Exactly. Far worse than M$. I develop totally via trials. |
@fredizzimo Coming again. After struggling for several days to try, I failed and gave up to find a way to layout title bar stub completely in macos codes. I still need to use winit resize event to update title bar stub's position and size. It makes the code kind of unclean but I can't find a better way. The biggest problem is winit always pacics here in whatever way I try:
I'm not sure whether there is a more gentle way to handle this. However, current code works well in function. Do you think we can try more about making the code neater or we just stop here. Here is the final effects. Just ignore the lag of resizing. It's an old problem. Screen.Recording.2023-12-16.at.00.17.51.mov |
@crupest, I did not take a too detailed look at the code, but it looks OK to me and we can always improve it later. Even small glitches are OK at this point, since it should be strictly better than what we had before, as long as it does not crash. @madsmtm, @kchibisov, do you have some advice from the Winit side? The idea here is to support transparent backgrounds and titlebars, by drawing them ourselves. Previously we used a custom background color for the whole window, but that was interfering with the transparency of the Neovim background. |
@fredizzimo winit has option to do transparent decorations or borderless, so you can offset the title bar, and you still draw into it (alacritty has transparent setting on macOS). It's not like you need to draw them on your own entirely, you can just clear and then update viewport? |
@crupest, I guess you tried some approaches using those options before starting to work on this approach? Personally, I'm quite blind on this, since I don't have a macOS computer to test on, and I'm just going on what's been reported in different issues here. But yes, now I saw this old issue, especially this image #1298 (comment), and that does indeed look like exactly what we want. We just need to offset the content, which is already possible through a user option |
You are right. A top padding is enough to make the appearance good. But there are several extra points of my codes.
Besides, there are some clean work. Like move the codes of previous draw background and update docs. |
Actually I don't draw the title bar by ourselves now. The solution is dropped after I find the way to add a top padding. I lined out the original solution and point out the comment of the new solution. |
Yeah, but it's pretty much the same with transparent style, no? The only issue is that you need to add handling for clicks and padding yourself, but winit has all the functions available for stuff like that, including moving. |
To be clear, actually the core solution of my codes is exactly adding a top padding. And there are the other points mentioned above. |
541258b
to
735f6ce
Compare
Works fine for me. Not a fan of the animation while entering/exiting fullscreen, but it can be fixed later. |
@crupest everything works fine, congrats! The only exception is a changed that has been made and I didn't see in the first look: the title is hidden by default on upstream when used --frame transparent. But by now you have removed it here which is bothering once the users had it hidden always by default. my suggestion is to create a setting to toggle it as the user wishes. After all, this is the last request I've made to finally approve the PR. |
@polachok That's kind of annoying indeed. But it may take some time for me to find a way of handling it better. MacOS automatically zooms the window content when toggling fullscreen, and then the new padding is painted. So the visual effect is a little bad. Maybe we have to find a way to update the padding and draw the surface before the zoom happens. Or we have to make a smooth animation so it looks better.
@falcucci I'm not sure about this problem. I was assuming that |
@crupest I am sure about this problem: a default feature has been changed and we are deprecating it in this pr. I see two ways to handle:
|
@falcucci Well, I think the former way is better. Since we are going to make it anyway, let's just make them together instead of creating another one immediately after this. But it may take some time for me to hack into the settings part. |
Could you take screenshots of all four frame variations, so it's easer for us that are not on Mac to judge? I think the title can be hidden by just setting it to empty inside Neovim, so we don't necessarily need to do anything |
@crupest sure, sounds good. I can help creating the toggle PR, but I am not sure if today I can do that (far from computer currently, maybe tomorrow). @fredizzimo you still plan to release today? |
Maybe, but we can delay it until tomorrow. But we should not delay it too long, since the release is long overdue, we get a new bugreport about the startup freeze about every other day. |
@fredizzimo it's just the title being displayed or not. I'm not sure if a neovim config would do that but I am curious to try since this is a winit platform specific property. |
Looks like the options are |
@fredizzimo @crupest let's merge this and i'll handle to toggle the title hidden option in another PR, I'll try to do it before going to the theater today. |
I realized, I made a mistake when reviewing this PR I thought the override only applied when the user don't set it to empty himself. At least Ithat's the way I think it should work, "Neovide" should only be the default |
That would be great! |
#2319 the PR has been created. |
Thank you! Let's fix further problems separately if they come up. |
🎉💯 |
Fix #2094
This pr does following changes:
--frame transparent
. Before this pr, the titlebar floats on the head of content. This pr adds a top padding of titlebar height, so the appearance looks better.neovide_background_color
option because the color of titlebar now honorsneovide_transparency
. An error message will be printed if user uses it.draw_background
code merges into the feature code of this pr. And docs are updated.And here are some other related changes:
This pr is almost done but still has some details to discuss. If you want to experience this right now, you can download it from the CI at https://github.com/crupest/neovide/actions/runs/7626642491 (currently based on
3e575fc
on main branch). Or just checkout the branch of this pr andcargo run --release -- --frame transparent
.