void flush() {
   XToolkit.awtLock();
   try {
     XlibWrapper.XFlush(XToolkit.getDisplay());
   } finally {
     XToolkit.awtUnlock();
   }
 }
 public void xSetVisible(boolean visible) {
   if (log.isLoggable(Level.FINE)) log.fine("Setting visible on " + this + " to " + visible);
   XToolkit.awtLock();
   try {
     this.visible = visible;
     if (visible) {
       XlibWrapper.XMapWindow(XToolkit.getDisplay(), getWindow());
     } else {
       XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), getWindow());
     }
     XlibWrapper.XFlush(XToolkit.getDisplay());
   } finally {
     XToolkit.awtUnlock();
   }
 }
 static void ungrabInput() {
   XToolkit.awtLock();
   try {
     XBaseWindow grabWindow = XAwtState.getGrabWindow();
     if (grabLog.isLoggable(Level.FINE)) {
       grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {String.valueOf(grabWindow)});
     }
     if (grabWindow != null) {
       grabWindow.ungrabInputImpl();
       XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime);
       XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), CurrentTime);
       XAwtState.setGrabWindow(null);
       // we need to call XFlush() here to force ungrab
       // see 6384219 for details
       XlibWrapper.XFlush(XToolkit.getDisplay());
     }
   } finally {
     XToolkit.awtUnlock();
   }
 }