From 4a339a46ec264632c3734d7c7eb7727ac6a0f944 Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 8 Jun 2016 08:01:21 -0700 Subject: [PATCH] MIR: Add better error handling for a failed connection --- src/video/mir/SDL_mirsym.h | 3 ++- src/video/mir/SDL_mirvideo.c | 6 ++++-- src/video/mir/SDL_mirwindow.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/video/mir/SDL_mirsym.h b/src/video/mir/SDL_mirsym.h index 36112c166c70c..0353aa89fa5bd 100644 --- a/src/video/mir/SDL_mirsym.h +++ b/src/video/mir/SDL_mirsym.h @@ -56,7 +56,7 @@ SDL_MIR_SYM(void,mir_surface_spec_set_state,(MirSurfaceSpec *spec, MirSurfaceSta SDL_MIR_SYM(void,mir_surface_apply_spec,(MirSurface *surface, MirSurfaceSpec *spec)) SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *params)) SDL_MIR_SYM(MirBufferStream*,mir_surface_get_buffer_stream,(MirSurface *surface)) -SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream* stream, int hot_x, int hot_y)) +SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y)) SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage)) SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event)) SDL_MIR_SYM(xkb_keysym_t,mir_keyboard_event_key_code,(MirKeyboardEvent const *event)) @@ -94,6 +94,7 @@ SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf) SDL_MIR_SYM(void,mir_wait_for,(MirWaitHandle* handle)) SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event)) SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event)) +SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection)) SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name) SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name) diff --git a/src/video/mir/SDL_mirvideo.c b/src/video/mir/SDL_mirvideo.c index 7b7196f385ea9..d225a6fd00ca1 100644 --- a/src/video/mir/SDL_mirvideo.c +++ b/src/video/mir/SDL_mirvideo.c @@ -277,8 +277,10 @@ MIR_VideoInit(_THIS) mir_data->software = SDL_FALSE; mir_data->pixel_format = mir_pixel_format_invalid; - if (!MIR_mir_connection_is_valid(mir_data->connection)) - return SDL_SetError("Failed to connect to the Mir Server"); + if (!MIR_mir_connection_is_valid(mir_data->connection)) { + return SDL_SetError("Failed to connect to the mir server: %s", + MIR_mir_connection_get_error_message(mir_data->connection)); + } MIR_InitDisplays(_this); MIR_InitMouse(); diff --git a/src/video/mir/SDL_mirwindow.c b/src/video/mir/SDL_mirwindow.c index 2d6f4a5116841..f91a568eda6f9 100644 --- a/src/video/mir/SDL_mirwindow.c +++ b/src/video/mir/SDL_mirwindow.c @@ -130,8 +130,8 @@ MIR_CreateWindow(_THIS, SDL_Window* window) MIR_mir_surface_spec_release(spec); if (!MIR_mir_surface_is_valid(mir_window->surface)) { - const char* error = MIR_mir_surface_get_error_message(mir_window->surface); - return SDL_SetError("Failed to created a mir surface: %s", error); + return SDL_SetError("Failed to created a mir surface: %s", + MIR_mir_surface_get_error_message(mir_window->surface)); } if (window->flags & SDL_WINDOW_OPENGL) {