Wayland: Fix phrasing and type of error messages

This commit is contained in:
Camilla Löwy 2022-03-22 19:30:43 +01:00
parent 4c110bba41
commit 2d45681bc3
2 changed files with 19 additions and 19 deletions

View File

@ -160,8 +160,8 @@ static void setCursor(_GLFWwindow* window, const char* name)
cursor = wl_cursor_theme_get_cursor(theme, name); cursor = wl_cursor_theme_get_cursor(theme, name);
if (!cursor) if (!cursor)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
"Wayland: Standard cursor not found"); "Wayland: Standard cursor shape unavailable");
return; return;
} }
// TODO: handle animated cursors too. // TODO: handle animated cursors too.
@ -1116,7 +1116,7 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform)
if (platformID == GLFW_PLATFORM_WAYLAND) if (platformID == GLFW_PLATFORM_WAYLAND)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libwayland-client"); "Wayland: Failed to load libwayland-client");
} }
return GLFW_FALSE; return GLFW_FALSE;
@ -1221,7 +1221,7 @@ int _glfwInitWayland(void)
if (!_glfw.wl.cursor.handle) if (!_glfw.wl.cursor.handle)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libwayland-cursor"); "Wayland: Failed to load libwayland-cursor");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -1238,7 +1238,7 @@ int _glfwInitWayland(void)
if (!_glfw.wl.egl.handle) if (!_glfw.wl.egl.handle)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libwayland-egl"); "Wayland: Failed to load libwayland-egl");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -1253,7 +1253,7 @@ int _glfwInitWayland(void)
if (!_glfw.wl.xkb.handle) if (!_glfw.wl.xkb.handle)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libxkbcommon"); "Wayland: Failed to load libxkbcommon");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -1345,7 +1345,7 @@ int _glfwInitWayland(void)
if (!_glfw.wl.cursorTheme) if (!_glfw.wl.cursorTheme)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Unable to load default cursor theme"); "Wayland: Failed to load default cursor theme");
return GLFW_FALSE; return GLFW_FALSE;
} }
// If this happens to be NULL, we just fallback to the scale=1 version. // If this happens to be NULL, we just fallback to the scale=1 version.
@ -1368,7 +1368,7 @@ int _glfwInitWayland(void)
if (!_glfw.wl.clipboardString) if (!_glfw.wl.clipboardString)
{ {
_glfwInputError(GLFW_OUT_OF_MEMORY, _glfwInputError(GLFW_OUT_OF_MEMORY,
"Wayland: Unable to allocate clipboard memory"); "Wayland: Failed to allocate clipboard memory");
return GLFW_FALSE; return GLFW_FALSE;
} }
} }

View File

@ -149,7 +149,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
if (fd < 0) if (fd < 0)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Creating a buffer file for %d B failed: %s", "Wayland: Failed to create buffer file of size %d: %s",
length, strerror(errno)); length, strerror(errno));
return NULL; return NULL;
} }
@ -158,7 +158,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
if (data == MAP_FAILED) if (data == MAP_FAILED)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: mmap failed: %s", strerror(errno)); "Wayland: Failed to map file: %s", strerror(errno));
close(fd); close(fd);
return NULL; return NULL;
} }
@ -418,7 +418,7 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable)
_glfw.wl.idleInhibitManager, window->wl.surface); _glfw.wl.idleInhibitManager, window->wl.surface);
if (!window->wl.idleInhibitor) if (!window->wl.idleInhibitor)
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Idle inhibitor creation failed"); "Wayland: Failed to create idle inhibitor");
} }
else if (!enable && window->wl.idleInhibitor) else if (!enable && window->wl.idleInhibitor)
{ {
@ -556,7 +556,7 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
if (!window->wl.xdg.surface) if (!window->wl.xdg.surface)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: xdg-surface creation failed"); "Wayland: Failed to create xdg-surface for window");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -568,7 +568,7 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
if (!window->wl.xdg.toplevel) if (!window->wl.xdg.toplevel)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: xdg-toplevel creation failed"); "Wayland: Failed to create xdg-toplevel for window");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -1378,7 +1378,7 @@ int _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape)
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name); cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
if (!cursor->wl.cursor) if (!cursor->wl.cursor)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
"Wayland: Failed to create standard cursor \"%s\"", "Wayland: Failed to create standard cursor \"%s\"",
name); name);
return GLFW_FALSE; return GLFW_FALSE;
@ -1681,7 +1681,7 @@ void _glfwSetClipboardStringWayland(const char* string)
if (!_glfw.wl.dataSource) if (!_glfw.wl.dataSource)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Impossible to create clipboard source"); "Wayland: Failed to create clipboard data source");
_glfw_free(_glfw.wl.clipboardSendString); _glfw_free(_glfw.wl.clipboardSendString);
_glfw.wl.clipboardSendString = NULL; _glfw.wl.clipboardSendString = NULL;
return; return;
@ -1703,7 +1703,7 @@ static GLFWbool growClipboardString(void)
if (!clipboard) if (!clipboard)
{ {
_glfwInputError(GLFW_OUT_OF_MEMORY, _glfwInputError(GLFW_OUT_OF_MEMORY,
"Wayland: Impossible to grow clipboard string"); "Wayland: Failed to grow clipboard string");
return GLFW_FALSE; return GLFW_FALSE;
} }
_glfw.wl.clipboardString = clipboard; _glfw.wl.clipboardString = clipboard;
@ -1720,7 +1720,7 @@ const char* _glfwGetClipboardStringWayland(void)
if (!_glfw.wl.dataOffer) if (!_glfw.wl.dataOffer)
{ {
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, _glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"No clipboard data has been sent yet"); "Wayland: No clipboard data available");
return NULL; return NULL;
} }
@ -1729,7 +1729,7 @@ const char* _glfwGetClipboardStringWayland(void)
{ {
// TODO: also report errno maybe? // TODO: also report errno maybe?
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Impossible to create clipboard pipe fds"); "Wayland: Failed to create clipboard pipe fds");
return NULL; return NULL;
} }
@ -1762,7 +1762,7 @@ const char* _glfwGetClipboardStringWayland(void)
{ {
// TODO: also report errno maybe. // TODO: also report errno maybe.
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Impossible to read from clipboard fd"); "Wayland: Failed to read from clipboard fd");
close(fds[0]); close(fds[0]);
return NULL; return NULL;
} }