/// <summary>
 /// Initializes a new instance of the <see cref="X11Window"/> class.
 /// </summary>
 /// <param name="processId">Process ID of the window.</param>
 /// <param name="parentWindowHandle">Window handle for the parent window.</param>
 /// <param name="itemId">The item ID for this window.</param>
 /// <param name="accessibleObject">The accessible object corresponding to this window.</param>
 internal X11Window(int processId, IntPtr parentWindowHandle, int itemId, AtSpiObject accessibleObject)
 {
     this.processId = processId;
     this.parentHandle = parentWindowHandle;
     this.itemId = itemId;
     this.accessibleObject = accessibleObject;
     this.EnumerationMethod = WindowEnumerationMethod.AssistiveTechnologyApi;
 }
        private X11Window WindowFromAccessibleObject(int id, AtSpiObject accessibleObject)
        {
            IntPtr parentWindowHandle = this.handle;
            if (!this.IsTopLevelWindow)
            {
                parentWindowHandle = this.parentHandle;
            }

            X11Window returnedWindow = new X11Window(this.processId, parentWindowHandle, id, accessibleObject);
            return returnedWindow;
        }
        /// <inheritdoc />
        protected override void Dispose(bool disposing)
        {
            if (!this.IsDisposed)
            {
                if (this.accessibleObject != null)
                {
                    this.accessibleObject.UnreferenceObject();
                    this.accessibleObject = null;
                }

                this.IsDisposed = true;
            }

            base.Dispose(disposing);
        }