Example #1
0
        private void HandleXClientMessage(XClientMessageEvent *xclientMessage)
        {
            var dispatchService = XlibDispatchService.Instance;

            if ((xclientMessage->format != 32) || (xclientMessage->message_type != dispatchService.GetAtom(WM_PROTOCOLS)))
            {
                return;
            }

            var eventAtom = (nuint)xclientMessage->data.l[0];

            if (eventAtom == dispatchService.GetAtom(WM_DELETE_WINDOW))
            {
                // If we are already disposing, then Dispose is happening on some other thread
                // and Close was called in order for us to continue disposal on the parent thread.
                // Otherwise, this is a normal close call and we should ensure we step through the
                // various states properly.

                if (_state == Disposing)
                {
                    DisposeWindowHandle();
                }
                else
                {
                    Dispose();
                }
            }
        }
Example #2
0
        private void HandleXClientMessage(XClientMessageEvent *xclientMessage, bool isWmProtocolsEvent)
        {
            if (isWmProtocolsEvent)
            {
                if (xclientMessage->data.l[0] == (nint)XlibDispatchProvider.Instance.WmDeleteWindowAtom)
                {
                    // If we are already disposing, then Dispose is happening on some other thread
                    // and Close was called in order for us to continue disposal on the parent thread.
                    // Otherwise, this is a normal close call and we should ensure we step through the
                    // various states properly.

                    if (_state == Disposing)
                    {
                        DisposeWindowHandle();
                    }
                    else
                    {
                        Dispose();
                    }
                }
            }
        }