示例#1
0
        /// <summary>
        /// Deletes a context.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="IntPtr"/> that specify the context to be deleted.
        /// </param>
        /// <returns>
        /// It returns a boolean value indicating whether the operation was successful. If it returns false,
        /// query the exception by calling <see cref="GetPlatformException"/>.
        /// </returns>
        /// <remarks>
        /// <para>The context <paramref name="ctx"/> must not be current on any thread.</para>
        /// </remarks>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="ctx"/> is IntPtr.Zero.
        /// </exception>
        public override bool DeleteContext(IntPtr ctx)
        {
            if (ctx == IntPtr.Zero)
            {
                throw new ArgumentException("ctx");
            }

            using (Glx.XLock displayLock = new Glx.XLock(Display)) {
                Glx.DestroyContext(Display, ctx);
            }

            return(true);
        }