From cbc18bf968437ecc276c952c8acc331f45251cba Mon Sep 17 00:00:00 2001 From: BrandonSchaefer Date: Mon, 5 Jan 2015 14:11:11 -0800 Subject: [PATCH] Various Mir fixes. Changed set_type --> set_state. Give more info back when an error happens with a connection/surface. Small var name change size --> mirPixelFormats. Fixes #412. --- src/mir_init.c | 5 ++++- src/mir_window.c | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mir_init.c b/src/mir_init.c index fe02e627..b69eb3f8 100644 --- a/src/mir_init.c +++ b/src/mir_init.c @@ -41,7 +41,10 @@ int _glfwPlatformInit(void) if (!mir_connection_is_valid(_glfw.mir.connection)) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Mir: Unable to connect to Server"); + "Mir: Unable to connect to Server %s", + mir_connection_get_error_message(_glfw.mir.connection)); + + mir_connection_release(_glfw.mir.connection); return GL_FALSE; } diff --git a/src/mir_window.c b/src/mir_window.c index 2024a636..c9812f52 100644 --- a/src/mir_window.c +++ b/src/mir_window.c @@ -90,11 +90,11 @@ static EventNode* dequeueEvent(EventQueue* queue) static MirPixelFormat findValidPixelFormat(void) { - unsigned int i, validFormats, size = 32; - MirPixelFormat formats[size]; + unsigned int i, validFormats, mirPixelFormats = 32; + MirPixelFormat formats[mir_pixel_formats]; mir_connection_get_available_surface_formats(_glfw.mir.connection, formats, - size, &validFormats); + mirPixelFormats, &validFormats); for (i = 0; i < validFormats; i++) { @@ -407,7 +407,10 @@ static int createSurface(_GLFWwindow* window) if (!mir_surface_is_valid(window->mir.surface)) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Mir: Unable to create surface"); + "Mir: Unable to create surface %s", + mir_surface_get_error_message(window->mir.surface)); + + mir_surface_release_sync(window->mir.surface); return GL_FALSE; } @@ -463,7 +466,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, GLFWvidmode mode; _glfwPlatformGetVideoMode(wndconfig->monitor, &mode); - mir_surface_set_type(window->mir.surface, mir_surface_state_fullscreen); + mir_surface_set_state(window->mir.surface, mir_surface_state_fullscreen); if (wndconfig->width > mode.width || wndconfig->height > mode.height) { @@ -539,12 +542,12 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) void _glfwPlatformIconifyWindow(_GLFWwindow* window) { - mir_surface_set_type(window->mir.surface, mir_surface_state_minimized); + mir_surface_set_state(window->mir.surface, mir_surface_state_minimized); } void _glfwPlatformRestoreWindow(_GLFWwindow* window) { - mir_surface_set_type(window->mir.surface, mir_surface_state_restored); + mir_surface_set_state(window->mir.surface, mir_surface_state_restored); } void _glfwPlatformHideWindow(_GLFWwindow* window)