| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | |
| | | #if SDL_VIDEO_DRIVER_MIR |
| | | |
| | | #include "SDL_assert.h" |
| | | #include "SDL_log.h" |
| | | |
| | | #include "SDL_mirwindow.h" |
| | | #include "SDL_video.h" |
| | | |
| | |
| | | #include "SDL_mirmouse.h" |
| | | #include "SDL_miropengl.h" |
| | | #include "SDL_mirvideo.h" |
| | | #include "SDL_mirvulkan.h" |
| | | |
| | | #include "SDL_mirdyn.h" |
| | | |
| | |
| | | int available = 0; |
| | | |
| | | if (SDL_MIR_LoadSymbols()) { |
| | | /* !!! FIXME: try to make a MirConnection here. */ |
| | | |
| | | /* Lets ensure we can connect to the mir server */ |
| | | MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); |
| | | |
| | | if (!MIR_mir_connection_is_valid(connection)) { |
| | | SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s", |
| | | MIR_mir_connection_get_error_message(connection)); |
| | | |
| | | return available; |
| | | } |
| | | |
| | | MIR_mir_connection_release(connection); |
| | | |
| | | available = 1; |
| | | SDL_MIR_UnloadSymbols(); |
| | | } |
| | |
| | | device->GL_GetProcAddress = MIR_GL_GetProcAddress; |
| | | |
| | | /* mirwindow */ |
| | | device->CreateWindow = MIR_CreateWindow; |
| | | device->CreateSDLWindow = MIR_CreateWindow; |
| | | device->DestroyWindow = MIR_DestroyWindow; |
| | | device->GetWindowWMInfo = MIR_GetWindowWMInfo; |
| | | device->SetWindowFullscreen = MIR_SetWindowFullscreen; |
| | |
| | | device->SetWindowGammaRamp = MIR_SetWindowGammaRamp; |
| | | device->GetWindowGammaRamp = MIR_GetWindowGammaRamp; |
| | | |
| | | device->CreateWindowFrom = NULL; |
| | | device->CreateSDLWindowFrom = NULL; |
| | | device->SetWindowIcon = NULL; |
| | | device->RaiseWindow = NULL; |
| | | device->SetWindowBordered = NULL; |
| | |
| | | device->HasClipboardText = NULL; |
| | | |
| | | device->ShowMessageBox = NULL; |
| | | |
| | | #if SDL_VIDEO_VULKAN |
| | | device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary; |
| | | device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary; |
| | | device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions; |
| | | device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface; |
| | | #endif |
| | | |
| | | return device; |
| | | } |
| | |
| | | |
| | | MirPixelFormat format = MIR_mir_output_get_current_pixel_format(output); |
| | | int num_modes = MIR_mir_output_get_num_modes(output); |
| | | SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(mir_output_get_current_mode(output), format); |
| | | SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(MIR_mir_output_get_current_mode(output), format); |
| | | |
| | | SDL_zero(display); |
| | | |
| | |
| | | { |
| | | MIR_Data* mir_data = _this->driverdata; |
| | | |
| | | mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__); |
| | | mir_data->connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); |
| | | mir_data->current_window = NULL; |
| | | mir_data->software = SDL_FALSE; |
| | | mir_data->pixel_format = mir_pixel_format_invalid; |