Skip to content
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

Color picking not working on Windows #68979

Closed
KoBeWi opened this issue Nov 21, 2022 · 6 comments · Fixed by #72764
Closed

Color picking not working on Windows #68979

KoBeWi opened this issue Nov 21, 2022 · 6 comments · Fixed by #72764

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Nov 21, 2022

Godot version

4.0 11e1c83

System information

Windows 10 x64

Issue description


The color never changes. Not for the property, nor for the button. According to the discussion in #63886, this is a Windows-specific issue.

Steps to reproduce

  1. Be on Windows
  2. Open ColorPicker
  3. Click the eyedrop button
  4. Try to pick some color

Minimal reproduction project

N/A

@duianto
Copy link

duianto commented Nov 22, 2022

v4.0.beta5.official [89a33d2], Win 10 22H2

It does work if the Color popup is closed with esc after clicking on the eye dropper icon:

  • click on the color property in the inspector to open the color popup
  • click on the eye dropper icon
  • press esc to close the color popup
  • click on a new color
godot_4_color_picker_windows.mp4

When this is fixed, so that the eye dropper works while the color popup is open,
then the eye dropper probably should be canceled when the color popup is closed with esc.

@Sauermann
Copy link
Contributor

While investigating this issue I tracked it to this:

void ColorPicker::_screen_pick_pressed() {
if (!is_inside_tree()) {
return;
}
Viewport *r = get_tree()->get_root();
if (!screen) {
screen = memnew(Control);
r->add_child(screen);
screen->set_as_top_level(true);
screen->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
screen->set_default_cursor_shape(CURSOR_POINTING_HAND);
screen->connect("gui_input", callable_mp(this, &ColorPicker::_screen_input));
// It immediately toggles off in the first press otherwise.
screen->call_deferred(SNAME("connect"), "hidden", Callable(btn_pick, "set_pressed").bind(false));
} else {
screen->show();
}
screen->move_to_front();
// TODO: show modal no longer works, needs to be converted to a popup.
//screen->show_modal();
}

Is it possible, that this is related to the Control->Window conversion?

I verified, that this problem also exists in v4.0.alpha1.official [31a7ddb] on Linux X11:

  • I can't pick colors
  • The color under the mouse cursor is not used

In v4.0.beta.custom_build [6318320] on Linux X11:

  • I can't pick colors
  • The color under the mouse cursor is used for previewing it in the color-picker (so at least some kind of progress has happened since v4.alpha1).

@stmSi
Copy link
Contributor

stmSi commented Dec 26, 2022

I saw weird things happening while debugging ColorPicker::_screen_input. The first Mouse Click Event doesn't not enter yet... after u click again.... two clicks events enter continuously.

  1. First comment out this so that u can capture screen click events as long as u want. (in _notification)

image


  1. insert these lines (in _screen_input)

image


  1. select color picker and click it. nothings happens. click again... "LEFT" will print 2 TIMES

image


  1. Color will set successfully.

@nezvers
Copy link

nezvers commented Jan 27, 2023

Godot 4 Beta 15 on Windows eyedropper does not pick a color.

@Sauermann
Copy link
Contributor

Sauermann commented Feb 4, 2023

The relevant code section has this comment:
// TODO: show modal no longer works, needs to be converted to a popup.

So I did some experiment with popups. Current status is that I ran into the problem that Popups can not be made transparent reliably (previously the Control screen simply was transparent). So I believe, that it is currently not possible to solve this by a simple replacement Control->Window

In a second attempt I tried to solve this with the Drag & Drop mechanic. This might be possible, but becomes quite complex.

@JohanAR
Copy link
Contributor

JohanAR commented Feb 4, 2023

I've considered a couple of alternative ideas, that may or may not work in reality..

  1. Use some OS-specific code for eye dropping a colour instead of trying to implement it using Godot objects.
  2. Hide the ColorPicker popup while using the eyedropper, and open it again after the user has clicked the main window. Possibly with some kind of decoration, like a thick frame around the window, or a small notification e.g. "click to pick a colour, or Esc to cancel", to give some kind of indication that the popup didn't just disappear.
  3. Remove eye dropper. Maybe people aren't using it anyway?

@akien-mga akien-mga added this to the 4.0 milestone Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants