public void keydown(KeyEvent ev) {
   setmods(ev);
   if (keygrab == null) {
     if (!root.keydown(ev)) root.globtype((char) 0, ev);
   } else {
     keygrab.keydown(ev);
   }
 }
 public void type(KeyEvent ev) {
   setmods(ev);
   if (keygrab == null) {
     if (!root.type(ev.getKeyChar(), ev)) root.globtype(ev.getKeyChar(), ev);
   } else {
     keygrab.type(ev.getKeyChar(), ev);
   }
 }
 public void draw(GOut g) {
   afterdraws = new LinkedList<AfterDraw>();
   root.draw(g);
   synchronized (afterdraws) {
     for (AfterDraw ad : afterdraws) {
       ad.draw(g);
     }
   }
   afterdraws = null;
 }
 public void mousewheel(MouseEvent ev, Coord c, int amount) {
   setmods(ev);
   lcc = mc = c;
   if (mousegrab == null) root.mousewheel(c, amount);
   else mousegrab.mousewheel(wdgxlate(c, mousegrab), amount);
 }
 public void mousemove(MouseEvent ev, Coord c) {
   setmods(ev);
   mc = c;
   if (mousegrab == null) root.mousemove(c);
   else mousegrab.mousemove(wdgxlate(c, mousegrab));
 }
 public void mouseup(MouseEvent ev, Coord c, int button) {
   setmods(ev);
   mc = c;
   if (mousegrab == null) root.mouseup(c, button);
   else mousegrab.mouseup(wdgxlate(c, mousegrab), button);
 }
 public void keyup(KeyEvent ev) {
   setmods(ev);
   if (keygrab == null) root.keyup(ev);
   else keygrab.keyup(ev);
 }