     mainDiv.expandWidth = true
     mainDiv.expandHeight = true
 
+    var lastMouseMouseDown = SDL_Event()
+
     try fn()
 // SDL_StartTextInput()
 // var textRect = SDL_Rect(x: 10, y: 10, w: 100, h: 30)

    }
  }

  // Returns the id that can be used for removing the handler.
  public func on(eventType: SEventType, fn: SEventHandler) -> Int {
    var a = customEvents[eventType]

            }
          case MOUSEBUTTONDOWN:
            p("mouse button down \(ev.button.x) \(ev.button.y) \(ev.button.clicks)")
            lastMouseMouseDown = ev
          case MOUSEBUTTONUP:
            checkForClick(lastMouseMouseDown, mouseUpEv: ev)
            p("mouse button up \(ev.button.x) \(ev.button.y) \(ev.button.clicks)")
            p("mainDiv \(mainDiv.lastx) \(mainDiv.lasty) \(mainDiv.lastSize.width) \(mainDiv.lastSize.height)")
            if let cp = textGrid.pointToCell(ev.button.x, y: ev.button.y) {
