// Disassociate this widget instance and all of its children // from their X window handles, as the mirror copy in the X // server has been lost. internal override void Disassociate() { // Perform the basic disassociation tasks first. base.Disassociate(); // Send a close message and destroy the application group. try { IntPtr d = dpy.Lock(); if (child != XWindow.Zero && !closeEventSent) { closeEventSent = true; Xlib.XSharpSendClose(d, child); Xlib.XFlush(d); } if (group != XAppGroup.Zero) { Xlib.XagDestroyApplicationGroup(d, group); group = XAppGroup.Zero; } } finally { dpy.Unlock(); } // Clean up the child process. ChildDestroyed(); }
// Constructor. public AppGroupWidget(Display dpy, Screen screen, XAppGroup group, EmbeddedApplication parent) : base(dpy, screen, DrawableKind.Widget, null) { embedParent = parent; handle = (XDrawable)group; dpy.handleMap[(XWindow)handle] = this; }
// Called when the child window is destroyed. private void ChildDestroyed() { // Clear the child window and destroy the application group. child = XWindow.Zero; try { IntPtr d = dpy.Lock(); if (group != XAppGroup.Zero) { Xlib.XagDestroyApplicationGroup(d, group); group = XAppGroup.Zero; } } finally { dpy.Unlock(); } // Wait for the child process to exit properly. if (process != null && !(process.HasExited)) { if (!process.WaitForExit(5000)) { // Process is still alive! Kill it the hard way. process.Kill(); process = null; } } // Delete the authority file, which we no longer require. if (authorityFile != null) { File.Delete(authorityFile); authorityFile = null; } // Notify subclasses that the child was destroyed. if (!closeNotifySent) { closeNotifySent = true; OnClose(); } }
// Disassociate this widget instance and all of its children // from their X window handles, as the mirror copy in the X // server has been lost. internal override void Disassociate() { // Perform the basic disassociation tasks first. base.Disassociate(); // Send a close message and destroy the application group. try { IntPtr d = dpy.Lock(); if(child != XWindow.Zero && !closeEventSent) { closeEventSent = true; Xlib.XSharpSendClose(d, child); Xlib.XFlush(d); } if(group != XAppGroup.Zero) { Xlib.XagDestroyApplicationGroup(d, group); group = XAppGroup.Zero; } } finally { dpy.Unlock(); } // Clean up the child process. ChildDestroyed(); }
// Called when the child window is destroyed. private void ChildDestroyed() { // Clear the child window and destroy the application group. child = XWindow.Zero; try { IntPtr d = dpy.Lock(); if(group != XAppGroup.Zero) { Xlib.XagDestroyApplicationGroup(d, group); group = XAppGroup.Zero; } } finally { dpy.Unlock(); } // Wait for the child process to exit properly. if(process != null && !(process.HasExited)) { if(!process.WaitForExit(5000)) { // Process is still alive! Kill it the hard way. process.Kill(); process = null; } } // Delete the authority file, which we no longer require. if(authorityFile != null) { File.Delete(authorityFile); authorityFile = null; } // Notify subclasses that the child was destroyed. if(!closeNotifySent) { closeNotifySent = true; OnClose(); } }
extern public static XStatus XagDestroyApplicationGroup (IntPtr display, XAppGroup app_group);
extern public static XStatus XagCreateEmbeddedApplicationGroup (IntPtr display, XVisualID root_visual, XColormap default_colormap, XPixel black_pixel, XPixel white_pixel, out XAppGroup app_group);