- XUnmapWindow(display, window);
-}
-
-void Window::tick()
-{
- while(1)
- {
- int pending=XPending(display);
- if(pending==0)
- break;
-
- for(int i=0; i<pending; ++i)
- {
- XEvent event;
- XNextEvent(display, &event);
- process_event(event);
- }
- }
-}
-
-void Window::prepare()
-{
- if(options.display.empty())
- display=XOpenDisplay(0);
- else
- display=XOpenDisplay(options.display.c_str());
- if(!display)
- throw Exception("Couldn't open X display");
-
- wm_delete_window=XInternAtom(display, "WM_DELETE_WINDOW", true);
-
- /* Throwing from the error handler doesn't work too well and I don't know
- how to dig up all the information that Xlib gives by default, so disable
- custom error handling for now. */
- //XSetErrorHandler(x_error_handler);
-}
-
-void Window::set_window(Handle wnd)
-{
- window=wnd;
-
- XSelectInput(display, window, ButtonPressMask|ButtonReleaseMask|PointerMotionMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask|EnterWindowMask);
-
- XSetWMProtocols(display, window, &wm_delete_window, 1);