-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Inset Mac OS traffic lights #513
Conversation
Thanks for this awesome PR! I had tried doing this only to fail at the "resize" artifacts: #494 Reading your solution made it clear. I should close that issue then. |
This feature is fantastic! However, I noticed a strange behavior: the hover effect still shows when I move the cursor to the "original" position of traffic lights. The electron implementation doesn't seem like have this behavior. I dug into its code but failed to find a solution. Update: strangely, the problem goes away if I resize the window. |
Hey what's the status of this? I really would like to be able to apply inset on the traffic lights without work arounds |
Hi, me too. But I know really little about Tao. If this gets merged then we still have to implement it somehow into tauri. |
The implementation seems fine to me. But I'm not sure if it's good to merge now. |
there is a good chance they may not accept but lets go ahead and merge this and if they didn't accept it upstream, we can implement it directly in tauri |
I'm sorry this has taken so long. I didn't really have time to work on this. I will document the function and delete the example these days. I hope it's not to late to merge? |
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.
Looks fine to me, however I'll hand this to @wusyong and @JonasKruckenberg (since you were interested in this)
Please rebase the PR to fix the conflicts and add a change file |
I'll review this tomorrow, it's a super important imo and this or has been open wayy too long 😉 let's get this over the finish line |
Maybe it's important to add that I couldn't test the changes since my MacBook broke 🥺. If one of you could do that it would be amazing |
After testing this PR now, I feel // WTH means width here? and height?
.with_traffic_light_inset(LogicalSize { width: 10, height: 20 }); |
Okay a few other observations:
The second one really is a dealbreaker right now, I guess we need to implement a delegate and stuff just like electron does as well |
I don't know if you fixed it already in that commit, but when I tested it with my supplied example the inset was persistent during resizing of the window. |
Okay yes my bad, calling the My only question @haasal is why the |
@amrbashir I added back the example, since it's indeed needed to use the method correctly (it's not enough to just call it once but it needs to be called after |
Yeah that was the reason I made the example. I already tried implementing this in Tauri itself using the raw window handle but I couldn't get rid of these artifacts. Do you think this method can now be used in tauri without causing artifacts? |
I don't know how to implement it instead. This whole thing gave me big headaches because I couldn't find a way to set the inset without having to call the method in some weird way. If you have any idea how to do this without having to call the method after |
I still don't see why the example is needed since tao should already handle that internally and not require users to keep calling it in |
then we should change it to behave that way |
I really would like to get this over with but as said earlier I don't really know how. If you know how to directly inject something into the "window draw pipeline" (I.e. how to automatically call my inset-method/function without requiring the user to do some weird setup) I could take a look at it |
@haasal you need add an inset field on the tao/src/platform_impl/macos/view.rs Line 54 in c5d606d
set_traffic_light_inset sets this field, then in draw_rect tao/src/platform_impl/macos/view.rs Line 382 in c5d606d
|
@wusyong I didn't do anything like this before and I don't want to mess up even worse. Do you mean pulling from upstream onto my dev branch and then merging with all of my contributions squashed into one commit? Wouldn't this negate all my commit messages? |
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Example not needed Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Deleted outdated TODO Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
The set_traffic_light_offset() method on window was removed and only the builder function now has to be called to set the offset. No more manual event handling is needed. Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
the example is no longer needed as the api design is now clear and only one method call is needed to set the inset Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
the set_traffic_light_position on window will now work as expected. I.e. only one call is necessary Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Also unified the api to always use inset instead of position Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
Signed-off-by: amrbashir <amr.bashir2015@gmail.com>
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 guess it is ready for merge now, @wusyong would you mind testing and merge?
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___
)Other information
Important: There still exist artifacts when resizing the window because the traffic lights are set just after the window has already been drawn.