'Initialize an event from the Windows input structure.'

def __init__(self, console, input):

    self.type = '??'
    self.serial = console.next_serial()
    self.width = 0
    self.height = 0
    self.x = 0
    self.y = 0
    self.char = ''
    self.keycode = 0
    self.keysym = '??'
    self.keyinfo = None
    self.width = None
    if (input.EventType == KEY_EVENT):
        if input.Event.KeyEvent.bKeyDown:
            self.type = 'KeyPress'
        else:
            self.type = 'KeyRelease'
        self.char = input.Event.KeyEvent.uChar.AsciiChar
        self.keycode = input.Event.KeyEvent.wVirtualKeyCode
        self.state = input.Event.KeyEvent.dwControlKeyState
        self.keyinfo = make_KeyPress(self.char, self.state, self.keycode)
    elif (input.EventType == MOUSE_EVENT):
        if (input.Event.MouseEvent.dwEventFlags & MOUSE_MOVED):
            self.type = 'Motion'
        else:
            self.type = 'Button'
        self.x = input.Event.MouseEvent.dwMousePosition.X
        self.y = input.Event.MouseEvent.dwMousePosition.Y
        self.state = input.Event.MouseEvent.dwButtonState
    elif (input.EventType == WINDOW_BUFFER_SIZE_EVENT):
        self.type = 'Configure'
        self.width = input.Event.WindowBufferSizeEvent.dwSize.X
        self.height = input.Event.WindowBufferSizeEvent.dwSize.Y
    elif (input.EventType == FOCUS_EVENT):
        if input.Event.FocusEvent.bSetFocus:
            self.type = 'FocusIn'
        else:
            self.type = 'FocusOut'
    elif (input.EventType == MENU_EVENT):
        self.type = 'Menu'
        self.state = input.Event.MenuEvent.dwCommandId
