C client: Fix non-english keyboard input on linux

This commit is contained in:
UnknownShadow200 2018-08-27 01:25:04 +10:00
parent 84be529f9e
commit 24c9bcc447
2 changed files with 8 additions and 8 deletions

View File

@ -494,15 +494,15 @@ void Window_ProcessEvents(void) {
case KeyPress:
{
Window_ToggleKey(&e.xkey, true);
UInt8 data[16]; UInt8 convBuffer[16];
UInt8 data[16];
int status = XLookupString(&e.xkey, data, Array_Elems(data), NULL, NULL);
/* TODO: Is this even right... */
String conv = String_FromEmptyArray(convBuffer);
String_DecodeUtf8(&conv, data, status);
Int32 i;
for (i = 0; i < conv.length; i++) { Event_RaiseInt(&KeyEvents_Press, conv.buffer[i]); }
/* TODO: Does this work for every non-english layout? works for latin keys (e.g. finnish) */
UInt8 raw; Int32 i;
for (i = 0; i < status; i++) {
if (!Convert_TryUnicodeToCP437(data[i], &raw)) continue;
Event_RaiseInt(&KeyEvents_Press, raw);
}
} break;
case KeyRelease:

View File

@ -880,7 +880,7 @@ ReturnCode Http_MakeRequest(struct AsyncRequest* request, void** handle) {
/* https://stackoverflow.com/questions/25308488/c-wininet-custom-http-headers */
if (request->Etag[0] || request->LastModified.Year) {
headers = String_InitAndClearArray(headersBuffer);
if (request->LastModified.Year > 0) {
if (request->LastModified.Year) {
String_AppendConst(&headers, "If-Modified-Since: ");
DateTime_HttpDate(&request->LastModified, &headers);
String_AppendConst(&headers, "\r\n");