From 8e2f4cfb3110ca8840e80f63b98e18d23cf47ff3 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Tue, 31 Jan 2012 12:14:59 +0100 Subject: [PATCH 01/12] add setting an utf8 string to _NET_WM_NAME for x11 --- src/x11_window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/x11_window.c b/src/x11_window.c index 641b3c84..dd387e06 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1512,6 +1512,12 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) // Set window & icon title XStoreName(_glfwLibrary.X11.display, window->X11.handle, title); XSetIconName(_glfwLibrary.X11.display, window->X11.handle, title); + + XChangeProperty(_glfwLibrary.X11.display, window->X11.handle, + XInternAtom(_glfwLibrary.X11.display, "_NET_WM_NAME", False), + XInternAtom(_glfwLibrary.X11.display, "UTF8_STRING", False), + 8, PropModeReplace, (unsigned char *) title, + strlen(title)); } From 1be6f17c668bd48d7d25e60b6606b5693e30c956 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Wed, 1 Feb 2012 00:10:17 +0100 Subject: [PATCH 02/12] add _NET_WM_NAME to the hasEWMGH check --- src/x11_platform.h | 1 + src/x11_window.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/x11_platform.h b/src/x11_platform.h index 46f09f1a..3aef3cbf 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -141,6 +141,7 @@ typedef struct _GLFWwindowX11 Colormap colormap; // Window colormap Window handle; // Window handle Atom wmDeleteWindow; // WM_DELETE_WINDOW atom + Atom wmName; // _NET_WM_NAME atom Atom wmPing; // _NET_WM_PING atom Atom wmState; // _NET_WM_STATE atom Atom wmStateFullscreen; // _NET_WM_STATE_FULLSCREEN atom diff --git a/src/x11_window.c b/src/x11_window.c index dd387e06..5ab1428c 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -195,6 +195,9 @@ static GLboolean hasEWMH(_GLFWwindow* window) window->X11.wmStateFullscreen = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN"); + window->X11.wmName = + getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_NAME"); + window->X11.wmPing = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING"); @@ -1513,11 +1516,14 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) XStoreName(_glfwLibrary.X11.display, window->X11.handle, title); XSetIconName(_glfwLibrary.X11.display, window->X11.handle, title); - XChangeProperty(_glfwLibrary.X11.display, window->X11.handle, - XInternAtom(_glfwLibrary.X11.display, "_NET_WM_NAME", False), + if(window->X11.wmName != None) + { + XChangeProperty(_glfwLibrary.X11.display, window->X11.handle, + window->X11.wmName, XInternAtom(_glfwLibrary.X11.display, "UTF8_STRING", False), 8, PropModeReplace, (unsigned char *) title, strlen(title)); + } } From 87dfde34a9702aa09708478a41c96e9f6e3cbca5 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 1 Feb 2012 14:43:42 +0100 Subject: [PATCH 03/12] Formatting. --- src/x11_window.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index 5ab1428c..d3c950c9 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1515,14 +1515,14 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) // Set window & icon title XStoreName(_glfwLibrary.X11.display, window->X11.handle, title); XSetIconName(_glfwLibrary.X11.display, window->X11.handle, title); - - if(window->X11.wmName != None) + + if (window->X11.wmName != None) { + Atom type = XInternAtom(_glfwLibrary.X11.display, "UTF8_STRING", False); XChangeProperty(_glfwLibrary.X11.display, window->X11.handle, - window->X11.wmName, - XInternAtom(_glfwLibrary.X11.display, "UTF8_STRING", False), - 8, PropModeReplace, (unsigned char *) title, - strlen(title)); + window->X11.wmName, type, 8, + PropModeReplace, + (unsigned char*) title, strlen(title)); } } From 0913b450c04d63b4ae551ca10f2b19234f2e2810 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 1 Feb 2012 14:46:00 +0100 Subject: [PATCH 04/12] Added credit. --- readme.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.html b/readme.html index 4d1f4c72..870a55b6 100644 --- a/readme.html +++ b/readme.html @@ -862,6 +862,8 @@ their skills. Special thanks go out to:

  • Tristam MacDonald, for his bug reports and feedback on the Cocoa port
  • +
  • Hans 'Hanmac' Mackowiak, for adding UTF-8 window title support on X11
  • +
  • David Medlock, for doing the initial Lua port
  • Kenneth Miller, for his many and detailed bug reports on Win32
  • From 4cffa3b185881e162cf1b04a775eefba03a8bf8a Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 2 Feb 2012 16:04:37 +0100 Subject: [PATCH 05/12] Added UTF-8 window title test. --- tests/CMakeLists.txt | 5 +++- tests/title.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 tests/title.c diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5adbf351..d7ac0954 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -51,10 +51,13 @@ target_link_libraries(sharing ${STATIC_DEPS}) add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c) target_link_libraries(tearing ${STATIC_DEPS}) +add_executable(title WIN32 MACOSX_BUNDLE title.c) +target_link_libraries(title ${STATIC_DEPS}) + add_executable(windows WIN32 MACOSX_BUNDLE windows.c) target_link_libraries(windows ${STATIC_DEPS}) -set(WINDOWS_BINARIES accuracy sharing tearing windows) +set(WINDOWS_BINARIES accuracy sharing tearing title windows) set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify joysticks listmodes peter reopen) diff --git a/tests/title.c b/tests/title.c new file mode 100644 index 00000000..7b342d94 --- /dev/null +++ b/tests/title.c @@ -0,0 +1,70 @@ +//======================================================================== +// UTF-8 window title test +// Copyright (c) Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== +// +// This test sets a UTF-8 window title +// +//======================================================================== + +#include + +#include +#include + +static void window_size_callback(GLFWwindow window, int width, int height) +{ + glViewport(0, 0, width, height); +} + +int main(void) +{ + GLFWwindow window; + + if (!glfwInit()) + { + fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError())); + exit(EXIT_FAILURE); + } + + window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "English 日本語 русский язык 官話", NULL); + if (!window) + { + fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError())); + exit(EXIT_FAILURE); + } + + glfwSwapInterval(1); + + glfwSetWindowSizeCallback(window_size_callback); + + while (glfwIsWindow(window) == GL_TRUE) + { + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(); + glfwWaitEvents(); + } + + exit(EXIT_SUCCESS); +} + From 797e93631163a895459fbc3a86243c639f082c76 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 2 Feb 2012 17:01:11 +0100 Subject: [PATCH 06/12] Replaced XStoreName and XSetIconName with X*SetWMProperties. --- src/x11_window.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index d3c950c9..606512b9 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1512,9 +1512,21 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window) void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { - // Set window & icon title - XStoreName(_glfwLibrary.X11.display, window->X11.handle, title); - XSetIconName(_glfwLibrary.X11.display, window->X11.handle, title); +#if defined(X_HAVE_UTF8_STRING) + Xutf8SetWMProperties(_glfwLibrary.X11.display, + window->X11.handle, + title, title, + NULL, 0, + NULL, NULL, NULL); +#else + // This may be a slightly better fallback than using XStoreName and + // XSetIconName, which always store their arguments using STRING + XmbSetWMProperties(_glfwLibrary.X11.display, + window->X11.handle, + title, title, + NULL, 0, + NULL, NULL, NULL); +#endif if (window->X11.wmName != None) { From 06074bc6988295ae427bb5266d4e3e529af5f33d Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 2 Feb 2012 17:20:14 +0100 Subject: [PATCH 07/12] Added support for _NET_WM_ICON_NAME. --- src/x11_platform.h | 1 + src/x11_window.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/x11_platform.h b/src/x11_platform.h index 3aef3cbf..e837b2f1 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -142,6 +142,7 @@ typedef struct _GLFWwindowX11 Window handle; // Window handle Atom wmDeleteWindow; // WM_DELETE_WINDOW atom Atom wmName; // _NET_WM_NAME atom + Atom wmIconName; // _NET_WM_ICON_NAME atom Atom wmPing; // _NET_WM_PING atom Atom wmState; // _NET_WM_STATE atom Atom wmStateFullscreen; // _NET_WM_STATE_FULLSCREEN atom diff --git a/src/x11_window.c b/src/x11_window.c index 606512b9..7ad34d05 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -198,6 +198,9 @@ static GLboolean hasEWMH(_GLFWwindow* window) window->X11.wmName = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_NAME"); + window->X11.wmIconName = + getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_ICON_NAME"); + window->X11.wmPing = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING"); @@ -1512,6 +1515,8 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window) void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { + Atom type = XInternAtom(_glfwLibrary.X11.display, "UTF8_STRING", False); + #if defined(X_HAVE_UTF8_STRING) Xutf8SetWMProperties(_glfwLibrary.X11.display, window->X11.handle, @@ -1530,12 +1535,19 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) if (window->X11.wmName != None) { - Atom type = XInternAtom(_glfwLibrary.X11.display, "UTF8_STRING", False); XChangeProperty(_glfwLibrary.X11.display, window->X11.handle, window->X11.wmName, type, 8, PropModeReplace, (unsigned char*) title, strlen(title)); } + + if (window->X11.wmIconName != None) + { + XChangeProperty(_glfwLibrary.X11.display, window->X11.handle, + window->X11.wmIconName, type, 8, + PropModeReplace, + (unsigned char*) title, strlen(title)); + } } From 70bfdfb22e410c3a92715004503a7f6ca36fad57 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 2 Feb 2012 17:33:08 +0100 Subject: [PATCH 08/12] Updated change log. --- readme.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.html b/readme.html index 870a55b6..f0a89585 100644 --- a/readme.html +++ b/readme.html @@ -315,6 +315,8 @@ version of GLFW.

  • [X11] Added support for the GLX_EXT_swap_control extension as an alternative to GLX_SGI_swap_control
  • [X11] Added the POSIX CLOCK_MONOTONIC time source as the preferred method
  • [X11] Added dependency on libm, where present
  • +
  • [X11] Added support for the _NET_WM_NAME and _NET_WM_ICON_NAME EWMH window properties
  • +
  • [X11] Bugfix: Some window properties required by the ICCCM were not set
  • [X11] Bugfix: Calling glXCreateContextAttribsARB with an unavailable OpenGL version caused the application to terminate with a BadMatch Xlib error
  • [X11] Bugfix: A synchronization point necessary for jitter-free locked cursor mode was incorrectly removed
  • [Win32] Removed explicit support for versions of Windows older than Windows XP
  • From 9c0c2c6b08f83d2cf7b61fc833a16c5f99ef6650 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 3 Feb 2012 20:34:24 +0100 Subject: [PATCH 09/12] Upgraded Win32 port to Unicode mode. --- readme.html | 1 + src/win32_init.c | 10 ++++---- src/win32_platform.h | 12 ++++++---- src/win32_window.c | 54 ++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 63 insertions(+), 14 deletions(-) diff --git a/readme.html b/readme.html index f0a89585..b007952d 100644 --- a/readme.html +++ b/readme.html @@ -319,6 +319,7 @@ version of GLFW.

  • [X11] Bugfix: Some window properties required by the ICCCM were not set
  • [X11] Bugfix: Calling glXCreateContextAttribsARB with an unavailable OpenGL version caused the application to terminate with a BadMatch Xlib error
  • [X11] Bugfix: A synchronization point necessary for jitter-free locked cursor mode was incorrectly removed
  • +
  • [Win32] Changed port to use Unicode mode only
  • [Win32] Removed explicit support for versions of Windows older than Windows XP
  • [Win32] Bugfix: Window activation and iconification did not work as expected
  • [Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path
  • diff --git a/src/win32_init.c b/src/win32_init.c index 0756b0f2..b23e7d57 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -47,7 +47,7 @@ static GLboolean initLibraries(void) #ifndef _GLFW_NO_DLOAD_GDI32 // gdi32.dll (OpenGL pixel format functions & SwapBuffers) - _glfwLibrary.Win32.gdi.instance = LoadLibrary("gdi32.dll"); + _glfwLibrary.Win32.gdi.instance = LoadLibrary(L"gdi32.dll"); if (!_glfwLibrary.Win32.gdi.instance) return GL_FALSE; @@ -81,12 +81,12 @@ static GLboolean initLibraries(void) #ifndef _GLFW_NO_DLOAD_WINMM // winmm.dll (for joystick and timer support) - _glfwLibrary.Win32.winmm.instance = LoadLibrary("winmm.dll"); + _glfwLibrary.Win32.winmm.instance = LoadLibrary(L"winmm.dll"); if (!_glfwLibrary.Win32.winmm.instance) return GL_FALSE; - _glfwLibrary.Win32.winmm.joyGetDevCapsA = (JOYGETDEVCAPSA_T) - GetProcAddress(_glfwLibrary.Win32.winmm.instance, "joyGetDevCapsA"); + _glfwLibrary.Win32.winmm.joyGetDevCaps = (JOYGETDEVCAPS_T) + GetProcAddress(_glfwLibrary.Win32.winmm.instance, "joyGetDevCapsW"); _glfwLibrary.Win32.winmm.joyGetPos = (JOYGETPOS_T) GetProcAddress(_glfwLibrary.Win32.winmm.instance, "joyGetPos"); _glfwLibrary.Win32.winmm.joyGetPosEx = (JOYGETPOSEX_T) @@ -94,7 +94,7 @@ static GLboolean initLibraries(void) _glfwLibrary.Win32.winmm.timeGetTime = (TIMEGETTIME_T) GetProcAddress(_glfwLibrary.Win32.winmm.instance, "timeGetTime"); - if (!_glfwLibrary.Win32.winmm.joyGetDevCapsA || + if (!_glfwLibrary.Win32.winmm.joyGetDevCaps || !_glfwLibrary.Win32.winmm.joyGetPos || !_glfwLibrary.Win32.winmm.joyGetPosEx || !_glfwLibrary.Win32.winmm.timeGetTime) diff --git a/src/win32_platform.h b/src/win32_platform.h index 074e28ba..0d63e09c 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -45,6 +45,8 @@ // thinks it is the only one that gets to do so #undef APIENTRY +#define UNICODE + #include #include @@ -162,7 +164,7 @@ typedef BOOL (WINAPI * SETDEVICEGAMMARAMP_T) (HDC,PVOID); // winmm.dll function pointer typedefs #ifndef _GLFW_NO_DLOAD_WINMM -typedef MMRESULT (WINAPI * JOYGETDEVCAPSA_T) (UINT,LPJOYCAPSA,UINT); +typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T) (UINT,LPJOYCAPS,UINT); typedef MMRESULT (WINAPI * JOYGETPOS_T) (UINT,LPJOYINFO); typedef MMRESULT (WINAPI * JOYGETPOSEX_T) (UINT,LPJOYINFOEX); typedef DWORD (WINAPI * TIMEGETTIME_T) (void); @@ -190,12 +192,12 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void); // winmm.dll shortcuts #ifndef _GLFW_NO_DLOAD_WINMM -#define _glfw_joyGetDevCaps _glfwLibrary.Win32.winmm.joyGetDevCapsA +#define _glfw_joyGetDevCaps _glfwLibrary.Win32.winmm.joyGetDevCaps #define _glfw_joyGetPos _glfwLibrary.Win32.winmm.joyGetPos #define _glfw_joyGetPosEx _glfwLibrary.Win32.winmm.joyGetPosEx #define _glfw_timeGetTime _glfwLibrary.Win32.winmm.timeGetTime #else -#define _glfw_joyGetDevCaps joyGetDevCapsA +#define _glfw_joyGetDevCaps joyGetDevCaps #define _glfw_joyGetPos joyGetPos #define _glfw_joyGetPosEx joyGetPosEx #define _glfw_timeGetTime timeGetTime @@ -204,7 +206,7 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void); // We use versioned window class names in order not to cause conflicts // between applications using different versions of GLFW -#define _GLFW_WNDCLASSNAME "GLFW30" +#define _GLFW_WNDCLASSNAME L"GLFW30" #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 Win32 @@ -309,7 +311,7 @@ typedef struct _GLFWlibraryWin32 // winmm.dll struct { HINSTANCE instance; - JOYGETDEVCAPSA_T joyGetDevCapsA; + JOYGETDEVCAPS_T joyGetDevCaps; JOYGETPOS_T joyGetPos; JOYGETPOSEX_T joyGetPosEx; TIMEGETTIME_T timeGetTime; diff --git a/src/win32_window.c b/src/win32_window.c index e2619acf..6ebe07b4 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -34,6 +34,31 @@ #include +//======================================================================== +// Convert the specified UTF-8 string to a wide string +//======================================================================== + +static WCHAR* createWideStringFromUTF8(const char* source) +{ + WCHAR* target; + int length; + + length = MultiByteToWideChar(CP_UTF8, 0, source, -1, NULL, 0); + if (!length) + return NULL; + + target = (WCHAR*) _glfwMalloc(sizeof(WCHAR) * (length + 1)); + + if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length + 1)) + { + _glfwFree(target); + return NULL; + } + + return target; +} + + //======================================================================== // Convert BPP to RGB bits based on "best guess" //======================================================================== @@ -1220,7 +1245,7 @@ static ATOM registerWindowClass(void) wc.lpszClassName = _GLFW_WNDCLASSNAME; // Set class name // Load user-provided icon if available - wc.hIcon = LoadIcon(_glfwLibrary.Win32.instance, "GLFW_ICON"); + wc.hIcon = LoadIcon(_glfwLibrary.Win32.instance, L"GLFW_ICON"); if (!wc.hIcon) { // Load default icon @@ -1280,9 +1305,10 @@ static int createWindow(_GLFWwindow* window, const _GLFWfbconfig* fbconfig) { DWORD dwStyle, dwExStyle; - int pixelFormat, fullWidth, fullHeight; + int length, pixelFormat, fullWidth, fullHeight; RECT wa; POINT pos; + WCHAR* wideTitle; // Set common window styles dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE; @@ -1331,9 +1357,17 @@ static int createWindow(_GLFWwindow* window, else SystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0); + wideTitle = createWideStringFromUTF8(wndconfig->title); + if (!wideTitle) + { + _glfwSetError(GLFW_PLATFORM_ERROR, + "glfwOpenWindow: Failed to convert title to wide string"); + return; + } + window->Win32.handle = CreateWindowEx(window->Win32.dwExStyle, _GLFW_WNDCLASSNAME, - wndconfig->title, + wideTitle, window->Win32.dwStyle, wa.left, wa.top, // Window position fullWidth, // Decorated window width @@ -1349,6 +1383,8 @@ static int createWindow(_GLFWwindow* window, return GL_FALSE; } + _glfwFree(wideTitle); + window->WGL.DC = GetDC(window->Win32.handle); if (!window->WGL.DC) { @@ -1568,7 +1604,17 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window) void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { - SetWindowText(window->Win32.handle, title); + WCHAR* wideTitle = createWideStringFromUTF8(title); + if (!wideTitle) + { + _glfwSetError(GLFW_PLATFORM_ERROR, + "glfwSetWindowTitle: Failed to convert title to wide string"); + return; + } + + SetWindowText(window->Win32.handle, wideTitle); + + _glfwFree(wideTitle); } From ee4f2386e79af3d0442d35e2d5aa04cc1e7e4942 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sat, 4 Feb 2012 02:13:44 +0100 Subject: [PATCH 10/12] Updated to new API. --- tests/title.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/title.c b/tests/title.c index 7b342d94..35344a04 100644 --- a/tests/title.c +++ b/tests/title.c @@ -41,7 +41,7 @@ int main(void) { GLFWwindow window; - if (!glfwInit()) + if (!glfwInit(NULL)) { fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError())); exit(EXIT_FAILURE); From e937c86893fbf9b0a37a90ac0549124296c15e05 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sat, 4 Feb 2012 02:15:17 +0100 Subject: [PATCH 11/12] Added UTF-8 window title support for Cocooa. --- src/cocoa_window.m | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 3e94f541..264ba6ef 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -476,9 +476,7 @@ static GLboolean createWindow(_GLFWwindow* window, return GL_FALSE; } - [window->NS.window setTitle:[NSString stringWithCString:wndconfig->title - encoding:NSISOLatin1StringEncoding]]; - + [window->NS.window setTitle:[NSString stringWithUTF8String:wndconfig->title]]; [window->NS.window setContentView:[[GLFWContentView alloc] initWithGlfwWindow:window]]; [window->NS.window setDelegate:window->NS.delegate]; @@ -779,8 +777,7 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window) void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title) { - [window->NS.window setTitle:[NSString stringWithCString:title - encoding:NSISOLatin1StringEncoding]]; + [window->NS.window setTitle:[NSString stringWithUTF8String:title]]; } //======================================================================== From afcc5f9e1d17827e7924dc6cf83e8d6e0147adbf Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sat, 4 Feb 2012 02:16:45 +0100 Subject: [PATCH 12/12] UTF-8 window title all done. --- readme.html | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.html b/readme.html index 6879be35..e342a91d 100644 --- a/readme.html +++ b/readme.html @@ -285,6 +285,7 @@ version of GLFW.

  • Added initial window title parameter to glfwOpenWindow
  • Added glfwSetGamma, glfwSetGammaRamp and glfwGetGammaRamp functions and GLFWgammaramp type for monitor gamma ramp control
  • Changed buffer bit depth parameters of glfwOpenWindow to window hints
  • +
  • Changed glfwOpenWindow and glfwSetWindowTitle to use UTF-8 encoded strings
  • Renamed glfw.h to glfw3.h to avoid conflicts with 2.x series
  • Renamed GLFW_WINDOW token to GLFW_WINDOWED
  • Renamed GLFW_WINDOW_NO_RESIZE to GLFW_WINDOW_RESIZABLE