Permalink
Browse files

Move to the new MirEvent 2.0 + 0.14/0.15 changes

Closes #568.
  • Loading branch information...
1 parent 37e1336 commit 9527c93a1c9a43ab3b2a2cfb56389cd3619b90f3 @BrandonSchaefer BrandonSchaefer committed with elmindreda Jul 30, 2015
Showing with 279 additions and 126 deletions.
  1. +4 −1 src/mir_init.c
  2. +36 −4 src/mir_monitor.c
  3. +4 −1 src/mir_platform.h
  4. +235 −120 src/mir_window.c
View
@@ -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
@@ -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();
View
@@ -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
@@ -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;
@@ -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;
View
@@ -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
@@ -89,6 +89,7 @@ typedef struct _GLFWlibraryMir
{
MirConnection* connection;
MirEGLNativeDisplayType display;
+ MirCursorConfiguration* default_conf;
EventQueue* event_queue;
pthread_mutex_t event_mutex;
@@ -102,6 +103,8 @@ typedef struct _GLFWlibraryMir
//
typedef struct _GLFWcursorMir
{
+ MirCursorConfiguration* conf;
+ MirBufferStream* custom_cursor;
} _GLFWcursorMir;
Oops, something went wrong.

0 comments on commit 9527c93

Please sign in to comment.