harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r472526 - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main: java/windows/org/apache/harmony/awt/nativebridge/windows/ java/windows/org/apache/harmony/awt/wtk/windows/ native/win32wrapper/windows/
Date Wed, 08 Nov 2006 15:59:22 GMT
Author: pyang
Date: Wed Nov  8 07:59:21 2006
New Revision: 472526

URL: http://svn.apache.org/viewvc?view=rev&rev=472526
Log:
Apply patch for HARMONY-1887([classlib][awt] Toolkit#getDesktopProperty doesn't support win.xpstyle.dllName
property on windows xp)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinSystemProperties.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.h

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java?view=diff&rev=472526&r1=472525&r2=472526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
Wed Nov  8 07:59:21 2006
@@ -3746,6 +3746,24 @@
 
     public final native int DestroyCursor(long hCursor);
 
+    public final int GetCurrentThemeName(Int16Pointer pszThemeFileName, int cchMaxNameChars,
Int16Pointer pszColorBuff, int cchMaxColorChars, Int16Pointer pszSizeBuff, int cchMaxSizeChars)
{
+        long tmp_0 = pszThemeFileName == null ? 0 : pszThemeFileName.longLockPointer();
+        long tmp_1 = pszColorBuff == null ? 0 : pszColorBuff.longLockPointer();
+        long tmp_2 = pszSizeBuff == null ? 0 : pszSizeBuff.longLockPointer();
+        int tmp_ret = GetCurrentThemeName(tmp_0, cchMaxNameChars, tmp_1, cchMaxColorChars,
tmp_2, cchMaxSizeChars);
+        if (pszThemeFileName != null) {
+            pszThemeFileName.unlock();
+        }
+        if (pszColorBuff != null) {
+            pszColorBuff.unlock();
+        }
+        if (pszSizeBuff != null) {
+            pszSizeBuff.unlock();
+        }
+        return tmp_ret;
+    }
+    public final native int GetCurrentThemeName(long pszThemeFileName, int cchMaxNameChars,
long pszColorBuff, int cchMaxColorChars, long pszSizeBuff, int cchMaxSizeChars);
+
     public final native long GetClipboardData(int uFormat);
 
     public final int MoveToEx(long param_0, int param_1, int param_2, Win32.POINT param_3)
{

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinSystemProperties.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinSystemProperties.java?view=diff&rev=472526&r1=472525&r2=472526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinSystemProperties.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinSystemProperties.java
Wed Nov  8 07:59:21 2006
@@ -28,6 +28,7 @@
 import java.util.Map;
 import java.util.TreeSet;
 import org.apache.harmony.awt.ComponentInternals;
+import org.apache.harmony.awt.nativebridge.Int16Pointer;
 import org.apache.harmony.awt.nativebridge.Int32Pointer;
 import org.apache.harmony.awt.nativebridge.NativeBridge;
 import org.apache.harmony.awt.nativebridge.windows.Win32;
@@ -472,7 +473,23 @@
     }
     
     void getXPTheme(Map<String, Object> props) {
-        setBoolProperty("win.xpstyle.themeActive", win32.IsThemeActive(), props); //$NON-NLS-1$
+        String style = "win.xpstyle."; //$NON-NLS-1$
+        String nm = "Name"; //$NON-NLS-1$
+        setBoolProperty(style + "themeActive", win32.IsThemeActive(), props);//$NON-NLS-1$
+        int bufSize = 256;
+        NativeBridge nb = NativeBridge.getInstance();
+        Int16Pointer ptrs[] = new Int16Pointer[3];
+        for (int i = 0; i < ptrs.length; i++) {
+            ptrs[i] = nb.createInt16Pointer(bufSize, false);
+        }
+        String[] names = new String[] {"dll", "color", "size"};//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+        int res = win32.GetCurrentThemeName(ptrs[0], bufSize, ptrs[1], bufSize,
+                                            ptrs[2], bufSize);
+        boolean ok = (res == WindowsDefs.S_OK); 
+        for (int i = 0; i < ptrs.length; i++) {
+            String val = (ok ? ptrs[i].getString() : null);
+            setDesktopProperty(style + names[i] + nm, val, props);
+        }
     }
     
     private void getDnDProps(Map<String, Object> props) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp?view=diff&rev=472526&r1=472525&r2=472526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp
Wed Nov  8 07:59:21 2006
@@ -878,6 +878,15 @@
     return (jint) (* p_nbridge_DestroyCursor)((void *) hCursor);
 }
 
+long  (__stdcall * p_nbridge_GetCurrentThemeName) (void *, int, void *, int, void *, int)
= NULL;
+
+JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetCurrentThemeName(
JNIEnv *env, jobject self, jlong pszThemeFileName, jint cchMaxNameChars, jlong pszColorBuff,
jint cchMaxColorChars, jlong pszSizeBuff, jint cchMaxSizeChars) {
+    if (p_nbridge_GetCurrentThemeName == NULL) {
+        p_nbridge_GetCurrentThemeName = (long  (__stdcall *) (void *, int, void *, int, void
*, int)) FindFunction(libUxTheme, "GetCurrentThemeName");
+    }
+    return (jint) (* p_nbridge_GetCurrentThemeName)((void *) pszThemeFileName, (int) cchMaxNameChars,
(void *) pszColorBuff, (int) cchMaxColorChars, (void *) pszSizeBuff, (int) cchMaxSizeChars);
+}
+
 void * (__stdcall * p_nbridge_GetClipboardData) (int) = NULL;
 
 JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetClipboardData(
JNIEnv *env, jobject self, jint uFormat) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.h?view=diff&rev=472526&r1=472525&r2=472526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.h
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.h
Wed Nov  8 07:59:21 2006
@@ -228,6 +228,8 @@
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_DestroyCursor(JNIEnv
*, jobject, jlong);
 
+JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetCurrentThemeName(JNIEnv
*, jobject, jlong, jint, jlong, jint, jlong, jint);
+
 JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetClipboardData(JNIEnv
*, jobject, jint);
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_MoveToEx(JNIEnv
*, jobject, jlong, jint, jint, jlong);



Mime
View raw message