1.1 --- a/src/video/mir/SDL_mirvideo.c Mon Feb 03 11:14:25 2014 -0500
1.2 +++ b/src/video/mir/SDL_mirvideo.c Mon Feb 03 11:52:54 2014 -0500
1.3 @@ -35,6 +35,8 @@
1.4 #include "SDL_mirvideo.h"
1.5 #include "SDL_mirwindow.h"
1.6
1.7 +#include "SDL_mirdyn.h"
1.8 +
1.9 #define MIR_DRIVER_NAME "mir"
1.10
1.11 static int
1.12 @@ -74,13 +76,23 @@
1.13 static int
1.14 MIR_Available()
1.15 {
1.16 - return 1;
1.17 + int available = 0;
1.18 +
1.19 + if (SDL_MIR_LoadSymbols()) {
1.20 + /* !!! FIXME: try to make a MirConnection here. */
1.21 + available = 1;
1.22 + SDL_MIR_UnloadSymbols();
1.23 +
1.24 + }
1.25 +
1.26 + return available;
1.27 }
1.28
1.29 static void
1.30 MIR_DeleteDevice(SDL_VideoDevice* device)
1.31 {
1.32 SDL_free(device);
1.33 + SDL_MIR_UnloadSymbols();
1.34 }
1.35
1.36 void
1.37 @@ -92,16 +104,24 @@
1.38 MIR_CreateDevice(int device_index)
1.39 {
1.40 MIR_Data* mir_data;
1.41 - SDL_VideoDevice* device = SDL_calloc(1, sizeof(SDL_VideoDevice));
1.42 + SDL_VideoDevice* device = NULL;
1.43 +
1.44 + if (!SDL_MIR_LoadSymbols()) {
1.45 + return NULL;
1.46 + }
1.47 +
1.48 + device = SDL_calloc(1, sizeof(SDL_VideoDevice));
1.49 if (!device) {
1.50 + SDL_MIR_UnloadSymbols();
1.51 SDL_OutOfMemory();
1.52 return NULL;
1.53 }
1.54
1.55 mir_data = SDL_calloc(1, sizeof(MIR_Data));
1.56 if (!mir_data) {
1.57 + SDL_free(device);
1.58 + SDL_MIR_UnloadSymbols();
1.59 SDL_OutOfMemory();
1.60 - SDL_free(device);
1.61 return NULL;
1.62 }
1.63
1.64 @@ -225,8 +245,7 @@
1.65 MIR_Data* mir_data = _this->driverdata;
1.66 int d;
1.67
1.68 - MirDisplayConfiguration* display_config =
1.69 - mir_connection_create_display_config(mir_data->connection);
1.70 + MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->connection);
1.71
1.72 for (d = 0; d < display_config->num_outputs; d++) {
1.73 MirDisplayOutput const* out = display_config->outputs + d;
1.74 @@ -246,7 +265,7 @@
1.75 }
1.76 }
1.77
1.78 - mir_display_config_destroy(display_config);
1.79 + MIR_mir_display_config_destroy(display_config);
1.80 }
1.81
1.82 int
1.83 @@ -254,9 +273,9 @@
1.84 {
1.85 MIR_Data* mir_data = _this->driverdata;
1.86
1.87 - mir_data->connection = mir_connect_sync(NULL, __PRETTY_FUNCTION__);
1.88 + mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__);
1.89
1.90 - if (!mir_connection_is_valid(mir_data->connection))
1.91 + if (!MIR_mir_connection_is_valid(mir_data->connection))
1.92 return SDL_SetError("Failed to connect to the Mir Server");
1.93
1.94 MIR_InitDisplays(_this);
1.95 @@ -275,7 +294,7 @@
1.96 MIR_GL_DeleteContext(_this, NULL);
1.97 MIR_GL_UnloadLibrary(_this);
1.98
1.99 - mir_connection_release(mir_data->connection);
1.100 + MIR_mir_connection_release(mir_data->connection);
1.101
1.102 SDL_free(mir_data);
1.103 _this->driverdata = NULL;
1.104 @@ -287,8 +306,7 @@
1.105 MIR_Data* mir_data = _this->driverdata;
1.106 int d;
1.107
1.108 - MirDisplayConfiguration* display_config =
1.109 - mir_connection_create_display_config(mir_data->connection);
1.110 + MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->connection);
1.111
1.112 for (d = 0; d < display_config->num_outputs; d++) {
1.113 MirDisplayOutput const* out = display_config->outputs + d;
1.114 @@ -305,7 +323,7 @@
1.115 }
1.116 }
1.117
1.118 - mir_display_config_destroy(display_config);
1.119 + MIR_mir_display_config_destroy(display_config);
1.120
1.121 return 0;
1.122 }