Windows: Generalize getMin/MaxCursorSize to one native GetSystemMetrics
This commit is contained in:
parent
d7ba837de9
commit
0f12ecee3b
|
@ -85,6 +85,8 @@ final class Win32Display implements DisplayImplementation {
|
||||||
private final static int SC_CONTEXTHELP = 0xF180;
|
private final static int SC_CONTEXTHELP = 0xF180;
|
||||||
private final static int SC_SEPARATOR = 0xF00F;
|
private final static int SC_SEPARATOR = 0xF00F;
|
||||||
|
|
||||||
|
private final static int SM_CXCURSOR = 13;
|
||||||
|
|
||||||
private static Win32DisplayPeerInfo peer_info;
|
private static Win32DisplayPeerInfo peer_info;
|
||||||
|
|
||||||
private static WindowsKeyboard keyboard;
|
private static WindowsKeyboard keyboard;
|
||||||
|
@ -221,8 +223,15 @@ final class Win32Display implements DisplayImplementation {
|
||||||
|
|
||||||
public native void setNativeCursor(Object handle) throws LWJGLException;
|
public native void setNativeCursor(Object handle) throws LWJGLException;
|
||||||
|
|
||||||
public native int getMinCursorSize();
|
public int getMinCursorSize() {
|
||||||
public native int getMaxCursorSize();
|
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 getDllInstance();
|
||||||
private static native long getHwnd();
|
private static native long getHwnd();
|
||||||
|
|
|
@ -44,19 +44,6 @@
|
||||||
#include "org_lwjgl_opengl_Win32Display.h"
|
#include "org_lwjgl_opengl_Win32Display.h"
|
||||||
#include "common_tools.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
|
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)
|
(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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -548,3 +548,8 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_transformY(JNIEnv *env
|
||||||
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) {
|
||||||
|
return GetSystemMetrics(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue