Slightly changed close window handling on X11

Optimized and avoids problems on Phosh shell
Thanks @TheBrokenRail for a patch (was a tiny part of patch #322).
https://sourceforge.net/p/irrlicht/patches/322
Changed patch slighlty to unify with rest of Irrlicht code.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6174 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-12-21 21:59:34 +00:00
parent 7f76377bad
commit e8e38b5095
2 changed files with 6 additions and 9 deletions

View File

@ -1,5 +1,6 @@
-------------------------- --------------------------
Changes in 1.9 (not yet released) Changes in 1.9 (not yet released)
- Slightly changed close window handling on X11 (optimized and avoids problems on some shells). Thanks @TheBrokenRail for a patch (was part of patch #322).
- Add getActiveColor functions to IGUIStaticText and IGUIButton (get currently used color). - Add getActiveColor functions to IGUIStaticText and IGUIButton (get currently used color).
- Add IGUIEnvironment::addToDeletionQueue to allow save removal of gui elements while iterating over them (like the same named function in ISceneManager). - Add IGUIEnvironment::addToDeletionQueue to allow save removal of gui elements while iterating over them (like the same named function in ISceneManager).
- IGUIEnvironment::drawAll has now a parameter to allow disabling automatic resize to screensize. Makes it easier to use partial screens with full alignment support. - IGUIEnvironment::drawAll has now a parameter to allow disabling automatic resize to screensize. Makes it easier to use partial screens with full alignment support.

View File

@ -72,13 +72,12 @@ namespace
Atom X_ATOM_NETWM_MAXIMIZE_VERT; Atom X_ATOM_NETWM_MAXIMIZE_VERT;
Atom X_ATOM_NETWM_MAXIMIZE_HORZ; Atom X_ATOM_NETWM_MAXIMIZE_HORZ;
Atom X_ATOM_NETWM_STATE; Atom X_ATOM_NETWM_STATE;
Atom X_ATOM_WM_DELETE_WINDOW;
}; };
namespace irr namespace irr
{ {
const char wmDeleteWindow[] = "WM_DELETE_WINDOW";
//! constructor //! constructor
CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param) CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
: CIrrDeviceStub(param), : CIrrDeviceStub(param),
@ -489,9 +488,8 @@ bool CIrrDeviceLinux::createWindow()
XMapRaised(XDisplay, XWindow); XMapRaised(XDisplay, XWindow);
CreationParams.WindowId = (void*)XWindow; CreationParams.WindowId = (void*)XWindow;
Atom wmDelete; X_ATOM_WM_DELETE_WINDOW = XInternAtom(XDisplay, "WM_DELETE_WINDOW", True);
wmDelete = XInternAtom(XDisplay, wmDeleteWindow, True); XSetWMProtocols(XDisplay, XWindow, &X_ATOM_WM_DELETE_WINDOW, 1);
XSetWMProtocols(XDisplay, XWindow, &wmDelete, 1);
if (CreationParams.Fullscreen) if (CreationParams.Fullscreen)
{ {
XSetInputFocus(XDisplay, XWindow, RevertToParent, CurrentTime); XSetInputFocus(XDisplay, XWindow, RevertToParent, CurrentTime);
@ -998,8 +996,7 @@ bool CIrrDeviceLinux::run()
case ClientMessage: case ClientMessage:
{ {
char *atom = XGetAtomName(XDisplay, event.xclient.message_type); if (static_cast<Atom>(event.xclient.data.l[0]) == X_ATOM_WM_DELETE_WINDOW && X_ATOM_WM_DELETE_WINDOW != None)
if (*atom == *wmDeleteWindow)
{ {
os::Printer::log("Quit message received.", ELL_INFORMATION); os::Printer::log("Quit message received.", ELL_INFORMATION);
Close = true; Close = true;
@ -1012,7 +1009,6 @@ bool CIrrDeviceLinux::run()
irrevent.UserEvent.UserData2 = static_cast<size_t>(event.xclient.data.l[1]); irrevent.UserEvent.UserData2 = static_cast<size_t>(event.xclient.data.l[1]);
postEventFromUser(irrevent); postEventFromUser(irrevent);
} }
XFree(atom);
} }
break; break;