From 8eeed6d3468cb2635176ec4a973954eb29043d89 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 16 Jul 2014 03:15:04 +0000 Subject: Various minor fixes (#953). --- pugl/pugl_internal.h | 2 +- pugl/pugl_osx.m | 18 +++++++++++++++++- pugl/pugl_win.cpp | 3 ++- pugl/pugl_x11.c | 9 +++++---- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index 6813fef..e7c667e 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -1,5 +1,5 @@ /* - Copyright 2012 David Robillard + Copyright 2012-2014 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index 346d833..7e543a8 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -1,5 +1,5 @@ /* - Copyright 2012 David Robillard + Copyright 2012-2014 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -36,6 +36,7 @@ defer:(BOOL)flag; - (void) setPuglview:(PuglView*)view; - (BOOL) windowShouldClose:(id)sender; +- (BOOL) canBecomeKeyWindow:(id)sender; @end @implementation PuglWindow @@ -80,6 +81,11 @@ return YES; } +- (BOOL) canBecomeKeyWindow:(id)sender +{ + return NO; +} + @end static void @@ -112,6 +118,7 @@ puglDisplay(PuglView* view) - (void) rightMouseDragged:(NSEvent*)event; - (void) mouseDown:(NSEvent*)event; - (void) mouseUp:(NSEvent*)event; +- (void) rightMouseDragged:(NSEvent*)event; - (void) rightMouseDown:(NSEvent*)event; - (void) rightMouseUp:(NSEvent*)event; - (void) scrollWheel:(NSEvent*)event; @@ -261,6 +268,15 @@ getModifiers(PuglView* view, NSEvent* ev) } } +- (void) rightMouseDragged:(NSEvent*)event +{ + if (puglview->motionFunc) { + NSPoint loc = [event locationInWindow]; + puglview->mods = getModifiers(puglview, event); + puglview->motionFunc(puglview, loc.x, puglview->height - loc.y); + } +} + - (void) mouseDown:(NSEvent*)event { if (puglview->mouseFunc) { diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp index 31fe2d3..a458bee 100644 --- a/pugl/pugl_win.cpp +++ b/pugl/pugl_win.cpp @@ -1,5 +1,5 @@ /* - Copyright 2012 David Robillard + Copyright 2012-2014 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -292,6 +292,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_MOUSEMOVE: if (view->motionFunc) { + view->event_timestamp_ms = GetMessageTime(); view->motionFunc(view, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); } break; diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c index 9b04aac..e29e3bd 100644 --- a/pugl/pugl_x11.c +++ b/pugl/pugl_x11.c @@ -1,5 +1,6 @@ /* Copyright 2012-2014 David Robillard + Copyright 2013 Robin Gareus Copyright 2011-2012 Ben Loftis, Harrison Consoles Permission to use, copy, modify, and/or distribute this software for any @@ -83,10 +84,10 @@ puglCreateWindow(PuglView* view, const char* title) if (!vi) { vi = glXChooseVisual(impl->display, impl->screen, attrListSgl); impl->doubleBuffered = False; - PUGL_LOG("No double buffering available\n"); + PUGL_LOG("no double-buffering available, using single-buffering\n"); } else { impl->doubleBuffered = True; - PUGL_LOG("Double buffered rendering enabled\n"); + PUGL_LOG("using double-buffered rendering\n"); } int glxMajor, glxMinor; @@ -140,9 +141,9 @@ puglCreateWindow(PuglView* view, const char* title) } if (glXIsDirect(impl->display, impl->ctx)) { - PUGL_LOG("DRI enabled (to disable, set LIBGL_ALWAYS_INDIRECT=1\n"); + PUGL_LOG("DRI enabled (set LIBGL_ALWAYS_INDIRECT=1 to disable)\n"); } else { - PUGL_LOG("No DRI available\n"); + PUGL_LOG("no DRI available\n"); } XFree(vi); -- cgit v1.2.3