MIR: Add better error handling for a failed connection
authorBrandon Schaefer <brandon.schaefer@canonical.com>
Wed, 08 Jun 2016 08:01:21 -0700
changeset 10181b82c0f22d22a
parent 10180 7356b2938fba
child 10182 4980c48b8dbe
MIR: Add better error handling for a failed connection
src/video/mir/SDL_mirsym.h
src/video/mir/SDL_mirvideo.c
src/video/mir/SDL_mirwindow.c
     1.1 --- a/src/video/mir/SDL_mirsym.h	Tue Jun 07 09:01:23 2016 -0700
     1.2 +++ b/src/video/mir/SDL_mirsym.h	Wed Jun 08 08:01:21 2016 -0700
     1.3 @@ -56,7 +56,7 @@
     1.4  SDL_MIR_SYM(void,mir_surface_apply_spec,(MirSurface *surface, MirSurfaceSpec *spec))
     1.5  SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *params))
     1.6  SDL_MIR_SYM(MirBufferStream*,mir_surface_get_buffer_stream,(MirSurface *surface))
     1.7 -SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream* stream, int hot_x, int hot_y))
     1.8 +SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y))
     1.9  SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage))
    1.10  SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event))
    1.11  SDL_MIR_SYM(xkb_keysym_t,mir_keyboard_event_key_code,(MirKeyboardEvent const *event))
    1.12 @@ -94,6 +94,7 @@
    1.13  SDL_MIR_SYM(void,mir_wait_for,(MirWaitHandle* handle))
    1.14  SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event))
    1.15  SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event))
    1.16 +SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection))
    1.17  
    1.18  SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name)
    1.19  SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name)
     2.1 --- a/src/video/mir/SDL_mirvideo.c	Tue Jun 07 09:01:23 2016 -0700
     2.2 +++ b/src/video/mir/SDL_mirvideo.c	Wed Jun 08 08:01:21 2016 -0700
     2.3 @@ -277,8 +277,10 @@
     2.4      mir_data->software       = SDL_FALSE;
     2.5      mir_data->pixel_format   = mir_pixel_format_invalid;
     2.6  
     2.7 -    if (!MIR_mir_connection_is_valid(mir_data->connection))
     2.8 -        return SDL_SetError("Failed to connect to the Mir Server");
     2.9 +    if (!MIR_mir_connection_is_valid(mir_data->connection)) {
    2.10 +        return SDL_SetError("Failed to connect to the mir server: %s",
    2.11 +            MIR_mir_connection_get_error_message(mir_data->connection));
    2.12 +    }
    2.13  
    2.14      MIR_InitDisplays(_this);
    2.15      MIR_InitMouse();
     3.1 --- a/src/video/mir/SDL_mirwindow.c	Tue Jun 07 09:01:23 2016 -0700
     3.2 +++ b/src/video/mir/SDL_mirwindow.c	Wed Jun 08 08:01:21 2016 -0700
     3.3 @@ -130,8 +130,8 @@
     3.4      MIR_mir_surface_spec_release(spec);
     3.5  
     3.6      if (!MIR_mir_surface_is_valid(mir_window->surface)) {
     3.7 -        const char* error = MIR_mir_surface_get_error_message(mir_window->surface);
     3.8 -        return SDL_SetError("Failed to created a mir surface: %s", error);
     3.9 +        return SDL_SetError("Failed to created a mir surface: %s",
    3.10 +            MIR_mir_surface_get_error_message(mir_window->surface));
    3.11      }
    3.12  
    3.13      if (window->flags & SDL_WINDOW_OPENGL) {