diff --git a/src/NixWindow.c b/src/NixWindow.c index e0a57d641..688dd438e 100644 --- a/src/NixWindow.c +++ b/src/NixWindow.c @@ -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: diff --git a/src/Platform.c b/src/Platform.c index bc58d8f45..95a0c8d49 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -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");