changeset 20693:2b19f1e6c882 draft

-Codechange: Pass proper Unicode UCS-4 characters instead of just UCS-2 to the window key press handlers.
author Michael Lutz <michi@icosahedron.de>
date Sat, 23 Mar 2013 23:37:24 +0100
parents ae27ee8c7eed
children d12783a922d3
files src/bridge_gui.cpp src/console_gui.cpp src/error_gui.cpp src/fios_gui.cpp src/highscore_gui.cpp src/misc_gui.cpp src/network/network_chat_gui.cpp src/network/network_content_gui.cpp src/network/network_gui.cpp src/newgrf_gui.cpp src/news_gui.cpp src/window_gui.h
diffstat 12 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -241,7 +241,7 @@
 		}
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		const uint8 i = keycode - '1';
 		if (i < 9 && i < this->bridges->Length()) {
--- a/src/console_gui.cpp
+++ b/src/console_gui.cpp
@@ -236,7 +236,7 @@
 		if (_iconsole_cmdline.HandleCaret()) this->SetDirty();
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		if (_focused_window != this) return ES_NOT_HANDLED;
 
--- a/src/error_gui.cpp
+++ b/src/error_gui.cpp
@@ -300,7 +300,7 @@
 		if (_window_system_initialized) ShowFirstError();
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		if (keycode != WKC_SPACE) return ES_NOT_HANDLED;
 		delete this;
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -618,7 +618,7 @@
 		}
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		if (keycode == WKC_ESC) {
 			delete this;
--- a/src/highscore_gui.cpp
+++ b/src/highscore_gui.cpp
@@ -63,7 +63,7 @@
 		delete this;
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		/* All keys are 'handled' by this window but we want to make
 		 * sure that 'quit' still works correctly. Not handling the
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1027,7 +1027,7 @@
 		}
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		/* ESC closes the window, Enter confirms the action */
 		switch (keycode) {
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -491,7 +491,7 @@
 		}
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		EventState state = ES_NOT_HANDLED;
 		if (keycode == WKC_TAB) {
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -800,7 +800,7 @@
 		}
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		switch (keycode) {
 			case WKC_UP:
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -799,7 +799,7 @@
 		this->SetDirty();
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		EventState state = ES_NOT_HANDLED;
 
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -1235,7 +1235,7 @@
 		this->SetWidgetDisabledState(WID_NS_PRESET_SAVE, has_missing);
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		if (!this->editable) return ES_NOT_HANDLED;
 
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -449,7 +449,7 @@
 		}
 	}
 
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+	virtual EventState OnKeyPress(WChar key, uint16 keycode)
 	{
 		if (keycode == WKC_SPACE) {
 			/* Don't continue. */
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -19,6 +19,7 @@
 #include "widget_type.h"
 #include "core/smallvec_type.hpp"
 #include "core/smallmap_type.hpp"
+#include "string_type.h"
 
 /**
  * Flags to describe the look of the frame
@@ -593,7 +594,7 @@
 	 * @return #ES_HANDLED if the key press has been handled and no other
 	 *         window should receive the event.
 	 */
-	virtual EventState OnKeyPress(uint16 key, uint16 keycode) { return ES_NOT_HANDLED; }
+	virtual EventState OnKeyPress(WChar key, uint16 keycode) { return ES_NOT_HANDLED; }
 
 	virtual EventState OnHotkey(int hotkey);