From 45909fada204eb6aa4790579d79a87367aad3d0d Mon Sep 17 00:00:00 2001 From: bschaefer Date: Sat, 16 Apr 2016 16:27:42 -0700 Subject: [PATCH 1/2] Need to create the native window before creating the context. As creating the context creates the egl surface. --- src/mir_window.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mir_window.c b/src/mir_window.c index 6b6f44679..93a82624a 100644 --- a/src/mir_window.c +++ b/src/mir_window.c @@ -345,12 +345,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - if (ctxconfig->api != GLFW_NO_API) - { - if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) - return GLFW_FALSE; - } - if (window->monitor) { GLFWvidmode mode; @@ -377,6 +371,12 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, window->mir.window = mir_buffer_stream_get_egl_native_window( mir_surface_get_buffer_stream(window->mir.surface)); + if (ctxconfig->api != GLFW_NO_API) + { + if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) + return GLFW_FALSE; + } + return GLFW_TRUE; } From cb6ccaf494510aa55fd6d7a49680a0d46cf54599 Mon Sep 17 00:00:00 2001 From: bschaefer Date: Sun, 17 Apr 2016 13:48:10 -0700 Subject: [PATCH 2/2] * Fix button states --- src/mir_window.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mir_window.c b/src/mir_window.c index 93a82624a..8ab4a4f68 100644 --- a/src/mir_window.c +++ b/src/mir_window.c @@ -160,10 +160,15 @@ static void handlePointerButton(_GLFWwindow* window, int pressed, const MirPointerEvent* pointer_event) { - MirPointerButton button = mir_pointer_event_buttons (pointer_event); int mods = mir_pointer_event_modifiers(pointer_event); const int publicMods = mirModToGLFWMod(mods); - int publicButton; + MirPointerButton button = mir_pointer_button_primary; + static uint32_t oldButtonStates = 0; + uint32_t newButtonStates = mir_pointer_event_buttons(pointer_event); + int publicButton = GLFW_MOUSE_BUTTON_LEFT; + + // XOR our old button states our new states to figure out what was added or removed + button = newButtonStates ^ oldButtonStates; switch (button) { @@ -188,6 +193,8 @@ static void handlePointerButton(_GLFWwindow* window, break; } + oldButtonStates = newButtonStates; + _glfwInputMouseClick(window, publicButton, pressed, publicMods); }