     while !done {
       while SDL_PollEvent(&ev) != 0 {
         invalidated = true
-        if ev.type == SDL.TEXTINPUT {
+        if ev.type == SDL.WINDOWEVENT {
+          p("window event \(ev.window.event)")
+        } else if ev.type == SDL.TEXTINPUT {
           p("text input \(ev.text)")
         } else if ev.type == SDL.QUIT {
           done = true

  public let TEXTINPUT: UInt32    = 771

  public let WINDOWEVENT_CLOSE: UInt8 = 214

  public let WINDOW_RESIZABLE: UInt32 = 32


    }
  }

  var errorMessage: String {
    if let s = String.fromCString(SDL_GetError()) {
      return s
    } else {
