From 2c72fa23e3aad2dc54a65bf3c9635eafa9c8786e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Jul 2015 14:27:20 -0400 Subject: Don't dispatch nothing events. --- pugl/pugl_internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pugl/pugl_internal.h') diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index 993f319..f83f2c7 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -1,5 +1,5 @@ /* - Copyright 2012-2014 David Robillard + Copyright 2012-2015 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 @@ -250,7 +250,9 @@ puglDecodeUTF8(const uint8_t* buf) static void puglDispatchEvent(PuglView* view, const PuglEvent* event) { - if (view->eventFunc) { + if (event->type == PUGL_NOTHING) { + return; + } else if (view->eventFunc) { view->eventFunc(view, event); } -- cgit v1.2.3 From 6b4a5a128ef5d87374dfef017cd20e069c068a4b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Sep 2015 15:22:49 -0400 Subject: Add support for aspect ratio constraints. Currently only implemented on X11. --- pugl/pugl_internal.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pugl/pugl_internal.h') diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index f83f2c7..1006c90 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -55,6 +55,10 @@ struct PuglViewImpl { int height; int min_width; int min_height; + int min_aspect_x; + int min_aspect_y; + int max_aspect_x; + int max_aspect_y; int mods; bool mouse_in_view; bool ignoreKeyRepeat; @@ -99,6 +103,19 @@ puglInitWindowMinSize(PuglView* view, int width, int height) view->min_height = height; } +void +puglInitWindowAspectRatio(PuglView* view, + int min_x, + int min_y, + int max_x, + int max_y) +{ + view->min_aspect_x = min_x; + view->min_aspect_y = min_y; + view->max_aspect_x = max_x; + view->max_aspect_y = max_y; +} + void puglInitWindowParent(PuglView* view, PuglNativeWindow parent) { -- cgit v1.2.3