airsoftsoftwair wrote:Appears you have misread my remarks. The question here is: Is there any way to detect whether MUIA_Window_CloseRequest was triggered by the user pressing the hotkey or by the user clicking the window's close gadget? This would be a prerequisite for implementing what the OP wants.
You don't need to care for the reason why MUIA_Window_CloseRequest is triggered. You also don't care what causes a button to be pressed. This can be done by mouse or by keyboard. But in any case MUIA_Pressed will be set to FALSE to indicate a click on that button. The close request can even be triggered artifically by just set()ing it. MUI does not remember any details about what is causing the trigger of a certain attribute, because in principle all triggers boil down to a code line like "set(object, attribute, value)".
The close request is exactly what it name says: a request to close the window, nothing else. If and how an application reacts on this request is up to the application. MUI does not impose anything here, and this is what this discussion is about.
"Esc" is simply the default key to trigger a close request for a window by keyboard. This can be changed by the user to anything else. Even "Return" can be used. However, if that is a sensible setting is a completely different matter.
Another possibility is to set MUIA_Window_DisableKeys to ignore certain standard keys:
Code: Select all
set(window, MUIA_Window_DisableKeys, 1<<MUIKEY_WINDOW_CLOSE);
This will disable the standard "Esc" sequence to trigger a close request. From that point on the close request can only be triggered by clicking the close gadget or by
In general it is a bad idea to disable standard keys, because people expect their key definitions to work always and in all situations. So better think more than twice if you really intend to use this feature.