From c9faebb8f8f6be4c0de4919a516b4692742bc13c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 2 May 2012 00:52:58 +0200 Subject: NEWT: Revert static/locked action instances due to possible deadlocks; class Window.ReparentAction -> enum Window.ReparentOperation Revert static/locked action instances due to possible deadlocks - reverts commit: be59d561fd6ab8aa659e85cd962d38fffd1acb0a (partially) - reverts commit: 5742b1faa210401470032ef129e56a83c47fd046 Even thought the idea of having no temp. objects is nice to have, using a static instance requires locking which introduces a deadlock in case the action is being issued from diff. threads. class Window.ReparentAction -> enum Window.ReparentOperation (Minor API Change) Clarifies reparent operations using enums --- src/newt/classes/com/jogamp/newt/Window.java | 18 +++++++++--------- src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/newt/classes/com') diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 32024a49a..3c5441bf7 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -269,22 +269,22 @@ public interface Window extends NativeWindow, WindowClosingProtocol { */ void warpPointer(int x, int y); - /** Defining ids for the reparenting strategy */ - public interface ReparentAction { + /** Reparenting operation types */ + public enum ReparentOperation { /** No native reparenting valid */ - static final int ACTION_INVALID = -1; + ACTION_INVALID, /** No native reparenting action required, no change*/ - static final int ACTION_UNCHANGED = 0; + ACTION_NOP, /** Native reparenting incl. Window tree */ - static final int ACTION_NATIVE_REPARENTING = 1; + ACTION_NATIVE_REPARENTING, /** Native window creation after tree change - instead of reparenting. */ - static final int ACTION_NATIVE_CREATION = 2; + ACTION_NATIVE_CREATION, /** Change Window tree only, native creation is pending */ - static final int ACTION_NATIVE_CREATION_PENDING = 3; + ACTION_NATIVE_CREATION_PENDING; } /** @@ -299,9 +299,9 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * * @return The issued reparent action type (strategy) as defined in Window.ReparentAction */ - int reparentWindow(NativeWindow newParent); + ReparentOperation reparentWindow(NativeWindow newParent); - int reparentWindow(NativeWindow newParent, boolean forceDestroyCreate); + ReparentOperation reparentWindow(NativeWindow newParent, boolean forceDestroyCreate); boolean setFullscreen(boolean fullscreen); diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 419ce7f7f..efdcf4c12 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -308,11 +308,11 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC ", \n\tContext: " + context + ", \n\tWindow: "+window+ /** ", \n\tFactory: "+factory+ */ "]"; } - public final int reparentWindow(NativeWindow newParent) { + public final ReparentOperation reparentWindow(NativeWindow newParent) { return window.reparentWindow(newParent); } - public final int reparentWindow(NativeWindow newParent, boolean forceDestroyCreate) { + public final ReparentOperation reparentWindow(NativeWindow newParent, boolean forceDestroyCreate) { return window.reparentWindow(newParent, forceDestroyCreate); } -- cgit v1.2.3