Search notes:

VIM: src/gui_w32

GUI support for Microsoft Windows, aka Win32.
Among others, this file handles Windows messages such as WM_KEYDOWN, WM_SYSKEYDOWN.

gui_mch_init()

gui_mch_init() initializes the GUI for gvim running on Windows.
Among others, it creates (CreateWindowExW) the main window and the text area window.
gui_mch_init is called from gui_start().

gui_mch_wait_for_chars(int wtime)

This function is called by gui_wait_for_chars() and Waits for a character from the keyboard. If wtime is -, it waits until a character is pressed. If wtime is greater than 0, it waits at most wtime milliseconds.
Returns OK if a character was found to be available within the given time (wtime), FAIL otherwise.
If wtime > 0, it uses the WinAPI function SetTimer() to call _OnTimer after wtime milliseconds.
When _OnTimer is triggered, it sets s_wait_timer to TRUE.
gui_wait_for_chars than enters a loop that is exited either when s_wait_timer was set to TRUE or when a character was pressed.
TODO: this is the function that calls MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT).

_WndProc()

_WndProc() is the Window procedure for gvim's main window.
WM_CHAR messages are handled by _OnChar().

process_message()

Handle a single windows message.
If the message is WM_KEYDOWN or WM_SYSKEYDOWN and the virtual keycode is VK_CANCEL (= ESC?), then

_TextAreaWndProc()

The Window procecdure for the text area inside gvim's main window.
Messages that are handled are:
HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_LBUTTONUP,	_OnMouseMoveOrRelease);
HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_MBUTTONUP,	_OnMouseMoveOrRelease);
HANDLE_MSG(hwnd, WM_MOUSEMOVE,	_OnMouseMoveOrRelease);
HANDLE_MSG(hwnd, WM_PAINT,	_OnPaint);
HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_RBUTTONUP,	_OnMouseMoveOrRelease);
HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_XBUTTONUP,	_OnMouseMoveOrRelease);
HANDLE_MSG(hwnd, WM_SIZE,	_OnSizeTextArea);
If feature FEAT_BEVAL_GUI is enabled, it also handles WM_NOTIFY.

_OnChar()

_OnChar handles WM_CHAR messages and is (one of the?) functions that calls add_to_input_buf().

_OnSetFocus

_OnSetFocus is called when a WM_SETFOCU message is received.
_OnSetFocus calls gui_focus_change(TRUE) which in turn uses add_to_input_buf(…)[add_to_input_buf() to insert the triplet CSI, KS_EXTRA, KE_FOCUSGAINED to the input buffer.

_OnTimer

This function basically sets the static variable s_wait_timer to TRUE to indicate to the loop in gui_mch_wait_for_chars() that the duration that that function is supposed to wait for a character has expired.

get_work_area()

get_work_area determines the size of the screen, taking position on multiple monitors into account (if supported).

gui_mch_set_shellsize()

Set the size of the window to the given width and height in pixels.

gui_mch_set_fg_color() / gui_mch_set_bg_color()

Sets foreground and background color.

ex_simalt()

Implementation of the :simalt command by delibarate use of PostMessage(… WM_SYSCOMMAND …).

See also

gui.c

Index