public LinuxX11Platform() { Display = Xlib.XOpenDisplay(null); //Xlib.XSetErrorHandler(OnError); Dispatcher.CurrentDispatcher.Initialize(ListenToEvents, WakeUp); _deleteProtocolAtomProvider = new Lazy <X11.Atom>(() => XInternAtom(Display, "WM_DELETE_WINDOW", false)); }
private void WakeUp() { Services.Logger.LogWindowingSystemEvent("Received wake up call."); if (!_windows.Any()) { Services.Logger.LogWindowingSystemEvent("No windows to wake. Request skipped."); return; } var connection = Xlib.XOpenDisplay(null); IntPtr ev = Marshal.AllocHGlobal(24 * sizeof(long)); try { var msg = new X11.XClientMessageEvent() { message_type = X11.Atom.None, window = _windows[0].XWindow, display = connection, type = (int)X11.Event.ClientMessage, format = 32 }; Marshal.StructureToPtr(msg, ev, false); X11.Status status = Xlib.XSendEvent(connection, _windows[0].XWindow, true, 0, ev); Services.Logger.LogWindowingSystemEvent("Message to XOrg sent. Status - {0}", status); } finally { Marshal.FreeHGlobal(ev); Xlib.XCloseDisplay(connection); } }