Clicking "No" or "Cancel" on pfd::message pfd::choice::yes_no_cancel returns pfd::button::ok on Linux KDE and pfd::message freezes the application
OfficialKrisHass opened this issue · comments
` auto m = pfd::message(title, description, pfd::choice::yes_no_cancel, pfd::icon::warning);
pfd::button btn = m.result();
Log((int32_t) btn);
switch(btn) {
case pfd::button::yes: return PopupResult::Yes;
case pfd::button::no: return PopupResult::No;
case pfd::button::cancel: return PopupResult::Cancel;
default: return PopupResult::Invalid;
}`
This code returns PopupResult::Invalid when clicking on the button "No" or "Cancel", and the Log((int32_t) btn);
prints 0 into the console on both cases, which is equal to pfd::button::ok. But prints 1 (pfd::button::yes) when pressing the button "Yes".
Also, when this code runs, it freezes the application (the title of the window says "Not Responding") and after a few seconds it shows me a dialog saying "This application is not responding, do you wish to terminate it or keep waiting ?".
I am running on Manjaro KDE, and using kdialog.
Also I did some digging and found that inside pfd::message::result "ret" is always empty, and m_mappings[exit_code] is pfd::button::no. When I press "Yes", exit_code is equal to 0 and m_mappings[exit_code] is equal to pfd::button::yes (1). When I press "No" exit_code is 1, m_mappings[exit_code] is pfd::button::ok (0) and when I press "Cancel" exit_code is 2, but m_mappings[exit_code] is pfd::button::ok (0).
@OfficialKrisHass in case you are interested, I've fixed this in my fork.
@samhocevar let me know if you would like a pull request for this.