26 #include "../../SDL_internal.h" 28 #if SDL_VIDEO_DRIVER_MIR 40 #define MIR_DRIVER_NAME "mir" 103 MIR_CreateDevice(
int device_index)
135 device->
free = MIR_DeleteDevice;
205 MIR_DRIVER_NAME,
"SDL Mir video driver",
206 MIR_Available, MIR_CreateDevice
210 MIR_SetCurrentDisplayMode(MirDisplayOutput
const* out,
SDL_VideoDisplay* display)
214 .w = out->modes[out->current_mode].horizontal_resolution,
215 .h = out->modes[out->current_mode].vertical_resolution,
216 .refresh_rate = out->modes[out->current_mode].refresh_rate,
225 MIR_AddAllModesFromDisplay(MirDisplayOutput
const* out,
SDL_VideoDisplay* display)
228 for (n_mode = 0; n_mode < out->num_modes; ++n_mode) {
231 .w = out->modes[n_mode].horizontal_resolution,
232 .h = out->modes[n_mode].vertical_resolution,
233 .refresh_rate = out->modes[n_mode].refresh_rate,
242 MIR_InitDisplays(
_THIS)
247 MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->
connection);
249 for (d = 0; d < display_config->num_outputs; d++) {
250 MirDisplayOutput
const* out = display_config->outputs +
d;
258 out->current_mode < out->num_modes) {
260 MIR_SetCurrentDisplayMode(out, &display);
261 MIR_AddAllModesFromDisplay(out, &display);
267 MIR_mir_display_config_destroy(display_config);
275 mir_data->
connection = MIR_mir_connect_sync(
NULL, __PRETTY_FUNCTION__);
280 if (!MIR_mir_connection_is_valid(mir_data->
connection))
281 return SDL_SetError(
"Failed to connect to the Mir Server");
283 MIR_InitDisplays(
_this);
299 MIR_mir_connection_release(mir_data->
connection);
311 MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->
connection);
313 for (d = 0; d < display_config->num_outputs; d++) {
314 MirDisplayOutput
const* out = display_config->outputs +
d;
319 out->current_mode < out->num_modes) {
321 rect->
x = out->position_x;
322 rect->
y = out->position_y;
323 rect->
w = out->modes->horizontal_resolution;
324 rect->
h = out->modes->vertical_resolution;
328 MIR_mir_display_config_destroy(display_config);
#define MIR_GL_GetSwapInterval
void(* RestoreWindow)(_THIS, SDL_Window *window)
void MIR_MinimizeWindow(_THIS, SDL_Window *window)
void MIR_HideWindow(_THIS, SDL_Window *window)
int MIR_CreateWindowFramebuffer(_THIS, SDL_Window *sdl_window, Uint32 *format, void **pixels, int *pitch)
void MIR_GL_UnloadLibrary(_THIS)
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
int MIR_CreateWindow(_THIS, SDL_Window *window)
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
MirPixelFormat pixel_format
A collection of pixels used in software blitting.
int(* GL_SetSwapInterval)(_THIS, int interval)
void(* ShowWindow)(_THIS, SDL_Window *window)
The structure that defines a display mode.
void(* StartTextInput)(_THIS)
void(* SetWindowSize)(_THIS, SDL_Window *window)
void MIR_DestroyWindow(_THIS, SDL_Window *window)
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
int(* GL_LoadLibrary)(_THIS, const char *path)
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
#define MIR_GL_SetSwapInterval
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
static SDL_VideoDevice * _this
void SDL_MIR_UnloadSymbols(void)
void(* HideWindow)(_THIS, SDL_Window *window)
MirConnection * connection
void(* RaiseWindow)(_THIS, SDL_Window *window)
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
void * SDL_calloc(size_t nmemb, size_t size)
MIR_Window * current_window
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
SDL_GLContext MIR_GL_CreateContext(_THIS, SDL_Window *window)
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
void MIR_RestoreWindow(_THIS, SDL_Window *window)
void MIR_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
void MIR_MaximizeWindow(_THIS, SDL_Window *window)
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
SDL_DisplayMode current_mode
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
void(* DestroyWindow)(_THIS, SDL_Window *window)
void(* StopTextInput)(_THIS)
int MIR_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
int MIR_UpdateWindowFramebuffer(_THIS, SDL_Window *sdl_window, const SDL_Rect *rects, int numrects)
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
void MIR_SetWindowTitle(_THIS, SDL_Window *window)
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
void MIR_DestroyWindowFramebuffer(_THIS, SDL_Window *sdl_window)
void(* GL_UnloadLibrary)(_THIS)
void * MIR_GL_GetProcAddress(_THIS, const char *proc)
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
int(* ShowMessageBox)(_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid)
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
#define SDL_OutOfMemory()
SDL_DisplayMode desktop_mode
#define MIR_GL_DeleteContext
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
int(* ResizeWindowShape)(SDL_Window *window)
void(* SetWindowPosition)(_THIS, SDL_Window *window)
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
int(* CreateWindow)(_THIS, SDL_Window *window)
The type used to identify a window.
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
void(* MinimizeWindow)(_THIS, SDL_Window *window)
SDL_bool(* HasClipboardText)(_THIS)
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_ShapeDriver shape_driver
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents...
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
char *(* GetClipboardText)(_THIS)
void(* SetWindowTitle)(_THIS, SDL_Window *window)
int(* GL_GetSwapInterval)(_THIS)
void(* MaximizeWindow)(_THIS, SDL_Window *window)
int(* SetClipboardText)(_THIS, const char *text)
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
void(* OnWindowEnter)(_THIS, SDL_Window *window)
void(* SuspendScreenSaver)(_THIS)
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
void MIR_GL_SwapWindow(_THIS, SDL_Window *window)
#define SDL_Unsupported()
int SDL_MIR_LoadSymbols(void)
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
SDL_bool MIR_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
void MIR_SetWindowMaximumSize(_THIS, SDL_Window *window)
int MIR_GL_LoadLibrary(_THIS, const char *path)
void *(* GL_GetProcAddress)(_THIS, const char *proc)
A rectangle, with the origin at the upper left.
void MIR_SetWindowMinimumSize(_THIS, SDL_Window *window)
void MIR_SetWindowSize(_THIS, SDL_Window *window)
void(* PumpEvents)(_THIS)
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)