diff options
author | Brad Hughes <bradhugh@outlook.com> | 2016-03-23 12:44:30 -0400 |
---|---|---|
committer | Brad Hughes <bradhugh@outlook.com> | 2016-03-23 12:44:30 -0400 |
commit | d0867ac3f2bdcfd4d1d2361ce8b6408a185908f4 (patch) | |
tree | 34221a4f84675bcbb1b76cafad697103b0173490 /src | |
parent | 0825bf2a2f3eedc7af1709816d0a88aab66845a8 (diff) |
Removing unused functions from winutf8.cpp. Also adding UWP implementations for Set/GetWindowText.
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/windows/winutf8.cpp | 113 | ||||
-rw-r--r-- | src/osd/windows/winutf8.h | 4 |
2 files changed, 10 insertions, 107 deletions
diff --git a/src/osd/windows/winutf8.cpp b/src/osd/windows/winutf8.cpp index 7be40039192..cd34b1d12fe 100644 --- a/src/osd/windows/winutf8.cpp +++ b/src/osd/windows/winutf8.cpp @@ -34,109 +34,6 @@ void win_output_debug_string_utf8(const char *string) //============================================================ -// win_get_module_file_name_utf8 -//============================================================ - -DWORD win_get_module_file_name_utf8(HMODULE module, char *filename, DWORD size) -{ - TCHAR t_filename[MAX_PATH]; - char *utf8_filename; - - if (GetModuleFileName(module, t_filename, ARRAY_LENGTH(t_filename)) == 0) - return 0; - - utf8_filename = utf8_from_tstring(t_filename); - if (!utf8_filename) - return 0; - - size = (DWORD) snprintf(filename, size, "%s", utf8_filename); - osd_free(utf8_filename); - return size; -} - - - -//============================================================ -// win_set_file_attributes_utf8 -//============================================================ - -BOOL win_set_file_attributes_utf8(const char* filename, DWORD fileattributes) -{ - BOOL result = FALSE; - TCHAR* t_filename = tstring_from_utf8(filename); - if( !t_filename ) - return result; - - result = SetFileAttributes(t_filename, fileattributes); - - osd_free(t_filename); - - return result; -} - - - -//============================================================ -// win_copy_file_utf8 -//============================================================ - -BOOL win_copy_file_utf8(const char* existingfilename, const char* newfilename, BOOL failifexists) -{ - TCHAR* t_existingfilename; - TCHAR* t_newfilename; - BOOL result = FALSE; - - t_existingfilename = tstring_from_utf8(existingfilename); - if( !t_existingfilename ) - return result; - - t_newfilename = tstring_from_utf8(newfilename); - if( !t_newfilename ) { - osd_free(t_existingfilename); - return result; - } - - result = CopyFile(t_existingfilename, t_newfilename, failifexists); - - osd_free(t_newfilename); - osd_free(t_existingfilename); - - return result; -} - - - -//============================================================ -// win_move_file_utf8 -//============================================================ - -BOOL win_move_file_utf8(const char* existingfilename, const char* newfilename) -{ - TCHAR* t_existingfilename; - TCHAR* t_newfilename; - BOOL result = FALSE; - - t_existingfilename = tstring_from_utf8(existingfilename); - if( !t_existingfilename ) - return result; - - t_newfilename = tstring_from_utf8(newfilename); - if( !t_newfilename ) { - free(t_existingfilename); - return result; - } - - result = MoveFile(t_existingfilename, t_newfilename); - - osd_free(t_newfilename); - osd_free(t_existingfilename); - - return result; -} - - - -//============================================================ // win_message_box_utf8 //============================================================ @@ -188,7 +85,12 @@ BOOL win_set_window_text_utf8(HWND window, const char *text) goto done; } +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) result = SetWindowText(window, t_text); +#else + Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->Title = ref new Platform::String(t_text); + result = TRUE; +#endif done: if (t_text) @@ -210,8 +112,13 @@ int win_get_window_text_utf8(HWND window, char *buffer, size_t buffer_size) t_buffer[0] = '\0'; +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) // invoke the core Win32 API GetWindowText(window, t_buffer, ARRAY_LENGTH(t_buffer)); +#else + auto title = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->Title; + wcsncpy(t_buffer, title->Data(), ARRAY_LENGTH(t_buffer)); +#endif utf8_buffer = utf8_from_tstring(t_buffer); if (!utf8_buffer) diff --git a/src/osd/windows/winutf8.h b/src/osd/windows/winutf8.h index f109649c70b..6aa72b6a21c 100644 --- a/src/osd/windows/winutf8.h +++ b/src/osd/windows/winutf8.h @@ -13,10 +13,6 @@ // wrappers for kernel32.dll void win_output_debug_string_utf8(const char *string); -DWORD win_get_module_file_name_utf8(HMODULE module, char *filename, DWORD size); -BOOL win_set_file_attributes_utf8(const char* filename, DWORD fileattributes); -BOOL win_copy_file_utf8(const char* existingfilename, const char* newfilename, BOOL failifexists); -BOOL win_move_file_utf8(const char* existingfilename, const char* newfilename); // wrappers for user32.dll int win_message_box_utf8(HWND window, const char *text, const char *caption, UINT type); |