Windows: Rename Win32* files to Windows*

This commit is contained in:
Elias Naur 2006-07-12 18:32:58 +00:00
parent 7815607e09
commit bb8dcf3996
27 changed files with 140 additions and 143 deletions

View File

@ -524,14 +524,14 @@
<class name="org.lwjgl.opengl.WindowsDirectInputDevice8" /> <class name="org.lwjgl.opengl.WindowsDirectInputDevice8" />
<class name="org.lwjgl.opengl.WindowsDirectInput3" /> <class name="org.lwjgl.opengl.WindowsDirectInput3" />
<class name="org.lwjgl.opengl.WindowsDirectInputDevice3" /> <class name="org.lwjgl.opengl.WindowsDirectInputDevice3" />
<class name="org.lwjgl.opengl.Win32PbufferPeerInfo" /> <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" />
<class name="org.lwjgl.opengl.Win32Display" /> <class name="org.lwjgl.opengl.WindowsDisplay" />
<class name="org.lwjgl.opengl.Win32Registry" /> <class name="org.lwjgl.opengl.WindowsRegistry" />
<class name="org.lwjgl.NativeSysImplementation" /> <class name="org.lwjgl.NativeSysImplementation" />
<class name="org.lwjgl.opengl.Win32AWTGLCanvasPeerInfo" /> <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo" />
<class name="org.lwjgl.opengl.Win32PeerInfo" /> <class name="org.lwjgl.opengl.WindowsPeerInfo" />
<class name="org.lwjgl.opengl.Win32DisplayPeerInfo" /> <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" />
<class name="org.lwjgl.opengl.Win32ContextImplementation" /> <class name="org.lwjgl.opengl.WindowsContextImplementation" />
</javah> </javah>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">

View File

@ -89,7 +89,7 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
class_name = "org.lwjgl.opengl.LinuxCanvasImplementation"; class_name = "org.lwjgl.opengl.LinuxCanvasImplementation";
break; break;
case LWJGLUtil.PLATFORM_WINDOWS: case LWJGLUtil.PLATFORM_WINDOWS:
class_name = "org.lwjgl.opengl.Win32CanvasImplementation"; class_name = "org.lwjgl.opengl.WindowsCanvasImplementation";
break; break;
case LWJGLUtil.PLATFORM_MACOSX: case LWJGLUtil.PLATFORM_MACOSX:
class_name = "org.lwjgl.opengl.MacOSXCanvasImplementation"; class_name = "org.lwjgl.opengl.MacOSXCanvasImplementation";

View File

