Windows: Generalize getMin/MaxCursorSize to one native GetSystemMetrics

This commit is contained in:
Elias Naur 2006-06-27 11:11:37 +00:00
parent d7ba837de9
commit 0f12ecee3b
3 changed files with 16 additions and 15 deletions

View File

@ -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();

View File

@ -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)
{

View File

@ -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);
}