diff options
Diffstat (limited to 'bundles/org.eclipse.swt')
35 files changed, 1085 insertions, 1063 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_wpf b/bundles/org.eclipse.swt/.classpath_wpf index 4dfe59424e..d1cf95611e 100644 --- a/bundles/org.eclipse.swt/.classpath_wpf +++ b/bundles/org.eclipse.swt/.classpath_wpf @@ -10,6 +10,7 @@ <attribute value="org.eclipse.swt.wpf.win32.x86" name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"/> </attributes> </classpathentry> + <classpathentry kind="src" path="Eclipse SWT PI/wpf_win32"/> <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/> <classpathentry kind="src" path="Eclipse SWT/emulated/datetime"/> <classpathentry kind="src" path="Eclipse SWT/emulated/bidi"/> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com.c b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com.c deleted file mode 100644 index f29d1a7d92..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com.c +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "com_structs.h" -#include "com_stats.h" - -#define COM_NATIVE(func) Java_org_eclipse_swt_internal_wpf_COM_##func - -#ifndef NO_OleInitialize -JNIEXPORT jint JNICALL COM_NATIVE(OleInitialize) - (JNIEnv *env, jclass that, jint arg0) -{ - jint rc = 0; - COM_NATIVE_ENTER(env, that, OleInitialize_FUNC); - rc = (jint)OleInitialize((LPVOID)arg0); - COM_NATIVE_EXIT(env, that, OleInitialize_FUNC); - return rc; -} -#endif - -#ifndef NO_OleUninitialize -JNIEXPORT void JNICALL COM_NATIVE(OleUninitialize) - (JNIEnv *env, jclass that) -{ - COM_NATIVE_ENTER(env, that, OleUninitialize_FUNC); - OleUninitialize(); - COM_NATIVE_EXIT(env, that, OleUninitialize_FUNC); -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_stats.c deleted file mode 100644 index 557ed0ee72..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_stats.c +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "com_stats.h" - -#ifdef NATIVE_STATS - -int COM_nativeFunctionCount = 2; -int COM_nativeFunctionCallCount[2]; -char * COM_nativeFunctionNames[] = { - "OleInitialize", - "OleUninitialize", -}; - -#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func - -JNIEXPORT jint JNICALL STATS_NATIVE(COM_1GetFunctionCount) - (JNIEnv *env, jclass that) -{ - return COM_nativeFunctionCount; -} - -JNIEXPORT jstring JNICALL STATS_NATIVE(COM_1GetFunctionName) - (JNIEnv *env, jclass that, jint index) -{ - return (*env)->NewStringUTF(env, COM_nativeFunctionNames[index]); -} - -JNIEXPORT jint JNICALL STATS_NATIVE(COM_1GetFunctionCallCount) - (JNIEnv *env, jclass that, jint index) -{ - return COM_nativeFunctionCallCount[index]; -} - -#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_stats.h deleted file mode 100644 index 1406582be1..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_stats.h +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifdef NATIVE_STATS -extern int COM_nativeFunctionCount; -extern int COM_nativeFunctionCallCount[]; -extern char* COM_nativeFunctionNames[]; -#define COM_NATIVE_ENTER(env, that, func) COM_nativeFunctionCallCount[func]++; -#define COM_NATIVE_EXIT(env, that, func) -#else -#ifndef COM_NATIVE_ENTER -#define COM_NATIVE_ENTER(env, that, func) -#endif -#ifndef COM_NATIVE_EXIT -#define COM_NATIVE_EXIT(env, that, func) -#endif -#endif - -typedef enum { - OleInitialize_FUNC, - OleUninitialize_FUNC, -} COM_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_structs.c deleted file mode 100644 index 98a128c4cc..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_structs.c +++ /dev/null @@ -1,14 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "com_structs.h" - diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_structs.h deleted file mode 100644 index 6e1d8de79e..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com_structs.h +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "com.h" - diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/make_wpf.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/make_wpf.mak index 072e6522c6..f4a8ace583 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/make_wpf.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/make_wpf.mak @@ -15,14 +15,14 @@ !include <make_common.mak> -SWT_PREFIX = swt -WS_PREFIX = wpf +SWT_PREFIX = swt +WS_PREFIX = wpf SWT_VERSION = $(maj_ver)$(min_ver) -SWT_LIB = $(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll -SWT_COM_LIB = $(SWT_PREFIX)-com-$(WS_PREFIX)-$(SWT_VERSION).dll -SWT_C_OBJS = swt.obj c.obj c_stats.obj +SWT_LIB = $(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll +SWT_WIN32_LIB = $(SWT_PREFIX)-win32-$(WS_PREFIX)-$(SWT_VERSION).dll +SWT_C_OBJS = swt.obj c.obj c_stats.obj SWT_CPP_OBJS = os.obj os_custom.obj os_stats.obj os_structs.obj -SWT_COM_OBJS = com.obj swt.obj com_stats.obj +SWT_WIN32_OBJS = win32.obj win32_stats.obj win32_structs.obj # Uncomment for Native Stats tool #NATIVE_STATS = -DNATIVE_STATS @@ -34,10 +34,10 @@ WPF_HOME = C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0 DOTNET_HOME = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 CFLAGS = -c -W2 -D_WIN32_DCOM -O2 -DVISTA -DSWT_VERSION=$(SWT_VERSION) -DNO_getenv $(NATIVE_STATS) $(TRYCATCH) /I"$(JAVA_HOME)\include" /I"$(JAVA_HOME)\include\win32" /I. CPPFLAGS = -clr /FU"$(WPF_HOME)\PresentationCore.dll" /FU"$(WPF_HOME)\PresentationFramework.dll" /FU$(DOTNET_HOME)\System.Data.dll /FU$(DOTNET_HOME)\System.dll /FU$(DOTNET_HOME)\System.Xml.dll /FU"$(WPF_HOME)\UIAutomationProvider.dll" /FU"$(WPF_HOME)\UIAutomationTypes.dll" /FU"$(WPF_HOME)\WindowsBase.dll" /FU$(DOTNET_HOME)\System.Drawing.dll /FU$(DOTNET_HOME)\System.Windows.Forms.dll /FU"$(WPF_HOME)\WindowsFormsIntegration.dll" -LFLAGS = -DLL -NODEFAULTLIB:"LIBCMT.LIB" -CLRTHREADATTRIBUTE:STA user32.lib gdi32.lib shell32.lib -COMLFLAGS = -DLL ole32.lib +LFLAGS = -DLL -NODEFAULTLIB:"LIBCMT.LIB" -CLRTHREADATTRIBUTE:STA +WIN32LFLAGS = -DLL ole32.lib user32.lib gdi32.lib shell32.lib -all: $(SWT_LIB) $(SWT_COM_LIB) +all: $(SWT_LIB) $(SWT_WIN32_LIB) .c.obj: cl $(CFLAGS) $*.c @@ -49,8 +49,8 @@ $(SWT_LIB): $(SWT_C_OBJS) $(SWT_CPP_OBJS) link $(LFLAGS) -OUT:$(SWT_LIB) $(SWT_C_OBJS) $(SWT_CPP_OBJS) mt.exe -manifest $(SWT_LIB).manifest -outputresource:$(SWT_LIB);2 -$(SWT_COM_LIB): $(SWT_COM_OBJS) - link $(COMLFLAGS) -OUT:$(SWT_COM_LIB) $(SWT_COM_OBJS) +$(SWT_WIN32_LIB): $(SWT_C_OBJS) $(SWT_WIN32_OBJS) + link $(WIN32LFLAGS) -OUT:$(SWT_WIN32_LIB) $(SWT_C_OBJS) $(SWT_WIN32_OBJS) install: all copy *.dll $(OUTPUT_DIR) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp index f189dfa0ff..b67989040c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.cpp @@ -879,19 +879,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Clipboard_1SetDataObject) } #endif -#ifndef NO_CloseHandle -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(CloseHandle)(JNIEnv *env, jclass that, jint arg0); -JNIEXPORT jboolean JNICALL OS_NATIVE(CloseHandle) - (JNIEnv *env, jclass that, jint arg0) -{ - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, CloseHandle_FUNC); - rc = (jboolean)CloseHandle((HANDLE)arg0); - OS_NATIVE_EXIT(env, that, CloseHandle_FUNC); - return rc; -} -#endif - #ifndef NO_ColorDialog_1AnyColor extern "C" JNIEXPORT void JNICALL OS_NATIVE(ColorDialog_1AnyColor)(JNIEnv *env, jclass that, jint arg0, jboolean arg1); JNIEXPORT void JNICALL OS_NATIVE(ColorDialog_1AnyColor) @@ -1927,82 +1914,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Control_1VerticalContentAlignment) } #endif -#ifndef NO_CreateCursor -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(CreateCursor)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6); -JNIEXPORT jint JNICALL OS_NATIVE(CreateCursor) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6) -{ - jbyte *lparg5=NULL; - jbyte *lparg6=NULL; - jint rc = 0; - OS_NATIVE_ENTER(env, that, CreateCursor_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { - if (arg5) if ((lparg5 = (jbyte*)env->GetPrimitiveArrayCritical(arg5, NULL)) == NULL) goto fail; - if (arg6) if ((lparg6 = (jbyte*)env->GetPrimitiveArrayCritical(arg6, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg5) if ((lparg5 = env->GetByteArrayElements(arg5, NULL)) == NULL) goto fail; - if (arg6) if ((lparg6 = env->GetByteArrayElements(arg6, NULL)) == NULL) goto fail; - } - rc = (jint)CreateCursor((HINSTANCE)arg0, arg1, arg2, arg3, arg4, (CONST VOID *)lparg5, (CONST VOID *)lparg6); -fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { - if (arg6 && lparg6) env->ReleasePrimitiveArrayCritical(arg6, lparg6, JNI_ABORT); - if (arg5 && lparg5) env->ReleasePrimitiveArrayCritical(arg5, lparg5, JNI_ABORT); - } else -#endif - { - if (arg6 && lparg6) env->ReleaseByteArrayElements(arg6, lparg6, JNI_ABORT); - if (arg5 && lparg5) env->ReleaseByteArrayElements(arg5, lparg5, JNI_ABORT); - } - OS_NATIVE_EXIT(env, that, CreateCursor_FUNC); - return rc; -} -#endif - -#ifndef NO_CreateIconIndirect -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(CreateIconIndirect)(JNIEnv *env, jclass that, jobject arg0); -JNIEXPORT jint JNICALL OS_NATIVE(CreateIconIndirect) - (JNIEnv *env, jclass that, jobject arg0) -{ - ICONINFO _arg0, *lparg0=NULL; - jint rc = 0; - OS_NATIVE_ENTER(env, that, CreateIconIndirect_FUNC); - if (arg0) if ((lparg0 = getICONINFOFields(env, arg0, &_arg0)) == NULL) goto fail; - rc = (jint)CreateIconIndirect(lparg0); -fail: - if (arg0 && lparg0) setICONINFOFields(env, arg0, lparg0); - OS_NATIVE_EXIT(env, that, CreateIconIndirect_FUNC); - return rc; -} -#endif - -#ifndef NO_CreateProcessW -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(CreateProcessW)(JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jint arg3, jboolean arg4, jint arg5, jint arg6, jint arg7, jobject arg8, jobject arg9); -JNIEXPORT jboolean JNICALL OS_NATIVE(CreateProcessW) - (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jint arg3, jboolean arg4, jint arg5, jint arg6, jint arg7, jobject arg8, jobject arg9) -{ - jchar *lparg1=NULL; - STARTUPINFOW _arg8, *lparg8=NULL; - PROCESS_INFORMATION _arg9, *lparg9=NULL; - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, CreateProcessW_FUNC); - if (arg1) if ((lparg1 = env->GetCharArrayElements(arg1, NULL)) == NULL) goto fail; - if (arg8) if ((lparg8 = getSTARTUPINFOWFields(env, arg8, &_arg8)) == NULL) goto fail; - if (arg9) if ((lparg9 = getPROCESS_INFORMATIONFields(env, arg9, &_arg9)) == NULL) goto fail; - rc = (jboolean)CreateProcessW((LPCWSTR)arg0, (LPWSTR)lparg1, (LPSECURITY_ATTRIBUTES)arg2, (LPSECURITY_ATTRIBUTES)arg3, arg4, (DWORD)arg5, (LPVOID)arg6, (LPCWSTR)arg7, (LPSTARTUPINFOW)lparg8, (LPPROCESS_INFORMATION)lparg9); -fail: - if (arg9 && lparg9) setPROCESS_INFORMATIONFields(env, arg9, lparg9); - if (arg8 && lparg8) setSTARTUPINFOWFields(env, arg8, lparg8); - if (arg1 && lparg1) env->ReleaseCharArrayElements(arg1, lparg1, 0); - OS_NATIVE_EXIT(env, that, CreateProcessW_FUNC); - return rc; -} -#endif - #ifndef NO_CultureInfo_1CurrentUICulture extern "C" JNIEXPORT jint JNICALL OS_NATIVE(CultureInfo_1CurrentUICulture)(JNIEnv *env, jclass that); JNIEXPORT jint JNICALL OS_NATIVE(CultureInfo_1CurrentUICulture) @@ -2493,19 +2404,6 @@ JNIEXPORT void JNICALL OS_NATIVE(DeleteGlobalRef) } #endif -#ifndef NO_DeleteObject -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(DeleteObject)(JNIEnv *env, jclass that, jint arg0); -JNIEXPORT jboolean JNICALL OS_NATIVE(DeleteObject) - (JNIEnv *env, jclass that, jint arg0) -{ - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, DeleteObject_FUNC); - rc = (jboolean)DeleteObject((HGDIOBJ)arg0); - OS_NATIVE_EXIT(env, that, DeleteObject_FUNC); - return rc; -} -#endif - #ifndef NO_DependencyObject_1ClearValue extern "C" JNIEXPORT void JNICALL OS_NATIVE(DependencyObject_1ClearValue)(JNIEnv *env, jclass that, jint arg0, jint arg1); JNIEXPORT void JNICALL OS_NATIVE(DependencyObject_1ClearValue) @@ -2554,19 +2452,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(DependencyProperty_1UnsetValue) } #endif -#ifndef NO_DestroyIcon -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(DestroyIcon)(JNIEnv *env, jclass that, jint arg0); -JNIEXPORT jboolean JNICALL OS_NATIVE(DestroyIcon) - (JNIEnv *env, jclass that, jint arg0) -{ - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, DestroyIcon_FUNC); - rc = (jboolean)DestroyIcon((HICON)arg0); - OS_NATIVE_EXIT(env, that, DestroyIcon_FUNC); - return rc; -} -#endif - #ifndef NO_DispatcherFrame_1Continue extern "C" JNIEXPORT void JNICALL OS_NATIVE(DispatcherFrame_1Continue)(JNIEnv *env, jclass that, jint arg0, jboolean arg1); JNIEXPORT void JNICALL OS_NATIVE(DispatcherFrame_1Continue) @@ -3154,17 +3039,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(EditingCommands_1DeletePreviousWord) } #endif -#ifndef NO_EnableWindow -extern "C" JNIEXPORT void JNICALL OS_NATIVE(EnableWindow)(JNIEnv *env, jclass that, jint arg0, jboolean arg1); -JNIEXPORT void JNICALL OS_NATIVE(EnableWindow) - (JNIEnv *env, jclass that, jint arg0, jboolean arg1) -{ - OS_NATIVE_ENTER(env, that, EnableWindow_FUNC); - EnableWindow((HWND)arg0, arg1); - OS_NATIVE_EXIT(env, that, EnableWindow_FUNC); -} -#endif - #ifndef NO_Environment_1ExpandEnvironmentVariables extern "C" JNIEXPORT jint JNICALL OS_NATIVE(Environment_1ExpandEnvironmentVariables)(JNIEnv *env, jclass that, jint arg0); JNIEXPORT jint JNICALL OS_NATIVE(Environment_1ExpandEnvironmentVariables) @@ -3248,29 +3122,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Expander_1IsExpanded__IZ) } #endif -#ifndef NO_ExtractIconExW -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(ExtractIconExW)(JNIEnv *env, jclass that, jcharArray arg0, jint arg1, jintArray arg2, jintArray arg3, jint arg4); -JNIEXPORT jint JNICALL OS_NATIVE(ExtractIconExW) - (JNIEnv *env, jclass that, jcharArray arg0, jint arg1, jintArray arg2, jintArray arg3, jint arg4) -{ - jchar *lparg0=NULL; - jint *lparg2=NULL; - jint *lparg3=NULL; - jint rc = 0; - OS_NATIVE_ENTER(env, that, ExtractIconExW_FUNC); - if (arg0) if ((lparg0 = env->GetCharArrayElements(arg0, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; - if (arg3) if ((lparg3 = env->GetIntArrayElements(arg3, NULL)) == NULL) goto fail; - rc = (jint)ExtractIconExW((LPCWSTR)lparg0, arg1, (HICON*)lparg2, (HICON*)lparg3, (UINT)arg4); -fail: - if (arg3 && lparg3) env->ReleaseIntArrayElements(arg3, lparg3, 0); - if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, 0); - if (arg0 && lparg0) env->ReleaseCharArrayElements(arg0, lparg0, 0); - OS_NATIVE_EXIT(env, that, ExtractIconExW_FUNC); - return rc; -} -#endif - #ifndef NO_FileDialog_1FileName extern "C" JNIEXPORT void JNICALL OS_NATIVE(FileDialog_1FileName)(JNIEnv *env, jclass that, jint arg0, jint arg1); JNIEXPORT void JNICALL OS_NATIVE(FileDialog_1FileName) @@ -4944,85 +4795,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Geometry_1Transform__II) } #endif -#ifndef NO_GetCursorPos -extern "C" JNIEXPORT void JNICALL OS_NATIVE(GetCursorPos)(JNIEnv *env, jclass that, jobject arg0); -JNIEXPORT void JNICALL OS_NATIVE(GetCursorPos) - (JNIEnv *env, jclass that, jobject arg0) -{ - POINT _arg0, *lparg0=NULL; - OS_NATIVE_ENTER(env, that, GetCursorPos_FUNC); - if (arg0) if ((lparg0 = getPOINTFields(env, arg0, &_arg0)) == NULL) goto fail; - GetCursorPos((LPPOINT)lparg0); -fail: - if (arg0 && lparg0) setPOINTFields(env, arg0, lparg0); - OS_NATIVE_EXIT(env, that, GetCursorPos_FUNC); -} -#endif - -#ifndef NO_GetIconInfo -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(GetIconInfo)(JNIEnv *env, jclass that, jint arg0, jobject arg1); -JNIEXPORT jboolean JNICALL OS_NATIVE(GetIconInfo) - (JNIEnv *env, jclass that, jint arg0, jobject arg1) -{ - ICONINFO _arg1, *lparg1=NULL; - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, GetIconInfo_FUNC); - if (arg1) if ((lparg1 = getICONINFOFields(env, arg1, &_arg1)) == NULL) goto fail; - rc = (jboolean)GetIconInfo((HICON)arg0, lparg1); -fail: - if (arg1 && lparg1) setICONINFOFields(env, arg1, lparg1); - OS_NATIVE_EXIT(env, that, GetIconInfo_FUNC); - return rc; -} -#endif - -#ifndef NO_GetKeyboardState -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(GetKeyboardState)(JNIEnv *env, jclass that, jbyteArray arg0); -JNIEXPORT jboolean JNICALL OS_NATIVE(GetKeyboardState) - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, GetKeyboardState_FUNC); - if (arg0) if ((lparg0 = env->GetByteArrayElements(arg0, NULL)) == NULL) goto fail; - rc = (jboolean)GetKeyboardState((PBYTE)lparg0); -fail: - if (arg0 && lparg0) env->ReleaseByteArrayElements(arg0, lparg0, 0); - OS_NATIVE_EXIT(env, that, GetKeyboardState_FUNC); - return rc; -} -#endif - -#ifndef NO_GetModuleHandleW -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(GetModuleHandleW)(JNIEnv *env, jclass that, jcharArray arg0); -JNIEXPORT jint JNICALL OS_NATIVE(GetModuleHandleW) - (JNIEnv *env, jclass that, jcharArray arg0) -{ - jchar *lparg0=NULL; - jint rc = 0; - OS_NATIVE_ENTER(env, that, GetModuleHandleW_FUNC); - if (arg0) if ((lparg0 = env->GetCharArrayElements(arg0, NULL)) == NULL) goto fail; - rc = (jint)GetModuleHandleW((LPCWSTR)lparg0); -fail: - if (arg0 && lparg0) env->ReleaseCharArrayElements(arg0, lparg0, 0); - OS_NATIVE_EXIT(env, that, GetModuleHandleW_FUNC); - return rc; -} -#endif - -#ifndef NO_GetProcessHeap -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(GetProcessHeap)(JNIEnv *env, jclass that); -JNIEXPORT jint JNICALL OS_NATIVE(GetProcessHeap) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, GetProcessHeap_FUNC); - rc = (jint)GetProcessHeap(); - OS_NATIVE_EXIT(env, that, GetProcessHeap_FUNC); - return rc; -} -#endif - #ifndef NO_GiveFeedbackEventArgs_1Effects extern "C" JNIEXPORT jint JNICALL OS_NATIVE(GiveFeedbackEventArgs_1Effects)(JNIEnv *env, jclass that, jint arg0); JNIEXPORT jint JNICALL OS_NATIVE(GiveFeedbackEventArgs_1Effects) @@ -5518,32 +5290,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(HeaderedItemsControl_1HeaderTemplateProperty) } #endif -#ifndef NO_HeapAlloc -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(HeapAlloc)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2); -JNIEXPORT jint JNICALL OS_NATIVE(HeapAlloc) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, HeapAlloc_FUNC); - rc = (jint)HeapAlloc((HANDLE)arg0, arg1, arg2); - OS_NATIVE_EXIT(env, that, HeapAlloc_FUNC); - return rc; -} -#endif - -#ifndef NO_HeapFree -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(HeapFree)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2); -JNIEXPORT jboolean JNICALL OS_NATIVE(HeapFree) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) -{ - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, HeapFree_FUNC); - rc = (jboolean)HeapFree((HANDLE)arg0, arg1, (LPVOID)arg2); - OS_NATIVE_EXIT(env, that, HeapFree_FUNC); - return rc; -} -#endif - #ifndef NO_HtmlDocument_1InvokeScript extern "C" JNIEXPORT jint JNICALL OS_NATIVE(HtmlDocument_1InvokeScript)(JNIEnv *env, jclass that, jint arg0, jint arg1); JNIEXPORT jint JNICALL OS_NATIVE(HtmlDocument_1InvokeScript) @@ -6430,32 +6176,6 @@ JNIEXPORT void JNICALL OS_NATIVE(ListView_1View) } #endif -#ifndef NO_LoadImage -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(LoadImage)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5); -JNIEXPORT jint JNICALL OS_NATIVE(LoadImage) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, LoadImage_FUNC); - rc = (jint)LoadImage((HINSTANCE)arg0, (LPCTSTR)arg1, (UINT)arg2, arg3, arg4, (UINT)arg5); - OS_NATIVE_EXIT(env, that, LoadImage_FUNC); - return rc; -} -#endif - -#ifndef NO_MapVirtualKeyW -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(MapVirtualKeyW)(JNIEnv *env, jclass that, jint arg0, jint arg1); -JNIEXPORT jint JNICALL OS_NATIVE(MapVirtualKeyW) - (JNIEnv *env, jclass that, jint arg0, jint arg1) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, MapVirtualKeyW_FUNC); - rc = (jint)MapVirtualKeyW(arg0, arg1); - OS_NATIVE_EXIT(env, that, MapVirtualKeyW_FUNC); - return rc; -} -#endif - #ifndef NO_MatrixTransform_1Matrix__I extern "C" JNIEXPORT jint JNICALL OS_NATIVE(MatrixTransform_1Matrix__I)(JNIEnv *env, jclass that, jint arg0); JNIEXPORT jint JNICALL OS_NATIVE(MatrixTransform_1Matrix__I) @@ -7068,35 +6788,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(Mouse_1XButton2) } #endif -#ifndef NO_MoveMemory -extern "C" JNIEXPORT void JNICALL OS_NATIVE(MoveMemory)(JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2); -JNIEXPORT void JNICALL OS_NATIVE(MoveMemory) - (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2) -{ - jchar *lparg1=NULL; - OS_NATIVE_ENTER(env, that, MoveMemory_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { - if (arg1) if ((lparg1 = (jchar*)env->GetPrimitiveArrayCritical(arg1, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg1) if ((lparg1 = env->GetCharArrayElements(arg1, NULL)) == NULL) goto fail; - } - MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2); -fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { - if (arg1 && lparg1) env->ReleasePrimitiveArrayCritical(arg1, lparg1, JNI_ABORT); - } else -#endif - { - if (arg1 && lparg1) env->ReleaseCharArrayElements(arg1, lparg1, JNI_ABORT); - } - OS_NATIVE_EXIT(env, that, MoveMemory_FUNC); -} -#endif - #ifndef NO_NewGlobalRef extern "C" JNIEXPORT jint JNICALL OS_NATIVE(NewGlobalRef)(JNIEnv *env, jclass that, jobject arg0); JNIEXPORT jint JNICALL OS_NATIVE(NewGlobalRef) @@ -7226,19 +6917,6 @@ JNIEXPORT void JNICALL OS_NATIVE(OpenFileDialog_1Multiselect) } #endif -#ifndef NO_PROCESS_1INFORMATION_1sizeof -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(PROCESS_1INFORMATION_1sizeof)(JNIEnv *env, jclass that); -JNIEXPORT jint JNICALL OS_NATIVE(PROCESS_1INFORMATION_1sizeof) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, PROCESS_1INFORMATION_1sizeof_FUNC); - rc = (jint)PROCESS_INFORMATION_sizeof(); - OS_NATIVE_EXIT(env, that, PROCESS_1INFORMATION_1sizeof_FUNC); - return rc; -} -#endif - #ifndef NO_Panel_1Background__I extern "C" JNIEXPORT jint JNICALL OS_NATIVE(Panel_1Background__I)(JNIEnv *env, jclass that, jint arg0); JNIEXPORT jint JNICALL OS_NATIVE(Panel_1Background__I) @@ -8694,32 +8372,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Run_1Text) } #endif -#ifndef NO_SHELLEXECUTEINFOW_1sizeof -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(SHELLEXECUTEINFOW_1sizeof)(JNIEnv *env, jclass that); -JNIEXPORT jint JNICALL OS_NATIVE(SHELLEXECUTEINFOW_1sizeof) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, SHELLEXECUTEINFOW_1sizeof_FUNC); - rc = (jint)SHELLEXECUTEINFOW_sizeof(); - OS_NATIVE_EXIT(env, that, SHELLEXECUTEINFOW_1sizeof_FUNC); - return rc; -} -#endif - -#ifndef NO_STARTUPINFOW_1sizeof -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(STARTUPINFOW_1sizeof)(JNIEnv *env, jclass that); -JNIEXPORT jint JNICALL OS_NATIVE(STARTUPINFOW_1sizeof) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, STARTUPINFOW_1sizeof_FUNC); - rc = (jint)STARTUPINFOW_sizeof(); - OS_NATIVE_EXIT(env, that, STARTUPINFOW_1sizeof_FUNC); - return rc; -} -#endif - #ifndef NO_ScrollBar_1Orientation__I extern "C" JNIEXPORT jint JNICALL OS_NATIVE(ScrollBar_1Orientation__I)(JNIEnv *env, jclass that, jint arg0); JNIEXPORT jint JNICALL OS_NATIVE(ScrollBar_1Orientation__I) @@ -8938,19 +8590,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Selector_1SelectionChanged) } #endif -#ifndef NO_SetCursorPos -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(SetCursorPos)(JNIEnv *env, jclass that, jint arg0, jint arg1); -JNIEXPORT jint JNICALL OS_NATIVE(SetCursorPos) - (JNIEnv *env, jclass that, jint arg0, jint arg1) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, SetCursorPos_FUNC); - rc = (jint)SetCursorPos(arg0, arg1); - OS_NATIVE_EXIT(env, that, SetCursorPos_FUNC); - return rc; -} -#endif - #ifndef NO_SetterBaseCollection_1Add extern "C" JNIEXPORT void JNICALL OS_NATIVE(SetterBaseCollection_1Add)(JNIEnv *env, jclass that, jint arg0, jint arg1); JNIEXPORT void JNICALL OS_NATIVE(SetterBaseCollection_1Add) @@ -8995,23 +8634,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Shape_1StrokeThickness) } #endif -#ifndef NO_ShellExecuteExW -extern "C" JNIEXPORT jboolean JNICALL OS_NATIVE(ShellExecuteExW)(JNIEnv *env, jclass that, jobject arg0); -JNIEXPORT jboolean JNICALL OS_NATIVE(ShellExecuteExW) - (JNIEnv *env, jclass that, jobject arg0) -{ - SHELLEXECUTEINFOW _arg0, *lparg0=NULL; - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, ShellExecuteExW_FUNC); - if (arg0) if ((lparg0 = getSHELLEXECUTEINFOWFields(env, arg0, &_arg0)) == NULL) goto fail; - rc = (jboolean)ShellExecuteExW((LPSHELLEXECUTEINFOW)lparg0); -fail: - if (arg0 && lparg0) setSHELLEXECUTEINFOWFields(env, arg0, lparg0); - OS_NATIVE_EXIT(env, that, ShellExecuteExW_FUNC); - return rc; -} -#endif - #ifndef NO_SizeChangedEventArgs_1NewSize extern "C" JNIEXPORT jint JNICALL OS_NATIVE(SizeChangedEventArgs_1NewSize)(JNIEnv *env, jclass that, jint arg0); JNIEXPORT jint JNICALL OS_NATIVE(SizeChangedEventArgs_1NewSize) @@ -10999,26 +10621,6 @@ JNIEXPORT void JNICALL OS_NATIVE(Timeline_1RepeatBehavior) } #endif -#ifndef NO_ToUnicode -extern "C" JNIEXPORT jint JNICALL OS_NATIVE(ToUnicode)(JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jcharArray arg3, jint arg4, jint arg5); -JNIEXPORT jint JNICALL OS_NATIVE(ToUnicode) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jcharArray arg3, jint arg4, jint arg5) -{ - jbyte *lparg2=NULL; - jchar *lparg3=NULL; - jint rc = 0; - OS_NATIVE_ENTER(env, that, ToUnicode_FUNC); - if (arg2) if ((lparg2 = env->GetByteArrayElements(arg2, NULL)) == NULL) goto fail; - if (arg3) if ((lparg3 = env->GetCharArrayElements(arg3, NULL)) == NULL) goto fail; - rc = (jint)ToUnicode(arg0, arg1, (PBYTE)lparg2, (LPWSTR)lparg3, arg4, arg5); -fail: - if (arg3 && lparg3) env->ReleaseCharArrayElements(arg3, lparg3, 0); - if (arg2 && lparg2) env->ReleaseByteArrayElements(arg2, lparg2, 0); - OS_NATIVE_EXIT(env, that, ToUnicode_FUNC); - return rc; -} -#endif - #ifndef NO_ToggleButton_1Checked extern "C" JNIEXPORT void JNICALL OS_NATIVE(ToggleButton_1Checked)(JNIEnv *env, jclass that, jint arg0, jint arg1); JNIEXPORT void JNICALL OS_NATIVE(ToggleButton_1Checked) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.h index c176b319b9..4e02bfe028 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os.h @@ -12,9 +12,6 @@ #ifndef INC_wpf_H #define INC_wpf_H -#include <string.h> -#include <windows.h> - #using <mscorlib.dll> using namespace System; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp index 6f050928d0..9ce7b4aa8d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp @@ -12,6 +12,7 @@ #include "swt.h" #include "os_structs.h" #include "os_stats.h" +#include "string.h" #define OS_NATIVE(func) Java_org_eclipse_swt_internal_wpf_OS_##func @@ -425,12 +426,18 @@ public: this->handle = handle; _isIcon = isIcon; } + [DllImport("user32.dll", SetLastError = true)] + static bool DestroyIcon(int hIcon); + + [DllImport("user32.dll", SetLastError = true)] + static bool DestroyCursor(int hCursor); + virtual bool ReleaseHandle () override { bool result; if (_isIcon) { - result = DestroyIcon((HICON)(int)handle); + result = DestroyIcon((int)handle); } else { - result = DestroyCursor((HCURSOR)(int)handle); + result = DestroyCursor((int)handle); } handle = (IntPtr)(-1); return result; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp index ec9713eed5..b92cf7a07f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1277; -int OS_nativeFunctionCallCount[1277]; +int OS_nativeFunctionCount = 1253; +int OS_nativeFunctionCallCount[1253]; char * OS_nativeFunctionNames[] = { "AccessText_1AccessKey", "AccessText_1Text", @@ -88,7 +88,6 @@ char * OS_nativeFunctionNames[] = { "Clipboard_1GetText", "Clipboard_1SetData", "Clipboard_1SetDataObject", - "CloseHandle", "ColorDialog_1AnyColor", "ColorDialog_1Color__I", "ColorDialog_1Color__II", @@ -174,9 +173,6 @@ char * OS_nativeFunctionNames[] = { "Control_1Template__II", "Control_1TemplateProperty", "Control_1VerticalContentAlignment", - "CreateCursor", - "CreateIconIndirect", - "CreateProcessW", "CultureInfo_1CurrentUICulture", "CursorInteropHelper_1Create", "Cursors_1AppStarting", @@ -215,12 +211,10 @@ char * OS_nativeFunctionNames[] = { "DataObject_1GetFormats", "DataObject_1SetData", "DeleteGlobalRef", - "DeleteObject", "DependencyObject_1ClearValue", "DependencyObject_1GetValue", "DependencyObject_1SetValue", "DependencyProperty_1UnsetValue", - "DestroyIcon", "DispatcherFrame_1Continue", "DispatcherHookEventArgs_1Operation", "DispatcherHooks_1DispatcherInactive", @@ -270,7 +264,6 @@ char * OS_nativeFunctionNames[] = { "EditingCommands_1Delete", "EditingCommands_1DeleteNextWord", "EditingCommands_1DeletePreviousWord", - "EnableWindow", "Environment_1ExpandEnvironmentVariables", "ExecutedRoutedEventArgs_1Command", "ExecutedRoutedEventArgs_1Handled", @@ -278,7 +271,6 @@ char * OS_nativeFunctionNames[] = { "Expander_1Expanded", "Expander_1IsExpanded__I", "Expander_1IsExpanded__IZ", - "ExtractIconExW", "FileDialog_1FileName", "FileDialog_1FileNames", "FileDialog_1Filter", @@ -420,11 +412,6 @@ char * OS_nativeFunctionNames[] = { "Geometry_1StrokeContains", "Geometry_1Transform__I", "Geometry_1Transform__II", - "GetCursorPos", - "GetIconInfo", - "GetKeyboardState", - "GetModuleHandleW", - "GetProcessHeap", "GiveFeedbackEventArgs_1Effects", "GlyphRun_1BidiLevel", "GradientBrush_1MappingMode", @@ -466,8 +453,6 @@ char * OS_nativeFunctionNames[] = { "HeaderedItemsControl_1Header__I", "HeaderedItemsControl_1Header__II", "HeaderedItemsControl_1HeaderTemplateProperty", - "HeapAlloc", - "HeapFree", "HtmlDocument_1InvokeScript", "HwndSource_1Handle", "Hyperlink_1Click", @@ -542,8 +527,6 @@ char * OS_nativeFunctionNames[] = { "ListBox_1UnselectAll", "ListViewItem_1typeid", "ListView_1View", - "LoadImage", - "MapVirtualKeyW", "MatrixTransform_1Matrix__I", "MatrixTransform_1Matrix__II", "Matrix_1Invert", @@ -594,7 +577,6 @@ char * OS_nativeFunctionNames[] = { "Mouse_1SetCursor", "Mouse_1XButton1", "Mouse_1XButton2", - "MoveMemory", "NewGlobalRef", "NotifyIcon_1DoubleClick", "NotifyIcon_1Icon", @@ -606,7 +588,6 @@ char * OS_nativeFunctionNames[] = { "Object_1GetType", "Object_1ToString", "OpenFileDialog_1Multiselect", - "PROCESS_1INFORMATION_1sizeof", "Panel_1Background__I", "Panel_1Background__II", "Panel_1BackgroundProperty", @@ -728,8 +709,6 @@ char * OS_nativeFunctionNames[] = { "RowDefinitionCollection_1Add", "RowDefinition_1Height", "Run_1Text", - "SHELLEXECUTEINFOW_1sizeof", - "STARTUPINFOW_1sizeof", "SWTCanvas_1Visual__I", "SWTCanvas_1Visual__II", "SWTStackPanel_1JNIRefProperty", @@ -753,12 +732,10 @@ char * OS_nativeFunctionNames[] = { "Selector_1SelectedItem", "Selector_1SelectedValue", "Selector_1SelectionChanged", - "SetCursorPos", "SetterBaseCollection_1Add", "Shape_1Fill", "Shape_1Stroke", "Shape_1StrokeThickness", - "ShellExecuteExW", "SizeChangedEventArgs_1NewSize", "SizeChangedEventArgs_1PreviousSize", "Size_1Height__I", @@ -920,7 +897,6 @@ char * OS_nativeFunctionNames[] = { "Timeline_1AutoReverse", "Timeline_1Duration", "Timeline_1RepeatBehavior", - "ToUnicode", "ToggleButton_1Checked", "ToggleButton_1CheckedEvent", "ToggleButton_1IndeterminateEvent", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h index 3de2d9bec8..4019b177fb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h @@ -96,7 +96,6 @@ typedef enum { Clipboard_1GetText_FUNC, Clipboard_1SetData_FUNC, Clipboard_1SetDataObject_FUNC, - CloseHandle_FUNC, ColorDialog_1AnyColor_FUNC, ColorDialog_1Color__I_FUNC, ColorDialog_1Color__II_FUNC, @@ -182,9 +181,6 @@ typedef enum { Control_1Template__II_FUNC, Control_1TemplateProperty_FUNC, Control_1VerticalContentAlignment_FUNC, - CreateCursor_FUNC, - CreateIconIndirect_FUNC, - CreateProcessW_FUNC, CultureInfo_1CurrentUICulture_FUNC, CursorInteropHelper_1Create_FUNC, Cursors_1AppStarting_FUNC, @@ -223,12 +219,10 @@ typedef enum { DataObject_1GetFormats_FUNC, DataObject_1SetData_FUNC, DeleteGlobalRef_FUNC, - DeleteObject_FUNC, DependencyObject_1ClearValue_FUNC, DependencyObject_1GetValue_FUNC, DependencyObject_1SetValue_FUNC, DependencyProperty_1UnsetValue_FUNC, - DestroyIcon_FUNC, DispatcherFrame_1Continue_FUNC, DispatcherHookEventArgs_1Operation_FUNC, DispatcherHooks_1DispatcherInactive_FUNC, @@ -278,7 +272,6 @@ typedef enum { EditingCommands_1Delete_FUNC, EditingCommands_1DeleteNextWord_FUNC, EditingCommands_1DeletePreviousWord_FUNC, - EnableWindow_FUNC, Environment_1ExpandEnvironmentVariables_FUNC, ExecutedRoutedEventArgs_1Command_FUNC, ExecutedRoutedEventArgs_1Handled_FUNC, @@ -286,7 +279,6 @@ typedef enum { Expander_1Expanded_FUNC, Expander_1IsExpanded__I_FUNC, Expander_1IsExpanded__IZ_FUNC, - ExtractIconExW_FUNC, FileDialog_1FileName_FUNC, FileDialog_1FileNames_FUNC, FileDialog_1Filter_FUNC, @@ -428,11 +420,6 @@ typedef enum { Geometry_1StrokeContains_FUNC, Geometry_1Transform__I_FUNC, Geometry_1Transform__II_FUNC, - GetCursorPos_FUNC, - GetIconInfo_FUNC, - GetKeyboardState_FUNC, - GetModuleHandleW_FUNC, - GetProcessHeap_FUNC, GiveFeedbackEventArgs_1Effects_FUNC, GlyphRun_1BidiLevel_FUNC, GradientBrush_1MappingMode_FUNC, @@ -474,8 +461,6 @@ typedef enum { HeaderedItemsControl_1Header__I_FUNC, HeaderedItemsControl_1Header__II_FUNC, HeaderedItemsControl_1HeaderTemplateProperty_FUNC, - HeapAlloc_FUNC, - HeapFree_FUNC, HtmlDocument_1InvokeScript_FUNC, HwndSource_1Handle_FUNC, Hyperlink_1Click_FUNC, @@ -550,8 +535,6 @@ typedef enum { ListBox_1UnselectAll_FUNC, ListViewItem_1typeid_FUNC, ListView_1View_FUNC, - LoadImage_FUNC, - MapVirtualKeyW_FUNC, MatrixTransform_1Matrix__I_FUNC, MatrixTransform_1Matrix__II_FUNC, Matrix_1Invert_FUNC, @@ -602,7 +585,6 @@ typedef enum { Mouse_1SetCursor_FUNC, Mouse_1XButton1_FUNC, Mouse_1XButton2_FUNC, - MoveMemory_FUNC, NewGlobalRef_FUNC, NotifyIcon_1DoubleClick_FUNC, NotifyIcon_1Icon_FUNC, @@ -614,7 +596,6 @@ typedef enum { Object_1GetType_FUNC, Object_1ToString_FUNC, OpenFileDialog_1Multiselect_FUNC, - PROCESS_1INFORMATION_1sizeof_FUNC, Panel_1Background__I_FUNC, Panel_1Background__II_FUNC, Panel_1BackgroundProperty_FUNC, @@ -736,8 +717,6 @@ typedef enum { RowDefinitionCollection_1Add_FUNC, RowDefinition_1Height_FUNC, Run_1Text_FUNC, - SHELLEXECUTEINFOW_1sizeof_FUNC, - STARTUPINFOW_1sizeof_FUNC, SWTCanvas_1Visual__I_FUNC, SWTCanvas_1Visual__II_FUNC, SWTStackPanel_1JNIRefProperty_FUNC, @@ -761,12 +740,10 @@ typedef enum { Selector_1SelectedItem_FUNC, Selector_1SelectedValue_FUNC, Selector_1SelectionChanged_FUNC, - SetCursorPos_FUNC, SetterBaseCollection_1Add_FUNC, Shape_1Fill_FUNC, Shape_1Stroke_FUNC, Shape_1StrokeThickness_FUNC, - ShellExecuteExW_FUNC, SizeChangedEventArgs_1NewSize_FUNC, SizeChangedEventArgs_1PreviousSize_FUNC, Size_1Height__I_FUNC, @@ -928,7 +905,6 @@ typedef enum { Timeline_1AutoReverse_FUNC, Timeline_1Duration_FUNC, Timeline_1RepeatBehavior_FUNC, - ToUnicode_FUNC, ToggleButton_1Checked_FUNC, ToggleButton_1CheckedEvent_FUNC, ToggleButton_1IndeterminateEvent_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.cpp index 4634eb6a6c..40e774ba6c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.cpp @@ -10,277 +10,4 @@ *******************************************************************************/ #include "swt.h" -#include "os_structs.h" - -#ifndef NO_ICONINFO -typedef struct ICONINFO_FID_CACHE { - int cached; - jclass clazz; - jfieldID fIcon, xHotspot, yHotspot, hbmMask, hbmColor; -} ICONINFO_FID_CACHE; - -ICONINFO_FID_CACHE ICONINFOFc; - -void cacheICONINFOFields(JNIEnv *env, jobject lpObject) -{ - if (ICONINFOFc.cached) return; - ICONINFOFc.clazz = env->GetObjectClass(lpObject); - ICONINFOFc.fIcon = env->GetFieldID(ICONINFOFc.clazz, "fIcon", "Z"); - ICONINFOFc.xHotspot = env->GetFieldID(ICONINFOFc.clazz, "xHotspot", "I"); - ICONINFOFc.yHotspot = env->GetFieldID(ICONINFOFc.clazz, "yHotspot", "I"); - ICONINFOFc.hbmMask = env->GetFieldID(ICONINFOFc.clazz, "hbmMask", "I"); - ICONINFOFc.hbmColor = env->GetFieldID(ICONINFOFc.clazz, "hbmColor", "I"); - ICONINFOFc.cached = 1; -} - -ICONINFO *getICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct) -{ - if (!ICONINFOFc.cached) cacheICONINFOFields(env, lpObject); - lpStruct->fIcon = env->GetBooleanField(lpObject, ICONINFOFc.fIcon); - lpStruct->xHotspot = env->GetIntField(lpObject, ICONINFOFc.xHotspot); - lpStruct->yHotspot = env->GetIntField(lpObject, ICONINFOFc.yHotspot); - lpStruct->hbmMask = (HBITMAP)env->GetIntField(lpObject, ICONINFOFc.hbmMask); - lpStruct->hbmColor = (HBITMAP)env->GetIntField(lpObject, ICONINFOFc.hbmColor); - return lpStruct; -} - -void setICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct) -{ - if (!ICONINFOFc.cached) cacheICONINFOFields(env, lpObject); - env->SetBooleanField(lpObject, ICONINFOFc.fIcon, (jboolean)lpStruct->fIcon); - env->SetIntField(lpObject, ICONINFOFc.xHotspot, (jint)lpStruct->xHotspot); - env->SetIntField(lpObject, ICONINFOFc.yHotspot, (jint)lpStruct->yHotspot); - env->SetIntField(lpObject, ICONINFOFc.hbmMask, (jint)lpStruct->hbmMask); - env->SetIntField(lpObject, ICONINFOFc.hbmColor, (jint)lpStruct->hbmColor); -} -#endif - -#ifndef NO_POINT -typedef struct POINT_FID_CACHE { - int cached; - jclass clazz; - jfieldID x, y; -} POINT_FID_CACHE; - -POINT_FID_CACHE POINTFc; - -void cachePOINTFields(JNIEnv *env, jobject lpObject) -{ - if (POINTFc.cached) return; - POINTFc.clazz = env->GetObjectClass(lpObject); - POINTFc.x = env->GetFieldID(POINTFc.clazz, "x", "I"); - POINTFc.y = env->GetFieldID(POINTFc.clazz, "y", "I"); - POINTFc.cached = 1; -} - -POINT *getPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct) -{ - if (!POINTFc.cached) cachePOINTFields(env, lpObject); - lpStruct->x = env->GetIntField(lpObject, POINTFc.x); - lpStruct->y = env->GetIntField(lpObject, POINTFc.y); - return lpStruct; -} - -void setPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct) -{ - if (!POINTFc.cached) cachePOINTFields(env, lpObject); - env->SetIntField(lpObject, POINTFc.x, (jint)lpStruct->x); - env->SetIntField(lpObject, POINTFc.y, (jint)lpStruct->y); -} -#endif - -#ifndef NO_PROCESS_INFORMATION -typedef struct PROCESS_INFORMATION_FID_CACHE { - int cached; - jclass clazz; - jfieldID hProcess, hThread, dwProcessId, dwThreadId; -} PROCESS_INFORMATION_FID_CACHE; - -PROCESS_INFORMATION_FID_CACHE PROCESS_INFORMATIONFc; - -void cachePROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject) -{ - if (PROCESS_INFORMATIONFc.cached) return; - PROCESS_INFORMATIONFc.clazz = env->GetObjectClass(lpObject); - PROCESS_INFORMATIONFc.hProcess = env->GetFieldID(PROCESS_INFORMATIONFc.clazz, "hProcess", "I"); - PROCESS_INFORMATIONFc.hThread = env->GetFieldID(PROCESS_INFORMATIONFc.clazz, "hThread", "I"); - PROCESS_INFORMATIONFc.dwProcessId = env->GetFieldID(PROCESS_INFORMATIONFc.clazz, "dwProcessId", "I"); - PROCESS_INFORMATIONFc.dwThreadId = env->GetFieldID(PROCESS_INFORMATIONFc.clazz, "dwThreadId", "I"); - PROCESS_INFORMATIONFc.cached = 1; -} - -PROCESS_INFORMATION *getPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct) -{ - if (!PROCESS_INFORMATIONFc.cached) cachePROCESS_INFORMATIONFields(env, lpObject); - lpStruct->hProcess = (HANDLE)env->GetIntField(lpObject, PROCESS_INFORMATIONFc.hProcess); - lpStruct->hThread = (HANDLE)env->GetIntField(lpObject, PROCESS_INFORMATIONFc.hThread); - lpStruct->dwProcessId = env->GetIntField(lpObject, PROCESS_INFORMATIONFc.dwProcessId); - lpStruct->dwThreadId = env->GetIntField(lpObject, PROCESS_INFORMATIONFc.dwThreadId); - return lpStruct; -} - -void setPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct) -{ - if (!PROCESS_INFORMATIONFc.cached) cachePROCESS_INFORMATIONFields(env, lpObject); - env->SetIntField(lpObject, PROCESS_INFORMATIONFc.hProcess, (jint)lpStruct->hProcess); - env->SetIntField(lpObject, PROCESS_INFORMATIONFc.hThread, (jint)lpStruct->hThread); - env->SetIntField(lpObject, PROCESS_INFORMATIONFc.dwProcessId, (jint)lpStruct->dwProcessId); - env->SetIntField(lpObject, PROCESS_INFORMATIONFc.dwThreadId, (jint)lpStruct->dwThreadId); -} -#endif - -#ifndef NO_SHELLEXECUTEINFOW -typedef struct SHELLEXECUTEINFOW_FID_CACHE { - int cached; - jclass clazz; - jfieldID cbSize, fMask, hwnd, lpVerb, lpFile, lpParameters, lpDirectory, nShow, hInstApp, lpIDList, lpClass, hkeyClass, dwHotKey, hIcon, hProcess; -} SHELLEXECUTEINFOW_FID_CACHE; - -SHELLEXECUTEINFOW_FID_CACHE SHELLEXECUTEINFOWFc; - -void cacheSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject) -{ - if (SHELLEXECUTEINFOWFc.cached) return; - SHELLEXECUTEINFOWFc.clazz = env->GetObjectClass(lpObject); - SHELLEXECUTEINFOWFc.cbSize = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "cbSize", "I"); - SHELLEXECUTEINFOWFc.fMask = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "fMask", "I"); - SHELLEXECUTEINFOWFc.hwnd = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "hwnd", "I"); - SHELLEXECUTEINFOWFc.lpVerb = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "lpVerb", "I"); - SHELLEXECUTEINFOWFc.lpFile = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "lpFile", "I"); - SHELLEXECUTEINFOWFc.lpParameters = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "lpParameters", "I"); - SHELLEXECUTEINFOWFc.lpDirectory = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "lpDirectory", "I"); - SHELLEXECUTEINFOWFc.nShow = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "nShow", "I"); - SHELLEXECUTEINFOWFc.hInstApp = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "hInstApp", "I"); - SHELLEXECUTEINFOWFc.lpIDList = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "lpIDList", "I"); - SHELLEXECUTEINFOWFc.lpClass = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "lpClass", "I"); - SHELLEXECUTEINFOWFc.hkeyClass = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "hkeyClass", "I"); - SHELLEXECUTEINFOWFc.dwHotKey = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "dwHotKey", "I"); - SHELLEXECUTEINFOWFc.hIcon = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "hIcon", "I"); - SHELLEXECUTEINFOWFc.hProcess = env->GetFieldID(SHELLEXECUTEINFOWFc.clazz, "hProcess", "I"); - SHELLEXECUTEINFOWFc.cached = 1; -} - -SHELLEXECUTEINFOW *getSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct) -{ - if (!SHELLEXECUTEINFOWFc.cached) cacheSHELLEXECUTEINFOWFields(env, lpObject); - lpStruct->cbSize = env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.cbSize); - lpStruct->fMask = env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.fMask); - lpStruct->hwnd = (HWND)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.hwnd); - lpStruct->lpVerb = (LPWSTR)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.lpVerb); - lpStruct->lpFile = (LPWSTR)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.lpFile); - lpStruct->lpParameters = (LPWSTR)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.lpParameters); - lpStruct->lpDirectory = (LPWSTR)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.lpDirectory); - lpStruct->nShow = env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.nShow); - lpStruct->hInstApp = (HINSTANCE)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.hInstApp); - lpStruct->lpIDList = (LPVOID)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.lpIDList); - lpStruct->lpClass = (LPWSTR)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.lpClass); - lpStruct->hkeyClass = (HKEY)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.hkeyClass); - lpStruct->dwHotKey = env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.dwHotKey); - lpStruct->hIcon = (HANDLE)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.hIcon); - lpStruct->hProcess = (HANDLE)env->GetIntField(lpObject, SHELLEXECUTEINFOWFc.hProcess); - return lpStruct; -} - -void setSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct) -{ - if (!SHELLEXECUTEINFOWFc.cached) cacheSHELLEXECUTEINFOWFields(env, lpObject); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.cbSize, (jint)lpStruct->cbSize); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.fMask, (jint)lpStruct->fMask); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.hwnd, (jint)lpStruct->hwnd); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.lpVerb, (jint)lpStruct->lpVerb); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.lpFile, (jint)lpStruct->lpFile); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.lpParameters, (jint)lpStruct->lpParameters); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.lpDirectory, (jint)lpStruct->lpDirectory); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.nShow, (jint)lpStruct->nShow); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.hInstApp, (jint)lpStruct->hInstApp); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.lpIDList, (jint)lpStruct->lpIDList); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.lpClass, (jint)lpStruct->lpClass); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.hkeyClass, (jint)lpStruct->hkeyClass); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.dwHotKey, (jint)lpStruct->dwHotKey); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.hIcon, (jint)lpStruct->hIcon); - env->SetIntField(lpObject, SHELLEXECUTEINFOWFc.hProcess, (jint)lpStruct->hProcess); -} -#endif - -#ifndef NO_STARTUPINFOW -typedef struct STARTUPINFOW_FID_CACHE { - int cached; - jclass clazz; - jfieldID cb, lpReserved, lpDesktop, lpTitle, dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags, wShowWindow, cbReserved2, lpReserved2, hStdInput, hStdOutput, hStdError; -} STARTUPINFOW_FID_CACHE; - -STARTUPINFOW_FID_CACHE STARTUPINFOWFc; - -void cacheSTARTUPINFOWFields(JNIEnv *env, jobject lpObject) -{ - if (STARTUPINFOWFc.cached) return; - STARTUPINFOWFc.clazz = env->GetObjectClass(lpObject); - STARTUPINFOWFc.cb = env->GetFieldID(STARTUPINFOWFc.clazz, "cb", "I"); - STARTUPINFOWFc.lpReserved = env->GetFieldID(STARTUPINFOWFc.clazz, "lpReserved", "I"); - STARTUPINFOWFc.lpDesktop = env->GetFieldID(STARTUPINFOWFc.clazz, "lpDesktop", "I"); - STARTUPINFOWFc.lpTitle = env->GetFieldID(STARTUPINFOWFc.clazz, "lpTitle", "I"); - STARTUPINFOWFc.dwX = env->GetFieldID(STARTUPINFOWFc.clazz, "dwX", "I"); - STARTUPINFOWFc.dwY = env->GetFieldID(STARTUPINFOWFc.clazz, "dwY", "I"); - STARTUPINFOWFc.dwXSize = env->GetFieldID(STARTUPINFOWFc.clazz, "dwXSize", "I"); - STARTUPINFOWFc.dwYSize = env->GetFieldID(STARTUPINFOWFc.clazz, "dwYSize", "I"); - STARTUPINFOWFc.dwXCountChars = env->GetFieldID(STARTUPINFOWFc.clazz, "dwXCountChars", "I"); - STARTUPINFOWFc.dwYCountChars = env->GetFieldID(STARTUPINFOWFc.clazz, "dwYCountChars", "I"); - STARTUPINFOWFc.dwFillAttribute = env->GetFieldID(STARTUPINFOWFc.clazz, "dwFillAttribute", "I"); - STARTUPINFOWFc.dwFlags = env->GetFieldID(STARTUPINFOWFc.clazz, "dwFlags", "I"); - STARTUPINFOWFc.wShowWindow = env->GetFieldID(STARTUPINFOWFc.clazz, "wShowWindow", "S"); - STARTUPINFOWFc.cbReserved2 = env->GetFieldID(STARTUPINFOWFc.clazz, "cbReserved2", "S"); - STARTUPINFOWFc.lpReserved2 = env->GetFieldID(STARTUPINFOWFc.clazz, "lpReserved2", "I"); - STARTUPINFOWFc.hStdInput = env->GetFieldID(STARTUPINFOWFc.clazz, "hStdInput", "I"); - STARTUPINFOWFc.hStdOutput = env->GetFieldID(STARTUPINFOWFc.clazz, "hStdOutput", "I"); - STARTUPINFOWFc.hStdError = env->GetFieldID(STARTUPINFOWFc.clazz, "hStdError", "I"); - STARTUPINFOWFc.cached = 1; -} - -STARTUPINFOW *getSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct) -{ - if (!STARTUPINFOWFc.cached) cacheSTARTUPINFOWFields(env, lpObject); - lpStruct->cb = env->GetIntField(lpObject, STARTUPINFOWFc.cb); - lpStruct->lpReserved = (LPWSTR)env->GetIntField(lpObject, STARTUPINFOWFc.lpReserved); - lpStruct->lpDesktop = (LPWSTR)env->GetIntField(lpObject, STARTUPINFOWFc.lpDesktop); - lpStruct->lpTitle = (LPWSTR)env->GetIntField(lpObject, STARTUPINFOWFc.lpTitle); - lpStruct->dwX = env->GetIntField(lpObject, STARTUPINFOWFc.dwX); - lpStruct->dwY = env->GetIntField(lpObject, STARTUPINFOWFc.dwY); - lpStruct->dwXSize = env->GetIntField(lpObject, STARTUPINFOWFc.dwXSize); - lpStruct->dwYSize = env->GetIntField(lpObject, STARTUPINFOWFc.dwYSize); - lpStruct->dwXCountChars = env->GetIntField(lpObject, STARTUPINFOWFc.dwXCountChars); - lpStruct->dwYCountChars = env->GetIntField(lpObject, STARTUPINFOWFc.dwYCountChars); - lpStruct->dwFillAttribute = env->GetIntField(lpObject, STARTUPINFOWFc.dwFillAttribute); - lpStruct->dwFlags = env->GetIntField(lpObject, STARTUPINFOWFc.dwFlags); - lpStruct->wShowWindow = env->GetShortField(lpObject, STARTUPINFOWFc.wShowWindow); - lpStruct->cbReserved2 = env->GetShortField(lpObject, STARTUPINFOWFc.cbReserved2); - lpStruct->lpReserved2 = (LPBYTE)env->GetIntField(lpObject, STARTUPINFOWFc.lpReserved2); - lpStruct->hStdInput = (HANDLE)env->GetIntField(lpObject, STARTUPINFOWFc.hStdInput); - lpStruct->hStdOutput = (HANDLE)env->GetIntField(lpObject, STARTUPINFOWFc.hStdOutput); - lpStruct->hStdError = (HANDLE)env->GetIntField(lpObject, STARTUPINFOWFc.hStdError); - return lpStruct; -} - -void setSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct) -{ - if (!STARTUPINFOWFc.cached) cacheSTARTUPINFOWFields(env, lpObject); - env->SetIntField(lpObject, STARTUPINFOWFc.cb, (jint)lpStruct->cb); - env->SetIntField(lpObject, STARTUPINFOWFc.lpReserved, (jint)lpStruct->lpReserved); - env->SetIntField(lpObject, STARTUPINFOWFc.lpDesktop, (jint)lpStruct->lpDesktop); - env->SetIntField(lpObject, STARTUPINFOWFc.lpTitle, (jint)lpStruct->lpTitle); - env->SetIntField(lpObject, STARTUPINFOWFc.dwX, (jint)lpStruct->dwX); - env->SetIntField(lpObject, STARTUPINFOWFc.dwY, (jint)lpStruct->dwY); - env->SetIntField(lpObject, STARTUPINFOWFc.dwXSize, (jint)lpStruct->dwXSize); - env->SetIntField(lpObject, STARTUPINFOWFc.dwYSize, (jint)lpStruct->dwYSize); - env->SetIntField(lpObject, STARTUPINFOWFc.dwXCountChars, (jint)lpStruct->dwXCountChars); - env->SetIntField(lpObject, STARTUPINFOWFc.dwYCountChars, (jint)lpStruct->dwYCountChars); - env->SetIntField(lpObject, STARTUPINFOWFc.dwFillAttribute, (jint)lpStruct->dwFillAttribute); - env->SetIntField(lpObject, STARTUPINFOWFc.dwFlags, (jint)lpStruct->dwFlags); - env->SetShortField(lpObject, STARTUPINFOWFc.wShowWindow, (jshort)lpStruct->wShowWindow); - env->SetShortField(lpObject, STARTUPINFOWFc.cbReserved2, (jshort)lpStruct->cbReserved2); - env->SetIntField(lpObject, STARTUPINFOWFc.lpReserved2, (jint)lpStruct->lpReserved2); - env->SetIntField(lpObject, STARTUPINFOWFc.hStdInput, (jint)lpStruct->hStdInput); - env->SetIntField(lpObject, STARTUPINFOWFc.hStdOutput, (jint)lpStruct->hStdOutput); - env->SetIntField(lpObject, STARTUPINFOWFc.hStdError, (jint)lpStruct->hStdError); -} -#endif - +#include "os_structs.h"
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.h index 46d36239e4..47ee4e9a14 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_structs.h @@ -11,63 +11,3 @@ #include "os.h" -#ifndef NO_ICONINFO -void cacheICONINFOFields(JNIEnv *env, jobject lpObject); -ICONINFO *getICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct); -void setICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct); -#define ICONINFO_sizeof() sizeof(ICONINFO) -#else -#define cacheICONINFOFields(a,b) -#define getICONINFOFields(a,b,c) NULL -#define setICONINFOFields(a,b,c) -#define ICONINFO_sizeof() 0 -#endif - -#ifndef NO_POINT -void cachePOINTFields(JNIEnv *env, jobject lpObject); -POINT *getPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct); -void setPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct); -#define POINT_sizeof() sizeof(POINT) -#else -#define cachePOINTFields(a,b) -#define getPOINTFields(a,b,c) NULL -#define setPOINTFields(a,b,c) -#define POINT_sizeof() 0 -#endif - -#ifndef NO_PROCESS_INFORMATION -void cachePROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject); -PROCESS_INFORMATION *getPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct); -void setPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct); -#define PROCESS_INFORMATION_sizeof() sizeof(PROCESS_INFORMATION) -#else -#define cachePROCESS_INFORMATIONFields(a,b) -#define getPROCESS_INFORMATIONFields(a,b,c) NULL -#define setPROCESS_INFORMATIONFields(a,b,c) -#define PROCESS_INFORMATION_sizeof() 0 -#endif - -#ifndef NO_SHELLEXECUTEINFOW -void cacheSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject); -SHELLEXECUTEINFOW *getSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct); -void setSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct); -#define SHELLEXECUTEINFOW_sizeof() sizeof(SHELLEXECUTEINFOW) -#else -#define cacheSHELLEXECUTEINFOWFields(a,b) -#define getSHELLEXECUTEINFOWFields(a,b,c) NULL -#define setSHELLEXECUTEINFOWFields(a,b,c) -#define SHELLEXECUTEINFOW_sizeof() 0 -#endif - -#ifndef NO_STARTUPINFOW -void cacheSTARTUPINFOWFields(JNIEnv *env, jobject lpObject); -STARTUPINFOW *getSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct); -void setSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct); -#define STARTUPINFOW_sizeof() sizeof(STARTUPINFOW) -#else -#define cacheSTARTUPINFOWFields(a,b) -#define getSTARTUPINFOWFields(a,b,c) NULL -#define setSTARTUPINFOWFields(a,b,c) -#define STARTUPINFOW_sizeof() 0 -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/COM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/COM.java deleted file mode 100644 index 44ad5abe92..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/COM.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.wpf; - - -import org.eclipse.swt.internal.*; - -public class COM extends Platform { - static { - Library.loadLibrary ("swt-com"); //$NON-NLS-1$ - } - -public static final native int OleInitialize(int reserved); -public static final native void OleUninitialize(); - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java index 160cd4022f..7e2395c987 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java @@ -351,26 +351,8 @@ public class OS extends C { public static final int RelativeSourceMode_FindAncestor = 3; - /** GDI+ constants */ - public static final int PixelFormat_Format24bppRgb = 137224; - public static final int PixelFormat_Format32bppRgb = 139273; - public static final int PixelFormat_Format32bppArgb = 2498570; - public static final int PixelFormat_Format16bppRgb555 = 135173; - public static final int PixelFormat_Format16bppRgb565 = 135174; - public static final int PixelFormat_Format16bppArgb1555 = 397319; - public static final int DialogResult_OK = 1; + public static final int DialogResult_OK = 1; - public static final int OIC_BANG = 0x7F03; - public static final int OIC_HAND = 0x7F01; - public static final int OIC_INFORMATION = 0x7F04; - public static final int OIC_QUES = 0x7F02; - public static final int OIC_WINLOGO = 0x7F05; - public static final int IMAGE_ICON = 0x1; - public static final int LR_SHARED = 0x8000; - - public static int HEAP_ZERO_MEMORY = 0x8; - public static int SW_SHOW = 0x5; - /* * Note that these GCHandles are leaked. @@ -385,34 +367,6 @@ public class OS extends C { public static final int Colors_Black = Colors_Black(); public static final int Colors_Transparent = Colors_Transparent(); public static final int SystemColors_ControlColor = SystemColors_ControlColor(); - - -/** Win32 Natives */ -public static final native boolean CloseHandle(int hObject); -public static final native int CreateCursor (int hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte [] pvANDPlane, byte [] pvXORPlane); -public static final native boolean CreateProcessW(int lpApplicationName, char [] lpCommandLine, int lpProcessAttributes, int lpThreadAttributes, boolean bInheritHandles, int dwCreationFlags, int lpEnvironment, int lpCurrentDirectory, STARTUPINFOW lpStartupInfo, PROCESS_INFORMATION lpProcessInformation); -public static final native int CreateIconIndirect (ICONINFO lplf); -public static final native boolean DeleteObject (int hGdiObj); -public static final native boolean DestroyIcon (int hIcon); -public static final native void EnableWindow(int window, boolean enabled); -public static final native int ExtractIconExW(char[] lpszFile, int nIconIndex, int [] phiconLarge, int [] phiconSmall, int nIcons); -public static final native void GetCursorPos (POINT point); -public static final native boolean GetIconInfo (int hIcon, ICONINFO piconinfo); -public static final native boolean GetKeyboardState (byte [] lpKeyState); -public static final native int GetProcessHeap(); -public static final native int GetModuleHandleW (char [] lpModuleName); -public static final native int HeapAlloc (int hHeap, int dwFlags, int dwBytes); -public static final native boolean HeapFree (int hHeap, int dwFlags, int lpMem); -public static final native int LoadImage (int hinst, int lpszName, int uType, int cxDesired, int cyDesired, int fuLoad); -public static final native int MapVirtualKeyW (int uCode, int uMapType); -public static final native void MoveMemory (int Destination, char [] Source, int Length); -public static final native int PROCESS_INFORMATION_sizeof(); -public static final native int SetCursorPos (int x, int y); -public static final native boolean ShellExecuteExW(SHELLEXECUTEINFOW lpExecInfo); -public static final native int SHELLEXECUTEINFOW_sizeof(); -public static final native int STARTUPINFOW_sizeof(); -public static final native int ToUnicode(int wVirtKey, int wScanCode, byte [] lpKeyState, char [] pwszBuff, int cchBuff, int wFlags); - /** Handlers */ public static final native int gcnew_CancelEventHandler(int jniRef, String string); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32.c b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32.c new file mode 100644 index 0000000000..5a42d7bb59 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32.c @@ -0,0 +1,413 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "swt.h" +#include "win32_structs.h" +#include "win32_stats.h" + +#define Win32_NATIVE(func) Java_org_eclipse_swt_internal_win32_Win32_##func + +#ifndef NO_CloseHandle +JNIEXPORT jboolean JNICALL Win32_NATIVE(CloseHandle) + (JNIEnv *env, jclass that, jint arg0) +{ + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, CloseHandle_FUNC); + rc = (jboolean)CloseHandle((HANDLE)arg0); + Win32_NATIVE_EXIT(env, that, CloseHandle_FUNC); + return rc; +} +#endif + +#ifndef NO_CreateCursor +JNIEXPORT jint JNICALL Win32_NATIVE(CreateCursor) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6) +{ + jbyte *lparg5=NULL; + jbyte *lparg6=NULL; + jint rc = 0; + Win32_NATIVE_ENTER(env, that, CreateCursor_FUNC); +#ifdef JNI_VERSION_1_2 + if (IS_JNI_1_2) { + if (arg5) if ((lparg5 = (*env)->GetPrimitiveArrayCritical(env, arg5, NULL)) == NULL) goto fail; + if (arg6) if ((lparg6 = (*env)->GetPrimitiveArrayCritical(env, arg6, NULL)) == NULL) goto fail; + } else +#endif + { + if (arg5) if ((lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL)) == NULL) goto fail; + if (arg6) if ((lparg6 = (*env)->GetByteArrayElements(env, arg6, NULL)) == NULL) goto fail; + } + rc = (jint)CreateCursor((HINSTANCE)arg0, arg1, arg2, arg3, arg4, (CONST VOID *)lparg5, (CONST VOID *)lparg6); +fail: +#ifdef JNI_VERSION_1_2 + if (IS_JNI_1_2) { + if (arg6 && lparg6) (*env)->ReleasePrimitiveArrayCritical(env, arg6, lparg6, JNI_ABORT); + if (arg5 && lparg5) (*env)->ReleasePrimitiveArrayCritical(env, arg5, lparg5, JNI_ABORT); + } else +#endif + { + if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, JNI_ABORT); + if (arg5 && lparg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, JNI_ABORT); + } + Win32_NATIVE_EXIT(env, that, CreateCursor_FUNC); + return rc; +} +#endif + +#ifndef NO_CreateIconIndirect +JNIEXPORT jint JNICALL Win32_NATIVE(CreateIconIndirect) + (JNIEnv *env, jclass that, jobject arg0) +{ + ICONINFO _arg0, *lparg0=NULL; + jint rc = 0; + Win32_NATIVE_ENTER(env, that, CreateIconIndirect_FUNC); + if (arg0) if ((lparg0 = getICONINFOFields(env, arg0, &_arg0)) == NULL) goto fail; + rc = (jint)CreateIconIndirect(lparg0); +fail: + if (arg0 && lparg0) setICONINFOFields(env, arg0, lparg0); + Win32_NATIVE_EXIT(env, that, CreateIconIndirect_FUNC); + return rc; +} +#endif + +#ifndef NO_CreateProcessW +JNIEXPORT jboolean JNICALL Win32_NATIVE(CreateProcessW) + (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2, jint arg3, jboolean arg4, jint arg5, jint arg6, jint arg7, jobject arg8, jobject arg9) +{ + jchar *lparg1=NULL; + STARTUPINFOW _arg8, *lparg8=NULL; + PROCESS_INFORMATION _arg9, *lparg9=NULL; + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, CreateProcessW_FUNC); + if (arg1) if ((lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg8) if ((lparg8 = getSTARTUPINFOWFields(env, arg8, &_arg8)) == NULL) goto fail; + if (arg9) if ((lparg9 = getPROCESS_INFORMATIONFields(env, arg9, &_arg9)) == NULL) goto fail; + rc = (jboolean)CreateProcessW((LPCWSTR)arg0, (LPWSTR)lparg1, (LPSECURITY_ATTRIBUTES)arg2, (LPSECURITY_ATTRIBUTES)arg3, arg4, (DWORD)arg5, (LPVOID)arg6, (LPCWSTR)arg7, (LPSTARTUPINFOW)lparg8, (LPPROCESS_INFORMATION)lparg9); +fail: + if (arg9 && lparg9) setPROCESS_INFORMATIONFields(env, arg9, lparg9); + if (arg8 && lparg8) setSTARTUPINFOWFields(env, arg8, lparg8); + if (arg1 && lparg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0); + Win32_NATIVE_EXIT(env, that, CreateProcessW_FUNC); + return rc; +} +#endif + +#ifndef NO_DeleteObject +JNIEXPORT jboolean JNICALL Win32_NATIVE(DeleteObject) + (JNIEnv *env, jclass that, jint arg0) +{ + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, DeleteObject_FUNC); + rc = (jboolean)DeleteObject((HGDIOBJ)arg0); + Win32_NATIVE_EXIT(env, that, DeleteObject_FUNC); + return rc; +} +#endif + +#ifndef NO_DestroyIcon +JNIEXPORT jboolean JNICALL Win32_NATIVE(DestroyIcon) + (JNIEnv *env, jclass that, jint arg0) +{ + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, DestroyIcon_FUNC); + rc = (jboolean)DestroyIcon((HICON)arg0); + Win32_NATIVE_EXIT(env, that, DestroyIcon_FUNC); + return rc; +} +#endif + +#ifndef NO_EnableWindow +JNIEXPORT void JNICALL Win32_NATIVE(EnableWindow) + (JNIEnv *env, jclass that, jint arg0, jboolean arg1) +{ + Win32_NATIVE_ENTER(env, that, EnableWindow_FUNC); + EnableWindow((HWND)arg0, arg1); + Win32_NATIVE_EXIT(env, that, EnableWindow_FUNC); +} +#endif + +#ifndef NO_ExtractIconExW +JNIEXPORT jint JNICALL Win32_NATIVE(ExtractIconExW) + (JNIEnv *env, jclass that, jcharArray arg0, jint arg1, jintArray arg2, jintArray arg3, jint arg4) +{ + jchar *lparg0=NULL; + jint *lparg2=NULL; + jint *lparg3=NULL; + jint rc = 0; + Win32_NATIVE_ENTER(env, that, ExtractIconExW_FUNC); + if (arg0) if ((lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail; + rc = (jint)ExtractIconExW((LPCWSTR)lparg0, arg1, (HICON*)lparg2, (HICON*)lparg3, (UINT)arg4); +fail: + if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + if (arg0 && lparg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0); + Win32_NATIVE_EXIT(env, that, ExtractIconExW_FUNC); + return rc; +} +#endif + +#ifndef NO_GetCursorPos +JNIEXPORT void JNICALL Win32_NATIVE(GetCursorPos) + (JNIEnv *env, jclass that, jobject arg0) +{ + POINT _arg0, *lparg0=NULL; + Win32_NATIVE_ENTER(env, that, GetCursorPos_FUNC); + if (arg0) if ((lparg0 = getPOINTFields(env, arg0, &_arg0)) == NULL) goto fail; + GetCursorPos((LPPOINT)lparg0); +fail: + if (arg0 && lparg0) setPOINTFields(env, arg0, lparg0); + Win32_NATIVE_EXIT(env, that, GetCursorPos_FUNC); +} +#endif + +#ifndef NO_GetIconInfo +JNIEXPORT jboolean JNICALL Win32_NATIVE(GetIconInfo) + (JNIEnv *env, jclass that, jint arg0, jobject arg1) +{ + ICONINFO _arg1, *lparg1=NULL; + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, GetIconInfo_FUNC); + if (arg1) if ((lparg1 = getICONINFOFields(env, arg1, &_arg1)) == NULL) goto fail; + rc = (jboolean)GetIconInfo((HICON)arg0, lparg1); +fail: + if (arg1 && lparg1) setICONINFOFields(env, arg1, lparg1); + Win32_NATIVE_EXIT(env, that, GetIconInfo_FUNC); + return rc; +} +#endif + +#ifndef NO_GetKeyboardState +JNIEXPORT jboolean JNICALL Win32_NATIVE(GetKeyboardState) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, GetKeyboardState_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jboolean)GetKeyboardState((PBYTE)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + Win32_NATIVE_EXIT(env, that, GetKeyboardState_FUNC); + return rc; +} +#endif + +#ifndef NO_GetModuleHandleW +JNIEXPORT jint JNICALL Win32_NATIVE(GetModuleHandleW) + (JNIEnv *env, jclass that, jcharArray arg0) +{ + jchar *lparg0=NULL; + jint rc = 0; + Win32_NATIVE_ENTER(env, that, GetModuleHandleW_FUNC); + if (arg0) if ((lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jint)GetModuleHandleW((LPCWSTR)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0); + Win32_NATIVE_EXIT(env, that, GetModuleHandleW_FUNC); + return rc; +} +#endif + +#ifndef NO_GetProcessHeap +JNIEXPORT jint JNICALL Win32_NATIVE(GetProcessHeap) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, GetProcessHeap_FUNC); + rc = (jint)GetProcessHeap(); + Win32_NATIVE_EXIT(env, that, GetProcessHeap_FUNC); + return rc; +} +#endif + +#ifndef NO_HeapAlloc +JNIEXPORT jint JNICALL Win32_NATIVE(HeapAlloc) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, HeapAlloc_FUNC); + rc = (jint)HeapAlloc((HANDLE)arg0, arg1, arg2); + Win32_NATIVE_EXIT(env, that, HeapAlloc_FUNC); + return rc; +} +#endif + +#ifndef NO_HeapFree +JNIEXPORT jboolean JNICALL Win32_NATIVE(HeapFree) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) +{ + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, HeapFree_FUNC); + rc = (jboolean)HeapFree((HANDLE)arg0, arg1, (LPVOID)arg2); + Win32_NATIVE_EXIT(env, that, HeapFree_FUNC); + return rc; +} +#endif + +#ifndef NO_LoadImage +JNIEXPORT jint JNICALL Win32_NATIVE(LoadImage) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, LoadImage_FUNC); + rc = (jint)LoadImage((HINSTANCE)arg0, (LPCTSTR)arg1, (UINT)arg2, arg3, arg4, (UINT)arg5); + Win32_NATIVE_EXIT(env, that, LoadImage_FUNC); + return rc; +} +#endif + +#ifndef NO_MapVirtualKeyW +JNIEXPORT jint JNICALL Win32_NATIVE(MapVirtualKeyW) + (JNIEnv *env, jclass that, jint arg0, jint arg1) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, MapVirtualKeyW_FUNC); + rc = (jint)MapVirtualKeyW(arg0, arg1); + Win32_NATIVE_EXIT(env, that, MapVirtualKeyW_FUNC); + return rc; +} +#endif + +#ifndef NO_MoveMemory +JNIEXPORT void JNICALL Win32_NATIVE(MoveMemory) + (JNIEnv *env, jclass that, jint arg0, jcharArray arg1, jint arg2) +{ + jchar *lparg1=NULL; + Win32_NATIVE_ENTER(env, that, MoveMemory_FUNC); +#ifdef JNI_VERSION_1_2 + if (IS_JNI_1_2) { + if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail; + } else +#endif + { + if (arg1) if ((lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL)) == NULL) goto fail; + } + MoveMemory((PVOID)arg0, (CONST VOID *)lparg1, arg2); +fail: +#ifdef JNI_VERSION_1_2 + if (IS_JNI_1_2) { + if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT); + } else +#endif + { + if (arg1 && lparg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, JNI_ABORT); + } + Win32_NATIVE_EXIT(env, that, MoveMemory_FUNC); +} +#endif + +#ifndef NO_OleInitialize +JNIEXPORT jint JNICALL Win32_NATIVE(OleInitialize) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, OleInitialize_FUNC); + rc = (jint)OleInitialize((LPVOID)arg0); + Win32_NATIVE_EXIT(env, that, OleInitialize_FUNC); + return rc; +} +#endif + +#ifndef NO_OleUninitialize +JNIEXPORT void JNICALL Win32_NATIVE(OleUninitialize) + (JNIEnv *env, jclass that) +{ + Win32_NATIVE_ENTER(env, that, OleUninitialize_FUNC); + OleUninitialize(); + Win32_NATIVE_EXIT(env, that, OleUninitialize_FUNC); +} +#endif + +#ifndef NO_PROCESS_1INFORMATION_1sizeof +JNIEXPORT jint JNICALL Win32_NATIVE(PROCESS_1INFORMATION_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, PROCESS_1INFORMATION_1sizeof_FUNC); + rc = (jint)PROCESS_INFORMATION_sizeof(); + Win32_NATIVE_EXIT(env, that, PROCESS_1INFORMATION_1sizeof_FUNC); + return rc; +} +#endif + +#ifndef NO_SHELLEXECUTEINFOW_1sizeof +JNIEXPORT jint JNICALL Win32_NATIVE(SHELLEXECUTEINFOW_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, SHELLEXECUTEINFOW_1sizeof_FUNC); + rc = (jint)SHELLEXECUTEINFOW_sizeof(); + Win32_NATIVE_EXIT(env, that, SHELLEXECUTEINFOW_1sizeof_FUNC); + return rc; +} +#endif + +#ifndef NO_STARTUPINFOW_1sizeof +JNIEXPORT jint JNICALL Win32_NATIVE(STARTUPINFOW_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, STARTUPINFOW_1sizeof_FUNC); + rc = (jint)STARTUPINFOW_sizeof(); + Win32_NATIVE_EXIT(env, that, STARTUPINFOW_1sizeof_FUNC); + return rc; +} +#endif + +#ifndef NO_SetCursorPos +JNIEXPORT jint JNICALL Win32_NATIVE(SetCursorPos) + (JNIEnv *env, jclass that, jint arg0, jint arg1) +{ + jint rc = 0; + Win32_NATIVE_ENTER(env, that, SetCursorPos_FUNC); + rc = (jint)SetCursorPos(arg0, arg1); + Win32_NATIVE_EXIT(env, that, SetCursorPos_FUNC); + return rc; +} +#endif + +#ifndef NO_ShellExecuteExW +JNIEXPORT jboolean JNICALL Win32_NATIVE(ShellExecuteExW) + (JNIEnv *env, jclass that, jobject arg0) +{ + SHELLEXECUTEINFOW _arg0, *lparg0=NULL; + jboolean rc = 0; + Win32_NATIVE_ENTER(env, that, ShellExecuteExW_FUNC); + if (arg0) if ((lparg0 = getSHELLEXECUTEINFOWFields(env, arg0, &_arg0)) == NULL) goto fail; + rc = (jboolean)ShellExecuteExW((LPSHELLEXECUTEINFOW)lparg0); +fail: + if (arg0 && lparg0) setSHELLEXECUTEINFOWFields(env, arg0, lparg0); + Win32_NATIVE_EXIT(env, that, ShellExecuteExW_FUNC); + return rc; +} +#endif + +#ifndef NO_ToUnicode +JNIEXPORT jint JNICALL Win32_NATIVE(ToUnicode) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jcharArray arg3, jint arg4, jint arg5) +{ + jbyte *lparg2=NULL; + jchar *lparg3=NULL; + jint rc = 0; + Win32_NATIVE_ENTER(env, that, ToUnicode_FUNC); + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetCharArrayElements(env, arg3, NULL)) == NULL) goto fail; + rc = (jint)ToUnicode(arg0, arg1, (PBYTE)lparg2, (LPWSTR)lparg3, arg4, arg5); +fail: + if (arg3 && lparg3) (*env)->ReleaseCharArrayElements(env, arg3, lparg3, 0); + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + Win32_NATIVE_EXIT(env, that, ToUnicode_FUNC); + return rc; +} +#endif + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32.h index 498a91812f..1d6f24b935 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/com.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32.h @@ -9,6 +9,14 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ +#ifndef INC_win32_H +#define INC_win32_H + + #include "swt.h" #include <ole2.h> #include <objbase.h> +#include <string.h> +#include <windows.h> + +#endif /* INC_win32_H */
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_stats.c new file mode 100644 index 0000000000..ba24afe2d4 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_stats.c @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "swt.h" +#include "win32_stats.h" + +#ifdef NATIVE_STATS + +int Win32_nativeFunctionCount = 26; +int Win32_nativeFunctionCallCount[26]; +char * Win32_nativeFunctionNames[] = { + "CloseHandle", + "CreateCursor", + "CreateIconIndirect", + "CreateProcessW", + "DeleteObject", + "DestroyIcon", + "EnableWindow", + "ExtractIconExW", + "GetCursorPos", + "GetIconInfo", + "GetKeyboardState", + "GetModuleHandleW", + "GetProcessHeap", + "HeapAlloc", + "HeapFree", + "LoadImage", + "MapVirtualKeyW", + "MoveMemory", + "OleInitialize", + "OleUninitialize", + "PROCESS_1INFORMATION_1sizeof", + "SHELLEXECUTEINFOW_1sizeof", + "STARTUPINFOW_1sizeof", + "SetCursorPos", + "ShellExecuteExW", + "ToUnicode", +}; + +#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func + +JNIEXPORT jint JNICALL STATS_NATIVE(Win32_1GetFunctionCount) + (JNIEnv *env, jclass that) +{ + return Win32_nativeFunctionCount; +} + +JNIEXPORT jstring JNICALL STATS_NATIVE(Win32_1GetFunctionName) + (JNIEnv *env, jclass that, jint index) +{ + return (*env)->NewStringUTF(env, Win32_nativeFunctionNames[index]); +} + +JNIEXPORT jint JNICALL STATS_NATIVE(Win32_1GetFunctionCallCount) + (JNIEnv *env, jclass that, jint index) +{ + return Win32_nativeFunctionCallCount[index]; +} + +#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_stats.h new file mode 100644 index 0000000000..e9e481dec7 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_stats.h @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#ifdef NATIVE_STATS +extern int Win32_nativeFunctionCount; +extern int Win32_nativeFunctionCallCount[]; +extern char* Win32_nativeFunctionNames[]; +#define Win32_NATIVE_ENTER(env, that, func) Win32_nativeFunctionCallCount[func]++; +#define Win32_NATIVE_EXIT(env, that, func) +#else +#ifndef Win32_NATIVE_ENTER +#define Win32_NATIVE_ENTER(env, that, func) +#endif +#ifndef Win32_NATIVE_EXIT +#define Win32_NATIVE_EXIT(env, that, func) +#endif +#endif + +typedef enum { + CloseHandle_FUNC, + CreateCursor_FUNC, + CreateIconIndirect_FUNC, + CreateProcessW_FUNC, + DeleteObject_FUNC, + DestroyIcon_FUNC, + EnableWindow_FUNC, + ExtractIconExW_FUNC, + GetCursorPos_FUNC, + GetIconInfo_FUNC, + GetKeyboardState_FUNC, + GetModuleHandleW_FUNC, + GetProcessHeap_FUNC, + HeapAlloc_FUNC, + HeapFree_FUNC, + LoadImage_FUNC, + MapVirtualKeyW_FUNC, + MoveMemory_FUNC, + OleInitialize_FUNC, + OleUninitialize_FUNC, + PROCESS_1INFORMATION_1sizeof_FUNC, + SHELLEXECUTEINFOW_1sizeof_FUNC, + STARTUPINFOW_1sizeof_FUNC, + SetCursorPos_FUNC, + ShellExecuteExW_FUNC, + ToUnicode_FUNC, +} Win32_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_structs.c new file mode 100644 index 0000000000..271c70aa5e --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_structs.c @@ -0,0 +1,286 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "swt.h" +#include "win32_structs.h" + +#ifndef NO_ICONINFO +typedef struct ICONINFO_FID_CACHE { + int cached; + jclass clazz; + jfieldID fIcon, xHotspot, yHotspot, hbmMask, hbmColor; +} ICONINFO_FID_CACHE; + +ICONINFO_FID_CACHE ICONINFOFc; + +void cacheICONINFOFields(JNIEnv *env, jobject lpObject) +{ + if (ICONINFOFc.cached) return; + ICONINFOFc.clazz = (*env)->GetObjectClass(env, lpObject); + ICONINFOFc.fIcon = (*env)->GetFieldID(env, ICONINFOFc.clazz, "fIcon", "Z"); + ICONINFOFc.xHotspot = (*env)->GetFieldID(env, ICONINFOFc.clazz, "xHotspot", "I"); + ICONINFOFc.yHotspot = (*env)->GetFieldID(env, ICONINFOFc.clazz, "yHotspot", "I"); + ICONINFOFc.hbmMask = (*env)->GetFieldID(env, ICONINFOFc.clazz, "hbmMask", "I"); + ICONINFOFc.hbmColor = (*env)->GetFieldID(env, ICONINFOFc.clazz, "hbmColor", "I"); + ICONINFOFc.cached = 1; +} + +ICONINFO *getICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct) +{ + if (!ICONINFOFc.cached) cacheICONINFOFields(env, lpObject); + lpStruct->fIcon = (*env)->GetBooleanField(env, lpObject, ICONINFOFc.fIcon); + lpStruct->xHotspot = (*env)->GetIntField(env, lpObject, ICONINFOFc.xHotspot); + lpStruct->yHotspot = (*env)->GetIntField(env, lpObject, ICONINFOFc.yHotspot); + lpStruct->hbmMask = (HBITMAP)(*env)->GetIntField(env, lpObject, ICONINFOFc.hbmMask); + lpStruct->hbmColor = (HBITMAP)(*env)->GetIntField(env, lpObject, ICONINFOFc.hbmColor); + return lpStruct; +} + +void setICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct) +{ + if (!ICONINFOFc.cached) cacheICONINFOFields(env, lpObject); + (*env)->SetBooleanField(env, lpObject, ICONINFOFc.fIcon, (jboolean)lpStruct->fIcon); + (*env)->SetIntField(env, lpObject, ICONINFOFc.xHotspot, (jint)lpStruct->xHotspot); + (*env)->SetIntField(env, lpObject, ICONINFOFc.yHotspot, (jint)lpStruct->yHotspot); + (*env)->SetIntField(env, lpObject, ICONINFOFc.hbmMask, (jint)lpStruct->hbmMask); + (*env)->SetIntField(env, lpObject, ICONINFOFc.hbmColor, (jint)lpStruct->hbmColor); +} +#endif + +#ifndef NO_POINT +typedef struct POINT_FID_CACHE { + int cached; + jclass clazz; + jfieldID x, y; +} POINT_FID_CACHE; + +POINT_FID_CACHE POINTFc; + +void cachePOINTFields(JNIEnv *env, jobject lpObject) +{ + if (POINTFc.cached) return; + POINTFc.clazz = (*env)->GetObjectClass(env, lpObject); + POINTFc.x = (*env)->GetFieldID(env, POINTFc.clazz, "x", "I"); + POINTFc.y = (*env)->GetFieldID(env, POINTFc.clazz, "y", "I"); + POINTFc.cached = 1; +} + +POINT *getPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct) +{ + if (!POINTFc.cached) cachePOINTFields(env, lpObject); + lpStruct->x = (*env)->GetIntField(env, lpObject, POINTFc.x); + lpStruct->y = (*env)->GetIntField(env, lpObject, POINTFc.y); + return lpStruct; +} + +void setPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct) +{ + if (!POINTFc.cached) cachePOINTFields(env, lpObject); + (*env)->SetIntField(env, lpObject, POINTFc.x, (jint)lpStruct->x); + (*env)->SetIntField(env, lpObject, POINTFc.y, (jint)lpStruct->y); +} +#endif + +#ifndef NO_PROCESS_INFORMATION +typedef struct PROCESS_INFORMATION_FID_CACHE { + int cached; + jclass clazz; + jfieldID hProcess, hThread, dwProcessId, dwThreadId; +} PROCESS_INFORMATION_FID_CACHE; + +PROCESS_INFORMATION_FID_CACHE PROCESS_INFORMATIONFc; + +void cachePROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject) +{ + if (PROCESS_INFORMATIONFc.cached) return; + PROCESS_INFORMATIONFc.clazz = (*env)->GetObjectClass(env, lpObject); + PROCESS_INFORMATIONFc.hProcess = (*env)->GetFieldID(env, PROCESS_INFORMATIONFc.clazz, "hProcess", "I"); + PROCESS_INFORMATIONFc.hThread = (*env)->GetFieldID(env, PROCESS_INFORMATIONFc.clazz, "hThread", "I"); + PROCESS_INFORMATIONFc.dwProcessId = (*env)->GetFieldID(env, PROCESS_INFORMATIONFc.clazz, "dwProcessId", "I"); + PROCESS_INFORMATIONFc.dwThreadId = (*env)->GetFieldID(env, PROCESS_INFORMATIONFc.clazz, "dwThreadId", "I"); + PROCESS_INFORMATIONFc.cached = 1; +} + +PROCESS_INFORMATION *getPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct) +{ + if (!PROCESS_INFORMATIONFc.cached) cachePROCESS_INFORMATIONFields(env, lpObject); + lpStruct->hProcess = (HANDLE)(*env)->GetIntField(env, lpObject, PROCESS_INFORMATIONFc.hProcess); + lpStruct->hThread = (HANDLE)(*env)->GetIntField(env, lpObject, PROCESS_INFORMATIONFc.hThread); + lpStruct->dwProcessId = (*env)->GetIntField(env, lpObject, PROCESS_INFORMATIONFc.dwProcessId); + lpStruct->dwThreadId = (*env)->GetIntField(env, lpObject, PROCESS_INFORMATIONFc.dwThreadId); + return lpStruct; +} + +void setPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct) +{ + if (!PROCESS_INFORMATIONFc.cached) cachePROCESS_INFORMATIONFields(env, lpObject); + (*env)->SetIntField(env, lpObject, PROCESS_INFORMATIONFc.hProcess, (jint)lpStruct->hProcess); + (*env)->SetIntField(env, lpObject, PROCESS_INFORMATIONFc.hThread, (jint)lpStruct->hThread); + (*env)->SetIntField(env, lpObject, PROCESS_INFORMATIONFc.dwProcessId, (jint)lpStruct->dwProcessId); + (*env)->SetIntField(env, lpObject, PROCESS_INFORMATIONFc.dwThreadId, (jint)lpStruct->dwThreadId); +} +#endif + +#ifndef NO_SHELLEXECUTEINFOW +typedef struct SHELLEXECUTEINFOW_FID_CACHE { + int cached; + jclass clazz; + jfieldID cbSize, fMask, hwnd, lpVerb, lpFile, lpParameters, lpDirectory, nShow, hInstApp, lpIDList, lpClass, hkeyClass, dwHotKey, hIcon, hProcess; +} SHELLEXECUTEINFOW_FID_CACHE; + +SHELLEXECUTEINFOW_FID_CACHE SHELLEXECUTEINFOWFc; + +void cacheSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject) +{ + if (SHELLEXECUTEINFOWFc.cached) return; + SHELLEXECUTEINFOWFc.clazz = (*env)->GetObjectClass(env, lpObject); + SHELLEXECUTEINFOWFc.cbSize = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "cbSize", "I"); + SHELLEXECUTEINFOWFc.fMask = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "fMask", "I"); + SHELLEXECUTEINFOWFc.hwnd = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "hwnd", "I"); + SHELLEXECUTEINFOWFc.lpVerb = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "lpVerb", "I"); + SHELLEXECUTEINFOWFc.lpFile = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "lpFile", "I"); + SHELLEXECUTEINFOWFc.lpParameters = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "lpParameters", "I"); + SHELLEXECUTEINFOWFc.lpDirectory = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "lpDirectory", "I"); + SHELLEXECUTEINFOWFc.nShow = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "nShow", "I"); + SHELLEXECUTEINFOWFc.hInstApp = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "hInstApp", "I"); + SHELLEXECUTEINFOWFc.lpIDList = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "lpIDList", "I"); + SHELLEXECUTEINFOWFc.lpClass = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "lpClass", "I"); + SHELLEXECUTEINFOWFc.hkeyClass = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "hkeyClass", "I"); + SHELLEXECUTEINFOWFc.dwHotKey = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "dwHotKey", "I"); + SHELLEXECUTEINFOWFc.hIcon = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "hIcon", "I"); + SHELLEXECUTEINFOWFc.hProcess = (*env)->GetFieldID(env, SHELLEXECUTEINFOWFc.clazz, "hProcess", "I"); + SHELLEXECUTEINFOWFc.cached = 1; +} + +SHELLEXECUTEINFOW *getSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct) +{ + if (!SHELLEXECUTEINFOWFc.cached) cacheSHELLEXECUTEINFOWFields(env, lpObject); + lpStruct->cbSize = (*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.cbSize); + lpStruct->fMask = (*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.fMask); + lpStruct->hwnd = (HWND)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hwnd); + lpStruct->lpVerb = (LPWSTR)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpVerb); + lpStruct->lpFile = (LPWSTR)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpFile); + lpStruct->lpParameters = (LPWSTR)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpParameters); + lpStruct->lpDirectory = (LPWSTR)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpDirectory); + lpStruct->nShow = (*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.nShow); + lpStruct->hInstApp = (HINSTANCE)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hInstApp); + lpStruct->lpIDList = (LPVOID)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpIDList); + lpStruct->lpClass = (LPWSTR)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpClass); + lpStruct->hkeyClass = (HKEY)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hkeyClass); + lpStruct->dwHotKey = (*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.dwHotKey); + lpStruct->hIcon = (HANDLE)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hIcon); + lpStruct->hProcess = (HANDLE)(*env)->GetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hProcess); + return lpStruct; +} + +void setSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct) +{ + if (!SHELLEXECUTEINFOWFc.cached) cacheSHELLEXECUTEINFOWFields(env, lpObject); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.cbSize, (jint)lpStruct->cbSize); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.fMask, (jint)lpStruct->fMask); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hwnd, (jint)lpStruct->hwnd); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpVerb, (jint)lpStruct->lpVerb); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpFile, (jint)lpStruct->lpFile); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpParameters, (jint)lpStruct->lpParameters); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpDirectory, (jint)lpStruct->lpDirectory); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.nShow, (jint)lpStruct->nShow); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hInstApp, (jint)lpStruct->hInstApp); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpIDList, (jint)lpStruct->lpIDList); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.lpClass, (jint)lpStruct->lpClass); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hkeyClass, (jint)lpStruct->hkeyClass); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.dwHotKey, (jint)lpStruct->dwHotKey); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hIcon, (jint)lpStruct->hIcon); + (*env)->SetIntField(env, lpObject, SHELLEXECUTEINFOWFc.hProcess, (jint)lpStruct->hProcess); +} +#endif + +#ifndef NO_STARTUPINFOW +typedef struct STARTUPINFOW_FID_CACHE { + int cached; + jclass clazz; + jfieldID cb, lpReserved, lpDesktop, lpTitle, dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags, wShowWindow, cbReserved2, lpReserved2, hStdInput, hStdOutput, hStdError; +} STARTUPINFOW_FID_CACHE; + +STARTUPINFOW_FID_CACHE STARTUPINFOWFc; + +void cacheSTARTUPINFOWFields(JNIEnv *env, jobject lpObject) +{ + if (STARTUPINFOWFc.cached) return; + STARTUPINFOWFc.clazz = (*env)->GetObjectClass(env, lpObject); + STARTUPINFOWFc.cb = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "cb", "I"); + STARTUPINFOWFc.lpReserved = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "lpReserved", "I"); + STARTUPINFOWFc.lpDesktop = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "lpDesktop", "I"); + STARTUPINFOWFc.lpTitle = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "lpTitle", "I"); + STARTUPINFOWFc.dwX = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwX", "I"); + STARTUPINFOWFc.dwY = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwY", "I"); + STARTUPINFOWFc.dwXSize = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwXSize", "I"); + STARTUPINFOWFc.dwYSize = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwYSize", "I"); + STARTUPINFOWFc.dwXCountChars = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwXCountChars", "I"); + STARTUPINFOWFc.dwYCountChars = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwYCountChars", "I"); + STARTUPINFOWFc.dwFillAttribute = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwFillAttribute", "I"); + STARTUPINFOWFc.dwFlags = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "dwFlags", "I"); + STARTUPINFOWFc.wShowWindow = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "wShowWindow", "S"); + STARTUPINFOWFc.cbReserved2 = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "cbReserved2", "S"); + STARTUPINFOWFc.lpReserved2 = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "lpReserved2", "I"); + STARTUPINFOWFc.hStdInput = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "hStdInput", "I"); + STARTUPINFOWFc.hStdOutput = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "hStdOutput", "I"); + STARTUPINFOWFc.hStdError = (*env)->GetFieldID(env, STARTUPINFOWFc.clazz, "hStdError", "I"); + STARTUPINFOWFc.cached = 1; +} + +STARTUPINFOW *getSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct) +{ + if (!STARTUPINFOWFc.cached) cacheSTARTUPINFOWFields(env, lpObject); + lpStruct->cb = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.cb); + lpStruct->lpReserved = (LPWSTR)(*env)->GetIntField(env, lpObject, STARTUPINFOWFc.lpReserved); + lpStruct->lpDesktop = (LPWSTR)(*env)->GetIntField(env, lpObject, STARTUPINFOWFc.lpDesktop); + lpStruct->lpTitle = (LPWSTR)(*env)->GetIntField(env, lpObject, STARTUPINFOWFc.lpTitle); + lpStruct->dwX = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwX); + lpStruct->dwY = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwY); + lpStruct->dwXSize = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwXSize); + lpStruct->dwYSize = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwYSize); + lpStruct->dwXCountChars = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwXCountChars); + lpStruct->dwYCountChars = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwYCountChars); + lpStruct->dwFillAttribute = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwFillAttribute); + lpStruct->dwFlags = (*env)->GetIntField(env, lpObject, STARTUPINFOWFc.dwFlags); + lpStruct->wShowWindow = (*env)->GetShortField(env, lpObject, STARTUPINFOWFc.wShowWindow); + lpStruct->cbReserved2 = (*env)->GetShortField(env, lpObject, STARTUPINFOWFc.cbReserved2); + lpStruct->lpReserved2 = (LPBYTE)(*env)->GetIntField(env, lpObject, STARTUPINFOWFc.lpReserved2); + lpStruct->hStdInput = (HANDLE)(*env)->GetIntField(env, lpObject, STARTUPINFOWFc.hStdInput); + lpStruct->hStdOutput = (HANDLE)(*env)->GetIntField(env, lpObject, STARTUPINFOWFc.hStdOutput); + lpStruct->hStdError = (HANDLE)(*env)->GetIntField(env, lpObject, STARTUPINFOWFc.hStdError); + return lpStruct; +} + +void setSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct) +{ + if (!STARTUPINFOWFc.cached) cacheSTARTUPINFOWFields(env, lpObject); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.cb, (jint)lpStruct->cb); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.lpReserved, (jint)lpStruct->lpReserved); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.lpDesktop, (jint)lpStruct->lpDesktop); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.lpTitle, (jint)lpStruct->lpTitle); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwX, (jint)lpStruct->dwX); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwY, (jint)lpStruct->dwY); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwXSize, (jint)lpStruct->dwXSize); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwYSize, (jint)lpStruct->dwYSize); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwXCountChars, (jint)lpStruct->dwXCountChars); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwYCountChars, (jint)lpStruct->dwYCountChars); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwFillAttribute, (jint)lpStruct->dwFillAttribute); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.dwFlags, (jint)lpStruct->dwFlags); + (*env)->SetShortField(env, lpObject, STARTUPINFOWFc.wShowWindow, (jshort)lpStruct->wShowWindow); + (*env)->SetShortField(env, lpObject, STARTUPINFOWFc.cbReserved2, (jshort)lpStruct->cbReserved2); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.lpReserved2, (jint)lpStruct->lpReserved2); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.hStdInput, (jint)lpStruct->hStdInput); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.hStdOutput, (jint)lpStruct->hStdOutput); + (*env)->SetIntField(env, lpObject, STARTUPINFOWFc.hStdError, (jint)lpStruct->hStdError); +} +#endif + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_structs.h new file mode 100644 index 0000000000..5864bb5300 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/win32_structs.h @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "win32.h" + +#ifndef NO_ICONINFO +void cacheICONINFOFields(JNIEnv *env, jobject lpObject); +ICONINFO *getICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct); +void setICONINFOFields(JNIEnv *env, jobject lpObject, ICONINFO *lpStruct); +#define ICONINFO_sizeof() sizeof(ICONINFO) +#else +#define cacheICONINFOFields(a,b) +#define getICONINFOFields(a,b,c) NULL +#define setICONINFOFields(a,b,c) +#define ICONINFO_sizeof() 0 +#endif + +#ifndef NO_POINT +void cachePOINTFields(JNIEnv *env, jobject lpObject); +POINT *getPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct); +void setPOINTFields(JNIEnv *env, jobject lpObject, POINT *lpStruct); +#define POINT_sizeof() sizeof(POINT) +#else +#define cachePOINTFields(a,b) +#define getPOINTFields(a,b,c) NULL +#define setPOINTFields(a,b,c) +#define POINT_sizeof() 0 +#endif + +#ifndef NO_PROCESS_INFORMATION +void cachePROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject); +PROCESS_INFORMATION *getPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct); +void setPROCESS_INFORMATIONFields(JNIEnv *env, jobject lpObject, PROCESS_INFORMATION *lpStruct); +#define PROCESS_INFORMATION_sizeof() sizeof(PROCESS_INFORMATION) +#else +#define cachePROCESS_INFORMATIONFields(a,b) +#define getPROCESS_INFORMATIONFields(a,b,c) NULL +#define setPROCESS_INFORMATIONFields(a,b,c) +#define PROCESS_INFORMATION_sizeof() 0 +#endif + +#ifndef NO_SHELLEXECUTEINFOW +void cacheSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject); +SHELLEXECUTEINFOW *getSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct); +void setSHELLEXECUTEINFOWFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFOW *lpStruct); +#define SHELLEXECUTEINFOW_sizeof() sizeof(SHELLEXECUTEINFOW) +#else +#define cacheSHELLEXECUTEINFOWFields(a,b) +#define getSHELLEXECUTEINFOWFields(a,b,c) NULL +#define setSHELLEXECUTEINFOWFields(a,b,c) +#define SHELLEXECUTEINFOW_sizeof() 0 +#endif + +#ifndef NO_STARTUPINFOW +void cacheSTARTUPINFOWFields(JNIEnv *env, jobject lpObject); +STARTUPINFOW *getSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct); +void setSTARTUPINFOWFields(JNIEnv *env, jobject lpObject, STARTUPINFOW *lpStruct); +#define STARTUPINFOW_sizeof() sizeof(STARTUPINFOW) +#else +#define cacheSTARTUPINFOWFields(a,b) +#define getSTARTUPINFOWFields(a,b,c) NULL +#define setSTARTUPINFOWFields(a,b,c) +#define STARTUPINFOW_sizeof() 0 +#endif + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/ICONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/ICONINFO.java index 28fc59980b..b5e2b24fb0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/ICONINFO.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/ICONINFO.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.swt.internal.wpf; +package org.eclipse.swt.internal.win32; public class ICONINFO { public boolean fIcon; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/POINT.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/POINT.java index a9b55cee10..3f07037586 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/POINT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/POINT.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.swt.internal.wpf; +package org.eclipse.swt.internal.win32; public class POINT { public int x; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/PROCESS_INFORMATION.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/PROCESS_INFORMATION.java index a95910c808..e7afbcddb5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/PROCESS_INFORMATION.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/PROCESS_INFORMATION.java @@ -8,12 +8,12 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.swt.internal.wpf; +package org.eclipse.swt.internal.win32; public class PROCESS_INFORMATION { public int /*long*/ hProcess; public int /*long*/ hThread; public int dwProcessId; public int dwThreadId; - public static int sizeof = OS.PROCESS_INFORMATION_sizeof (); + public static int sizeof = Win32.PROCESS_INFORMATION_sizeof (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/SHELLEXECUTEINFOW.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/SHELLEXECUTEINFOW.java index 9c26b2c367..0fdf629c93 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/SHELLEXECUTEINFOW.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/SHELLEXECUTEINFOW.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.swt.internal.wpf; +package org.eclipse.swt.internal.win32; public class SHELLEXECUTEINFOW { public int cbSize; @@ -31,6 +31,6 @@ public class SHELLEXECUTEINFOW { // }; public int /*long*/ hIcon; public int /*long*/ hProcess; - public static final int sizeof = OS.SHELLEXECUTEINFOW_sizeof (); + public static final int sizeof = Win32.SHELLEXECUTEINFOW_sizeof (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/STARTUPINFOW.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/STARTUPINFOW.java index 0886702cff..21b4e8c779 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/STARTUPINFOW.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/STARTUPINFOW.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.swt.internal.wpf; +package org.eclipse.swt.internal.win32; public class STARTUPINFOW { public int cb; @@ -29,5 +29,5 @@ public class STARTUPINFOW { public int /*long*/ hStdInput; public int /*long*/ hStdOutput; public int /*long*/ hStdError; - public static int sizeof = OS.STARTUPINFOW_sizeof (); + public static int sizeof = Win32.STARTUPINFOW_sizeof (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/Win32.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/Win32.java new file mode 100644 index 0000000000..4102f5fe62 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf_win32/org/eclipse/swt/internal/win32/Win32.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.win32; + + +import org.eclipse.swt.internal.*; + +public class Win32 extends C { + static { + Library.loadLibrary ("swt-win32"); //$NON-NLS-1$ + } + + /** GDI+ constants */ + public static final int PixelFormat_Format24bppRgb = 137224; + public static final int PixelFormat_Format32bppRgb = 139273; + public static final int PixelFormat_Format32bppArgb = 2498570; + public static final int PixelFormat_Format16bppRgb555 = 135173; + public static final int PixelFormat_Format16bppRgb565 = 135174; + public static final int PixelFormat_Format16bppArgb1555 = 397319; + + public static final int OIC_BANG = 0x7F03; + public static final int OIC_HAND = 0x7F01; + public static final int OIC_INFORMATION = 0x7F04; + public static final int OIC_QUES = 0x7F02; + public static final int OIC_WINLOGO = 0x7F05; + public static final int IMAGE_ICON = 0x1; + public static final int LR_SHARED = 0x8000; + + public static int HEAP_ZERO_MEMORY = 0x8; + public static int SW_SHOW = 0x5; + +/** OLE Natives */ +public static final native int OleInitialize(int reserved); +public static final native void OleUninitialize(); + +/** Win32 Natives */ +public static final native boolean CloseHandle(int hObject); +public static final native int CreateCursor (int hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte [] pvANDPlane, byte [] pvXORPlane); +public static final native boolean CreateProcessW(int lpApplicationName, char [] lpCommandLine, int lpProcessAttributes, int lpThreadAttributes, boolean bInheritHandles, int dwCreationFlags, int lpEnvironment, int lpCurrentDirectory, STARTUPINFOW lpStartupInfo, PROCESS_INFORMATION lpProcessInformation); +public static final native int CreateIconIndirect (ICONINFO lplf); +public static final native boolean DeleteObject (int hGdiObj); +public static final native boolean DestroyIcon (int hIcon); +public static final native void EnableWindow(int window, boolean enabled); +public static final native int ExtractIconExW(char[] lpszFile, int nIconIndex, int [] phiconLarge, int [] phiconSmall, int nIcons); +public static final native void GetCursorPos (POINT point); +public static final native boolean GetIconInfo (int hIcon, ICONINFO piconinfo); +public static final native boolean GetKeyboardState (byte [] lpKeyState); +public static final native int GetProcessHeap(); +public static final native int GetModuleHandleW (char [] lpModuleName); +public static final native int HeapAlloc (int hHeap, int dwFlags, int dwBytes); +public static final native boolean HeapFree (int hHeap, int dwFlags, int lpMem); +public static final native int LoadImage (int hinst, int lpszName, int uType, int cxDesired, int cyDesired, int fuLoad); +public static final native int MapVirtualKeyW (int uCode, int uMapType); +public static final native void MoveMemory (int Destination, char [] Source, int Length); +public static final native int PROCESS_INFORMATION_sizeof(); +public static final native int SetCursorPos (int x, int y); +public static final native boolean ShellExecuteExW(SHELLEXECUTEINFOW lpExecInfo); +public static final native int SHELLEXECUTEINFOW_sizeof(); +public static final native int STARTUPINFOW_sizeof(); +public static final native int ToUnicode(int wVirtKey, int wScanCode, byte [] lpKeyState, char [] pwszBuff, int cchBuff, int wFlags); + + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/wpf/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/wpf/org/eclipse/swt/program/Program.java index 1e0190ee3a..a3cf30ee5f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/wpf/org/eclipse/swt/program/Program.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/wpf/org/eclipse/swt/program/Program.java @@ -11,6 +11,7 @@ package org.eclipse.swt.program; import org.eclipse.swt.internal.wpf.*; +import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; @@ -234,19 +235,19 @@ public static Program [] getPrograms () { */ public static boolean launch (String fileName) { if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - int hHeap = OS.GetProcessHeap (); + int hHeap = Win32.GetProcessHeap (); int length = fileName.length (); char [] buffer = new char [length + 1]; fileName.getChars (0, length, buffer, 0); int byteCount = buffer.length * 2; - int lpFile = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpFile, buffer, byteCount); + int lpFile = Win32.HeapAlloc (hHeap, Win32.HEAP_ZERO_MEMORY, byteCount); + Win32.MoveMemory (lpFile, buffer, byteCount); SHELLEXECUTEINFOW info = new SHELLEXECUTEINFOW (); info.cbSize = SHELLEXECUTEINFOW.sizeof; info.lpFile = lpFile; - info.nShow = OS.SW_SHOW; - boolean result = OS.ShellExecuteExW (info); - if (lpFile != 0) OS.HeapFree (hHeap, 0, lpFile); + info.nShow = Win32.SW_SHOW; + boolean result = Win32.ShellExecuteExW (info); + if (lpFile != 0) Win32.HeapFree (hHeap, 0, lpFile); return result; } @@ -286,9 +287,9 @@ public boolean execute (String fileName) { STARTUPINFOW lpStartupInfo = new STARTUPINFOW (); lpStartupInfo.cb = STARTUPINFOW.sizeof; PROCESS_INFORMATION lpProcessInformation = new PROCESS_INFORMATION (); - boolean success = OS.CreateProcessW (0, buffer, 0, 0, false, 0, 0, 0, lpStartupInfo, lpProcessInformation); - if (lpProcessInformation.hProcess != 0) OS.CloseHandle (lpProcessInformation.hProcess); - if (lpProcessInformation.hThread != 0) OS.CloseHandle (lpProcessInformation.hThread); + boolean success = Win32.CreateProcessW (0, buffer, 0, 0, false, 0, 0, 0, lpStartupInfo, lpProcessInformation); + if (lpProcessInformation.hProcess != 0) Win32.CloseHandle (lpProcessInformation.hProcess); + if (lpProcessInformation.hThread != 0) Win32.CloseHandle (lpProcessInformation.hThread); return success; } @@ -314,7 +315,7 @@ public ImageData getImageData () { char [] buffer = new char [length + 1]; fileName.getChars (0, length, buffer, 0); int [] phiconSmall = new int [1], phiconLarge = null; - OS.ExtractIconExW (buffer, nIconIndex, phiconLarge, phiconSmall, 1); + Win32.ExtractIconExW (buffer, nIconIndex, phiconLarge, phiconSmall, 1); if (phiconSmall [0] == 0) return null; int empty = OS.Int32Rect_Empty (); int source = OS.Imaging_CreateBitmapSourceFromHIcon (phiconSmall [0], empty, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Cursor.java index 55fe007b28..44b0082149 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Cursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Cursor.java @@ -12,6 +12,8 @@ package org.eclipse.swt.graphics; import org.eclipse.swt.internal.wpf.*; +import org.eclipse.swt.internal.win32.*; + import org.eclipse.swt.*; /** @@ -194,8 +196,8 @@ public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int byte[] maskData = ImageData.convertPad(mask.data, mask.width, mask.height, mask.depth, mask.scanlinePad, 2); /* Create the cursor */ - int hInst = OS.GetModuleHandleW(null); - int cursor = OS.CreateCursor(hInst, hotspotX, hotspotY, source.width, source.height, sourceData, maskData); + int hInst = Win32.GetModuleHandleW(null); + int cursor = Win32.CreateCursor(hInst, hotspotX, hotspotY, source.width, source.height, sourceData, maskData); if (cursor == 0) SWT.error(SWT.ERROR_NO_HANDLES); int safeHandle = OS.gcnew_SWTSafeHandle(cursor, false); if (safeHandle == 0) SWT.error(SWT.ERROR_NO_HANDLES); @@ -256,7 +258,7 @@ public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) { int pixelFormat = 0; boolean transparent = source.maskData != null || source.transparentPixel != -1 || source.alpha != -1 || source.alphaData != null; if (transparent) { - pixelFormat = OS.PixelFormat_Format32bppArgb; + pixelFormat = Win32.PixelFormat_Format32bppArgb; if (!(palette.isDirect && source.depth == 32 && redMask == 0xFF00 && greenMask == 0xFF0000 && blueMask == 0xFF000000)) { newData = new ImageData(width, height, 32, new PaletteData(0xFF00, 0xFF0000, 0xFF000000)); } @@ -266,32 +268,32 @@ public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) { case 2: case 4: case 8: - pixelFormat = OS.PixelFormat_Format24bppRgb; + pixelFormat = Win32.PixelFormat_Format24bppRgb; newData = new ImageData(source.width, source.height, 24, new PaletteData(0xFF, 0xFF00, 0xFF0000)); break; case 16: if (redMask == 0x7C00 && greenMask == 0x3E0 && blueMask == 0x1F) { - pixelFormat = OS.PixelFormat_Format16bppRgb555; + pixelFormat = Win32.PixelFormat_Format16bppRgb555; } else if (redMask == 0xF800 && greenMask == 0x7E0 && blueMask == 0x1F) { - pixelFormat = OS.PixelFormat_Format16bppRgb565; + pixelFormat = Win32.PixelFormat_Format16bppRgb565; } else { - pixelFormat = OS.PixelFormat_Format16bppRgb555; + pixelFormat = Win32.PixelFormat_Format16bppRgb555; newData = new ImageData(source.width, source.height, 16, new PaletteData(0x7C00, 0x3E0, 0x1F)); } break; case 24: if (redMask == 0xFF && greenMask == 0xFF00 && blueMask == 0xFF0000) { - pixelFormat = OS.PixelFormat_Format24bppRgb; + pixelFormat = Win32.PixelFormat_Format24bppRgb; } else { - pixelFormat = OS.PixelFormat_Format24bppRgb; + pixelFormat = Win32.PixelFormat_Format24bppRgb; newData = new ImageData(source.width, source.height, 24, new PaletteData(0xFF, 0xFF00, 0xFF0000)); } break; case 32: if (redMask == 0xFF00 && greenMask == 0xFF0000 && blueMask == 0xFF000000) { - pixelFormat = OS.PixelFormat_Format32bppRgb; + pixelFormat = Win32.PixelFormat_Format32bppRgb; } else { - pixelFormat = OS.PixelFormat_Format32bppRgb; + pixelFormat = Win32.PixelFormat_Format32bppRgb; newData = new ImageData(source.width, source.height, 32, new PaletteData(0xFF00, 0xFF0000, 0xFF000000)); } break; @@ -363,14 +365,14 @@ public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) { int hIcon = OS.Bitmap_GetHicon(bitmap); if (hIcon == 0) SWT.error(SWT.ERROR_NO_HANDLES); ICONINFO info = new ICONINFO(); - OS.GetIconInfo(hIcon, info); + Win32.GetIconInfo(hIcon, info); info.fIcon = false; info.xHotspot = hotspotX; info.yHotspot = hotspotY; - OS.DestroyIcon(hIcon); - hIcon = OS.CreateIconIndirect(info); - if (info.hbmColor != 0) OS.DeleteObject(info.hbmColor); - if (info.hbmMask != 0)OS.DeleteObject(info.hbmMask); + Win32.DestroyIcon(hIcon); + hIcon = Win32.CreateIconIndirect(info); + if (info.hbmColor != 0) Win32.DeleteObject(info.hbmColor); + if (info.hbmMask != 0)Win32.DeleteObject(info.hbmMask); if (hIcon == 0) SWT.error(SWT.ERROR_NO_HANDLES); /* Create the cursor */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Device.java index b361dea014..3e1661bf8f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/graphics/Device.java @@ -23,8 +23,9 @@ public abstract class Device implements Drawable { /* Debugging */ public static boolean DEBUG; + public static boolean TRACK; boolean debug = DEBUG; - boolean tracking = DEBUG; + boolean tracking = DEBUG || TRACK; Error [] errors; Object [] objects; @@ -100,6 +101,7 @@ public Device(DeviceData data) { debug = data.debug; tracking = data.tracking; } + tracking = true; create (data); init (); if (tracking) { @@ -536,8 +538,19 @@ public boolean isDisposed () { * @since 3.3 */ public boolean loadFont (String path) { - //TODO - return false; + checkDevice(); + if (path == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + int length = path.length (); + char[] buffer = new char [length + 1]; + path.getChars (0, length, buffer, 0); + int str = OS.gcnew_String(buffer); + int uri = OS.gcnew_Uri(str, OS.UriKind_RelativeOrAbsolute); + int list = OS.Fonts_GetTypefaces(uri); + int count = OS.TypefaceCollection_Count(list); + OS.GCHandle_Free(list); + OS.GCHandle_Free(uri); + OS.GCHandle_Free(str); + return count != 0; } void new_Object (Object object) { @@ -588,6 +601,19 @@ protected void release () { colors = null; if (systemFont != null) systemFont.dispose(); systemFont = null; + if (objects != null) { + for (int i = 0; i < objects.length; i++) { + if (objects[i] != null) ((Resource)objects[i]).dispose(); + } + } + if (TRACK & objects != null) { + for (int i = 0; i < objects.length; i++) { + if (objects[i] != null) { + System.err.println(objects[i]); + errors[i].printStackTrace(); + } + } + } } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java index 93f1ff2327..1cdeca18d6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java @@ -11,6 +11,7 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.internal.wpf.*; +import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; @@ -672,7 +673,7 @@ protected void create (DeviceData data) { } void createDisplay (DeviceData data) { - COM.OleInitialize (0); + Win32.OleInitialize (0); application = OS.gcnew_Application(); if (application == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.Application_ShutdownMode (application, OS.ShutdownMode_OnExplicitShutdown); @@ -1038,7 +1039,7 @@ public Control getCursorControl () { public Point getCursorLocation () { checkDevice (); POINT pt = new POINT (); - OS.GetCursorPos (pt); + Win32.GetCursorPos (pt); return new Point (pt.x, pt.y); } @@ -1513,43 +1514,43 @@ public Image getSystemImage (int id) { switch (id) { case SWT.ICON_ERROR: { if (errorImage != null) return errorImage; - int hIcon = OS.LoadImage (0, OS.OIC_HAND, OS.IMAGE_ICON, 0, 0, OS.LR_SHARED); + int hIcon = Win32.LoadImage (0, Win32.OIC_HAND, Win32.IMAGE_ICON, 0, 0, Win32.LR_SHARED); int empty = OS.Int32Rect_Empty (); int source = OS.Imaging_CreateBitmapSourceFromHIcon (hIcon, empty, 0); errorImage = Image.wpf_new (this, SWT.BITMAP, source); OS.GCHandle_Free (empty); - OS.DestroyIcon (hIcon); + Win32.DestroyIcon (hIcon); return errorImage; } case SWT.ICON_WORKING: case SWT.ICON_INFORMATION: { if (infoImage != null) return infoImage; - int hIcon = OS.LoadImage (0, OS.OIC_INFORMATION, OS.IMAGE_ICON, 0, 0, OS.LR_SHARED); + int hIcon = Win32.LoadImage (0, Win32.OIC_INFORMATION, Win32.IMAGE_ICON, 0, 0, Win32.LR_SHARED); int empty = OS.Int32Rect_Empty (); int source = OS.Imaging_CreateBitmapSourceFromHIcon (hIcon, empty, 0); infoImage = Image.wpf_new (this, SWT.BITMAP, source); OS.GCHandle_Free (empty); - OS.DestroyIcon (hIcon); + Win32.DestroyIcon (hIcon); return infoImage; } case SWT.ICON_QUESTION: { if (questionImage != null) return questionImage; - int hIcon = OS.LoadImage (0, OS.OIC_QUES, OS.IMAGE_ICON, 0, 0, OS.LR_SHARED); + int hIcon = Win32.LoadImage (0, Win32.OIC_QUES, Win32.IMAGE_ICON, 0, 0, Win32.LR_SHARED); int empty = OS.Int32Rect_Empty (); int source = OS.Imaging_CreateBitmapSourceFromHIcon (hIcon, empty, 0); questionImage = Image.wpf_new (this, SWT.BITMAP, source); OS.GCHandle_Free (empty); - OS.DestroyIcon (hIcon); + Win32.DestroyIcon (hIcon); return questionImage; } case SWT.ICON_WARNING: { if (warningIcon != null) return warningIcon; - int hIcon = OS.LoadImage (0, OS.OIC_BANG, OS.IMAGE_ICON, 0, 0, OS.LR_SHARED); + int hIcon = Win32.LoadImage (0, Win32.OIC_BANG, Win32.IMAGE_ICON, 0, 0, Win32.LR_SHARED); int empty = OS.Int32Rect_Empty (); int source = OS.Imaging_CreateBitmapSourceFromHIcon (hIcon, empty, 0); warningIcon = Image.wpf_new (this, SWT.BITMAP, source); OS.GCHandle_Free (empty); - OS.DestroyIcon (hIcon); + Win32.DestroyIcon (hIcon); return warningIcon; } } @@ -2308,7 +2309,7 @@ void releaseDisplay () { shells = null; /* Uninitialize OLE */ - COM.OleUninitialize (); + Win32.OleUninitialize (); } /** @@ -2549,7 +2550,7 @@ void sendEvent (int eventType, Event event) { */ public void setCursorLocation (int x, int y) { checkDevice (); - OS.SetCursorPos (x, y); + Win32.SetCursorPos (x, y); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Shell.java index fd42a77b2e..ed90bdaa89 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Shell.java @@ -12,6 +12,7 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.internal.wpf.*; +import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; @@ -1318,7 +1319,7 @@ void updateModal () { int source = OS.PresentationSource_FromVisual (handle); if (source != 0) { int hwnd = OS.HwndSource_Handle (source); - OS.EnableWindow (OS.IntPtr_ToInt32 (hwnd), isActive ()); + Win32.EnableWindow (OS.IntPtr_ToInt32 (hwnd), isActive ()); OS.GCHandle_Free (hwnd); OS.GCHandle_Free (source); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TrayItem.java index 1673f32ee7..230e32a870 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TrayItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TrayItem.java @@ -15,6 +15,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.wpf.*; +import org.eclipse.swt.internal.win32.*; /** * Instances of this class represent icons that can be placed on the @@ -350,7 +351,7 @@ public void setImage (Image image) { OS.BitmapSource_CopyPixels (newImage, rect, buffer, buffer.length, bytesPerLine); OS.GCHandle_Free (rect); OS.GCHandle_Free (newImage); - int bitmap = OS.gcnew_Bitmap (width, height, bytesPerLine, OS.PixelFormat_Format32bppArgb, buffer); + int bitmap = OS.gcnew_Bitmap (width, height, bytesPerLine, Win32.PixelFormat_Format32bppArgb, buffer);//TODO int hIcon = OS.Bitmap_GetHicon (bitmap); OS.GCHandle_Free (bitmap); int icon = OS.Icon_FromHandle (hIcon); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java index 9fe00b23f6..2014eeb05b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java @@ -13,6 +13,7 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.wpf.*; +import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; @@ -1360,15 +1361,15 @@ boolean setKeyState (Event event, int type, int e) { } boolean textual = false; int vKey = OS.KeyInterop_VirtualKeyFromKey (key); - int mapKey = OS.MapVirtualKeyW (vKey, 2); + int mapKey = Win32.MapVirtualKeyW (vKey, 2); if ((mapKey & 0x80000000) != 0) { display.deadChar = true; return false; } char [] result = new char [1]; byte [] keyboard = new byte [256]; - OS.GetKeyboardState (keyboard); - textual = OS.ToUnicode (vKey, 0, keyboard, result, 1, 0) == 1; + Win32.GetKeyboardState (keyboard); + textual = Win32.ToUnicode (vKey, 0, keyboard, result, 1, 0) == 1; if (textual && type == SWT.KeyDown) { if (display.deadChar) display.lastChar = result [0]; //TODO problem: in german, dead key + non-combing key |