diff options
author | Kenneth Russel <[email protected]> | 2008-06-26 04:54:44 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-06-26 04:54:44 +0000 |
commit | f287efc004e6932cbb2efdf777798a381994ca48 (patch) | |
tree | ce9a159f1e05cd234dddd64dffbb22ccb5e7163e /src/classes/com/sun/javafx/newt/windows | |
parent | 2a07b5aad1d5dcf9c699e74c7e94d98f827fd4f9 (diff) |
Added getSurfaceHandle() to NativeWindow abstraction in support of
Windows platform where there is a distinction between the window
handle (HWND) and window surface (HDC). WGL implementation now refers
to window surface instead of window handle. JAWT implementation
returns same value for both window handle and window surface. Newt
creates window surface on demand; unneeded for EGL binding. RedSquare
demo now runs on Windows with Newt + GL2.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1695 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/javafx/newt/windows')
-rwxr-xr-x | src/classes/com/sun/javafx/newt/windows/WindowsWindow.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java index bfaf79d42..47dd15add 100755 --- a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java +++ b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java @@ -38,6 +38,8 @@ import com.sun.opengl.impl.*; public class WindowsWindow extends Window { + private long hdc; + private static final String WINDOW_CLASS_NAME = "NewtWindow"; static { NativeLibLoader.loadNEWT(); @@ -50,6 +52,13 @@ public class WindowsWindow extends Window { public WindowsWindow() { } + public long getSurfaceHandle() { + if (hdc == 0) { + hdc = GetDC(windowHandle); + } + return hdc; + } + protected void createNative() { long wndClass = getWindowClass(); windowHandle = CreateWindow(WINDOW_CLASS_NAME, getHInstance(), visualID, x, y, width, height); @@ -59,7 +68,11 @@ public class WindowsWindow extends Window { } protected void closeNative() { - CloseWindow(windowHandle); + if (hdc != 0) { + ReleaseDC(windowHandle, hdc); + hdc = 0; + } + DestroyWindow(windowHandle); } public void setVisible(boolean visible) { @@ -126,7 +139,9 @@ public class WindowsWindow extends Window { private static native long RegisterWindowClass(String windowClassName, long hInstance); private native long CreateWindow(String windowClassName, long hInstance, long visualID, int x, int y, int width, int height); - private native void CloseWindow(long windowHandle); + private native void DestroyWindow(long windowHandle); + private native long GetDC(long windowHandle); + private native void ReleaseDC(long windowHandle, long hdc); private native void setVisible0(long windowHandle, boolean visible); private static native void DispatchMessages(long windowHandle, int eventMask); private native void setSize0(long windowHandle, int width, int height); |