Skip to content

Conversation

onesounds
Copy link
Contributor

@onesounds onesounds commented Oct 12, 2021

for Fix the #735 issue.

Why it happen.

so...

  1. force update using Dispatcher
    https://stackoverflow.com/questions/1644079/change-wpf-controls-from-a-non-main-thread-using-dispatcher-invoke
    It is too difficult for me.

  2. Using Opacity?

  • Visibility hidden or collapsed doesn't update data. Opacity 0 is possible.
  • I thought opacity 0 will reserved area.

It is my solution

  1. When It close (there are two place, esc command and toggle window)
  2. update query data. (replace query data by setting)
  3. window opacity = 0 (it just for hide delay. The user feels that the window closes quickly.)
  4. 30ms delay (Time for update data. it's not showing because opacity 0)
  5. close (hidden) window.

When I tested it, it worked well. feel so good.

problem

  • I tested a number of things. I think opacity 0 doesn't reserved area. You can use this as a substitute for closing windows.
  • but window visible using in everywhere. I can't change everything.
  • If you close the progress bar when you see it, it remains the next time you open it.
  • So tricky.

you guys will be able to trimmed more neatly.

@onesounds
Copy link
Contributor Author

it work only esc and toggle case. It doesn't work every visible/hidden case.

@onesounds onesounds closed this Oct 13, 2021
@jjw24
Copy link
Member

jjw24 commented Oct 13, 2021

what do you mean visible/hidden case?

@onesounds
Copy link
Contributor Author

onesounds commented Oct 13, 2021

what do you mean visible/hidden case?

like 'open item' thing. In addition to esc and toggle hotkey, there are situations in which windows are closed.
I think closing(Mainwindow visibility control) should be a function(method? I don't know what I call) and connected to everything. The location should not be hotkeymapper either. Flow uses the visibility code everywhere, but I haven't checked it all in this PR.

Anyway, looking at Power Toy, It was a similar way to me.
microsoft/PowerToys@3a15276

I'll try copying it, but I don't know if it'll work out. If I success, I'll reopen.

@taooceros
Copy link
Member

It's similar, just await 100ms before changing to collapse. They use Thread.Sleep(100), which I am not sure whether will cause a bit slow on closing.

- add some opacity trick for empty query
- remove start animation
- add some opacity trick for empty query
- remove start animation
@onesounds
Copy link
Contributor Author

onesounds commented Oct 14, 2021

It was brought from powertoy to process toggle and updates. I think I fixed it. The opacity trick written above was also used.
Some codes are in the mainviewmodel.cs (when esc and choose item) and the rest are in the hotkeymapper.
(alt+space toggle uses hotkeymapper) I think I have to transfer hotkeymapper classe them all, but it's too much for me. anyway, It should be fixed to use the main view model class.

I fixed what I saw first. It does not work when the plug-in context menu is selected. I don't know where to fix this.
I leave the rest to you guys.

@onesounds onesounds reopened this Oct 14, 2021
@onesounds
Copy link
Contributor Author

onesounds commented Oct 14, 2021

I think I have to transfer hotkeymapper classe them all, but it's too much for me. anyway, It should be fixed to use the main view model class.

The necessary methods were moved, and the redundant ones were erased. ESC and toggle use same method in now.

@taooceros
Copy link
Member

Hm why all hotkey mapper method is moved to mainviewmodel? Previously #565 extract those method related to hotkey from mainviewmodel to hotkey mapper. I don't think we should move it back.

I can handle the rest of the refactor if you think sometimes you encounter trouble in using the method across classes.

@onesounds
Copy link
Contributor Author

Hm why all hotkey mapper method is moved to mainviewmodel? Previously #565 extract those method related to hotkey from mainviewmodel to hotkey mapper. I don't think we should move it back.

I can handle the rest of the refactor if you think sometimes you encounter trouble in using the method across classes.

I didn't see that issue discussion. I didn't know why this was separated. I just thought the empty query method should be separated from hotkey. I thought it was intuitive to be by the window.

Anyway, I referred to Power Toy. They probably organized the code better than me. I focused on changing window hiding to a unified method. I just moved what was called together while moving the import empty query. If there seems to be a problem, you can correct it. As you know, I don't know how to structure it.

@taooceros taooceros added this to the 1.9.0 milestone Oct 19, 2021
@taooceros taooceros added the kind/ui related to UI, icons, themes, etc label Oct 19, 2021
@taooceros taooceros linked an issue Oct 19, 2021 that may be closed by this pull request
@taooceros
Copy link
Member

@onesounds Please check the last commit, and if you think it works as expected, I will merge it.
In addition, I found that we don't need the clearQueryCommand, do we still need to keep it?

@taooceros taooceros merged commit e69b454 into Flow-Launcher:dev Oct 20, 2021
@jjw24 jjw24 added the bug Something isn't working label Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working kind/ui related to UI, icons, themes, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual issue using Last Query Style -> Empy Last Query

3 participants