Skip to content

Commit

Permalink
Move to the new MirEvent 2.0 + 0.14/0.15 changes
Browse files Browse the repository at this point in the history
Closes #568.
  • Loading branch information
BrandonSchaefer authored and elmindreda committed Jul 30, 2015
1 parent 37e1336 commit 9527c93
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 126 deletions.
5 changes: 4 additions & 1 deletion src/mir_init.c
@@ -1,7 +1,7 @@
//========================================================================
// GLFW 3.1 Mir - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
// Copyright (c) 2014-2015 Brandon Schaefer <brandon.schaefer@canonical.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -55,6 +55,9 @@ int _glfwPlatformInit(void)
if (!_glfwInitContextAPI())
return GL_FALSE;

// Need the default conf for when we set a NULL cursor
_glfw.mir.default_conf = mir_cursor_configuration_from_name(mir_arrow_cursor_name);

_glfwInitTimer();
_glfwInitJoysticks();

Expand Down
40 changes: 36 additions & 4 deletions src/mir_monitor.c
@@ -1,7 +1,7 @@
//========================================================================
// GLFW 3.1 Mir - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
// Copyright (c) 2014-2015 Brandon Schaefer <brandon.schaefer@canonical.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -86,6 +86,39 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
*ypos = monitor->mir.y;
}

void FillInRGBBitsFromPixelFormat(GLFWvidmode* mode, MirPixelFormat const pf)
{
switch (pf)
{
case mir_pixel_format_rgb_565:
mode->redBits = 5;
mode->greenBits = 6;
mode->blueBits = 5;
break;
case mir_pixel_format_rgba_5551:
mode->redBits = 5;
mode->greenBits = 5;
mode->blueBits = 5;
break;
case mir_pixel_format_rgba_4444:
mode->redBits = 4;
mode->greenBits = 4;
mode->blueBits = 4;
break;
case mir_pixel_format_abgr_8888:
case mir_pixel_format_xbgr_8888:
case mir_pixel_format_argb_8888:
case mir_pixel_format_xrgb_8888:
case mir_pixel_format_bgr_888:
case mir_pixel_format_rgb_888:
default:
mode->redBits = 8;
mode->greenBits = 8;
mode->blueBits = 8;
break;
}
}

GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
{
int i;
Expand All @@ -106,9 +139,8 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
modes[*found].width = out->modes[*found].horizontal_resolution;
modes[*found].height = out->modes[*found].vertical_resolution;
modes[*found].refreshRate = out->modes[*found].refresh_rate;
modes[*found].redBits = 8;
modes[*found].greenBits = 8;
modes[*found].blueBits = 8;

FillInRGBBitsFromPixelFormat(&modes[*found], out->output_formats[*found]);
}

break;
Expand Down
5 changes: 4 additions & 1 deletion src/mir_platform.h
@@ -1,7 +1,7 @@
//========================================================================
// GLFW 3.1 Mir - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
// Copyright (c) 2014-2015 Brandon Schaefer <brandon.schaefer@canonical.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -89,6 +89,7 @@ typedef struct _GLFWlibraryMir
{
MirConnection* connection;
MirEGLNativeDisplayType display;
MirCursorConfiguration* default_conf;
EventQueue* event_queue;

pthread_mutex_t event_mutex;
Expand All @@ -102,6 +103,8 @@ typedef struct _GLFWlibraryMir
//
typedef struct _GLFWcursorMir
{
MirCursorConfiguration* conf;
MirBufferStream* custom_cursor;
} _GLFWcursorMir;


Expand Down

0 comments on commit 9527c93

Please sign in to comment.