Repository navigation
Implemented getTopWindowAt - #22
Conversation
|
Hey! Sorry for the delay in my reply. These days, I have very limited time and access to all my "things". Thank you so much for your time and help. I can not test, extend to all other methods and merge this all at the moment, I hope it's not a problem for you (if it is, just let me know and I will do my best!). Besides, I have to carefully read your advices and your code to understand everything. Bear in mind I have never studied nor worked in Python (I learned Python, very recently, and mainly on stackoverflow, HAHAHAHA!, Let's say it's sad but true!), so this all is really helpful to me!!! Regarding your comments:
Apart from this all, I think your code is fantastic and will work perfectly! Thank you for your help and "instruction". |
I think it's worth implementing that way. Unfortunately I haven't had time, (and won't really have for the next 2 weeks) to look into it and read some apple documentation. So I threw together a very naïve implementation (maybe a No hurry on merging, I just install directly from my fork ! |
|
Understood and agree. I will complete that function on macOS as soon as I can, don't worry. Have some nice days! |
Closes #20. Incidentally Fixes #18
Some notes:
append. (difference in performance is small, but it's there, it's also best practice)map,filter,reduce, etc., as they are considered non-pythonic. They were nearly removed from python3. The difference in performance is marginal.Unknowntypes along the way. Didn't wanna scope creep too much, so only touched functions related to this PR.Win32Window(hwnd) if hwnd else NonegetWindowsAt? BecausegetAllWindowsiterates over the entire list to remove bad windows. And often the window we'll be interested in is going to be at the very end of the clientliststack. This has noticeable performance implications at it scales with the number of windows open (5 windows --> ~5 times slower, 2 windows --> ~2 times slower).Benchmarks:
Note this means there's a performance improvement to be had everywhere we get all windows. I don't think
getAllWindowsitself should return a generator (as it's public API I think it's ok to make it a list and be consistent with the rest of the exposed methods). But they could all use a__getAllWindowsGeneratorunder the hood.I didn't want to scope creep this PR, so I'll leave this for another time.