harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r528252 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main/native: gl/windows/WinThemeGraphics.cpp win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp
Date Thu, 12 Apr 2007 22:03:09 GMT
Author: ndbeyer
Date: Thu Apr 12 15:03:08 2007
New Revision: 528252

URL: http://svn.apache.org/viewvc?view=rev&rev=528252
Log:
Apply patch for HARMONY-3569:[classlib][awt] gl library depends on uxtheme.dll which is not
present in Windows 2000

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinThemeGraphics.cpp
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinThemeGraphics.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinThemeGraphics.cpp?view=diff&rev=528252&r1=528251&r2=528252
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinThemeGraphics.cpp
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinThemeGraphics.cpp
Thu Apr 12 15:03:08 2007
@@ -24,7 +24,6 @@
 
 #include <windows.h>
 #include <objidl.h>
-#include <uxTheme.h>
 
 #include "gl_GDIPlus.h"
 #include "org_apache_harmony_awt_theme_windows_WinThemeGraphics.h"
@@ -80,14 +79,32 @@
     restoreGdiClip(gi->hdc, (HRGN)hOldClipRgn);
 }
 
+static void (__stdcall *drawThemeBackground) (void*, void*, int, int, void*, void*)(NULL);
+static BOOL isUxThemeAvailable(true);
+
 JNIEXPORT void JNICALL Java_org_apache_harmony_awt_theme_windows_WinThemeGraphics_drawXpBackground
         (JNIEnv * env, jclass clazz, jlong gip, jint x, jint y, jint w, jint h, 
         jlong hTheme, jint type, jint state) {
 
+    if (!isUxThemeAvailable) {
+        return;
+    }
+
+    if (drawThemeBackground == NULL) {
+        HMODULE libUxTheme = LoadLibrary("UxTheme");
+        isUxThemeAvailable = (libUxTheme != NULL);
+
+        if (!isUxThemeAvailable) {
+            return;
+        }
+
+        drawThemeBackground = (void (__stdcall *) (void*, void*, int, int, void*, void*))
GetProcAddress(libUxTheme, "DrawThemeBackground");
+    }
+
     GraphicsInfo *gi = (GraphicsInfo *)gip;
 
     RECT bounds = { (int)x, (int)y, (int)x + (int)w, (int)y + (int)h };
-    DrawThemeBackground((HTHEME)hTheme, gi->hdc, type, state, &bounds, NULL);
+    drawThemeBackground((void*) hTheme, (void*) gi->hdc, (int) type, (int) state, (void*)
&bounds, (void*) NULL);
 }
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_awt_theme_windows_WinThemeGraphics_drawClassicBackground

Modified: 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/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp?view=diff&rev=528252&r1=528251&r2=528252
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/win32wrapper/windows/org_apache_harmony_awt_nativebridge_windows_Win32.cpp
Thu Apr 12 15:03:08 2007
@@ -161,6 +161,9 @@
 long  (__stdcall * p_nbridge_GetThemeSysFont) (void *, int, void *) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetThemeSysFont(
JNIEnv *env, jobject self, jlong hTheme, jint iFontId, jlong plf) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_GetThemeSysFont == NULL) {
         p_nbridge_GetThemeSysFont = (long  (__stdcall *) (void *, int, void *)) FindFunction(libUxTheme,
"GetThemeSysFont");
     }
@@ -269,6 +272,9 @@
 long  (__stdcall * p_nbridge_GetThemeSysInt) (void *, int, void *) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetThemeSysInt(
JNIEnv *env, jobject self, jlong hTheme, jint iIntId, jlong piValue) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_GetThemeSysInt == NULL) {
         p_nbridge_GetThemeSysInt = (long  (__stdcall *) (void *, int, void *)) FindFunction(libUxTheme,
"GetThemeSysInt");
     }
