From 0f12ecee3bc886682fef0eeae0635a80a0a3a7ce Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 27 Jun 2006 11:11:37 +0000 Subject: [PATCH] Windows: Generalize getMin/MaxCursorSize to one native GetSystemMetrics --- src/java/org/lwjgl/opengl/Win32Display.java | 13 +++++++++++-- src/native/win32/org_lwjgl_input_Cursor.c | 13 ------------- src/native/win32/org_lwjgl_opengl_Display.c | 5 +++++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/java/org/lwjgl/opengl/Win32Display.java b/src/java/org/lwjgl/opengl/Win32Display.java index ca5d9b23..a766b248 100644 --- a/src/java/org/lwjgl/opengl/Win32Display.java +++ b/src/java/org/lwjgl/opengl/Win32Display.java @@ -85,6 +85,8 @@ final class Win32Display implements DisplayImplementation { private final static int SC_CONTEXTHELP = 0xF180; private final static int SC_SEPARATOR = 0xF00F; + private final static int SM_CXCURSOR = 13; + private static Win32DisplayPeerInfo peer_info; private static WindowsKeyboard keyboard; @@ -221,8 +223,15 @@ final class Win32Display implements DisplayImplementation { public native void setNativeCursor(Object handle) throws LWJGLException; - public native int getMinCursorSize(); - public native int getMaxCursorSize(); + public int getMinCursorSize() { + return getSystemMetrics(SM_CXCURSOR); + } + + public int getMaxCursorSize() { + return getSystemMetrics(SM_CXCURSOR); + } + + public native int getSystemMetrics(int index); private static native long getDllInstance(); private static native long getHwnd(); diff --git a/src/native/win32/org_lwjgl_input_Cursor.c b/src/native/win32/org_lwjgl_input_Cursor.c index 93b25640..e1b4230b 100644 --- a/src/native/win32/org_lwjgl_input_Cursor.c +++ b/src/native/win32/org_lwjgl_input_Cursor.c @@ -44,19 +44,6 @@ #include "org_lwjgl_opengl_Win32Display.h" #include "common_tools.h" -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMaxCursorSize -(JNIEnv *env, jobject self) -{ - return GetSystemMetrics(SM_CXCURSOR); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMinCursorSize -(JNIEnv *env, jobject self) -{ - return GetSystemMetrics(SM_CXCURSOR); -} - - JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_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) { diff --git a/src/native/win32/org_lwjgl_opengl_Display.c b/src/native/win32/org_lwjgl_opengl_Display.c index d330091d..fc09db0d 100644 --- a/src/native/win32/org_lwjgl_opengl_Display.c +++ b/src/native/win32/org_lwjgl_opengl_Display.c @@ -548,3 +548,8 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_transformY(JNIEnv *env GetClientRect(hwnd, &clientRect); return (clientRect.bottom - clientRect.top) - 1 - y; } + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getSystemMetrics(JNIEnv *env, jclass unused, jint index) { + return GetSystemMetrics(index); +} +