@ -79,7 +79,7 @@ final class Context {
class_name = "org.lwjgl.opengl.LinuxContextImplementation"; class_name = "org.lwjgl.opengl.LinuxContextImplementation";
break; break;
case LWJGLUtil.PLATFORM_WINDOWS: case LWJGLUtil.PLATFORM_WINDOWS:
class_name = "org.lwjgl.opengl.Win32ContextImplementation"; class_name = "org.lwjgl.opengl.WindowsContextImplementation";
break; break;
case LWJGLUtil.PLATFORM_MACOSX: case LWJGLUtil.PLATFORM_MACOSX:
class_name = "org.lwjgl.opengl.MacOSXContextImplementation"; class_name = "org.lwjgl.opengl.MacOSXContextImplementation";

View File

@ -144,7 +144,7 @@ public final class Display {
class_name = "org.lwjgl.opengl.LinuxDisplay"; class_name = "org.lwjgl.opengl.LinuxDisplay";
break; break;
case LWJGLUtil.PLATFORM_WINDOWS: case LWJGLUtil.PLATFORM_WINDOWS:
class_name = "org.lwjgl.opengl.Win32Display"; class_name = "org.lwjgl.opengl.WindowsDisplay";
break; break;
case LWJGLUtil.PLATFORM_MACOSX: case LWJGLUtil.PLATFORM_MACOSX:
class_name = "org.lwjgl.opengl.MacOSXDisplay"; class_name = "org.lwjgl.opengl.MacOSXDisplay";

View File

@ -41,13 +41,13 @@ import org.lwjgl.LWJGLException;
* @version $Revision$ * @version $Revision$
* $Id$ * $Id$
*/ */
final class Win32AWTGLCanvasPeerInfo extends Win32PeerInfo { final class WindowsAWTGLCanvasPeerInfo extends WindowsPeerInfo {
private final AWTGLCanvas canvas; private final AWTGLCanvas canvas;
private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); private final AWTSurfaceLock awt_surface = new AWTSurfaceLock();
private final PixelFormat pixel_format; private final PixelFormat pixel_format;
private boolean has_pixel_format= false; private boolean has_pixel_format= false;
public Win32AWTGLCanvasPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) { public WindowsAWTGLCanvasPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) {
this.canvas = canvas; this.canvas = canvas;
this.pixel_format = pixel_format; this.pixel_format = pixel_format;
} }

View File

@ -46,7 +46,7 @@ import org.lwjgl.LWJGLUtil;
* @version $Revision$ * @version $Revision$
* $Id$ * $Id$
*/ */
final class Win32CanvasImplementation implements AWTCanvasImplementation { final class WindowsCanvasImplementation implements AWTCanvasImplementation {
static { static {
// Make sure the awt stuff is properly initialised (the jawt library in particular) // Make sure the awt stuff is properly initialised (the jawt library in particular)
Toolkit.getDefaultToolkit(); Toolkit.getDefaultToolkit();
@ -66,7 +66,7 @@ final class Win32CanvasImplementation implements AWTCanvasImplementation {
} }
public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException {
return new Win32AWTGLCanvasPeerInfo(canvas, pixel_format); return new WindowsAWTGLCanvasPeerInfo(canvas, pixel_format);
} }
/** /**

View File

@ -41,7 +41,7 @@ import org.lwjgl.LWJGLException;
* @version $Revision$ * @version $Revision$
* $Id$ * $Id$
*/ */
final class Win32ContextImplementation implements ContextImplementation { final class WindowsContextImplementation implements ContextImplementation {
public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException {
ByteBuffer peer_handle = peer_info.lockAndGetHandle(); ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try { try {

View File

@ -46,7 +46,7 @@ import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil; import org.lwjgl.LWJGLUtil;
import org.lwjgl.input.Cursor; import org.lwjgl.input.Cursor;
final class Win32Display implements DisplayImplementation { final class WindowsDisplay implements DisplayImplementation {
private final static int GAMMA_LENGTH = 256; private final static int GAMMA_LENGTH = 256;
private final static int WM_MOUSEMOVE = 0x0200; private final static int WM_MOUSEMOVE = 0x0200;
private final static int WM_LBUTTONDOWN = 0x0201; private final static int WM_LBUTTONDOWN = 0x0201;
@ -98,9 +98,9 @@ final class Win32Display implements DisplayImplementation {
private final static int SW_SHOWMINNOACTIVE = 7; private final static int SW_SHOWMINNOACTIVE = 7;
private final static int SW_RESTORE = 9; private final static int SW_RESTORE = 9;
private static Win32Display current_display; private static WindowsDisplay current_display;
private Win32DisplayPeerInfo peer_info; private WindowsDisplayPeerInfo peer_info;
private WindowsKeyboard keyboard; private WindowsKeyboard keyboard;
private WindowsMouse mouse; private WindowsMouse mouse;
@ -119,7 +119,7 @@ final class Win32Display implements DisplayImplementation {
private boolean did_maximize; private boolean did_maximize;
private boolean inAppActivate; private boolean inAppActivate;
public Win32Display() { public WindowsDisplay() {
current_display = this; current_display = this;
} }
@ -228,14 +228,14 @@ final class Win32Display implements DisplayImplementation {
public String getAdapter() { public String getAdapter() {
try { try {
String adapter_string = Win32Registry.queryRegistrationKey( String adapter_string = WindowsRegistry.queryRegistrationKey(
Win32Registry.HKEY_LOCAL_MACHINE, WindowsRegistry.HKEY_LOCAL_MACHINE,
"HARDWARE\\DeviceMap\\Video", "HARDWARE\\DeviceMap\\Video",
"\\Device\\Video0"); "\\Device\\Video0");
String root_key = "\\registry\\machine\\"; String root_key = "\\registry\\machine\\";
if (adapter_string.toLowerCase().startsWith(root_key)) { if (adapter_string.toLowerCase().startsWith(root_key)) {
String driver_value = Win32Registry.queryRegistrationKey( String driver_value = WindowsRegistry.queryRegistrationKey(
Win32Registry.HKEY_LOCAL_MACHINE, WindowsRegistry.HKEY_LOCAL_MACHINE,
adapter_string.substring(root_key.length()), adapter_string.substring(root_key.length()),
"InstalledDisplayDrivers"); "InstalledDisplayDrivers");
return driver_value; return driver_value;
@ -284,7 +284,7 @@ final class Win32Display implements DisplayImplementation {
} }
public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException {
peer_info = new Win32DisplayPeerInfo(pixel_format); peer_info = new WindowsDisplayPeerInfo(pixel_format);
return peer_info; return peer_info;
} }
public void update() { public void update() {
@ -410,25 +410,25 @@ final class Win32Display implements DisplayImplementation {
private native int nGetPbufferCapabilities(PixelFormat format) throws LWJGLException; private native int nGetPbufferCapabilities(PixelFormat format) throws LWJGLException;
public boolean isBufferLost(PeerInfo handle) { public boolean isBufferLost(PeerInfo handle) {
return ((Win32PbufferPeerInfo)handle).isBufferLost(); return ((WindowsPbufferPeerInfo)handle).isBufferLost();
} }
public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format,
IntBuffer pixelFormatCaps, IntBuffer pixelFormatCaps,
IntBuffer pBufferAttribs) throws LWJGLException { IntBuffer pBufferAttribs) throws LWJGLException {
return new Win32PbufferPeerInfo(width, height, pixel_format, pixelFormatCaps, pBufferAttribs); return new WindowsPbufferPeerInfo(width, height, pixel_format, pixelFormatCaps, pBufferAttribs);
} }
public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { public void setPbufferAttrib(PeerInfo handle, int attrib, int value) {
((Win32PbufferPeerInfo)handle).setPbufferAttrib(attrib, value); ((WindowsPbufferPeerInfo)handle).setPbufferAttrib(attrib, value);
} }
public void bindTexImageToPbuffer(PeerInfo handle, int buffer) { public void bindTexImageToPbuffer(PeerInfo handle, int buffer) {
((Win32PbufferPeerInfo)handle).bindTexImageToPbuffer(buffer); ((WindowsPbufferPeerInfo)handle).bindTexImageToPbuffer(buffer);
} }
public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) {
((Win32PbufferPeerInfo)handle).releaseTexImageFromPbuffer(buffer); ((WindowsPbufferPeerInfo)handle).releaseTexImageFromPbuffer(buffer);
} }

View File

@ -41,8 +41,8 @@ import org.lwjgl.LWJGLException;
* @version $Revision$ * @version $Revision$
* $Id$ * $Id$
*/ */
final class Win32DisplayPeerInfo extends Win32PeerInfo { final class WindowsDisplayPeerInfo extends WindowsPeerInfo {
public Win32DisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { public WindowsDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException {
GLContext.loadOpenGLLibrary(); GLContext.loadOpenGLLibrary();
try { try {
createDummyDC(getHandle()); createDummyDC(getHandle());

View File

@ -42,8 +42,8 @@ import org.lwjgl.LWJGLException;
* @version $Revision$ * @version $Revision$
* $Id$ * $Id$
*/ */
final class Win32PbufferPeerInfo extends Win32PeerInfo { final class WindowsPbufferPeerInfo extends WindowsPeerInfo {
public Win32PbufferPeerInfo(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { public WindowsPbufferPeerInfo(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException {
nCreate(getHandle(), width, height, pixel_format, pixelFormatCaps, pBufferAttribs); nCreate(getHandle(), width, height, pixel_format, pixelFormatCaps, pBufferAttribs);
} }
private static native void nCreate(ByteBuffer handle, int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException; private static native void nCreate(ByteBuffer handle, int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException;

View File

@ -42,8 +42,8 @@ import org.lwjgl.LWJGLException;
* @version $Revision$ * @version $Revision$
* $Id$ * $Id$
*/ */
abstract class Win32PeerInfo extends PeerInfo { abstract class WindowsPeerInfo extends PeerInfo {
public Win32PeerInfo() { public WindowsPeerInfo() {
super(createHandle()); super(createHandle());
} }
private static native ByteBuffer createHandle(); private static native ByteBuffer createHandle();

View File

@ -38,7 +38,7 @@ package org.lwjgl.opengl;
import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLException;
final class Win32Registry { final class WindowsRegistry {
final static int HKEY_CLASSES_ROOT = 1; final static int HKEY_CLASSES_ROOT = 1;
final static int HKEY_CURRENT_USER = 2; final static int HKEY_CURRENT_USER = 2;
final static int HKEY_LOCAL_MACHINE = 3; final static int HKEY_LOCAL_MACHINE = 3;

View File

@ -43,6 +43,7 @@
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <jni.h> #include <jni.h>
#include "org_lwjgl_opengl_WindowsDisplay.h"
HINSTANCE dll_handle; HINSTANCE dll_handle;
@ -59,6 +60,6 @@ BOOL WINAPI DllMain(
return TRUE; // Success return TRUE; // Success
} }
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_Win32Display_getDllInstance(JNIEnv *env, jclass unused) { JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDllInstance(JNIEnv *env, jclass unused) {
return (LONG_PTR)dll_handle; return (LONG_PTR)dll_handle;
} }

View File

@ -33,9 +33,7 @@
/** /**
* $Id$ * $Id$
* *
* Base Win32 display * @author elias_naue <elias_naur@users.sourceforge.net>
*
* @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision$ * @version $Revision$
*/ */

View File

@ -33,9 +33,7 @@
/** /**
* $Id$ * $Id$
* *
* Base Win32 display * @author elias_naur <elias_naur@users.sourceforge.net>
*
* @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision$ * @version $Revision$
*/ */
@ -60,7 +58,7 @@ typedef struct {
}; };
HDC format_hdc; HDC format_hdc;
HDC drawable_hdc; HDC drawable_hdc;
} Win32PeerInfo; } WindowsPeerInfo;
/* /*
* Register the LWJGL window class. * Register the LWJGL window class.

View File

@ -33,7 +33,7 @@
/** /**
* $Id$ * $Id$
* *
* Win32 specific library for display handling. * Windows specific library for display handling.
* *
* @author cix_foo <cix_foo@users.sourceforge.net> * @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision$ * @version $Revision$
@ -45,7 +45,7 @@
//#define COMPILE_MULTIMON_STUBS //#define COMPILE_MULTIMON_STUBS
//#include <Multimon.h> //#include <Multimon.h>
#include <jni.h> #include <jni.h>
#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_opengl_WindowsDisplay.h"
#include "display.h" #include "display.h"
#include "common_tools.h" #include "common_tools.h"
@ -164,7 +164,7 @@ void switchDisplayMode(JNIEnv * env, jobject mode) {
} }
static jobject createNativeGammaBuffer(JNIEnv *env) { static jobject createNativeGammaBuffer(JNIEnv *env) {
return newJavaManagedByteBuffer(env, sizeof(WORD)*3*org_lwjgl_opengl_Win32Display_GAMMA_LENGTH); return newJavaManagedByteBuffer(env, sizeof(WORD)*3*org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH);
} }
jobject getCurrentGammaRamp(JNIEnv *env) { jobject getCurrentGammaRamp(JNIEnv *env) {
@ -222,8 +222,8 @@ jobject convertToNativeRamp(JNIEnv *env, jobject float_gamma_obj) {
scaledRampEntry = gammaRamp[i]*0xffff; scaledRampEntry = gammaRamp[i]*0xffff;
rampEntry = (WORD)scaledRampEntry; rampEntry = (WORD)scaledRampEntry;
native_ramp_buffer[i] = rampEntry; native_ramp_buffer[i] = rampEntry;
native_ramp_buffer[i + org_lwjgl_opengl_Win32Display_GAMMA_LENGTH] = rampEntry; native_ramp_buffer[i + org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH] = rampEntry;
native_ramp_buffer[i + 2*org_lwjgl_opengl_Win32Display_GAMMA_LENGTH] = rampEntry; native_ramp_buffer[i + 2*org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH] = rampEntry;
} }
return native_ramp; return native_ramp;
} }
@ -238,7 +238,7 @@ jobject getCurrentDisplayMode(JNIEnv * env) {
} }
void resetDisplayMode(JNIEnv * env) { void resetDisplayMode(JNIEnv * env) {
// Under Win32, all we have to do is: // Under Windows, all we have to do is:
ChangeDisplaySettings(NULL, 0); ChangeDisplaySettings(NULL, 0);
} }

View File

@ -33,7 +33,7 @@
/** /**
* $Id$ * $Id$
* *
* Win32 specific library for display handling. * Windows specific library for display handling.
* *
* @author cix_foo <cix_foo@users.sourceforge.net> * @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision$ * @version $Revision$

View File

@ -33,7 +33,7 @@
/** /**
* $Id$ * $Id$
* *
* Win32 system library. * Windows system library.
* *
* @author cix_foo <cix_foo@users.sourceforge.net> * @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision$ * @version $Revision$

View File

@ -41,10 +41,10 @@
#include "Window.h" #include "Window.h"
#include "org_lwjgl_input_Cursor.h" #include "org_lwjgl_input_Cursor.h"
#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_opengl_WindowsDisplay.h"
#include "common_tools.h" #include "common_tools.h"
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateCursor JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateCursor
(JNIEnv *env, jobject self, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) (JNIEnv *env, jobject self, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
{ {
unsigned char col0, col1, col2, col3, col4, col5, col6, col7; unsigned char col0, col1, col2, col3, col4, col5, col6, col7;
@ -154,7 +154,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateCursor
return handle_buffer; return handle_buffer;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyCursor JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_destroyCursor
(JNIEnv *env, jobject self, jobject handle_buffer) (JNIEnv *env, jobject self, jobject handle_buffer)
{ {
HCURSOR *cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); HCURSOR *cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer);

View File

@ -33,7 +33,7 @@
/** /**
* $Id$ * $Id$
* *
* Base Win32 display * Base Windows display
* *
* @author cix_foo <cix_foo@users.sourceforge.net> * @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision$ * @version $Revision$
@ -46,7 +46,7 @@
#include "extgl_wgl.h" #include "extgl_wgl.h"
#include "common_tools.h" #include "common_tools.h"
#include "display.h" #include "display.h"
#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_opengl_WindowsDisplay.h"
#include "context.h" #include "context.h"
static HICON small_icon = NULL; static HICON small_icon = NULL;
@ -94,7 +94,7 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
JNIEnv *env = getThreadEnv(); JNIEnv *env = getThreadEnv();
if (env != NULL && !(*env)->ExceptionOccurred(env)) { if (env != NULL && !(*env)->ExceptionOccurred(env)) {
/* /*
* We'll cache a global reference to the Win32Display class in the window's user data. * We'll cache a global reference to the WindowsDisplay class in the window's user data.
* This is not so much to avoid lookup overhead as it is to avoid problems * This is not so much to avoid lookup overhead as it is to avoid problems
* with AWT. Specifically, awt code can indirectly call this message handler * with AWT. Specifically, awt code can indirectly call this message handler
* when it does a SendMessage on the main thread to the currently focused window, * when it does a SendMessage on the main thread to the currently focused window,
@ -108,7 +108,7 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
*/ */
display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA); display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (display_class_global == NULL) { if (display_class_global == NULL) {
display_class = (*env)->FindClass(env, "org/lwjgl/opengl/Win32Display"); display_class = (*env)->FindClass(env, "org/lwjgl/opengl/WindowsDisplay");
if (display_class != NULL) { if (display_class != NULL) {
display_class_global = (*env)->NewGlobalRef(env, display_class); display_class_global = (*env)->NewGlobalRef(env, display_class);
if (display_class_global != NULL) if (display_class_global != NULL)
@ -129,7 +129,7 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
} }
/* /*
* Handle native Win32 messages * Handle native Windows messages
*/ */
static void handleMessages(JNIEnv *env) { static void handleMessages(JNIEnv *env) {
/* /*
@ -160,7 +160,7 @@ static void handleMessages(JNIEnv *env) {
} }
} }
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_Win32Display_getHwnd(JNIEnv *env, jclass unused) { JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getHwnd(JNIEnv *env, jclass unused) {
return (INT_PTR)display_hwnd; return (INT_PTR)display_hwnd;
} }
@ -169,22 +169,22 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_Win32Display_getHwnd(JNIEnv *env,
* Method: nSetTitle * Method: nSetTitle
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setTitle JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setTitle
(JNIEnv * env, jobject self, jstring title_obj) { (JNIEnv * env, jobject self, jstring title_obj) {
char * title = GetStringNativeChars(env, title_obj); char * title = GetStringNativeChars(env, title_obj);
SetWindowText(display_hwnd, title); SetWindowText(display_hwnd, title);
free(title); free(title);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nUpdate(JNIEnv * env, jclass class) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nUpdate(JNIEnv * env, jclass class) {
handleMessages(env); handleMessages(env);
} }
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Win32Display_getAvailableDisplayModes(JNIEnv *env, jobject self) { JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getAvailableDisplayModes(JNIEnv *env, jobject self) {
return getAvailableDisplayModes(env); return getAvailableDisplayModes(env);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y) {
jclass cls_displayMode = (*env)->GetObjectClass(env, mode); jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
@ -214,7 +214,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateWindow(JNIEnv *
SetFocus(display_hwnd); SetFocus(display_hwnd);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nDestroyWindow(JNIEnv *env, jclass clazz) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nDestroyWindow(JNIEnv *env, jclass clazz) {
jclass display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(display_hwnd, GWLP_USERDATA); jclass display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(display_hwnd, GWLP_USERDATA);
closeWindow(&display_hwnd, &display_hdc); closeWindow(&display_hwnd, &display_hdc);
if (display_class_global != NULL) if (display_class_global != NULL)
@ -223,11 +223,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nDestroyWindow(JNIEnv
freeSmallIcon(); freeSmallIcon();
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_resetCursorClipping(JNIEnv *env, jclass unused) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_resetCursorClipping(JNIEnv *env, jclass unused) {
ClipCursor(NULL); ClipCursor(NULL);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setupCursorClipping(JNIEnv *env, jclass unused, jlong hwnd_ptr) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setupCursorClipping(JNIEnv *env, jclass unused, jlong hwnd_ptr) {
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
RECT hwnd_client; RECT hwnd_client;
if (display_hwnd != NULL && GetWindowRect(hwnd, &hwnd_client) != 0) { if (display_hwnd != NULL && GetWindowRect(hwnd, &hwnd_client) != 0) {
@ -236,46 +236,46 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setupCursorClipping(JN
} }
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nSwitchDisplayMode(JNIEnv *env, jobject self, jobject mode) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSwitchDisplayMode(JNIEnv *env, jobject self, jobject mode) {
switchDisplayMode(env, mode); switchDisplayMode(env, mode);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nResetDisplayMode(JNIEnv *env, jobject self) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nResetDisplayMode(JNIEnv *env, jobject self) {
resetDisplayMode(env); resetDisplayMode(env);
} }
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_getCurrentDisplayMode(JNIEnv *env, jclass unused) { JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentDisplayMode(JNIEnv *env, jclass unused) {
return getCurrentDisplayMode(env); return getCurrentDisplayMode(env);
} }
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_convertToNativeRamp(JNIEnv *env, jclass unused, jobject float_ramp) { JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_convertToNativeRamp(JNIEnv *env, jclass unused, jobject float_ramp) {
return convertToNativeRamp(env, float_ramp); return convertToNativeRamp(env, float_ramp);
} }
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_getCurrentGammaRamp(JNIEnv *env, jclass unused) { JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentGammaRamp(JNIEnv *env, jclass unused) {
return getCurrentGammaRamp(env); return getCurrentGammaRamp(env);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nSetGammaRamp(JNIEnv *env, jclass unused, jobject gamma_buffer) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetGammaRamp(JNIEnv *env, jclass unused, jobject gamma_buffer) {
setGammaRamp(env, gamma_buffer); setGammaRamp(env, gamma_buffer);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_showWindow(JNIEnv *env, jclass unused, jlong hwnd_ptr, jint mode) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_showWindow(JNIEnv *env, jclass unused, jlong hwnd_ptr, jint mode) {
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
ShowWindow(hwnd, mode); ShowWindow(hwnd, mode);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setForegroundWindow(JNIEnv *env, jclass unused, jlong hwnd_ptr) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setForegroundWindow(JNIEnv *env, jclass unused, jlong hwnd_ptr) {
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
SetForegroundWindow(hwnd); SetForegroundWindow(hwnd);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setFocus(JNIEnv *env, jclass unused, jlong hwnd_ptr) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setFocus(JNIEnv *env, jclass unused, jlong hwnd_ptr) {
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
SetFocus(hwnd); SetFocus(hwnd);
} }
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Win32Display_nGetVersion(JNIEnv *env, jobject self, jstring driver) { JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetVersion(JNIEnv *env, jobject self, jstring driver) {
char *driver_str; char *driver_str;
jstring result; jstring result;
driver_str = GetStringNativeChars(env, driver); driver_str = GetStringNativeChars(env, driver);
@ -286,7 +286,7 @@ JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Win32Display_nGetVersion(JNIEnv
return result; return result;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nReshape(JNIEnv *env, jclass unused, jlong hwnd_ptr, jint x, jint y, jint width, jint height) { JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReshape(JNIEnv *env, jclass unused, jlong hwnd_ptr, jint x, jint y, jint width, jint height) {
HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
DWORD exstyle, windowflags; DWORD exstyle, windowflags;
RECT clientSize; RECT clientSize;
@ -432,7 +432,7 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
return icon; return icon;
} }
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_nSetWindowIcon16 JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon16
(JNIEnv *env, jclass clazz, jobject iconBuffer) (JNIEnv *env, jclass clazz, jobject iconBuffer)
{ {
int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer); int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer);
@ -450,7 +450,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_nSetWindowIcon16
return -1; return -1;
} }
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_nSetWindowIcon32 JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon32
(JNIEnv *env, jclass clazz, jobject iconBuffer) (JNIEnv *env, jclass clazz, jobject iconBuffer)
{ {
int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer); int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer);
@ -468,7 +468,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_nSetWindowIcon32
return -1; return -1;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setCursorPosition JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setCursorPosition
(JNIEnv * env, jclass unused, jint x, jint y, jboolean fullscreen) { (JNIEnv * env, jclass unused, jint x, jint y, jboolean fullscreen) {
DWORD windowflags, exstyle; DWORD windowflags, exstyle;
int transformed_x, transformed_y; int transformed_x, transformed_y;
@ -504,7 +504,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setCursorPosition
printfDebugJava(env, "SetCursorPos failed"); printfDebugJava(env, "SetCursorPos failed");
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setNativeCursor JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setNativeCursor
(JNIEnv *env, jobject self, jobject handle_buffer) (JNIEnv *env, jobject self, jobject handle_buffer)
{ {
HCURSOR *cursor_handle; HCURSOR *cursor_handle;
@ -520,14 +520,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setNativeCursor
} }
} }
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_transformY(JNIEnv *env, jclass unused, jlong hwnd_int, jint y) { JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_transformY(JNIEnv *env, jclass unused, jlong hwnd_int, jint y) {
HWND hwnd = (HWND)(INT_PTR)hwnd_int; HWND hwnd = (HWND)(INT_PTR)hwnd_int;
RECT clientRect; RECT clientRect;
GetClientRect(hwnd, &clientRect); GetClientRect(hwnd, &clientRect);
return (clientRect.bottom - clientRect.top) - 1 - y; return (clientRect.bottom - clientRect.top) - 1 - y;
} }
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getSystemMetrics(JNIEnv *env, jclass unused, jint index) { JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getSystemMetrics(JNIEnv *env, jclass unused, jint index) {
return GetSystemMetrics(index); return GetSystemMetrics(index);
} }

View File

@ -33,14 +33,14 @@
/** /**
* $Id$ * $Id$
* *
* Win32 Pbuffer. * Windows Pbuffer.
* *
* @author elias_naur <elias_naur@users.sourceforge.net> * @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision$ * @version $Revision$
*/ */
#include <stdlib.h> #include <stdlib.h>
#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_opengl_WindowsDisplay.h"
#include "org_lwjgl_opengl_Pbuffer.h" #include "org_lwjgl_opengl_Pbuffer.h"
#include "context.h" #include "context.h"
@ -98,7 +98,7 @@ static bool getExtensions(JNIEnv *env, WGLExtensions *extensions, jobject pixel_
return true; return true;
} }
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_nGetPbufferCapabilities JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetPbufferCapabilities
(JNIEnv *env, jobject self, jobject pixel_format) (JNIEnv *env, jobject self, jobject pixel_format)
{ {
int caps = 0; int caps = 0;
@ -120,7 +120,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_nGetPbufferCapabilitie
return caps; return caps;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nCreate JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nCreate
(JNIEnv *env, jobject self, jobject peer_info_handle, (JNIEnv *env, jobject self, jobject peer_info_handle,
jint width, jint height, jobject pixel_format, jint width, jint height, jobject pixel_format,
jobject pixelFormatCaps, jobject pBufferAttribs) jobject pixelFormatCaps, jobject pBufferAttribs)
@ -135,7 +135,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nCreate
HGLRC saved_context; HGLRC saved_context;
WGLExtensions extensions; WGLExtensions extensions;
const int *pBufferAttribs_ptr; const int *pBufferAttribs_ptr;
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
int pixel_format_id; int pixel_format_id;
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
@ -174,24 +174,24 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nCreate
peer_info->drawable_hdc = Pbuffer_dc; peer_info->drawable_hdc = Pbuffer_dc;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nDestroy JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nDestroy
(JNIEnv *env, jclass clazz, jobject peer_info_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
peer_info->pbuffer.extensions.wglReleasePbufferDCARB(peer_info->pbuffer.pbuffer, peer_info->drawable_hdc); peer_info->pbuffer.extensions.wglReleasePbufferDCARB(peer_info->pbuffer.pbuffer, peer_info->drawable_hdc);
peer_info->pbuffer.extensions.wglDestroyPbufferARB(peer_info->pbuffer.pbuffer); peer_info->pbuffer.extensions.wglDestroyPbufferARB(peer_info->pbuffer.pbuffer);
} }
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nIsBufferLost JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nIsBufferLost
(JNIEnv *env, jclass clazz, jobject peer_info_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
BOOL buffer_lost; BOOL buffer_lost;
peer_info->pbuffer.extensions.wglQueryPbufferARB(peer_info->pbuffer.pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); peer_info->pbuffer.extensions.wglQueryPbufferARB(peer_info->pbuffer.pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost);
return buffer_lost ? JNI_TRUE : JNI_FALSE; return buffer_lost ? JNI_TRUE : JNI_FALSE;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nSetPbufferAttrib JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nSetPbufferAttrib
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint attrib, jint value) { (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint attrib, jint value) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
int attribs[3]; int attribs[3];
attribs[0] = attrib; attribs[0] = attrib;
@ -201,14 +201,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nSetPbufferAtt
peer_info->pbuffer.extensions.wglSetPbufferAttribARB(peer_info->pbuffer.pbuffer, attribs); peer_info->pbuffer.extensions.wglSetPbufferAttribARB(peer_info->pbuffer.pbuffer, attribs);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nBindTexImageToPbuffer JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nBindTexImageToPbuffer
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
peer_info->pbuffer.extensions.wglBindTexImageARB(peer_info->pbuffer.pbuffer, buffer); peer_info->pbuffer.extensions.wglBindTexImageARB(peer_info->pbuffer.pbuffer, buffer);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nReleaseTexImageFromPbuffer JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nReleaseTexImageFromPbuffer
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
peer_info->pbuffer.extensions.wglReleaseTexImageARB(peer_info->pbuffer.pbuffer, buffer); peer_info->pbuffer.extensions.wglReleaseTexImageARB(peer_info->pbuffer.pbuffer, buffer);
} }

View File

@ -41,13 +41,13 @@
#include <jawt.h> #include <jawt.h>
#include <jawt_md.h> #include <jawt_md.h>
#include "awt_tools.h" #include "awt_tools.h"
#include "org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.h" #include "org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h"
#include "context.h" #include "context.h"
#include "common_tools.h" #include "common_tools.h"
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo_nInitHandle JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo_nInitHandle
(JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
JAWT_Win32DrawingSurfaceInfo *win32_dsi = (JAWT_Win32DrawingSurfaceInfo *)surface->dsi->platformInfo; JAWT_Win32DrawingSurfaceInfo *win32_dsi = (JAWT_Win32DrawingSurfaceInfo *)surface->dsi->platformInfo;
peer_info->format_hwnd = win32_dsi->hwnd; peer_info->format_hwnd = win32_dsi->hwnd;

View File

@ -38,38 +38,38 @@
*/ */
#include <jni.h> #include <jni.h>
#include "org_lwjgl_opengl_Win32ContextImplementation.h" #include "org_lwjgl_opengl_WindowsContextImplementation.h"
#include "context.h" #include "context.h"
#include "common_tools.h" #include "common_tools.h"
typedef struct { typedef struct {
WGLExtensions extensions; WGLExtensions extensions;
HGLRC context; HGLRC context;
} Win32Context; } WindowsContext;
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nCreate JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCreate
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject shared_context_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject shared_context_handle) {
Win32PeerInfo *peer_info; WindowsPeerInfo *peer_info;
Win32Context *shared_context_info; WindowsContext *shared_context_info;
Win32Context *context_info; WindowsContext *context_info;
HGLRC context; HGLRC context;
HGLRC shared_context = NULL; HGLRC shared_context = NULL;
HDC saved_hdc; HDC saved_hdc;
HGLRC saved_context; HGLRC saved_context;
WGLExtensions extensions; WGLExtensions extensions;
jobject context_handle = newJavaManagedByteBuffer(env, sizeof(Win32Context)); jobject context_handle = newJavaManagedByteBuffer(env, sizeof(WindowsContext));
if (context_handle == NULL) { if (context_handle == NULL) {
throwException(env, "Could not create handle buffer"); throwException(env, "Could not create handle buffer");
return NULL; return NULL;
} }
peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
context = wglCreateContext(peer_info->format_hdc); context = wglCreateContext(peer_info->format_hdc);
if (context == NULL) { if (context == NULL) {
throwException(env, "Could not create context"); throwException(env, "Could not create context");
return NULL; return NULL;
} }
if (shared_context_handle != NULL) { if (shared_context_handle != NULL) {
shared_context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, shared_context_handle); shared_context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, shared_context_handle);
shared_context = shared_context_info->context; shared_context = shared_context_info->context;
if (!wglShareLists(shared_context, context)) { if (!wglShareLists(shared_context, context)) {
wglDeleteContext(context); wglDeleteContext(context);
@ -88,47 +88,47 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nCrea
extgl_InitWGL(&extensions); extgl_InitWGL(&extensions);
if (!wglMakeCurrent(saved_hdc, saved_context)) if (!wglMakeCurrent(saved_hdc, saved_context))
printfDebugJava(env, "Failed to restore current context"); printfDebugJava(env, "Failed to restore current context");
context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
context_info->context = context; context_info->context = context;
context_info->extensions = extensions; context_info->extensions = extensions;
return context_handle; return context_handle;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nSwapBuffers JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSwapBuffers
(JNIEnv *env, jclass clazz, jobject peer_info_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
SwapBuffers(peer_info->drawable_hdc); SwapBuffers(peer_info->drawable_hdc);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nReleaseCurrentContext JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nReleaseCurrentContext
(JNIEnv *env, jclass clazz) { (JNIEnv *env, jclass clazz) {
wglMakeCurrent(NULL, NULL); wglMakeCurrent(NULL, NULL);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nMakeCurrent JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nMakeCurrent
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) {
Win32Context *context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
if (!wglMakeCurrent(peer_info->drawable_hdc, context_info->context)) if (!wglMakeCurrent(peer_info->drawable_hdc, context_info->context))
throwException(env, "Could not make context current"); throwException(env, "Could not make context current");
} }
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nIsCurrent JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nIsCurrent
(JNIEnv *env, jclass clazz, jobject context_handle) { (JNIEnv *env, jclass clazz, jobject context_handle) {
Win32Context *context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
return wglGetCurrentContext() == context_info->context; return wglGetCurrentContext() == context_info->context;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nSetSwapInterval JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval
(JNIEnv *env, jclass clazz, jobject context_handle, jint value) { (JNIEnv *env, jclass clazz, jobject context_handle, jint value) {
Win32Context *context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
if (context_info->extensions.WGL_EXT_swap_control) { if (context_info->extensions.WGL_EXT_swap_control) {
context_info->extensions.wglSwapIntervalEXT(value); context_info->extensions.wglSwapIntervalEXT(value);
} }
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32ContextImplementation_nDestroy JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nDestroy
(JNIEnv *env, jclass clazz, jobject context_handle) { (JNIEnv *env, jclass clazz, jobject context_handle) {
Win32Context *context_info = (Win32Context *)(*env)->GetDirectBufferAddress(env, context_handle); WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
wglDeleteContext(context_info->context); wglDeleteContext(context_info->context);
} }

View File

@ -39,13 +39,13 @@
#include <jni.h> #include <jni.h>
#include "Window.h" #include "Window.h"
#include "org_lwjgl_opengl_Win32DisplayPeerInfo.h" #include "org_lwjgl_opengl_WindowsDisplayPeerInfo.h"
#include "context.h" #include "context.h"
#include "common_tools.h" #include "common_tools.h"
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32DisplayPeerInfo_createDummyDC JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplayPeerInfo_createDummyDC
(JNIEnv *env, jclass clazz, jobject peer_info_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
HWND dummy_hwnd = createDummyWindow(0, 0); HWND dummy_hwnd = createDummyWindow(0, 0);
HDC dummy_hdc; HDC dummy_hdc;
if (dummy_hwnd == NULL) { if (dummy_hwnd == NULL) {
@ -57,15 +57,15 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32DisplayPeerInfo_createDummyDC
peer_info->format_hdc = dummy_hdc; peer_info->format_hdc = dummy_hdc;
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32DisplayPeerInfo_nDestroy JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplayPeerInfo_nDestroy
(JNIEnv *env, jclass clazz, jobject peer_info_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
closeWindow(&peer_info->format_hwnd, &peer_info->format_hdc); closeWindow(&peer_info->format_hwnd, &peer_info->format_hdc);
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32DisplayPeerInfo_nInitDC JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplayPeerInfo_nInitDC
(JNIEnv *env, jclass clazz, jobject peer_info_handle) { (JNIEnv *env, jclass clazz, jobject peer_info_handle) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
int pixel_format; int pixel_format;
peer_info->drawable_hdc = getCurrentHDC(); peer_info->drawable_hdc = getCurrentHDC();
pixel_format = GetPixelFormat(peer_info->format_hdc); pixel_format = GetPixelFormat(peer_info->format_hdc);

View File

@ -38,18 +38,18 @@
*/ */
#include <jni.h> #include <jni.h>
#include "org_lwjgl_opengl_Win32PeerInfo.h" #include "org_lwjgl_opengl_WindowsPeerInfo.h"
#include "context.h" #include "context.h"
#include "common_tools.h" #include "common_tools.h"
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32PeerInfo_createHandle JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle
(JNIEnv *env, jclass clazz) { (JNIEnv *env, jclass clazz) {
return newJavaManagedByteBuffer(env, sizeof(Win32PeerInfo)); return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo));
} }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PeerInfo_nChoosePixelFormat JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) { (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) {
Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
int pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point); int pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);

View File

@ -39,7 +39,7 @@
#include <jni.h> #include <jni.h>
#include <windows.h> #include <windows.h>
#include "org_lwjgl_opengl_Win32Registry.h" #include "org_lwjgl_opengl_WindowsRegistry.h"
#include "common_tools.h" #include "common_tools.h"
/* /*
@ -108,20 +108,20 @@ static jstring queryRegistrationKey(JNIEnv *env, HKEY root_key, LPCTSTR subkey,
static HKEY enumToRootKey(jint root_key_enum) { static HKEY enumToRootKey(jint root_key_enum) {
switch (root_key_enum) { switch (root_key_enum) {
case org_lwjgl_opengl_Win32Registry_HKEY_CLASSES_ROOT: case org_lwjgl_opengl_WindowsRegistry_HKEY_CLASSES_ROOT:
return HKEY_CLASSES_ROOT; return HKEY_CLASSES_ROOT;
case org_lwjgl_opengl_Win32Registry_HKEY_CURRENT_USER: case org_lwjgl_opengl_WindowsRegistry_HKEY_CURRENT_USER:
return HKEY_CURRENT_USER; return HKEY_CURRENT_USER;
case org_lwjgl_opengl_Win32Registry_HKEY_LOCAL_MACHINE: case org_lwjgl_opengl_WindowsRegistry_HKEY_LOCAL_MACHINE:
return HKEY_LOCAL_MACHINE; return HKEY_LOCAL_MACHINE;
case org_lwjgl_opengl_Win32Registry_HKEY_USERS: case org_lwjgl_opengl_WindowsRegistry_HKEY_USERS:
return HKEY_USERS; return HKEY_USERS;
default: default:
return 0; return 0;
} }
} }
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Win32Registry_nQueryRegistrationKey (JNIEnv *env, jclass unused, jint root_key, jstring subkey, jstring value) { JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_WindowsRegistry_nQueryRegistrationKey (JNIEnv *env, jclass unused, jint root_key, jstring subkey, jstring value) {
HKEY root = enumToRootKey(root_key); HKEY root = enumToRootKey(root_key);
char *subkey_native; char *subkey_native;
char *value_native; char *value_native;