@@ -404,6 +410,9 @@
 long  (__stdcall * p_nbridge_DrawThemeBackground) (void *, void *, int, int, void *, void
*) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_DrawThemeBackground(
JNIEnv *env, jobject self, jlong hTheme, jlong hdc, jint iPartId, jint iStateId, jlong pRect,
jlong pClipRect) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_DrawThemeBackground == NULL) {
         p_nbridge_DrawThemeBackground = (long  (__stdcall *) (void *, void *, int, int, void
*, void *)) FindFunction(libUxTheme, "DrawThemeBackground");
     }
@@ -881,6 +890,9 @@
 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 (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_GetCurrentThemeName == NULL) {
         p_nbridge_GetCurrentThemeName = (long  (__stdcall *) (void *, int, void *, int, void
*, int)) FindFunction(libUxTheme, "GetCurrentThemeName");
     }
@@ -1007,6 +1019,9 @@
 int  (__stdcall * p_nbridge_IsThemeActive) () = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_IsThemeActive(
JNIEnv *env, jobject self) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_IsThemeActive == NULL) {
         p_nbridge_IsThemeActive = (int  (__stdcall *) ()) FindFunction(libUxTheme, "IsThemeActive");
     }
@@ -1016,6 +1031,9 @@
 unsigned long  (__stdcall * p_nbridge_GetThemeSysColor) (void *, int) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetThemeSysColor(
JNIEnv *env, jobject self, jlong hTheme, jint iColorId) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_GetThemeSysColor == NULL) {
         p_nbridge_GetThemeSysColor = (unsigned long  (__stdcall *) (void *, int)) FindFunction(libUxTheme,
"GetThemeSysColor");
     }
@@ -1070,6 +1088,9 @@
 long  (__stdcall * p_nbridge_CloseThemeData) (void *) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_CloseThemeData(
JNIEnv *env, jobject self, jlong hTheme) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_CloseThemeData == NULL) {
         p_nbridge_CloseThemeData = (long  (__stdcall *) (void *)) FindFunction(libUxTheme,
"CloseThemeData");
     }
@@ -1097,6 +1118,9 @@
 int (__stdcall * p_nbridge_GetThemeSysSize) (void *, int) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetThemeSysSize(
JNIEnv *env, jobject self, jlong hTheme, jint iSizeId) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_GetThemeSysSize == NULL) {
         p_nbridge_GetThemeSysSize = (int (__stdcall *) (void *, int)) FindFunction(libUxTheme,
"GetThemeSysSize");
     }
@@ -1394,6 +1418,9 @@
 int  (__stdcall * p_nbridge_GetThemeSysBool) (void *, int) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_GetThemeSysBool(
JNIEnv *env, jobject self, jlong hTheme, jint iBoolId) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_GetThemeSysBool == NULL) {
         p_nbridge_GetThemeSysBool = (int  (__stdcall *) (void *, int)) FindFunction(libUxTheme,
"GetThemeSysBool");
     }
@@ -1421,6 +1448,9 @@
 void * (__stdcall * p_nbridge_OpenThemeData) (void *, void *) = NULL;
 
 JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_OpenThemeData(
JNIEnv *env, jobject self, jlong hwnd, jlong pszClassList) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_OpenThemeData == NULL) {
         p_nbridge_OpenThemeData = (void * (__stdcall *) (void *, void *)) FindFunction(libUxTheme,
"OpenThemeData");
     }
@@ -1484,6 +1514,9 @@
 long  (__stdcall * p_nbridge_EnableTheming) (int) = NULL;
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_EnableTheming(
JNIEnv *env, jobject self, jint fEnable) {
+    if (libUxTheme == NULL) {
+        return 0;
+    }
     if (p_nbridge_EnableTheming == NULL) {
         p_nbridge_EnableTheming = (long  (__stdcall *) (int)) FindFunction(libUxTheme, "EnableTheming");
     }
@@ -2233,5 +2266,6 @@
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_windows_Win32_proxycall191(
JNIEnv *env, jobject self, jlong fnptr1234, jlong This, jint param_1, jlong param_2) {
     return (jint)((long  (__stdcall *) (void *, long, void *)) fnptr1234)((void *) This,
(long) param_1, (void *) param_2);
 }
+
 
 



Mime
View raw message