Closed crumblingstatue closed 1 year ago
For reference, gcolor2 for example supports clicking the picker, and then clicking somewhere on the screen, and it doesn't lose focus and doesn't give focus to the window that gets clicked on, so this should be possible.
Yeah, the current implementation is more of a proof of concept than a working thing and only really acts as a zoom in of the area around the cursor. There is a lot of work here to be done for it to really work as intended.
Will have to read up on how to keep focus with egui when the cursor leaves the window.
Here is an idea: Why not have the zoom window inside our egui ui? That way we don't need a separate window, and we can just use the pick shortcut key to pick the color, since our window didn't get unfocused.
Also, this way, we only need to handle how to get the screen pixels for each platform, not have to mess around with window code.
Even if native picker windows are for some reason desirable, a built-in zoomer could be an option. I personally would be satisfied with it completely. I might start on a proof of concept soon.
Perhaps limiting the functionality until a solution arrives is a good idea, we could use egui for window handling and that does solve most problems for now. The functionality for getting the screen pixel is already there on all 3 platforms so one would just have to work on creating something similar to the zoomed window inside of egui that would follow the users cursor.
Getting the native zoomed picker window to work will be quite messy and probably take some time so it might be a good idea to have it under some experimental checkbox in the settings or something like this.
I've added some changes in fix-zoom-picker
branch that make the zoom button react to dragging instead of clicking so that the epick window stays in focused. I only experimented briefly and so far the only thing I don't like about this solution is that whenever I hold the mouse over the button for too long it ends the drag event and the window dissapears. Will have to spend some more time on it but seems like it might be a viable solution
I've managed to resolve the issue of loosing focus by adding an artificial timeout before the zoom window is moved next to the cursor. If you're still interestend in this issue let me know if it works on your desktop environement as well as I only tested on bspwm.
I've managed to resolve this issue without adding the timeout by setting a different window type for the zoom picker window. It works well on bspwm and plasma but should work on all X11 WMs.
When I activate the zoom picker, I expect clicking somewhere to set the current color. Instead, the window I click on gets focused (causing epick to lose focus), and the color is not set. My second instinct is to use the color pick shortcut key (p), but that doesn't work if epick is not focused. When the zoom picker is activated, the zoom picker window gets the focus, so epick doesn't receive key events.
Either clicking should set the color, and/or the color pick shortcut key should work when using the zoom picker, without having to click on the epick window first to focus it.
System info: Linux X11