"Lei Zhang" thestig@google.com wrote:
On Windows, clicking the close button of a nonactive window generates a WM_MOUSEACTIVATE notification. Applications with custom window procedures can then choose to ignore the close button if they wished to by returning MA_ACTIVATEANDEAT / MA_NOACTIVATEANDEAT.
I'm not sure what you mean by "applications with custom window procedures" because all (even simple ones) window procs in applications are custom, and they are free to handle/ignore any message they like, for instance WM_CLOSE or WM_SYSCOMMAND/SC_CLOSE.
We already send WM_MOUSEACTIVATE message on a take focus X11 event, so I don't see a point in duplicating it. On the other hand if a WM doesn't activate a window when a user clicks on window's caption (where the close button usually placed) then it's a WM bug and we can do nothing to fix it.
On 6/18/07, Dmitry Timoshkov dmitry@codeweavers.com wrote:
"Lei Zhang" thestig@google.com wrote:
On Windows, clicking the close button of a nonactive window generates a WM_MOUSEACTIVATE notification. Applications with custom window procedures can then choose to ignore the close button if they wished to by returning MA_ACTIVATEANDEAT / MA_NOACTIVATEANDEAT.
I'm not sure what you mean by "applications with custom window procedures" because all (even simple ones) window procs in applications are custom, and they are free to handle/ignore any message they like, for instance WM_CLOSE or WM_SYSCOMMAND/SC_CLOSE.
We already send WM_MOUSEACTIVATE message on a take focus X11 event, so I don't see a point in duplicating it. On the other hand if a WM doesn't activate a window when a user clicks on window's caption (where the close button usually placed) then it's a WM bug and we can do nothing to fix it.
-- Dmitry.
Please try the sample program I attached to bug 8706. It has a window procedure that does what I vaguely described here.
Are you sure a WM activates a window before sending the message to close the window in reaction to the close button click event? If so, then both Gnome and KDE would be buggy because the sample app I wrote did not receive them with either of their WMs, nor did I see the code that sends WM_MOUSEACTIVATE get called.
"Lei Zhang" thestig@google.com wrote:
We already send WM_MOUSEACTIVATE message on a take focus X11 event, so I don't see a point in duplicating it. On the other hand if a WM doesn't activate a window when a user clicks on window's caption (where the close button usually placed) then it's a WM bug and we can do nothing to fix it.
Are you sure a WM activates a window before sending the message to close the window in reaction to the close button click event? If so, then both Gnome and KDE would be buggy because the sample app I wrote did not receive them with either of their WMs, nor did I see the code that sends WM_MOUSEACTIVATE get called.
I know that neither KDE nor Gnome do not activate a window if a user clicks on the window caption buttons, that's their bug IMO, not Wine's one.
On 6/18/07, Dmitry Timoshkov dmitry@codeweavers.com wrote:
"Lei Zhang" thestig@google.com wrote:
We already send WM_MOUSEACTIVATE message on a take focus X11 event, so I don't see a point in duplicating it. On the other hand if a WM doesn't activate a window when a user clicks on window's caption (where the close button usually placed) then it's a WM bug and we can do nothing to fix it.
Are you sure a WM activates a window before sending the message to close the window in reaction to the close button click event? If so, then both Gnome and KDE would be buggy because the sample app I wrote did not receive them with either of their WMs, nor did I see the code that sends WM_MOUSEACTIVATE get called.
I know that neither KDE nor Gnome do not activate a window if a user clicks on the window caption buttons, that's their bug IMO, not Wine's one.
-- Dmitry.
Just curious, what popular WMs do active a window when users click the window caption buttons?
In the case where the WM does the right thing and activates the window. (It looks like fvwm95 is one such WM.) Handle_wm_protocols() gets called, with protocol == x11drv_atom(WM_TAKE_FOCUS). This sends a WM_MOUSEACTIVATE message, and then the application can return MA_*ANDEAT. Now what? Currently handle_wm_protocols() gets called with protocol == x11drv_atom(WM_DELETE_WINDOW) next and the application is told to close even though it asked not to be.
"Lei Zhang" thestig@google.com wrote:
Just curious, what popular WMs do active a window when users click the window caption buttons?
I have no idea.
In the case where the WM does the right thing and activates the window. (It looks like fvwm95 is one such WM.)
That's a WM specific behaviour, we can do nothing about it.
Handle_wm_protocols() gets called, with protocol == x11drv_atom(WM_TAKE_FOCUS). This sends a WM_MOUSEACTIVATE message, and then the application can return MA_*ANDEAT. Now what? Currently handle_wm_protocols() gets called with protocol == x11drv_atom(WM_DELETE_WINDOW) next and the application is told to close even though it asked not to be.
Next, a window receieves WM_SYSCOMMAND/SC_CLOSE as I already pointed out, and a wndproc can do whatever it likes: ignore/pass through it.
What real world application are you trying to fix?