Merge branch 'master' into jgrpp

# Conflicts:
#	src/debug.cpp
#	src/lang/russian.txt
#	src/misc_gui.cpp
#	src/os/windows/crashlog_win.cpp
#	src/os/windows/font_win32.cpp
#	src/os/windows/win32.cpp
#	src/rail_cmd.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2021-04-11 03:05:08 +01:00
52 changed files with 439 additions and 267 deletions

View File

@@ -1074,6 +1074,9 @@ void OpenGLBackend::DrawMouseCursor()
void OpenGLBackend::PopulateCursorCache()
{
static_assert(lengthof(_cursor.sprite_seq) == lengthof(this->cursor_sprite_seq));
static_assert(lengthof(_cursor.sprite_pos) == lengthof(this->cursor_sprite_pos));
if (this->clear_cursor_cache) {
/* We have a pending cursor cache clear to do first. */
this->clear_cursor_cache = false;

View File

@@ -215,7 +215,7 @@ bool VideoDriver_Win32Base::MakeWindow(bool full_screen, bool resize)
char window_title[64];
seprintf(window_title, lastof(window_title), "OpenTTD %s", _openttd_revision);
this->main_wnd = CreateWindow(L"OTTD", OTTD2FS(window_title), style, x, y, w, h, 0, 0, GetModuleHandle(nullptr), this);
this->main_wnd = CreateWindow(L"OTTD", OTTD2FS(window_title).c_str(), style, x, y, w, h, 0, 0, GetModuleHandle(nullptr), this);
if (this->main_wnd == nullptr) usererror("CreateWindow failed");
ShowWindow(this->main_wnd, showstyle);
}
@@ -332,7 +332,7 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
/* Transmit text to windowing system. */
if (len > 0) {
HandleTextInput(nullptr, true); // Clear marked string.
HandleTextInput(FS2OTTD(str));
HandleTextInput(FS2OTTD(str).c_str());
}
SetCompositionPos(hwnd);
@@ -553,14 +553,6 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
uint scancode = GB(lParam, 16, 8);
keycode = scancode == 41 ? (uint)WKC_BACKQUOTE : MapWindowsKey(wParam);
/* Silently drop all messages handled by WM_CHAR. */
MSG msg;
if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) {
if ((msg.message == WM_CHAR || msg.message == WM_DEADCHAR) && GB(lParam, 16, 8) == GB(msg.lParam, 16, 8)) {
return 0;
}
}
uint charcode = MapVirtualKey(wParam, MAPVK_VK_TO_CHAR);
/* No character translation? */
@@ -569,21 +561,26 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
/* Is the console key a dead key? If yes, ignore the first key down event. */
if (HasBit(charcode, 31) && !console) {
if (scancode == 41) {
console = true;
return 0;
/* If an edit box is in focus, wait for the corresponding WM_CHAR message. */
if (!EditBoxInGlobalFocus()) {
/* Is the console key a dead key? If yes, ignore the first key down event. */
if (HasBit(charcode, 31) && !console) {
if (scancode == 41) {
console = true;
return 0;
}
}
console = false;
/* IMEs and other input methods sometimes send a WM_CHAR without a WM_KEYDOWN,
* clear the keycode so a previous WM_KEYDOWN doesn't become 'stuck'. */
uint cur_keycode = keycode;
keycode = 0;
return HandleCharMsg(cur_keycode, LOWORD(charcode));
}
console = false;
/* IMEs and other input methods sometimes send a WM_CHAR without a WM_KEYDOWN,
* clear the keycode so a previous WM_KEYDOWN doesn't become 'stuck'. */
uint cur_keycode = keycode;
keycode = 0;
return HandleCharMsg(cur_keycode, LOWORD(charcode));
return 0;
}
case WM_SYSKEYDOWN: // user presses F10 or Alt, both activating the title-menu