|
From: <eli...@us...> - 2008-04-01 20:45:26
|
Revision: 2967
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2967&view=rev
Author: elias_naur
Date: 2008-04-01 13:45:24 -0700 (Tue, 01 Apr 2008)
Log Message:
-----------
Windows: Moved Display.setIcon logic to java
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-01 19:46:20 UTC (rev 2966)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-01 20:45:24 UTC (rev 2967)
@@ -550,31 +550,33 @@
* @return number of icons used.
*/
public int setIcon(ByteBuffer[] icons) {
- boolean done16 = false;
- boolean done32 = false;
+ boolean done_small = false;
+ boolean done_large = false;
int used = 0;
+ int small_icon_size = 16;
+ int large_icon_size = 32;
for (int i=0;i<icons.length;i++) {
int size = icons[i].limit() / 4;
- if ((((int) Math.sqrt(size)) == 16) && (!done16)) {
- nSetWindowIcon16(icons[i].asIntBuffer());
+ if ((((int) Math.sqrt(size)) == small_icon_size) && (!done_small)) {
+ nSetWindowIconSmall(small_icon_size, small_icon_size, icons[i].asIntBuffer());
used++;
- done16 = true;
+ done_small = true;
}
- if ((((int) Math.sqrt(size)) == 32) && (!done32)) {
- nSetWindowIcon32(icons[i].asIntBuffer());
+ if ((((int) Math.sqrt(size)) == large_icon_size) && (!done_large)) {
+ nSetWindowIconLarge(large_icon_size, large_icon_size, icons[i].asIntBuffer());
used++;
- done32 = true;
+ done_large = true;
}
}
return used;
}
- private static native int nSetWindowIcon16(IntBuffer icon);
+ private static native int nSetWindowIconSmall(int width, int height, IntBuffer icon);
- private static native int nSetWindowIcon32(IntBuffer icon);
+ private static native int nSetWindowIconLarge(int width, int height, IntBuffer icon);
private void handleMouseButton(int button, int state, long millis) {
if (mouse != null)
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-01 19:46:20 UTC (rev 2966)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-01 20:45:24 UTC (rev 2967)
@@ -462,13 +462,13 @@
return icon;
}
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon16
- (JNIEnv *env, jclass clazz, jobject iconBuffer)
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIconSmall
+ (JNIEnv *env, jclass clazz, jint width, jint height, jobject iconBuffer)
{
jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer);
freeSmallIcon();
- small_icon = createWindowIcon(env, imgData, 16, 16);
+ small_icon = createWindowIcon(env, imgData, width, height);
if (small_icon != NULL) {
if (display_hwnd != NULL) {
SendMessage(display_hwnd, WM_SETICON, ICON_SMALL, (LPARAM) (small_icon));
@@ -480,13 +480,13 @@
return -1;
}
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon32
- (JNIEnv *env, jclass clazz, jobject iconBuffer)
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIconLarge
+ (JNIEnv *env, jclass clazz, jint width, jint height, jobject iconBuffer)
{
jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer);
freeLargeIcon();
- large_icon = createWindowIcon(env, imgData, 32, 32);
+ large_icon = createWindowIcon(env, imgData, width, height);
if (large_icon != NULL) {
if (display_hwnd != NULL) {
SendMessage(display_hwnd, WM_SETICON, ICON_BIG, (LPARAM) (large_icon));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|